mirror of
https://github.com/standardnotes/server
synced 2026-07-14 09:01:33 -04:00
21 lines
814 B
TypeScript
21 lines
814 B
TypeScript
import { DomainEventHandlerInterface, RefundProcessedEvent } from '@standardnotes/domain-events'
|
|
import { inject, injectable } from 'inversify'
|
|
|
|
import TYPES from '../../Bootstrap/Types'
|
|
import { StatisticsMeasure } from '../Statistics/StatisticsMeasure'
|
|
import { StatisticsStoreInterface } from '../Statistics/StatisticsStoreInterface'
|
|
import { Period } from '../Time/Period'
|
|
|
|
@injectable()
|
|
export class RefundProcessedEventHandler implements DomainEventHandlerInterface {
|
|
constructor(@inject(TYPES.StatisticsStore) private statisticsStore: StatisticsStoreInterface) {}
|
|
|
|
async handle(event: RefundProcessedEvent): Promise<void> {
|
|
await this.statisticsStore.incrementMeasure(StatisticsMeasure.Refunds, event.payload.amount, [
|
|
Period.Today,
|
|
Period.ThisWeek,
|
|
Period.ThisMonth,
|
|
])
|
|
}
|
|
}
|