/** Angular Imports */ import { Injectable } from '@angular/core' ; import { HttpClient , HttpParams } from '@angular/common/http' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /**
 * Savings Service.
 */ @ Injectable ( { providedIn : 'root' } ) export class SavingsService { constructor ( private http ) { } param { string } savingAccountId returns { Observable < any > } getSavingsTransactionTemplateResource ( savingAccountId ) { return this . http . get ( `/savingsaccounts/${ savingAccountId }/transactions/template` ) ; } param { string } savingAccountId returns { Observable < any > } getSavingsChargeTemplateResource ( savingAccountId ) { return this . http . get ( `/savingsaccounts/${ savingAccountId }/charges/template` ) ; } param { any } savingsCharge returns { Observable < any > } createSavingsCharge ( savingAccountId , resourceType , savingsCharge ) { return this . http . post ( `/savingsaccounts/${ savingAccountId }/${ resourceType }` , savingsCharge ) ; } param { string } chargeId returns { Observable < any > } getChargeTemplate ( chargeId ) { const params = { template : 'true' } ; return this . http . get ( `/charges/${ chargeId }` , { params : params } ) ; } param accountId returns { Observable < any > } getSavingsAccountData ( accountId ) { const httpParams = new HttpParams ( ) . set ( 'associations' , 'all' ) ; return this . http . get ( `/savingsaccounts/${ accountId }` , { params : httpParams } ) ; } param accountId returns { Observable < any > } getSavingsAccountAndTemplate ( accountId , template ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) . set ( 'associations' , 'charges' ) ; return this . http . get ( `/savingsaccounts/${ accountId }` , { params : httpParams } ) ; } param clientId param clientName param fromAccountId param locale param dateFormat returns { Observable < any > } getStandingInstructions ( clientId , clientName , fromAccountId , locale , dateFormat ) { const httpParams = new HttpParams ( ) . set ( 'clientId' , clientId ) . set ( 'clientName' , clientName ) . set ( 'fromAccountId' , fromAccountId ) . set ( 'fromAccountType' , '2' ) . set ( 'locale' , locale ) . set ( 'dateFormat' , dateFormat ) ; return this . http . get ( `/standinginstructions` , { params : httpParams } ) ; } returns { Observable < any > } getSavingsDatatables ( ) { const httpParams = new HttpParams ( ) . set ( 'apptable' , 'm_savings_account' ) ; return this . http . get ( `/datatables` , { params : httpParams } ) ; } param accountId param datatableName returns { Observable < any > } getSavingsDatatable ( accountId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . get ( `/datatables/${ datatableName }/${ accountId }` , { params : httpParams } ) ; } param accountId param datatableName param data returns { Observable < any > } addSavingsDatatableEntry ( accountId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . post ( `/datatables/${ datatableName }/${ accountId }` , data , { params : httpParams } ) ; } param accountId param datatableName param data returns { Observable < any > } editSavingsDatatableEntry ( accountId , datatableName , data ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . put ( `/datatables/${ datatableName }/${ accountId }` , data , { params : httpParams } ) ; } param accountId param datatableName returns { Observable < any > } deleteDatatableContent ( accountId , datatableName ) { const httpParams = new HttpParams ( ) . set ( 'genericResultSet' , 'true' ) ; return this . http . delete ( `/datatables/${ datatableName }/${ accountId }` , { params : httpParams } ) ; } param entityId returns { Observable < any > } getSavingsAccountTemplate ( entityId , productId ? , isGroup ? ) { let httpParams = new HttpParams ( ) . set ( isGroup ? 'groupId' : 'clientId' , entityId ) ; httpParams = productId ? httpParams . set ( 'productId' , productId ) : httpParams ; return this . http . get ( '/savingsaccounts/template' , { params : httpParams } ) ; } param { any } savingsAccount returns { Observable < any > } createSavingsAccount ( savingsAccount ) { return this . http . post ( '/savingsaccounts' , savingsAccount ) ; } param { any } savingsAccount returns { Observable < any > } updateSavingsAccount ( accountId , savingsAccount ) { return this . http . put ( `/savingsaccounts/${ accountId }` , savingsAccount ) ; } param { string } accountId returns { Observable < any > } deleteSavingsAccount ( accountId ) { return this . http . delete ( `/savingsaccounts/${ accountId }` ) ; } param { string } accountId param { string } command param { any } data returns { Observable < any > } executeSavingsAccountCommand ( accountId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/savingsaccounts/${ accountId }` , data , { params : httpParams } ) ; } param { string } accountId param { string } command param { any } data returns { Observable < any > } executeSavingsAccountUpdateCommand ( accountId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . put ( `/savingsaccounts/${ accountId }` , data , { params : httpParams } ) ; } param { string } accountId param { string } transactionId returns { Observable < any > } getSavingsAccountTransaction ( accountId , transactionId ) { return this . http . get ( `/savingsaccounts/${ accountId }/transactions/${ transactionId }` ) ; } param { string } accountId param { string } transactionId returns { Observable < any > } getSavingsAccountTransactionTemplate ( accountId , transactionId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/savingsaccounts/${ accountId }/transactions/${ transactionId }` , { params : httpParams } ) ; } param { string } accountId param { string } command param { any } data param { string } transactionId returns { Observable < any > } executeSavingsAccountTransactionsCommand ( accountId , command , data , transactionId ? ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; if ( transactionId ) { return this . http . post ( `/savingsaccounts/${ accountId }/transactions/${ transactionId }` , data , { params : httpParams } ) ; } return this . http . post ( `/savingsaccounts/${ accountId }/transactions` , data , { params : httpParams } ) ; } param { string } accountId param { string } chargeId returns { Observable < any > } getSavingsAccountCharge ( accountId , chargeId ) { return this . http . get ( `/savingsaccounts/${ accountId }/charges/${ chargeId }` ) ; } param { string } accountId param { string } command param { any } data param { string } chargeId returns { Observable < any > } executeSavingsAccountChargesCommand ( accountId , command , data , chargeId ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/savingsaccounts/${ accountId }/charges/${ chargeId }` , data , { params : httpParams } ) ; } param { string } accountId param { any } data param { any } chargeId returns { Observable < any > } editSavingsAccountCharge ( accountId , data , chargeId ) { return this . http . put ( `/savingsaccounts/${ accountId }/charges/${ chargeId }` , data ) ; } param { string } accountId param { any } chargeId returns { Observable < any > } deleteSavingsAccountCharge ( accountId , chargeId ) { return this . http . delete ( `/savingsaccounts/${ accountId }/charges/${ chargeId }` ) ; } }