feat: add-account-details

This commit is contained in:
Abdalhamid Alhamad
2025-07-31 14:07:01 +03:00
parent a245545811
commit 7e63abb2fb
9 changed files with 94 additions and 8 deletions

View File

@ -13,7 +13,7 @@ export class CardService {
@Transactional()
async createCard(customerId: string, cardData: CreateApplicationResponse): Promise<Card> {
const account = await this.accountService.createAccount(cardData.accountId);
const account = await this.accountService.createAccount(cardData);
return this.cardRepository.createCard(customerId, account.id, cardData);
}
@ -37,6 +37,15 @@ export class CardService {
return card;
}
async getCardByAccountNumber(accountNumber: string): Promise<Card> {
const card = await this.cardRepository.getCardByAccountNumber(accountNumber);
if (!card) {
throw new BadRequestException('CARD.NOT_FOUND');
}
return card;
}
async getActiveCardForCustomer(customerId: string): Promise<Card> {
const card = await this.cardRepository.getActiveCardForCustomer(customerId);
if (!card) {