feat: add make account transfer (transfer-funds) (#1151)

Fixes: #251 #1060
This commit is contained in:
Muskan Khedia
2020-07-23 12:12:45 +05:30
committed by GitHub
parent 55280eae2a
commit 63a9e46fc2
16 changed files with 497 additions and 49 deletions
@@ -0,0 +1,46 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
/**
* View Standing Instructions resolver.
*/
@Injectable()
export class MakeAccountTransferTemplateResolver implements Resolve<Object> {
accountTypeId: string;
id: any;
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const accountType = route.queryParamMap.get('accountType');
switch (accountType) {
case 'fromloans':
this.accountTypeId = '1';
this.id = route.queryParamMap.get('loanId');
break;
case 'fromsavings':
this.accountTypeId = '2';
this.id = route.queryParamMap.get('savingsId');
break;
default:
this.accountTypeId = '0';
}
return this.accountTransfersService.newAccountTranferResource(this.id, this.accountTypeId);
}
}