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:
co-authored by
Claude Opus 4.6
parent
73aa69ee02
commit
0a32d7135e
@@ -0,0 +1,368 @@
|
||||
/**
|
||||
* 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 { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Current Accounts Service.
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CurrentAccountsService {
|
||||
private http = inject(HttpClient);
|
||||
|
||||
/**
|
||||
* @param {string} currentAccountId is current account's Id.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountTransactionTemplateResource(currentAccountId: string): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${currentAccountId}/transactions/template`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} currentAccountId current account id.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountChargeTemplateResource(currentAccountId: string): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${currentAccountId}/charges/template`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} currentAccountCharge to apply on a current account Account.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createCurrentAccountCharge(
|
||||
currentAccountId: string,
|
||||
resourceType: string,
|
||||
currentAccountCharge: any
|
||||
): Observable<any> {
|
||||
return this.http.post(`/currentaccounts/${currentAccountId}/${resourceType}`, currentAccountCharge);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} chargeId Charge ID of charge.
|
||||
* @returns {Observable<any>} Charge.
|
||||
*/
|
||||
getChargeTemplate(chargeId: string): Observable<any> {
|
||||
const params = { template: 'true' };
|
||||
return this.http.get(`/charges/${chargeId}`, { params: params });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId Current Account Id of account to get data for.
|
||||
* @returns {Observable<any>} Current Account data.
|
||||
*/
|
||||
getCurrentAccountData(accountId: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('associations', 'all');
|
||||
return this.http.get(`/currentaccounts/${accountId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId Current Account Id of account to get data for.
|
||||
* @returns {Observable<any>} Current account and template.
|
||||
*/
|
||||
getCurrentAccountAndTemplate(accountId: string, template: boolean): Observable<any> {
|
||||
const httpParams = new HttpParams().set('template', template.toString()).set('associations', 'charges');
|
||||
return this.http.get(`/currentaccounts/${accountId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clientId Client Id
|
||||
* @param clientName Client Name
|
||||
* @param fromAccountId Account Id
|
||||
* @param locale Locale
|
||||
* @param dateFormat Date Format
|
||||
* @returns {Observable<any>} Standing Instructions
|
||||
*/
|
||||
getStandingInstructions(
|
||||
clientId: string,
|
||||
clientName: string,
|
||||
fromAccountId: string,
|
||||
locale: string,
|
||||
dateFormat: string
|
||||
): Observable<any> {
|
||||
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>}
|
||||
*/
|
||||
getCurrentAccountDatatables(): Observable<any> {
|
||||
const httpParams = new HttpParams().set('apptable', 'm_current_account');
|
||||
return this.http.get(`/datatables`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId account Id of current account to get datatable for.
|
||||
* @param datatableName Data table name.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountDatatable(accountId: string, datatableName: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('genericResultSet', 'true');
|
||||
return this.http.get(`/datatables/${datatableName}/${accountId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountTransactionDatatables(): Observable<any> {
|
||||
const httpParams = new HttpParams().set('apptable', 'm_current_account_transaction');
|
||||
return this.http.get(`/datatables`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId account Id of current account to get datatable for.
|
||||
* @param datatableName Data table name.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountTransactionDatatable(transactionId: string, datatableName: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('genericResultSet', 'true');
|
||||
return this.http.get(`/datatables/${datatableName}/${transactionId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId account Id of current account to get add datatable entry for.
|
||||
* @param datatableName Data Table name.
|
||||
* @param data Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
addCurrentAccountDatatableEntry(accountId: string, datatableName: string, data: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('genericResultSet', 'true');
|
||||
return this.http.post(`/datatables/${datatableName}/${accountId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId account Id of current account to get add datatable entry for.
|
||||
* @param datatableName Data Table name.
|
||||
* @param data Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
editCurrentAccountDatatableEntry(accountId: string, datatableName: string, data: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('genericResultSet', 'true');
|
||||
return this.http.put(`/datatables/${datatableName}/${accountId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param accountId account Id of current account to get add datatable entry for.
|
||||
* @param datatableName Data Table name.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteDatatableContent(accountId: string, datatableName: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('genericResultSet', 'true');
|
||||
return this.http.delete(`/datatables/${datatableName}/${accountId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entityId Entity Id assosciated with current account.
|
||||
* @returns {Observable<any>} Current account template.
|
||||
*/
|
||||
getCurrentAccountTemplate(entityId: string, productId?: string, isGroup?: boolean): Observable<any> {
|
||||
let httpParams = new HttpParams().set(isGroup ? 'groupId' : 'clientId', entityId);
|
||||
httpParams = productId ? httpParams.set('productId', productId) : httpParams;
|
||||
return this.http.get('/currentaccounts/template', { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} currentAccount Current Account
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createCurrentAccount(currentAccount: any): Observable<any> {
|
||||
return this.http.post('/currentaccounts', currentAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} currentAccount Current Account
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
updateCurrentAccount(accountId: string, currentAccount: any): Observable<any> {
|
||||
return this.http.put(`/currentaccounts/${accountId}`, currentAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId current account Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteCurrentAccount(accountId: string): Observable<any> {
|
||||
return this.http.delete(`/currentaccounts/${accountId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} command Command
|
||||
* @param {any} data Data
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
executeCurrentAccountCommand(accountId: string, command: string, data: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.post(`/currentaccounts/${accountId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} command Command
|
||||
* @param {any} data Data
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
executeCurrentAccountUpdateCommand(accountId: string, command: string, data: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.put(`/currentaccounts/${accountId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} transactionId Transaction Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountTransaction(accountId: string, transactionId: string): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${accountId}/transactions/${transactionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} transactionId Transaction Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountTransactionTemplate(accountId: string, transactionId: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('template', 'true');
|
||||
return this.http.get(`/currentaccounts/${accountId}/transactions/${transactionId}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} command Command
|
||||
* @param {any} data Data
|
||||
* @param {string} transactionId Transaction Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
executeCurrentAccountTransactionsCommand(
|
||||
accountId: string,
|
||||
command: string,
|
||||
data: any,
|
||||
transactionId?: any
|
||||
): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
if (transactionId) {
|
||||
return this.http.post(`/currentaccounts/${accountId}/transactions/${transactionId}`, data, {
|
||||
params: httpParams
|
||||
});
|
||||
}
|
||||
return this.http.post(`/currentaccounts/${accountId}/transactions`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId current account Id
|
||||
* @param {string} chargeId current account charge Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getCurrentAccountCharge(accountId: string, chargeId: string): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${accountId}/charges/${chargeId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {string} command Command
|
||||
* @param {any} data Data
|
||||
* @param {string} chargeId Charge Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
executeCurrentAccountChargesCommand(accountId: string, command: string, data: any, chargeId: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.post(`/currentaccounts/${accountId}/charges/${chargeId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {any} data Charge Data
|
||||
* @param {any} chargeId Charge Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
editCurrentAccountCharge(accountId: string, data: any, chargeId: any): Observable<any> {
|
||||
return this.http.put(`/currentaccounts/${accountId}/charges/${chargeId}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Current Account Id
|
||||
* @param {any} chargeId Charge Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteCurrentAccountCharge(accountId: string, chargeId: any): Observable<any> {
|
||||
return this.http.delete(`/currentaccounts/${accountId}/charges/${chargeId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentAccountId Current Account Id
|
||||
* @returns The notes for particular loan
|
||||
*/
|
||||
getCurrentAccountNotes(currentAccountId: string): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${currentAccountId}/notes`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a note to the particular Current Account Id
|
||||
* @param currentAccountId Current Account ID
|
||||
* @param noteData Note Data to be added
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createCurrentAccountNote(currentAccountId: string, noteData: any): Observable<any> {
|
||||
return this.http.post(`/currentaccounts/${currentAccountId}/notes`, noteData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the Current Account Note
|
||||
* @param currentAccountId Current Account ID
|
||||
* @param noteId Note ID
|
||||
* @param noteData Note Data
|
||||
*/
|
||||
editCurrentAccountNote(currentAccountId: string, noteId: string, noteData: any) {
|
||||
return this.http.put(`/currentaccounts/${currentAccountId}/notes/${noteId}`, noteData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the particular Note
|
||||
* @param currentAccountId Current Account ID
|
||||
* @param noteId Note ID
|
||||
*/
|
||||
deleteCurrentAccountNote(currentAccountId: string, noteId: string) {
|
||||
return this.http.delete(`/currentaccounts/${currentAccountId}/notes/${noteId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentAccountId Current Account Id of account to get data for.
|
||||
* @returns {Observable<any>} Current Account data.
|
||||
*/
|
||||
getCurrentAccountDocuments(currentAccountId: any): Observable<any> {
|
||||
return this.http.get(`/currentaccounts/${currentAccountId}/documents`);
|
||||
}
|
||||
|
||||
downloadCurrentAccountDocument(parentEntityId: string, documentId: string) {
|
||||
return this.http.get(`/currentaccounts/${parentEntityId}/documents/${documentId}/attachment`, {
|
||||
responseType: 'blob'
|
||||
});
|
||||
}
|
||||
|
||||
deleteCurrentAccountDocument(currentAccountId: any, documentId: any): Observable<any> {
|
||||
return this.http.delete(`/currentaccounts/${currentAccountId}/documents/${documentId}`);
|
||||
}
|
||||
|
||||
loadCurrentAccountDocument(currentAccountId: any, data: any): Observable<any> {
|
||||
return this.http.post(`/currentaccounts/${currentAccountId}/documents`, data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user