feat: transfer to parent

This commit is contained in:
Abdalhameed Ahmad
2025-09-07 20:23:11 +03:00
parent 9b0e1791da
commit d768da70f2
6 changed files with 45 additions and 4 deletions

View File

@ -27,10 +27,18 @@ export class AccountService {
return account;
}
async creditAccountBalance(accountReference: string, amount: number) {
creditAccountBalance(accountReference: string, amount: number) {
return this.accountRepository.topUpAccountBalance(accountReference, amount);
}
async getAccountByCustomerId(customerId: string): Promise<Account> {
const account = await this.accountRepository.getAccountByCustomerId(customerId);
if (!account) {
throw new UnprocessableEntityException('ACCOUNT.NOT_FOUND');
}
return account;
}
async decreaseAccountBalance(accountReference: string, amount: number) {
const account = await this.getAccountByReferenceNumber(accountReference);
/**