feat: add Current Account module, DIP verification, charges integration, and translations

- Current Account module with full CRUD, transactions, charges, hold/release, block/unblock
- Current Products management under Products module
- DIP mobile number verification with real API call to /lookup/check
- Sanctions verification dialog
- Charges support for Current Account (chargeAppliesTo=5) in create/edit
- Fixed permissions from SAVINGSACCOUNT to CURRENTACCOUNT across all current account components
- Added all missing translation keys for Current Account in en-US.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Aditya
2026-03-17 18:23:37 +05:30
co-authored by Claude Opus 4.6
parent 73aa69ee02
commit 0a32d7135e
210 changed files with 15048 additions and 155 deletions
@@ -0,0 +1,121 @@
<!--
Copyright since 2025 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<div class="container mat-elevation-z8">
<mat-card>
<form [formGroup]="closeCurrentAccountForm" (ngSubmit)="submit()">
<mat-card-content>
<div class="layout-column">
<mat-form-field (click)="closedOnDatePicker.open()">
<mat-label>{{ 'labels.inputs.Closed On Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[max]="maxDate"
[matDatepicker]="closedOnDatePicker"
required
formControlName="closedOnDate"
/>
<mat-datepicker-toggle matSuffix [for]="closedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #closedOnDatePicker></mat-datepicker>
@if (closeCurrentAccountForm.controls.closedOnDate.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Closed On Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-checkbox class="m-b-25 m-t-15" formControlName="withdrawBalance">
{{ 'labels.inputs.Withdraw Balance' | translate }}
</mat-checkbox>
<mat-checkbox formControlName="postInterestValidationOnClosure">
{{ 'labels.inputs.Is Interest Posting required on closure date' | translate }}?
</mat-checkbox>
@if (closeCurrentAccountForm.controls['withdrawBalance'].value) {
<div class="layout-column">
@if (closeCurrentAccountForm.controls['amount']) {
<mat-form-field class="m-t-20">
<mat-label>{{ 'labels.inputs.Transaction Amount' | translate }}</mat-label>
<input type="number" required matInput formControlName="amount" />
</mat-form-field>
}
@if (closeCurrentAccountForm.controls['paymentTypeId']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Payment Type' | translate }}</mat-label>
<mat-select formControlName="paymentTypeId">
@for (paymentType of paymentTypeOptions; track paymentType) {
<mat-option [value]="paymentType.id">
{{ paymentType.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
}
<div class="flex-fill">
<span class="expandcollapsebutton m-l-10 m-t-40 flex-75" (click)="addPaymentDetails()">
<mat-slide-toggle>
<div [className]="showPaymentDetails ? 'enabled' : 'disabled'">
<span class="m-l-10">{{ 'labels.inputs.Show Payment Details' | translate }}</span>
</div>
</mat-slide-toggle>
</span>
</div>
@if (closeCurrentAccountForm.controls['accountNumber']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Account Number' | translate }}</mat-label>
<input type="number" formControlName="accountNumber" matInput />
</mat-form-field>
}
@if (closeCurrentAccountForm.controls['checkNumber']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Cheque' | translate }}</mat-label>
<input type="number" formControlName="checkNumber" matInput />
</mat-form-field>
}
@if (closeCurrentAccountForm.controls['routingCode']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Routing Code' | translate }}</mat-label>
<input formControlName="routingCode" matInput />
</mat-form-field>
}
@if (closeCurrentAccountForm.controls['receiptNumber']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Receipt Number' | translate }}</mat-label>
<input formControlName="receiptNumber" matInput />
</mat-form-field>
}
@if (closeCurrentAccountForm.controls['bankNumber']) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Bank' | translate }}</mat-label>
<input formControlName="bankNumber" matInput />
</mat-form-field>
}
</div>
}
<mat-form-field>
<mat-label>{{ 'labels.inputs.Note' | translate }}</mat-label>
<textarea matInput formControlName="note" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
</mat-form-field>
</div>
</mat-card-content>
<mat-card-actions class="layout-row align-center gap-5px responsive-column">
<button type="button" mat-raised-button [routerLink]="['../../']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button mat-raised-button color="warn" [disabled]="!closeCurrentAccountForm.valid">
{{ 'labels.buttons.Confirm' | translate }}
</button>
</mat-card-actions>
</form>
</mat-card>
</div>
@@ -0,0 +1,11 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
.container {
max-width: 37rem;
}
@@ -0,0 +1,165 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/** Angular Imports */
import { Component, OnInit, inject } from '@angular/core';
import {
UntypedFormGroup,
UntypedFormBuilder,
Validators,
UntypedFormControl,
ReactiveFormsModule
} from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
/** Custom Services */
import { CurrentAccountsService } from 'app/current-accounts/current-accounts.service';
import { SettingsService } from 'app/settings/settings.service';
import { MatCheckbox } from '@angular/material/checkbox';
import { MatSlideToggle } from '@angular/material/slide-toggle';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
/**
* Close Current Account Component
*/
@Component({
selector: 'mifosx-close-current-account',
templateUrl: './close-current-account.component.html',
styleUrls: ['./close-current-account.component.scss'],
imports: [
...STANDALONE_SHARED_IMPORTS,
MatCheckbox,
MatSlideToggle,
CdkTextareaAutosize
]
})
export class CloseCurrentAccountComponent implements OnInit {
private formBuilder = inject(UntypedFormBuilder);
private currentAccountsService = inject(CurrentAccountsService);
private dateUtils = inject(Dates);
private route = inject(ActivatedRoute);
private router = inject(Router);
private settingsService = inject(SettingsService);
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
maxDate = new Date();
/** Close Current Account form. */
closeCurrentAccountForm: UntypedFormGroup;
/** Current Account Id */
accountId: any;
/** Flag to enable payment details fields. */
addPaymentDetailsFlag = false;
/** Payment Type Options */
paymentTypeOptions: any;
/** Transaction Amount */
transactionAmount: any;
/**
* @param {FormBuilder} formBuilder Form Builder
* @param {CurrentAccountsService} currentAccountsService Current Accounts Service
* @param {Dates} dateUtils Date Utils
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor() {
this.route.data.subscribe((data: { currentAccountActionData: any }) => {
this.paymentTypeOptions = data.currentAccountActionData[0].paymentTypeOptions;
this.transactionAmount = data.currentAccountActionData[1].summary.accountBalance;
});
this.accountId = this.route.snapshot.params['currentAccountId'];
}
/**
* Creates the close current account form.
*/
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createCloseCurrentAccountForm();
this.buildDependencies();
}
/**
* Creates the close current account form.
*/
createCloseCurrentAccountForm() {
this.closeCurrentAccountForm = this.formBuilder.group({
closedOnDate: [
'',
Validators.required
],
withdrawBalance: [false],
postInterestValidationOnClosure: [false],
note: ['']
});
}
/**
* Subscribe to value changes of withdraw balance checkbox.
*/
buildDependencies() {
this.closeCurrentAccountForm.get('withdrawBalance').valueChanges.subscribe((value: boolean) => {
if (value) {
this.closeCurrentAccountForm.addControl(
'amount',
new UntypedFormControl({ value: this.transactionAmount, disabled: true })
);
this.closeCurrentAccountForm.addControl('paymentTypeId', new UntypedFormControl(''));
} else {
this.closeCurrentAccountForm.removeControl('amount');
this.closeCurrentAccountForm.removeControl('paymentTypeId');
}
});
}
/**
* Method to add payment detail fields to the UI.
*/
addPaymentDetails() {
this.addPaymentDetailsFlag = !this.addPaymentDetailsFlag;
if (this.addPaymentDetailsFlag) {
this.closeCurrentAccountForm.addControl('accountNumber', new UntypedFormControl(''));
this.closeCurrentAccountForm.addControl('checkNumber', new UntypedFormControl(''));
this.closeCurrentAccountForm.addControl('routingCode', new UntypedFormControl(''));
this.closeCurrentAccountForm.addControl('receiptNumber', new UntypedFormControl(''));
this.closeCurrentAccountForm.addControl('bankNumber', new UntypedFormControl(''));
} else {
this.closeCurrentAccountForm.removeControl('accountNumber');
this.closeCurrentAccountForm.removeControl('checkNumber');
this.closeCurrentAccountForm.removeControl('routingCode');
this.closeCurrentAccountForm.removeControl('receiptNumber');
this.closeCurrentAccountForm.removeControl('bankNumber');
}
}
/**
* Submits the form and closes the current account,
* if successful redirects to the current account.
*/
submit() {
const closeCurrentAccountFormData = this.closeCurrentAccountForm.value;
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const prevClosedOnDate: Date = this.closeCurrentAccountForm.value.closedOnDate;
if (closeCurrentAccountFormData.closedOnDate instanceof Date) {
closeCurrentAccountFormData.closedOnDate = this.dateUtils.formatDate(prevClosedOnDate, dateFormat);
}
const data = {
...closeCurrentAccountFormData,
dateFormat,
locale
};
this.currentAccountsService.executeCurrentAccountCommand(this.accountId, 'close', data).subscribe(() => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}