import { Body, Controller, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { ResponseFactory } from '~/core/utils'; import { AccountCardStatusChangedWebhookRequest, AccountTransactionWebhookRequest, CardTransactionWebhookRequest, KycWebhookRequest, } from '../dtos/requests'; import { NeoLeapWebhookService } from '../services'; @Controller('neoleap-webhooks') @ApiTags('Neoleap Webhooks') export class NeoLeapWebhooksController { constructor(private readonly neoleapWebhookService: NeoLeapWebhookService) {} @Post('card-transaction') async handleCardTransactionWebhook(@Body() body: CardTransactionWebhookRequest) { await this.neoleapWebhookService.handleCardTransactionWebhook(body); return ResponseFactory.data({ message: 'Card transaction processed successfully', status: 'success' }); } @Post('account-transaction') async handleAccountTransactionWebhook(@Body() body: AccountTransactionWebhookRequest) { await this.neoleapWebhookService.handleAccountTransactionWebhook(body); return ResponseFactory.data({ message: 'Account transaction processed successfully', status: 'success' }); } @Post('account-card-status-changed') async handleAccountCardStatusChangedWebhook(@Body() body: AccountCardStatusChangedWebhookRequest) { await this.neoleapWebhookService.handleAccountCardStatusChangedWebhook(body); return ResponseFactory.data({ message: 'Card status updated successfully', status: 'success' }); } @Post('kyc') async handleKycWebhook(@Body() body: KycWebhookRequest) { await this.neoleapWebhookService.handleKycWebhook(body); return ResponseFactory.data({ message: 'KYC processed successfully', status: 'success' }); } }