Restore Interbank functionality

This commit is contained in:
Victor Romero
2025-03-28 00:06:59 -06:00
parent e776d5cee8
commit 9ddb79ba45
7 changed files with 79 additions and 3 deletions
@@ -114,4 +114,38 @@ export class AccountTransfersService {
getViewAccountTransferDetails(transferId: any): Observable<any> {
return this.http.get(`/accounttransfers/${transferId}`);
}
getAccountByNumber(accountNumber: string, currency: string): Observable<any> {
const payload = {
partyId: accountNumber,
partyIdType: 'MSISDN',
currencyCode: currency
};
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
return this.http
.post(
`${environment.vNextApiUrl}${environment.vNextApiVersion}${environment.vNextApiProvider}/participant`,
JSON.stringify(payload),
{ headers }
)
.pipe(
switchMap((participant: any) => {
const body = JSON.stringify({ ...payload, ownerFspId: participant.fspId });
return this.http.post(
`${environment.vNextApiUrl}${environment.vNextApiVersion}${environment.vNextApiProvider}/partyinfo`,
body,
{ headers }
);
})
);
}
sendInterbankTransfer(body: any): Observable<any> {
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
return this.http.post(
`${environment.vNextApiUrl}${environment.vNextApiVersion}${environment.vNextApiProvider}/executetransfer`,
body,
{ headers }
);
}
}
@@ -318,7 +318,31 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
},
note: this.makeAccountTransferForm.controls.transferDescription.value
};
this.accountTransfersService.sendInterbankTransfer(JSON.stringify(payload)).subscribe(
(trnsfr) => {
if (trnsfr.systemMessage) {
this.isLoading = false;
this.router.navigate(['../../transactions'], { relativeTo: this.route });
}
},
(error) => {
this.isLoading = false;
}
);
}
searchAccountByNumber() {}
searchAccountByNumber() {
this.isLoading = true;
this.accountTransfersService
.getAccountByNumber(this.phoneAccount, this.accountTransferTemplateData.currency.code)
.subscribe(
(acc) => {
this.interbankTransferForm = true;
this.createMakeAccountInterbankTransferForm(acc);
},
(error) => {
this.isLoading = false;
}
);
}
}
@@ -85,7 +85,7 @@ export class SavingsAccountViewComponent implements OnInit {
taskPermissionName: 'CREATE_ACCOUNTTRANSFER'
});
}
if (this.savingsAccountData.externalId) {
if (this.savingsAccountData.externalId && environment.interbankTransfers === 'true') {
this.buttonConfig.addOption({
name: 'Interbank Transfer',
taskPermissionName: 'CREATE_ACCOUNTTRANSFER'