mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 00:54:54 +00:00
feat: handle card status changed webhook
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { Transactional } from 'typeorm-transactional';
|
||||
import { AccountCardStatusChangedWebhookRequest } from '~/common/modules/neoleap/dtos/requests';
|
||||
import { CreateApplicationResponse } from '~/common/modules/neoleap/dtos/response';
|
||||
import { Card } from '../entities';
|
||||
import { CardStatusMapper } from '../mappers/card-status.mapper';
|
||||
import { CardRepository } from '../repositories';
|
||||
import { AccountService } from './account.service';
|
||||
|
||||
@ -42,4 +44,11 @@ export class CardService {
|
||||
}
|
||||
return card;
|
||||
}
|
||||
|
||||
async updateCardStatus(body: AccountCardStatusChangedWebhookRequest) {
|
||||
const card = await this.getCardByReferenceNumber(body.cardId);
|
||||
const { description, status } = CardStatusMapper[body.newStatus] || CardStatusMapper['99'];
|
||||
|
||||
return this.cardRepository.updateCardStatus(card.id, status, description);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user