mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
37 lines
932 B
TypeScript
37 lines
932 B
TypeScript
import { Inject, Service } from 'typedi';
|
|
import { IPaymentReceiveDeletedPayload } from '@/interfaces';
|
|
import { ValidateTransactionMatched } from '../ValidateTransactionsMatched';
|
|
import events from '@/subscribers/events';
|
|
|
|
@Service()
|
|
export class ValidateMatchingOnPaymentReceivedDelete {
|
|
@Inject()
|
|
private validateNoMatchingLinkedService: ValidateTransactionMatched;
|
|
|
|
/**
|
|
* Constructor method.
|
|
*/
|
|
public attach(bus) {
|
|
bus.subscribe(
|
|
events.paymentReceive.onDeleting,
|
|
this.validateMatchingOnPaymentReceivedDelete.bind(this)
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {IPaymentReceiveDeletedPayload}
|
|
*/
|
|
public async validateMatchingOnPaymentReceivedDelete({
|
|
tenantId,
|
|
oldPaymentReceive,
|
|
trx,
|
|
}: IPaymentReceiveDeletedPayload) {
|
|
await this.validateNoMatchingLinkedService.validateTransactionNoMatchLinking(
|
|
tenantId,
|
|
'PaymentReceive',
|
|
oldPaymentReceive.id
|
|
);
|
|
}
|
|
}
|