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'
+5
View File
@@ -47,4 +47,9 @@
// Min Password length
window['env']['minPasswordLength'] = '12';
window["env"]["vNextApiUrl"] = '';
window["env"]["vNextApiProvider"] = '';
window["env"]["vNextApiVersion"] = '';
window["env"]["interbankTransfers"] = "false";
})(this);
+5
View File
@@ -46,4 +46,9 @@
// Min Password length
window['env']['minPasswordLength'] = '$MIFOS_MIN_PASSWORD_LENGTH';
window['env']['vNextApiUrl'] = '$VNEXT_API_URL';
window['env']['vNextApiProvider'] = '$VNEXT_API_PROVIDER';
window['env']['vNextApiVersion'] = '$VNEXT_API_VERSION';
window['env']['interbankTransfers'] = '$VNEXT_INTERBANK_TRANSFERS';
})(this);
+5
View File
@@ -52,6 +52,11 @@ export const environment = {
}
},
vNextApiUrl: loadedEnv['vNextApiUrl'] || 'https://apis.mifos.community',
vNextApiProvider: loadedEnv['vNextApiProvider'] || '/vnext1',
vNextApiVersion: loadedEnv['vNextApiVersion'] || '/v1.0',
interbankTransfers: loadedEnv['interbankTransfers'] || false,
minPasswordLength: loadedEnv['minPasswordLength'] || 12
};
+4 -1
View File
@@ -55,7 +55,10 @@ export const environment = {
idleTimeout: loadedEnv['sessionIdleTimeout'] || 300000 // 5 minutes
}
},
vNextApiUrl: loadedEnv['vNextApiUrl'] || 'https://apis.mifos.community',
vNextApiProvider: loadedEnv['vNextApiProvider'] || '/vnext1',
vNextApiVersion: loadedEnv['vNextApiVersion'] || '/v1.0',
interbankTransfers: loadedEnv['interbankTransfers'] || false,
minPasswordLength: loadedEnv['minPasswordLength'] || 12
};