Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/app/customApis.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,20 @@ export class OrganizationService {
});
}
}
/**
* Savings Service
*/
@Injectable({
providedIn: 'root'
})
export class SavingsService {
constructor(private http: HttpClient) {}

/**
* @param {any} savingsAccount Savings Account
* @returns {Observable<any>}
*/
createSavingsAccount(savingsAccount: any): Observable<any> {
return this.http.post('/savingsaccounts', savingsAccount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { SavingsChargesService } from '@fineract/client';
import { FixedDepositsService } from '../fixed-deposits.service';

/**
Expand All @@ -15,11 +15,11 @@ import { FixedDepositsService } from '../fixed-deposits.service';
@Injectable()
export class FixedDepositsAccountActionsResolver {
/**
* @param {SavingsService} SavingsService Savings service.
* @param {SavingsChargesService} SavingsChargesService Savings charges service.
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service.
*/
constructor(
private savingsService: SavingsService,
private savingsChargesService: SavingsChargesService,
private fixedDepositsService: FixedDepositsService
) {}

Expand All @@ -34,7 +34,7 @@ export class FixedDepositsAccountActionsResolver {
route.paramMap.get('fixedDepositAccountId') || route.parent.parent.paramMap.get('fixedDepositAccountId');
switch (actionName) {
case 'Add Charge':
return this.savingsService.getSavingsChargeTemplateResource(fixedDepositAccountId);
return this.savingsChargesService.retrieveTemplate18({ savingsAccountId: Number(fixedDepositAccountId) });
case 'Close':
return this.fixedDepositsService.getFixedDepositsAccountClosureTemplate(fixedDepositAccountId);
case 'Withdrawal':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@angular/material/table';

/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { SavingsAccountService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';

/** Custom Dialogs */
Expand Down Expand Up @@ -90,15 +90,15 @@ export class ChargesTabComponent implements OnInit {

/**
* Retrieves the Fixed Deposits account data from `resolve`.
* @param {SavingsService} savingsService Savings Service
* @param {SavingsAccountService} savingsAccountService Savings Account Service
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
* @param {Dates} dateUtils Date Utils.
* @param {SettingsService} settingsService Settings Service.
*/
constructor(
private savingsService: SavingsService,
private savingsAccountService: SavingsAccountService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
Expand Down Expand Up @@ -169,8 +169,12 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService
.executeSavingsAccountChargesCommand(this.fixedDepositsAccountData.id, 'paycharge', dataObject, chargeId)
this.savingsAccountService
.handleCommands6({
accountId: this.fixedDepositsAccountData.id,
postSavingsAccountsAccountIdRequest: dataObject,
command: 'paycharge'
})
.subscribe(() => {
this.reload();
});
Expand All @@ -186,8 +190,18 @@ export class ChargesTabComponent implements OnInit {
const waiveChargeDialogRef = this.dialog.open(WaiveChargeDialogComponent, { data: { id: chargeId } });
waiveChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService
.executeSavingsAccountChargesCommand(this.fixedDepositsAccountData.id, 'waive', {}, chargeId)
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const dataObject = {
dateFormat,
locale
};
this.savingsAccountService
.handleCommands6({
accountId: this.fixedDepositsAccountData.id,
postSavingsAccountsAccountIdRequest: dataObject,
command: 'waive'
})
.subscribe(() => {
this.reload();
});
Expand All @@ -203,8 +217,18 @@ export class ChargesTabComponent implements OnInit {
const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, { data: { id: chargeId } });
inactivateChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService
.executeSavingsAccountChargesCommand(this.fixedDepositsAccountData.id, 'inactivate', {}, chargeId)
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const dataObject = {
dateFormat,
locale
};
this.savingsAccountService
.handleCommands6({
accountId: this.fixedDepositsAccountData.id,
postSavingsAccountsAccountIdRequest: dataObject,
command: 'inactivate'
})
.subscribe(() => {
this.reload();
});
Expand Down Expand Up @@ -242,8 +266,8 @@ export class ChargesTabComponent implements OnInit {
dateFormat,
locale
};
this.savingsService
.editSavingsAccountCharge(this.fixedDepositsAccountData.id, dataObject, charge.id)
this.savingsAccountService
.handleCommands6(this.fixedDepositsAccountData.id, dataObject, charge.id)
.subscribe(() => {
this.reload();
});
Expand All @@ -261,7 +285,7 @@ export class ChargesTabComponent implements OnInit {
});
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.savingsService.deleteSavingsAccountCharge(this.fixedDepositsAccountData.id, chargeId).subscribe(() => {
this.savingsAccountService.delete18(this.fixedDepositsAccountData.id, chargeId).subscribe(() => {
this.reload();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.conf

/** Custom Services */
import { FixedDepositsService } from '../fixed-deposits.service';
import { SavingsService } from 'app/savings/savings.service';
import { SavingsAccountService } from '@fineract/client';
import { Currency } from 'app/shared/models/general.model';
import {
MatCard,
Expand Down Expand Up @@ -83,14 +83,14 @@ export class FixedDepositAccountViewComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
* @param {SavingsService} savingsService Savings Service
* @param {SavingsAccountService} savingsAccountService Savings Account Service
* @param {MatDialog} dialog Mat Dialog
*/
constructor(
private route: ActivatedRoute,
private router: Router,
private fixedDepositsService: FixedDepositsService,
private savingsService: SavingsService,
private savingsAccountService: SavingsAccountService,
public dialog: MatDialog
) {
this.route.data.subscribe((data: { fixedDepositsAccountData: any; savingsDatatables: any }) => {
Expand Down Expand Up @@ -240,9 +240,13 @@ export class FixedDepositAccountViewComponent implements OnInit {
});
deleteSavingsAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService
.executeSavingsAccountUpdateCommand(this.fixedDepositsAccountData.id, 'updateWithHoldTax', {
withHoldTax: true
this.savingsAccountService
.update20({
accountId: this.fixedDepositsAccountData.id,
command: 'updateWithHoldTax',
putSavingsAccountsAccountIdRequest: {
withHoldTax: true
} as any
})
.subscribe(() => {
this.reload();
Expand All @@ -261,9 +265,13 @@ export class FixedDepositAccountViewComponent implements OnInit {
});
disableWithHoldTaxDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) {
this.savingsService
.executeSavingsAccountUpdateCommand(this.fixedDepositsAccountData.id, 'updateWithHoldTax', {
withHoldTax: false
this.savingsAccountService
.update20({
accountId: this.fixedDepositsAccountData.id,
command: 'updateWithHoldTax',
putSavingsAccountsAccountIdRequest: {
withHoldTax: false
} as any
})
.subscribe(() => {
this.reload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
import { UndoTransactionDialogComponent } from 'app/savings/savings-account-view/custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
import { Dates } from 'app/core/utils/dates';
import { SavingsService } from 'app/savings/savings.service';
import { SavingsAccountTransactionsService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';
import { NgIf, NgClass, CurrencyPipe } from '@angular/common';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
Expand Down Expand Up @@ -37,7 +37,7 @@ export class ViewTransactionComponent {
/**
*/
constructor(
private savingsService: SavingsService,
private savingsAccountTransactionsService: SavingsAccountTransactionsService,
private route: ActivatedRoute,
private dateUtils: Dates,
private router: Router,
Expand Down Expand Up @@ -76,8 +76,13 @@ export class ViewTransactionComponent {
dateFormat,
locale
};
this.savingsService
.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, this.transactionData.id)
this.savingsAccountTransactionsService
.adjustTransaction1({
savingsId: Number(this.accountId),
transactionId: this.transactionData.id,
command: 'undo',
postSavingsAccountBulkReversalTransactionsRequest: data as any
})
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { Dates } from 'app/core/utils/dates';

/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { SavingsAccountService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';

Expand Down Expand Up @@ -33,15 +33,15 @@ export class ActivateFixedDepositsAccountComponent implements OnInit {
/**
* Fixed deposits endpoint is not supported so using Savings endpoint.
* @param {FormBuilder} formBuilder Form Builder
* @param {SavingsService} savingsService Savings Service
* @param {SavingsAccountService} savingsAccountService Savings Account Service
* @param {Dates} dateUtils Date Utils
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {SettingsService} settingsService Settings Service
*/
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private savingsAccountService: SavingsAccountService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
Expand Down Expand Up @@ -87,8 +87,14 @@ export class ActivateFixedDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.savingsService.executeSavingsAccountCommand(this.accountId, 'activate', data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.savingsAccountService
.handleCommands6({
accountId: this.accountId,
command: 'activate',
postSavingsAccountsAccountIdRequest: data
})
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Router, ActivatedRoute, RouterLink } from '@angular/router';
import { Dates } from 'app/core/utils/dates';

/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { ChargesService, SavingsAccountService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';

Expand Down Expand Up @@ -47,15 +47,17 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {Dates} dateUtils Date Utils
* @param {SavingsService} savingsService Savings Service
* @param {ChargesService} chargesService Charges Service
* @param {SavingsAccountService} savingsAccountService Savings Account Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private savingsService: SavingsService,
private chargesService: ChargesService,
private savingsAccountService: SavingsAccountService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { fixedDepositsAccountActionData: any }) => {
Expand All @@ -75,7 +77,7 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {

buildDependencies() {
this.fixedDepositsChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
this.savingsService.getChargeTemplate(chargeId).subscribe((data: any) => {
this.chargesService.retrieveCharge(chargeId).subscribe((data: any) => {
this.chargeDetails = data;
const chargeTimeType = data.chargeTimeType.id;
if (data.chargeTimeType.value === 'Withdrawal Fee' || data.chargeTimeType.value === 'Saving No Activity Fee') {
Expand Down Expand Up @@ -155,8 +157,14 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {
}
}
}
this.savingsService.createSavingsCharge(this.fixedDepositAccountId, 'charges', savingsCharge).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.savingsAccountService
.handleCommands6({
accountId: Number(this.fixedDepositAccountId),
command: 'charges',
postSavingsAccountsAccountIdRequest: savingsCharge
})
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { UntypedFormGroup, UntypedFormBuilder, ReactiveFormsModule } from '@angu
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { SavingsAccountService } from '@fineract/client';
import { FixedDepositsService } from '../../fixed-deposits.service';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
Expand Down Expand Up @@ -33,13 +33,13 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
/**
* Fixed deposits endpoint is not supported so using Savings endpoint.
* @param {FormBuilder} formBuilder Form Builder
* @param {SavingsService} savingsService Savings Service
* @param {SavingsAccountService } savingsAccountService Savings Account Service
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
*/
constructor(
private formBuilder: UntypedFormBuilder,
private savingsService: SavingsService,
private savingsAccountService: SavingsAccountService,
private fixedDepositsService: FixedDepositsService,
private route: ActivatedRoute,
private router: Router
Expand Down Expand Up @@ -83,9 +83,15 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
this.router.navigate(['../../'], { relativeTo: this.route });
});
} else {
this.savingsService.executeSavingsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
this.savingsAccountService
.handleCommands6({
accountId: this.accountId,
command: this.undoCommand,
postSavingsAccountsAccountIdRequest: data
})
.subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
}
}
Loading