feat: interbank transfer (#2299)
This commit is contained in:
@@ -15,6 +15,7 @@ import { MakeAccountTransfersComponent } from './make-account-transfers/make-acc
|
|||||||
import { ListStandingInstructionsComponent } from './list-standing-instructions/list-standing-instructions.component';
|
import { ListStandingInstructionsComponent } from './list-standing-instructions/list-standing-instructions.component';
|
||||||
import { ListTransactionsComponent } from './list-transactions/list-transactions.component';
|
import { ListTransactionsComponent } from './list-transactions/list-transactions.component';
|
||||||
import { ViewAccountTransferComponent } from './view-account-transfer/view-account-transfer.component';
|
import { ViewAccountTransferComponent } from './view-account-transfer/view-account-transfer.component';
|
||||||
|
import { MakeAccountInterbankTransfersComponent } from './make-account-interbank-transfers/make-account-interbank-transfers.component';
|
||||||
/**
|
/**
|
||||||
* Account Transfers Module
|
* Account Transfers Module
|
||||||
*
|
*
|
||||||
@@ -34,7 +35,8 @@ import { ViewAccountTransferComponent } from './view-account-transfer/view-accou
|
|||||||
MakeAccountTransfersComponent,
|
MakeAccountTransfersComponent,
|
||||||
ListStandingInstructionsComponent,
|
ListStandingInstructionsComponent,
|
||||||
ListTransactionsComponent,
|
ListTransactionsComponent,
|
||||||
ViewAccountTransferComponent
|
ViewAccountTransferComponent,
|
||||||
|
MakeAccountInterbankTransfersComponent
|
||||||
],
|
],
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Environment Configuration */
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
import { switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account Transfers Service.
|
* Account Transfers Service.
|
||||||
*/
|
*/
|
||||||
@@ -110,4 +114,38 @@ export class AccountTransfersService {
|
|||||||
getViewAccountTransferDetails(transferId: any): Observable<any> {
|
getViewAccountTransferDetails(transferId: any): Observable<any> {
|
||||||
return this.http.get(`/accounttransfers/${transferId}`);
|
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 }
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ export class MakeAccountTransferTemplateResolver implements Resolve<Object> {
|
|||||||
this.accountTypeId = '2';
|
this.accountTypeId = '2';
|
||||||
this.id = route.queryParamMap.get('savingsId');
|
this.id = route.queryParamMap.get('savingsId');
|
||||||
break;
|
break;
|
||||||
|
case 'interbank':
|
||||||
|
this.accountTypeId = '2';
|
||||||
|
this.id = route.queryParamMap.get('savingsId');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.accountTypeId = '0';
|
this.accountTypeId = '0';
|
||||||
}
|
}
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
<form [formGroup]="makeAccountTransferForm">
|
||||||
|
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
|
<mat-form-field fxFlex="98%" (click)="transferDatePicker.open()">
|
||||||
|
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[min]="minDate"
|
||||||
|
[max]="maxDate"
|
||||||
|
[matDatepicker]="transferDatePicker"
|
||||||
|
required
|
||||||
|
formControlName="transferDate"
|
||||||
|
/>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="transferDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #transferDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferDate.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Transaction Date' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Bank' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toBank" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Client' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toClientId" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Account Type' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toAccountType" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Account' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toAccountId" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%" class="error-warn">
|
||||||
|
<mat-label>{{ 'labels.inputs.Amount' | translate }}</mat-label>
|
||||||
|
<input #amntInput type="number" matInput required formControlName="transferAmount" />
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferAmount.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.get('transferAmount')?.hasError('amountExceedsBalance')">
|
||||||
|
<fa-icon icon="exclamation-triangle" size="md"></fa-icon>
|
||||||
|
{{ 'errors.validation.msg.savingsproduct.insufficient.balance' | translate: { balance } }}
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="98%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Description' | translate }}</mat-label>
|
||||||
|
<textarea matInput formControlName="transferDescription" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferDescription.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Transfer Description' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4 {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-t {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-divider {
|
||||||
|
margin: 0 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MakeAccountInterbankTransfersComponent } from './make-account-interbank-transfers.component';
|
||||||
|
|
||||||
|
describe('MakeAccountInterbankTransfersComponent', () => {
|
||||||
|
let component: MakeAccountInterbankTransfersComponent;
|
||||||
|
let fixture: ComponentFixture<MakeAccountInterbankTransfersComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [MakeAccountInterbankTransfersComponent]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(MakeAccountInterbankTransfersComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
|
import { MatInput } from '@angular/material/input';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-make-account-interbank-transfers',
|
||||||
|
templateUrl: './make-account-interbank-transfers.component.html',
|
||||||
|
styleUrls: ['./make-account-interbank-transfers.component.scss']
|
||||||
|
})
|
||||||
|
export class MakeAccountInterbankTransfersComponent {
|
||||||
|
@Input() makeAccountTransferForm: FormGroup;
|
||||||
|
@Input() balance: number;
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date(2100, 0, 1);
|
||||||
|
}
|
||||||
+66
-4
@@ -1,5 +1,11 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<mat-card>
|
<div *ngIf="isLoading" class="loader-wrapper">
|
||||||
|
<div class="bottom triangle"></div>
|
||||||
|
<div class="top triangle"></div>
|
||||||
|
<div class="left triangle"></div>
|
||||||
|
<div class="right triangle"></div>
|
||||||
|
</div>
|
||||||
|
<mat-card *ngIf="!isLoading">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div fxLayout="row wrap" fxLayout.lt-md="column">
|
<div fxLayout="row wrap" fxLayout.lt-md="column">
|
||||||
<h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Transferring From Details' | translate }}</h3>
|
<h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Transferring From Details' | translate }}</h3>
|
||||||
@@ -36,11 +42,52 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Transferred To' | translate }}</h3>
|
<div *ngIf="interbank">
|
||||||
|
<div fxFlexFill>
|
||||||
|
<h3 class="mat-h3" fxFlex="40%" fxLayoutAlign="start center">
|
||||||
|
{{ 'labels.heading.Transferred To' | translate }}
|
||||||
|
</h3>
|
||||||
|
<mat-form-field fxFlex="40%">
|
||||||
|
<mat-label>{{ 'labels.inputs.Phone Number' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[disabled]="interbankTransferForm"
|
||||||
|
type="tel"
|
||||||
|
#input
|
||||||
|
[(ngModel)]="phoneAccount"
|
||||||
|
maxlength="10"
|
||||||
|
required
|
||||||
|
/><!-- formControlName="phoneNumber" -->
|
||||||
|
<mat-hint align="end">{{ phoneAccount.length || 0 }}/10</mat-hint>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-card-actions
|
||||||
|
*ngIf="!interbankTransferForm"
|
||||||
|
fxLayout="row"
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="5px"
|
||||||
|
>
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../..']">
|
||||||
|
{{ 'labels.buttons.Cancel' | translate }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
mat-raised-button
|
||||||
|
color="primary"
|
||||||
|
[disabled]="phoneAccount.length !== 10"
|
||||||
|
(click)="searchAccountByNumber()"
|
||||||
|
*mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'"
|
||||||
|
id="search-button"
|
||||||
|
>
|
||||||
|
{{ 'labels.buttons.Search' | translate }}
|
||||||
|
</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-divider [inset]="true"></mat-divider>
|
<mat-divider [inset]="true"></mat-divider>
|
||||||
|
|
||||||
<form [formGroup]="makeAccountTransferForm">
|
<form *ngIf="!interbank" [formGroup]="makeAccountTransferForm">
|
||||||
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||||
<mat-form-field fxFlex="98%" (click)="transferDatePicker.open()">
|
<mat-form-field fxFlex="98%" (click)="transferDatePicker.open()">
|
||||||
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
|
||||||
@@ -121,6 +168,10 @@
|
|||||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.get('transferAmount')?.hasError('amountExceedsBalance')">
|
||||||
|
<fa-icon icon="exclamation-triangle" size="md"></fa-icon>
|
||||||
|
{{ 'errors.validation.msg.savingsproduct.insufficient.balance' | translate: { balance } }}
|
||||||
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field fxFlex="98%">
|
<mat-form-field fxFlex="98%">
|
||||||
@@ -138,9 +189,20 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<mifosx-make-account-interbank-transfers
|
||||||
|
*ngIf="interbank && interbankTransferForm"
|
||||||
|
[makeAccountTransferForm]="makeAccountTransferForm"
|
||||||
|
[balance]="balance"
|
||||||
|
></mifosx-make-account-interbank-transfers>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
||||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
<mat-card-actions
|
||||||
|
*ngIf="!interbank === !interbankTransferForm"
|
||||||
|
fxLayout="row"
|
||||||
|
fxLayout.xs="column"
|
||||||
|
fxLayoutAlign="center"
|
||||||
|
fxLayoutGap="5px"
|
||||||
|
>
|
||||||
<button type="button" mat-raised-button [routerLink]="['../..']">
|
<button type="button" mat-raised-button [routerLink]="['../..']">
|
||||||
{{ 'labels.buttons.Cancel' | translate }}
|
{{ 'labels.buttons.Cancel' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
+16
@@ -20,3 +20,19 @@ mat-divider {
|
|||||||
.container {
|
.container {
|
||||||
max-width: 37rem;
|
max-width: 37rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep mat-form-field.error-warn.mat-form-field-invalid .mat-form-field-ripple {
|
||||||
|
background-color: #000000de !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep mat-form-field.error-warn.mat-form-field-invalid .mat-form-field-label {
|
||||||
|
color: #0009 !important;
|
||||||
|
|
||||||
|
.mat-form-field-required-marker {
|
||||||
|
color: #0009 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep mat-form-field.error-warn.mat-form-field-invalid .mat-error {
|
||||||
|
color: #0009 !important;
|
||||||
|
}
|
||||||
|
|||||||
+145
-12
@@ -1,13 +1,24 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Component, OnInit, AfterViewInit } from '@angular/core';
|
import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
import {
|
||||||
|
AbstractControl,
|
||||||
|
FormGroup,
|
||||||
|
UntypedFormBuilder,
|
||||||
|
UntypedFormGroup,
|
||||||
|
ValidationErrors,
|
||||||
|
Validators
|
||||||
|
} from '@angular/forms';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { AccountTransfersService } from '../account-transfers.service';
|
import { AccountTransfersService } from '../account-transfers.service';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { ClientsService } from 'app/clients/clients.service';
|
import { ClientsService } from 'app/clients/clients.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
import { MatInput } from '@angular/material/input';
|
||||||
|
|
||||||
|
/** Environment Configuration */
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create account transfers
|
* Create account transfers
|
||||||
@@ -26,6 +37,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
maxDate = new Date(2100, 0, 1);
|
maxDate = new Date(2100, 0, 1);
|
||||||
/** Edit Standing Instructions form. */
|
/** Edit Standing Instructions form. */
|
||||||
makeAccountTransferForm: UntypedFormGroup;
|
makeAccountTransferForm: UntypedFormGroup;
|
||||||
|
//makeAccountInterbankTransferForm: FormGroup;
|
||||||
/** To Office Type Data */
|
/** To Office Type Data */
|
||||||
toOfficeTypeData: any;
|
toOfficeTypeData: any;
|
||||||
/** To Client Type Data */
|
/** To Client Type Data */
|
||||||
@@ -42,6 +54,13 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
id: any;
|
id: any;
|
||||||
/** Clients Data */
|
/** Clients Data */
|
||||||
clientsData: any;
|
clientsData: any;
|
||||||
|
/** interbank transfer */
|
||||||
|
interbank: boolean = false;
|
||||||
|
/** Reference of phoneAccount search */
|
||||||
|
phoneAccount = '';
|
||||||
|
interbankTransferForm: boolean = false;
|
||||||
|
balance: number = 0;
|
||||||
|
isLoading: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the standing instructions template from `resolve`.
|
* Retrieves the standing instructions template from `resolve`.
|
||||||
@@ -77,8 +96,12 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.id = this.route.snapshot.queryParams['loanId'];
|
this.id = this.route.snapshot.queryParams['loanId'];
|
||||||
break;
|
break;
|
||||||
case 'fromsavings':
|
case 'fromsavings':
|
||||||
|
case 'interbank':
|
||||||
this.accountTypeId = '2';
|
this.accountTypeId = '2';
|
||||||
this.id = this.route.snapshot.queryParams['savingsId'];
|
this.id = this.route.snapshot.queryParams['savingsId'];
|
||||||
|
this.interbank = this.route.snapshot.queryParams['interbank'] === 'true';
|
||||||
|
this.balance = this.router.getCurrentNavigation().extras.state.balance;
|
||||||
|
console.log('is interbank?', this.interbank);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.accountTypeId = '0';
|
this.accountTypeId = '0';
|
||||||
@@ -90,7 +113,9 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.maxDate = this.settingsService.businessDate;
|
this.maxDate = this.settingsService.businessDate;
|
||||||
this.createMakeAccountTransferForm();
|
if (!this.interbank) {
|
||||||
|
this.createMakeAccountTransferForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +141,10 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
],
|
],
|
||||||
transferAmount: [
|
transferAmount: [
|
||||||
this.accountTransferTemplateData.transferAmount,
|
this.accountTransferTemplateData.transferAmount,
|
||||||
Validators.required
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0.01),
|
||||||
|
this.amountExceedsBalanceValidator.bind(this)]
|
||||||
],
|
],
|
||||||
transferDate: [
|
transferDate: [
|
||||||
this.settingsService.businessDate,
|
this.settingsService.businessDate,
|
||||||
@@ -129,6 +157,48 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createMakeAccountInterbankTransferForm(account: any) {
|
||||||
|
/* --> */ this.makeAccountTransferForm = this.formBuilder.group({
|
||||||
|
toBank: [
|
||||||
|
{ value: account.sourceFspId, disabled: true },
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toClientId: [
|
||||||
|
{ value: account.firsName + ' ' + account.lastName, disabled: true },
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toAccountType: [
|
||||||
|
{ value: 'Saving Account', disabled: true },
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toAccountId: [
|
||||||
|
{ value: account.partyId, disabled: true },
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
transferAmount: [
|
||||||
|
this.accountTransferTemplateData.transferAmount,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0.01),
|
||||||
|
this.amountExceedsBalanceValidator.bind(this)]
|
||||||
|
],
|
||||||
|
transferDate: [
|
||||||
|
this.settingsService.businessDate,
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
transferDescription: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
]
|
||||||
|
});
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
amountExceedsBalanceValidator(control: AbstractControl): ValidationErrors | null {
|
||||||
|
const amount = control.value;
|
||||||
|
return amount > this.balance ? { amountExceedsBalance: true } : null;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets options value */
|
/** Sets options value */
|
||||||
setOptions() {
|
setOptions() {
|
||||||
this.toOfficeTypeData = this.accountTransferTemplateData.toOfficeOptions;
|
this.toOfficeTypeData = this.accountTransferTemplateData.toOfficeOptions;
|
||||||
@@ -172,14 +242,16 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
* Subscribes to Clients search filter:
|
* Subscribes to Clients search filter:
|
||||||
*/
|
*/
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.makeAccountTransferForm.controls.toClientId.valueChanges.subscribe((value: string) => {
|
if (!this.interbank) {
|
||||||
if (value.length >= 2) {
|
this.makeAccountTransferForm.controls.toClientId.valueChanges.subscribe((value: string) => {
|
||||||
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
|
if (value.length >= 2) {
|
||||||
this.clientsData = data.pageItems;
|
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
|
||||||
});
|
this.clientsData = data.pageItems;
|
||||||
this.changeEvent();
|
});
|
||||||
}
|
this.changeEvent();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,6 +267,11 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
* Submits the standing instructions form
|
* Submits the standing instructions form
|
||||||
*/
|
*/
|
||||||
submit() {
|
submit() {
|
||||||
|
this.interbank ? this.makeInterbankTransfer() : this.makeTransfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
makeTransfer() {
|
||||||
|
this.isLoading = true;
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
const locale = this.settingsService.language.code;
|
const locale = this.settingsService.language.code;
|
||||||
const makeAccountTransferData = {
|
const makeAccountTransferData = {
|
||||||
@@ -209,7 +286,63 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
fromOfficeId: this.accountTransferTemplateData.fromClient.officeId
|
fromOfficeId: this.accountTransferTemplateData.fromClient.officeId
|
||||||
};
|
};
|
||||||
this.accountTransfersService.createAccountTransfer(makeAccountTransferData).subscribe(() => {
|
this.accountTransfersService.createAccountTransfer(makeAccountTransferData).subscribe(() => {
|
||||||
|
this.isLoading = false;
|
||||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makeInterbankTransfer() {
|
||||||
|
this.isLoading = true;
|
||||||
|
const payload = {
|
||||||
|
homeTransactionId: crypto.randomUUID(),
|
||||||
|
from: {
|
||||||
|
fspId: environment.fineractPlatformTenantId,
|
||||||
|
idType: 'MSISDN',
|
||||||
|
idValue: this.accountTransferTemplateData.fromAccount.externalId.trim()
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
fspId: this.makeAccountTransferForm.controls.toBank.value,
|
||||||
|
idType: 'MSISDN',
|
||||||
|
idValue: this.makeAccountTransferForm.controls.toAccountId.value
|
||||||
|
},
|
||||||
|
amountType: 'SEND',
|
||||||
|
amount: {
|
||||||
|
currencyCode: this.accountTransferTemplateData.currency.code,
|
||||||
|
amount: this.makeAccountTransferForm.controls.transferAmount.value
|
||||||
|
},
|
||||||
|
transactionType: {
|
||||||
|
scenario: 'TRANSFER',
|
||||||
|
subScenario: 'DOMESTIC',
|
||||||
|
initiator: 'PAYER',
|
||||||
|
initiatorType: 'CUSTOMER'
|
||||||
|
},
|
||||||
|
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() {
|
||||||
|
this.isLoading = true;
|
||||||
|
this.accountTransfersService
|
||||||
|
.getAccountByNumber(this.phoneAccount, this.accountTransferTemplateData.currency.code)
|
||||||
|
.subscribe(
|
||||||
|
(acc) => {
|
||||||
|
this.interbankTransferForm = true;
|
||||||
|
this.createMakeAccountInterbankTransferForm(acc);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/conf
|
|||||||
import { Currency } from 'app/shared/models/general.model';
|
import { Currency } from 'app/shared/models/general.model';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
/** Environment Configuration */
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Account View Component
|
* Savings Account View Component
|
||||||
*/
|
*/
|
||||||
@@ -82,6 +85,12 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
taskPermissionName: 'CREATE_ACCOUNTTRANSFER'
|
taskPermissionName: 'CREATE_ACCOUNTTRANSFER'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (this.savingsAccountData.externalId && environment.interbankTransfers === 'true') {
|
||||||
|
this.buttonConfig.addOption({
|
||||||
|
name: 'Interbank Transfer',
|
||||||
|
taskPermissionName: 'CREATE_ACCOUNTTRANSFER'
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!this.savingsAccountData.fieldOfficerId) {
|
if (!this.savingsAccountData.fieldOfficerId) {
|
||||||
this.buttonConfig.addOption({
|
this.buttonConfig.addOption({
|
||||||
name: 'Assign Staff',
|
name: 'Assign Staff',
|
||||||
@@ -178,12 +187,26 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
this.disableWithHoldTax();
|
this.disableWithHoldTax();
|
||||||
break;
|
break;
|
||||||
case 'Transfer Funds':
|
case 'Transfer Funds':
|
||||||
const queryParams: any = { savingsId: this.savingsAccountData.id, accountType: 'fromsavings' };
|
const queryParams: any = {
|
||||||
|
interbank: false,
|
||||||
|
savingsId: this.savingsAccountData.id,
|
||||||
|
accountType: 'fromsavings'
|
||||||
|
};
|
||||||
this.router.navigate(['transfer-funds/make-account-transfer'], {
|
this.router.navigate(['transfer-funds/make-account-transfer'], {
|
||||||
relativeTo: this.route,
|
relativeTo: this.route,
|
||||||
queryParams: queryParams
|
queryParams: queryParams,
|
||||||
|
state: { balance: this.savingsAccountData.summary.availableBalance }
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'Interbank Transfer': {
|
||||||
|
const queryParams: any = { interbank: true, savingsId: this.savingsAccountData.id, accountType: 'interbank' };
|
||||||
|
this.router.navigate(['transfer-funds/make-account-transfer'], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: queryParams,
|
||||||
|
state: { balance: this.savingsAccountData.summary.availableBalance }
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'Unblock Account':
|
case 'Unblock Account':
|
||||||
case 'Unblock Deposit':
|
case 'Unblock Deposit':
|
||||||
case 'Unblock Withdrawal':
|
case 'Unblock Withdrawal':
|
||||||
|
|||||||
+11
-6
@@ -2,18 +2,18 @@
|
|||||||
window["env"] = window["env"] || {};
|
window["env"] = window["env"] || {};
|
||||||
|
|
||||||
// BackEnd Environment variables
|
// BackEnd Environment variables
|
||||||
window["env"]["fineractApiUrls"] = '';
|
window['env']['fineractApiUrls'] = '';
|
||||||
window["env"]["fineractApiUrl"] = '';
|
window['env']['fineractApiUrl'] = '';
|
||||||
|
|
||||||
window["env"]["apiProvider"] = '';
|
window['env']['apiProvider'] = '';
|
||||||
window["env"]["apiVersion"] = '';
|
window['env']['apiVersion'] = '';
|
||||||
|
|
||||||
window["env"]["fineractPlatformTenantId"] = '';
|
window["env"]["fineractPlatformTenantId"] = '';
|
||||||
window["env"]["fineractPlatformTenantIds"] = '';
|
window["env"]["fineractPlatformTenantIds"] = '';
|
||||||
|
|
||||||
// Language Environment variables
|
// Language Environment variables
|
||||||
window["env"]["defaultLanguage"] = '';
|
window['env']['defaultLanguage'] = '';
|
||||||
window["env"]["supportedLanguages"] = '';
|
window['env']['supportedLanguages'] = '';
|
||||||
|
|
||||||
window['env']['preloadClients'] = '';
|
window['env']['preloadClients'] = '';
|
||||||
|
|
||||||
@@ -44,4 +44,9 @@
|
|||||||
// OAuth Client Id
|
// OAuth Client Id
|
||||||
window['env']['oauthAppId'] = '';
|
window['env']['oauthAppId'] = '';
|
||||||
|
|
||||||
|
window["env"]["vNextApiUrl"] = '';
|
||||||
|
window["env"]["vNextApiProvider"] = '';
|
||||||
|
window["env"]["vNextApiVersion"] = '';
|
||||||
|
window["env"]["interbankTransfers"] = "false";
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|||||||
@@ -43,4 +43,9 @@
|
|||||||
|
|
||||||
// OAuth Client Id
|
// OAuth Client Id
|
||||||
window['env']['oauthAppId'] = '$MIFOS_OAUTH_CLIENT_ID';
|
window['env']['oauthAppId'] = '$MIFOS_OAUTH_CLIENT_ID';
|
||||||
|
|
||||||
|
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);
|
})(this);
|
||||||
|
|||||||
@@ -245,6 +245,7 @@
|
|||||||
"validation.msg.savingsproduct.description.exceeds.max.length": "Description cannot be over {{params[0].value}} characters long.",
|
"validation.msg.savingsproduct.description.exceeds.max.length": "Description cannot be over {{params[0].value}} characters long.",
|
||||||
"validation.msg.savingsproduct.digitsAfterDecimal.is.not.within.expected.range": "Decimal places entered is `{{params[0].value}}` and must be a number between {{params[1].value}} and {{params[2].value}}.",
|
"validation.msg.savingsproduct.digitsAfterDecimal.is.not.within.expected.range": "Decimal places entered is `{{params[0].value}}` and must be a number between {{params[1].value}} and {{params[2].value}}.",
|
||||||
"validation.msg.savingsproduct.incomeFromFeeAccountId.cannot.be.blank ": "Income from Fees Account is mandatory",
|
"validation.msg.savingsproduct.incomeFromFeeAccountId.cannot.be.blank ": "Income from Fees Account is mandatory",
|
||||||
|
"validation.msg.savingsproduct.insufficient.balance": "You have a balance of ${{balance}} in your account",
|
||||||
"validation.msg.savingsproduct.interestCalculationDaysInYearType.cannot.be.blank": "Interest calculation (Days in Year) is mandatory.",
|
"validation.msg.savingsproduct.interestCalculationDaysInYearType.cannot.be.blank": "Interest calculation (Days in Year) is mandatory.",
|
||||||
"validation.msg.savingsproduct.interestCalculationDaysInYearType.is.not.one.of.expected.enumerations": "Interest calculation (Days in Year) must be one of `[ {{params[1].value}} ]`.",
|
"validation.msg.savingsproduct.interestCalculationDaysInYearType.is.not.one.of.expected.enumerations": "Interest calculation (Days in Year) must be one of `[ {{params[1].value}} ]`.",
|
||||||
"validation.msg.savingsproduct.interestCalculationType.cannot.be.blank": "Interest calculation type is mandatory.",
|
"validation.msg.savingsproduct.interestCalculationType.cannot.be.blank": "Interest calculation type is mandatory.",
|
||||||
@@ -2525,6 +2526,7 @@
|
|||||||
"Navigation": "Navigation",
|
"Navigation": "Navigation",
|
||||||
"Notifications": "Notifications",
|
"Notifications": "Notifications",
|
||||||
"Organization": "Organization",
|
"Organization": "Organization",
|
||||||
|
"Interbank Transfer": "Interbank Transfer",
|
||||||
"Interest Payment Waiver": "Interest Payment Waiver",
|
"Interest Payment Waiver": "Interest Payment Waiver",
|
||||||
"Payments": "Payments",
|
"Payments": "Payments",
|
||||||
"Payout Refund": "Payout Refund",
|
"Payout Refund": "Payout Refund",
|
||||||
|
|||||||
@@ -50,7 +50,11 @@ export const environment = {
|
|||||||
timeout: {
|
timeout: {
|
||||||
idleTimeout: loadedEnv['sessionIdleTimeout'] || 300000 // 5 minutes
|
idleTimeout: loadedEnv['sessionIdleTimeout'] || 300000 // 5 minutes
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
vNextApiUrl: window['env']['vNextApiUrl'] || 'https://apis.flexcore.mx',
|
||||||
|
vNextApiProvider: window['env']['vNextApiProvider'] || '/vnext1',
|
||||||
|
vNextApiVersion: window['env']['vNextApiVersion'] || '/v1.0',
|
||||||
|
interbankTransfers: window['env']['interbankTransfers'] || false
|
||||||
};
|
};
|
||||||
|
|
||||||
// Server URL
|
// Server URL
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ export const environment = {
|
|||||||
timeout: {
|
timeout: {
|
||||||
idleTimeout: loadedEnv['sessionIdleTimeout'] || 300000 // 5 minutes
|
idleTimeout: loadedEnv['sessionIdleTimeout'] || 300000 // 5 minutes
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
vNextApiUrl: window['env']['vNextApiUrl'] || 'https://apis.flexcore.mx',
|
||||||
|
vNextApiProvider: window['env']['vNextApiProvider'] || '/vnext1',
|
||||||
|
vNextApiVersion: window['env']['vNextApiVersion'] || '/v1.0',
|
||||||
|
interbankTransfers: window['env']['interbankTransfers'] || false
|
||||||
};
|
};
|
||||||
|
|
||||||
// Server URL
|
// Server URL
|
||||||
|
|||||||
Reference in New Issue
Block a user