mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
feat: add-account-details
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { Injectable, UnprocessableEntityException } from '@nestjs/common';
|
||||
import { CreateApplicationResponse } from '~/common/modules/neoleap/dtos/response';
|
||||
import { Account } from '../entities/account.entity';
|
||||
import { AccountRepository } from '../repositories/account.repository';
|
||||
|
||||
@ -6,8 +7,8 @@ import { AccountRepository } from '../repositories/account.repository';
|
||||
export class AccountService {
|
||||
constructor(private readonly accountRepository: AccountRepository) {}
|
||||
|
||||
createAccount(accountId: string): Promise<Account> {
|
||||
return this.accountRepository.createAccount(accountId);
|
||||
createAccount(data: CreateApplicationResponse): Promise<Account> {
|
||||
return this.accountRepository.createAccount(data);
|
||||
}
|
||||
|
||||
async getAccountByReferenceNumber(accountReference: string): Promise<Account> {
|
||||
@ -18,6 +19,14 @@ export class AccountService {
|
||||
return account;
|
||||
}
|
||||
|
||||
async getAccountByAccountNumber(accountNumber: string): Promise<Account> {
|
||||
const account = await this.accountRepository.getAccountByAccountNumber(accountNumber);
|
||||
if (!account) {
|
||||
throw new UnprocessableEntityException('ACCOUNT.NOT_FOUND');
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
||||
async creditAccountBalance(accountReference: string, amount: number) {
|
||||
return this.accountRepository.topUpAccountBalance(accountReference, amount);
|
||||
}
|
||||
|
Reference in New Issue
Block a user