/** Angular Imports */ import { Injectable } from '@angular/core' ; import { HttpClient , HttpParams } from '@angular/common/http' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /** Custom Services */ import { SettingsService } from 'app/settings/settings.service' ; /**
 * Products service.
 */ @ Injectable ( { providedIn : 'root' } ) export class ProductsService { param { HttpClient } http param { SettingsService } settingsService constructor ( private http , private settingsService ) { } returns { Observable < any > } getLoanProducts ( ) { return this . http . get ( '/loanproducts' ) ; } createLoanProduct ( loanProduct ) { return this . http . post ( '/loanproducts' , loanProduct ) ; } getLoanProductsTemplate ( ) { return this . http . get ( '/loanproducts/template' ) ; } getLoanProduct ( loanProductId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/loanproducts/${ loanProductId }` , { params : httpParams } ) ; } updateLoanProduct ( loanProductId , loanProduct ) { return this . http . put ( `/loanproducts/${ loanProductId }` , loanProduct ) ; } returns { Observable < any > } getSavingProducts ( ) { return this . http . get ( '/savingsproducts' ) ; } createSavingProduct ( savingProduct ) { return this . http . post ( '/savingsproducts' , savingProduct ) ; } getSavingProductsTemplate ( ) { return this . http . get ( '/savingsproducts/template' ) ; } getSavingProduct ( savingProductId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/savingsproducts/${ savingProductId }` , { params : httpParams } ) ; } updateSavingProduct ( savingProductId , savingProduct ) { return this . http . put ( `/savingsproducts/${ savingProductId }` , savingProduct ) ; } returns { Observable < any > } getShareProducts ( ) { return this . http . get ( '/products/share' ) ; } createShareProduct ( shareProduct ) { return this . http . post ( '/products/share' , shareProduct ) ; } getShareProductsTemplate ( ) { return this . http . get ( '/products/share/template' ) ; } getShareProduct ( shareProductId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/products/share/${ shareProductId }` , { params : httpParams } ) ; } updateShareProduct ( shareProductId , shareProduct ) { return this . http . put ( `/products/share/${ shareProductId }` , shareProduct ) ; } getDividends ( shareProductId ) { return this . http . get ( `/shareproduct/${ shareProductId }/dividend` ) ; } param shareProductId param dividendData returns { Observable < any > } createDividend ( shareProductId , dividendData ) { return this . http . post ( `/shareproduct/${ shareProductId }/dividend` , dividendData ) ; } getDividendData ( shareProductId , dividendId ) { const httpParams = new HttpParams ( ) . set ( 'dateFormat' , this . settingsService . dateFormat ) . set ( 'limit' , '10' ) . set ( 'locale' , this . settingsService . language . code ) . set ( 'offset' , '0' ) ; return this . http . get ( `/shareproduct/${ shareProductId }/dividend/${ dividendId }` , { params : httpParams } ) ; } approveDividend ( shareProductId , dividendId , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , 'approve' ) ; return this . http . put ( `/shareproduct/${ shareProductId }/dividend/${ dividendId }` , data , { params : httpParams } ) ; } returns { Observable < any > } getRecurringDepositProducts ( ) { return this . http . get ( '/recurringdepositproducts' ) ; } param { string } recurringDepositProductId param { boolean } template return { Observable < any > } getRecurringDepositProduct ( recurringDepositProductId , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/recurringdepositproducts/${ recurringDepositProductId }` , { params : httpParams } ) ; } getRecurringDepositProductsTemplate ( ) { return this . http . get ( '/recurringdepositproducts/template' ) ; } returns { Observable < any > } getCharges ( ) { return this . http . get ( '/charges' ) ; } getChargesTemplate ( ) { return this . http . get ( '/charges/template' ) ; } param { string } chargeId returns { Observable < any > } getCharge ( selectedCharge , template = false ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/charges/${ selectedCharge }` , { params : httpParams } ) ; } param chargeId param charges updateCharge ( chargeId , charges ) { return this . http . put ( `/charges/${ chargeId }` , charges ) ; } param { string } chargeId returns { Observable < any > } deleteCharge ( chargeId ) { return this . http . delete ( `/charges/${ chargeId }` ) ; } param { any } charge returns { Observable < any > } createCharge ( charge ) { return this . http . post ( '/charges' , charge ) ; } returns { Observable < any > } getFixedDepositProducts ( ) { return this . http . get ( '/fixeddepositproducts' ) ; } createFixedDepositProduct ( fixedDepositProduct ) { return this . http . post ( '/fixeddepositproducts' , fixedDepositProduct ) ; } getFixedDepositProductsTemplate ( ) { return this . http . get ( '/fixeddepositproducts/template' ) ; } param { string } fixedDepositProductId returns { Observable < any > } getFixedDepositProduct ( fixedDepositProductId ) { return this . http . get ( `/fixeddepositproducts/${ fixedDepositProductId }` ) ; } getFixedDepositProductAndTemplate ( fixedDepositProductId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/fixeddepositproducts/${ fixedDepositProductId }` , { params : httpParams } ) ; } updateFixedDepositProduct ( fixedDepositProductId , fixedDepositProduct ) { return this . http . put ( `/fixeddepositproducts/${ fixedDepositProductId }` , fixedDepositProduct ) ; } returns { Observable < any > } getTaxComponents ( ) { return this . http . get ( '/taxes/component' ) ; } param { string } taxComponentId returns { Observable < any > } getTaxComponent ( taxComponentId ) { return this . http . get ( `/taxes/component/${ taxComponentId }` ) ; } returns { Observable < any > } getTaxComponentTemplate ( ) { return this . http . get ( '/taxes/component/template' ) ; } param { any } taxComponent returns { Observable < any > } createTaxComponent ( taxComponent ) { return this . http . post ( '/taxes/component' , taxComponent ) ; } updateTaxComponent ( taxComponentId , taxComponent ) { return this . http . put ( `/taxes/component/${ taxComponentId }` , taxComponent ) ; } returns { Observable < any > } getTaxGroups ( ) { return this . http . get ( '/taxes/group' ) ; } param { string } taxGroupId param { string } template returns { Observable < any > } getTaxGroup ( taxGroupId , template ) { const httpParams = new HttpParams ( ) . set ( 'template' , template ) ; return this . http . get ( `/taxes/group/${ taxGroupId }` , { params : httpParams } ) ; } returns { Observable < any > } getTaxGroupTemplate ( ) { return this . http . get ( '/taxes/group/template' ) ; } param { any } taxGroup returns { Observable < any > } createTaxGroup ( taxGroup ) { return this . http . post ( '/taxes/group' , taxGroup ) ; } param { any } taxGroupId param { any } taxGroup returns { Observable < any > } updateTaxGroup ( taxGroupId , taxGroup ) { return this . http . put ( `/taxes/group/${ taxGroupId }` , taxGroup ) ; } returns { Observable < any > } getProductMixes ( ) { let httpParams = new HttpParams ( ) ; httpParams = httpParams . set ( 'associations' , 'productMixes' ) ; return this . http . get ( '/loanproducts' , { params : httpParams } ) ; } returns { Observable < any > } getFloatingRates ( ) { return this . http . get ( '/floatingrates' ) ; } param { any } floatingRate returns { Observable < any > } createFloatingRate ( floatingRate ) { return this . http . post ( '/floatingrates' , floatingRate ) ; } param { string } floatingRateId returns { Observable < any > } getFloatingRate ( floatingRateId ) { return this . http . get ( `/floatingrates/${ floatingRateId }` ) ; } param { string } floatingRateId param { any } floatingRate returns { Observable < any > } updateFloatingRate ( floatingRateId , floatingRate ) { return this . http . put ( `/floatingrates/${ floatingRateId }` , floatingRate ) ; } param { string } productId returns { Observable < any > } getProductMix ( productId ) { return this . http . get ( `/loanproducts/${ productId }/productmix` ) ; } getProductsMixTemplate ( ) { let httpParams = new HttpParams ( ) ; httpParams = httpParams . set ( 'isProductMixTemplate' , 'true' ) ; return this . http . get ( '/loanproducts/template' , { params : httpParams } ) ; } param { string } productMixId returns { Observable < any > } getProductMixTemplate ( productMixId ) { let httpParams = new HttpParams ( ) ; httpParams = httpParams . set ( 'template' , 'true' ) ; return this . http . get ( `/loanproducts/${ productMixId }/productmix` , { params : httpParams } ) ; } param { string } productMixId param { any } productMix returns { Observable < any > } createProductMix ( productMix , productMixId ) { return this . http . post ( `/loanproducts/${ productMixId }/productmix` , productMix ) ; } param { string } productMixId param { any } productMix returns { Observable < any > } updateProductMix ( productMix , productMixId ) { return this . http . put ( `/loanproducts/${ productMixId }/productmix` , productMix ) ; } param { string } productMixId returns { Observable < any > } deleteProductMix ( productMixId ) { return this . http . delete ( `/loanproducts/${ productMixId }/productmix` ) ; } getAllInterestRateCharts ( productId ) { const httpParams = new HttpParams ( ) . set ( 'productId' , productId ) ; return this . http . get ( `/interestratecharts` , { params : httpParams } ) ; } createRecurringDepositProduct ( recurringDepositProduct ) { return this . http . post ( '/recurringdepositproducts' , recurringDepositProduct ) ; } getRecurringDepositProductAndTemplate ( recurringDepositProductId ) { const httpParams = new HttpParams ( ) . set ( 'template' , 'true' ) ; return this . http . get ( `/recurringdepositproducts/${ recurringDepositProductId }` , { params : httpParams } ) ; } updateRecurringDepositProduct ( recurringDepositProductId , recurringDepositProduct ) { return this . http . put ( `/recurringdepositproducts/${ recurringDepositProductId }` , recurringDepositProduct ) ; } }