Files
zod-backend/src/webhook/services/neoleap-webook.service.ts
2025-08-14 14:40:08 +03:00

37 lines
1.2 KiB
TypeScript

import { forwardRef, Inject, Injectable } from '@nestjs/common';
import { CardService } from '~/card/services';
import { TransactionService } from '~/card/services/transaction.service';
import { CustomerService } from '~/customer/services';
import {
AccountCardStatusChangedWebhookRequest,
AccountTransactionWebhookRequest,
CardTransactionWebhookRequest,
KycWebhookRequest,
} from '../../common/modules/neoleap/dtos/requests';
@Injectable()
export class NeoLeapWebhookService {
constructor(
@Inject(forwardRef(() => CustomerService))
private readonly customerService: CustomerService,
private readonly transactionService: TransactionService,
private readonly cardService: CardService,
) {}
handleCardTransactionWebhook(body: CardTransactionWebhookRequest) {
return this.transactionService.createCardTransaction(body);
}
handleAccountTransactionWebhook(body: AccountTransactionWebhookRequest) {
return this.transactionService.createAccountTransaction(body);
}
handleAccountCardStatusChangedWebhook(body: AccountCardStatusChangedWebhookRequest) {
return this.cardService.updateCardStatus(body);
}
handleKycWebhook(body: KycWebhookRequest) {
return this.customerService.updateCustomerKyc(body);
}
}