mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 00:24:54 +00:00
37 lines
1.2 KiB
TypeScript
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);
|
|
}
|
|
}
|