Files
cbsnexora/src/app/organization/organization.service.ts
T
niteshandClaude Opus 5.5 7c23bdd6af Merge branch 'feature/dds' into merge/dds-into-dev-latest
Brings the DDS (Daily Deposit Scheme) UI from feature/dds onto the
current dev-latest:
- Agent settlement (Agent Tran), Close Party account, DDS reports,
  Party-Savings link field
- Agent collection entry screen, per-agent GL account, maturity auto
  close
- Approvals tab, vouchers, payout & close, Sundry GL search, closure
  tab and fixes
- Menu: DDS Party Master, DDS Accounts, DDS Collection, DDS Reports and
  Locker links placed in the Deposits mega panel groups; Agent Master,
  Commission Slab and DDS Batch Processing under Organization; DDS
  Approvals tab in the checker inbox

No content conflicts. Nothing from dev-latest is removed.

Merge adjustments:
- package-lock.json: kept dev-latest's lock file. feature/dds does not
  add or change any dependency in package.json; its lock file was only
  regenerated (about 18k lines removed and 12k added), which would have
  changed resolved versions for packages already on dev-latest.
- Dropped src/app/deposits/party-master/CBS-Backend.code-workspace, a
  VS Code workspace file holding local folder paths, not app code.
- angular.json: bundle budget raised to 18mb warning / 20mb error, as on
  feature/dds.

Lint fixes required by the pre-commit hook (no behaviour change):
- Prettier formatting on 12 DDS files.
- create-party.component.scss: the dense data-entry section deliberately
  re-targets the base selectors to override them, so
  no-duplicate-selectors is disabled for that section instead of
  merging rules and changing the cascade.
- notice-dialog / create-dds-account-type scss: stylelint-disable-line
  for the "ch" width unit.
- commission-slab-master.component.scss: stylelint auto-fix.

Verified with tsc -p src/tsconfig.app.json --noEmit, stylelint, prettier
and eslint on all merged files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 15:10:37 +05:30

1343 lines
45 KiB
TypeScript

/**
* 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';
/** Custom Imports. */
import { SettingsService } from 'app/settings/settings.service';
/**
* Organization service.
*/
@Injectable({
providedIn: 'root'
})
export class OrganizationService {
private http = inject(HttpClient);
private settingsService = inject(SettingsService);
/**
* @returns {Observable<any>} Loan Provisioning Criteria data
*/
getProvisioningCriterias(): Observable<any> {
return this.http.get('/provisioningcriteria');
}
/**
* @returns {Observable<any>} Loan Provisioning Criteria template.
*/
getProvisioningCriteriaTemplate(): Observable<any> {
return this.http.get('/provisioningcriteria/template');
}
/**
* @param {string} provisioningId Provisioning ID of Loan Provisioning Criteria.
* @returns {Observable<any>} Provisioning Criteria.
*/
getProvisioningCriteria(provisioningId: string, template: boolean = false): Observable<any> {
const httpParams = new HttpParams().set('template', template.toString());
return this.http.get(`/provisioningcriteria/${provisioningId}`, { params: httpParams });
}
/**
* @param {any} criteriaData Provisioning Criteria to be created.
* @returns {Observable<any>}
*/
createProvisioningCriteria(criteriaData: any): Observable<any> {
return this.http.post('/provisioningcriteria', criteriaData);
}
/**
* @param {any} criteriaId Criteria Id
* @param {any} criteriaData Provisioning Criteria to be created.
* @returns {Observable<any>}
*/
updateProvisioningCriteria(criteriaId: any, criteriaData: any): Observable<any> {
return this.http.put(`/provisioningcriteria/${criteriaId}`, criteriaData);
}
/**
* @param {string} provisioningId Provisioning ID of provisioning criteria to be deleted.
* @returns {Observable<any>}
*/
deleteProvisioningCriteria(criteriaId: string): Observable<any> {
return this.http.delete(`/provisioningcriteria/${criteriaId}`);
}
/**
* @returns {Observable<any>} Offices data
*/
getOffices(): Observable<any> {
return this.http.get('/offices');
}
/**
* Get Office Template.
* @param {string} officeId Office Id of the office selected.
* @returns {Observable<any>} Office Template.
*/
getOfficeTemplate(officeId: string): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId.toString());
return this.http.get(`/loans/loanreassignment/template`, { params: httpParams });
}
/**
* Get Officer Template.
* @param officerId Officer Id.
* @param officeId Office Id.
*/
getOfficerTemplate(officerId: string, officeId: string): Observable<any> {
const httpParams = new HttpParams()
.set('fromLoanOfficerId', officerId.toString())
.set('officeId', officeId.toString());
return this.http.get('/loans/loanreassignment/template', { params: httpParams });
}
/**
* Bulk Loan Reassignment.
* @param loanData Load Data to be created.
* @returns {Observable<any>}
*/
createLoanReassignment(loanData: any): Observable<any> {
return this.http.post('/loans/loanreassignment', loanData);
}
/**
* @param {string} officeId Office ID of Office.
* @param {boolean} template
* @returns {Observable<any>} Office.
*/
getOffice(officeId: string, template: boolean = false): Observable<any> {
const httpParams = new HttpParams().set('template', template.toString());
return this.http.get(`/offices/${officeId}`, { params: httpParams });
}
/**
* @param {any} office Office to be created.
* @returns {Observable<any>}
*/
createOffice(office: any): Observable<any> {
return this.http.post('/offices', office);
}
/**
* @param {any} office Office to be updated.
* @param {string} officeId Office Id
* @returns {Observable<any>}
*/
updateOffice(officeId: string, office: any): Observable<any> {
return this.http.put(`/offices/${officeId}`, office);
}
/**
* Delete an office. Fineract enforces referential integrity server-side
* (rejects when staff / sub-offices / linked clients exist) — the UI also
* pre-checks staff count for a better experience.
* @param {string} officeId Office Id to remove.
* @returns {Observable<any>}
*/
deleteOffice(officeId: string): Observable<any> {
return this.http.delete(`/offices/${officeId}`);
}
/**
* @returns {Observable<any>}
*/
getOfficeDatatables(): Observable<any> {
const httpParams = new HttpParams().set('apptable', 'm_office');
return this.http.get(`/datatables`, { params: httpParams });
}
/**
* @param officeId Office Id of office to get datatable for.
* @param datatableName Data table name.
* @returns {Observable<any>}
*/
getOfficeDatatable(officeId: string, datatableName: string): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.get(`/datatables/${datatableName}/${officeId}`, { params: httpParams });
}
/**
* @param officeId Office Id of office to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
addOfficeDatatableEntry(officeId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.post(`/datatables/${datatableName}/${officeId}`, data, { params: httpParams });
}
/**
* @param officeId Office Id of office to get add datatable entry for.
* @param datatableName Data Table name.
* @param data Data.
* @returns {Observable<any>}
*/
editOfficeDatatableEntry(officeId: string, datatableName: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.put(`/datatables/${datatableName}/${officeId}`, data, { params: httpParams });
}
/**
* @param officeId Office Id of office to get add datatable entry for.
* @param datatableName Data Table name.
* @returns {Observable<any>}
*/
deleteDatatableContent(officeId: string, datatableName: string): Observable<any> {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.delete(`/datatables/${datatableName}/${officeId}`, { params: httpParams });
}
/**
* @returns {Observable<any>} Employees data
*/
getEmployees(): Observable<any> {
const httpParams = new HttpParams().set('status', 'all');
return this.http.get('/staff', { params: httpParams });
}
/**
* @param {any} employee Employee to be created.
* @returns {Observable<any>}
*/
createEmployee(employee: any): Observable<any> {
return this.http.post('/staff', employee);
}
/**
* @param {string} employeeId Employee ID of employee.
* @param {boolean} template
* @returns {Observable<any>} Employee.
*/
getEmployee(employeeId: string, template: boolean = true): Observable<any> {
const httpParams = new HttpParams().set('template', template.toString());
return this.http.get(`/staff/${employeeId}`, { params: httpParams });
}
/**
* @returns {Observable<any>} Currencies data
*/
getCurrencies(): Observable<any> {
return this.http.get('/currencies');
}
/**
* @returns {Observable<any>} DDS Agents data
*/
getAgents(): Observable<any> {
return this.http.get('/dds/agents');
}
/**
* @param {string | number} agentId Agent ID.
* @returns {Observable<any>} DDS Agent.
*/
getAgent(agentId: string | number): Observable<any> {
return this.http.get(`/dds/agents/${agentId}`);
}
/**
* @param {any} agent Agent to be created.
* @returns {Observable<any>}
*/
createAgent(agent: any): Observable<any> {
return this.http.post('/dds/agents', agent);
}
/**
* @param {string | number} agentId Agent ID.
* @param {any} agent Agent changes to apply.
* @returns {Observable<any>}
*/
updateAgent(agentId: string | number, agent: any): Observable<any> {
return this.http.put(`/dds/agents/${agentId}`, agent);
}
/**
* @returns {Observable<any>} DDS Parties data
*/
getParties(): Observable<any> {
return this.http.get('/dds/parties');
}
/**
* The parties a given agent collects for — what the daily transaction screen works from, since
* it handles one agent's round at a time.
*
* @param {string | number} agentId Agent ID.
* @returns {Observable<any>} That agent's DDS Parties.
*/
getPartiesOfAgent(agentId: string | number): Observable<any> {
return this.http.get('/dds/parties', { params: new HttpParams().set('agentId', String(agentId)) });
}
/**
* @param {string | number} partyId Party ID.
* @returns {Observable<any>} DDS Party.
*/
getParty(partyId: string | number): Observable<any> {
return this.http.get(`/dds/parties/${partyId}`);
}
/**
* @param {any} party Party to be created.
* @returns {Observable<any>}
*/
createParty(party: any): Observable<any> {
return this.http.post('/dds/parties', party);
}
/**
* @param {string | number} partyId Party ID.
* @param {any} party Party changes to apply.
* @returns {Observable<any>}
*/
updateParty(partyId: string | number, party: any): Observable<any> {
return this.http.put(`/dds/parties/${partyId}`, party);
}
/**
* @param {string | number} partyId Party ID.
* @param {any} closeCommand { closeDate }
* @returns {Observable<any>}
*/
closeParty(partyId: string | number, closeCommand: any): Observable<any> {
return this.http.post(`/dds/parties/${partyId}?command=close`, closeCommand);
}
/**
* The DDS accounts whose term has run out and which are still open - the branch's list of closures
* waiting to be done. Nothing closes itself: a matured account is money the bank owes the customer,
* and where it goes has to be agreed with them.
*
* @returns {Observable<any>} Accounts due for closure, oldest maturity first.
*/
getPartiesDueForClosure(): Observable<any> {
return this.http.get('/dds/parties/dueforclosure');
}
/**
* The customer's own accounts a DDS maturity can be paid into - active savings accounts of theirs,
* with fixed and recurring deposits and their other DDS scheme accounts left out.
*
* The server applies the same conditions the payout itself does, so this list can never offer a
* choice that is then refused on save. Filtering here instead meant the two drifted apart: the
* accounts on offer once included a scheme account of a party that had already closed.
*
* @param {string | number} clientId Client ID.
* @returns {Observable<any>} id, accountNo, productName and balance for each.
*/
/** The liability GL accounts a DDS balance can be parked in, for the clerk to search and pick. */
getDdsSundryAccounts(): Observable<any> {
return this.http.get('/dds/parties/sundryaccounts');
}
/** DDS entries waiting on (or already past) a checker - PENDING, APPROVED or REJECTED. */
getDdsApprovals(status: string, fromDate?: string, toDate?: string): Observable<any> {
const params: any = { status };
if (fromDate) {
params.fromDate = fromDate;
}
if (toDate) {
params.toDate = toDate;
}
return this.http.get('/dds/approvals', { params });
}
getDdsApproval(commandId: string | number): Observable<any> {
return this.http.get(`/dds/approvals/${commandId}`);
}
/** Approves or rejects a DDS entry; an approval returns the voucher it moved under. */
actOnDdsApproval(commandId: string | number, command: 'approve' | 'reject'): Observable<any> {
return this.http.post(`/dds/approvals/${commandId}`, {}, { params: { command } });
}
/** How a closed DDS account was closed: by whom, what it came to and where the money went. */
getPartyClosure(partyId: string | number): Observable<any> {
return this.http.get(`/dds/parties/${partyId}/closure`);
}
getCreditableAccounts(clientId: string | number): Observable<any> {
return this.http.get('/dds/parties/creditaccounts', { params: { clientId: String(clientId) } });
}
/**
* Pays a matured DDS account out and closes it. What is paid is what the account holds, not the
* figure quoted at opening.
*
* @param {string | number} partyId Party ID.
* @param {any} payoutCommand { toSavingsAccountNo } - another savings account of the same customer
* to move the money into. Omit it when they have none here: the money is then parked in the
* matured-deposits payable account for the branch to send on to their account at another bank.
* @returns {Observable<any>}
*/
payOutParty(partyId: string | number, payoutCommand: any): Observable<any> {
return this.http.post(`/dds/parties/${partyId}?command=payout`, payoutCommand);
}
/**
* Closes a DDS account before its term is up, and pays out what is left - one act, unlike a
* maturity payout, which leaves the account open for the clerk to close separately.
*
* @param {string | number} partyId Party ID.
* @param {any} closeCommand { shortfallBorneBy, closeDate, dateFormat, locale, toSavingsAccountNo? }.
* closeDate, dateFormat and locale go up exactly as they do on an ordinary close.
* shortfallBorneBy is mandatory
* and is CUSTOMER (their interest is recalculated at the scheme's reduced rate and the
* difference taken back) or AGENT (the customer keeps a full month's interest and the agent
* funds the days left in it). The agent is charged a share of their commission either way.
* toSavingsAccountNo works as it does for a payout. The lock-in, the rate reduction and the
* agent's share come from the scheme and are applied by the server.
* @returns {Observable<any>}
*/
prematureCloseParty(partyId: string | number, closeCommand: any): Observable<any> {
return this.http.post(`/dds/parties/${partyId}?command=prematureclose`, closeCommand);
}
/**
* Closes a DDS account early inside its scheme's lock-in, for the reason given. Its own permission,
* so it goes to a manager for approval; the scheme's lock-in is not changed.
*/
prematureCloseOverrideParty(partyId: string | number, closeCommand: any): Observable<any> {
return this.http.post(`/dds/parties/${partyId}?command=prematurecloseoverride`, closeCommand);
}
/**
* @param {any} transaction Daily transaction batch (PARTY_TRAN collections or a WITHDRAW_DEPOSITE transfer) to post.
* @returns {Observable<any>}
*/
createPartyTransaction(transaction: any): Observable<any> {
return this.http.post('/dds/partytransactions', transaction);
}
/**
* What an agent wrote down on their round for a date, with what it adds up to.
*
* The counter reads it to count cash against; the agent's own screen shows it back as the record
* of their round. One call for both, so the two can never disagree about the same day.
*/
getAgentCollectionDay(agentId: any, entryDate: string): Observable<any> {
return this.http.get(`/dds/collectionentries?agentId=${agentId}&entryDate=${entryDate}`);
}
/**
* Turns an agent's outstanding entries for a date into real credits - all of them, together.
*
* No amount is sent. What settles is what the entries say, to the rupee: a figure typed at the
* counter would be a second opinion about a total the entries already give.
*/
settleAgentCollections(settlement: any): Observable<any> {
return this.http.post('/dds/collectionentries/settle', settlement);
}
/** Everything the agent still has outstanding, whatever day it was written - what a receipt is applied against. */
getAgentPendingCollections(agentId: any): Observable<any> {
return this.http.get(`/dds/collectionentries/pending?agentId=${agentId}`);
}
/**
* The cashier's receipts into the agent's GL account: the DDS receipts ready to apply, or - with a
* voucher number - that one voucher in whatever state, so the screen can say why it cannot be used.
*/
getAgentCashReceipts(agentId: any, voucherNo?: string, includeWaiting = false): Observable<any> {
const voucher = voucherNo ? `&voucherNo=${encodeURIComponent(voucherNo)}` : '';
const waiting = includeWaiting ? '&includeWaiting=true' : '';
return this.http.get(`/dds/collectionentries/cashreceipts?agentId=${agentId}${voucher}${waiting}`);
}
/** A cashier receipt's own Dr/Cr lines. */
getCashReceiptGlEntries(receiptId: any): Observable<any> {
return this.http.get(`/dds/collectionentries/cashreceipts/${receiptId}/glentries`);
}
/**
* An agent's DDS transactions. The daily entry screen uses this to show what has already been
* keyed for the agent today, so the same collection book is not entered twice.
*
* @param {string | number} agentId Agent ID.
* @returns {Observable<any>} That agent's transactions.
*/
getPartyTransactionsOfAgent(agentId: string | number): Observable<any> {
return this.http.get('/dds/partytransactions', {
params: new HttpParams().set('agentId', String(agentId))
});
}
/**
* @param {string | number} partyId DDS account (party) id.
* @returns {Observable<any>} Everything posted to that DDS account, most recent first.
*/
getPartyTransactionsOfParty(partyId: string | number): Observable<any> {
return this.http.get('/dds/partytransactions', {
params: new HttpParams().set('partyId', String(partyId))
});
}
/**
* @returns {Observable<any>} DDS Commission Slabs data
*/
getCommissionSlabs(): Observable<any> {
return this.http.get('/dds/commissionslabs');
}
/**
* @param {any[]} slabs New commission slab rows to add to the chart.
* @returns {Observable<any>}
*/
createCommissionSlabs(slabs: any[]): Observable<any> {
return this.http.post('/dds/commissionslabs', { slabs });
}
/**
* Corrects one saved commission slab. The backend re-checks the corrected range against the other
* slabs of its type and refuses an overlap.
*
* @param {string | number} slabId Commission slab ID.
* @param {any} slab The corrected slab.
* @returns {Observable<any>} Command result.
*/
updateCommissionSlab(slabId: string | number, slab: any): Observable<any> {
return this.http.put(`/dds/commissionslabs/${slabId}`, slab);
}
/**
* @param {any} batch Batch run filters (jobType, branchScope, jobDate, agentFrom/To, partyFrom/To) to generate a preview for.
* @returns {Observable<any>}
*/
generateDdsBatchRun(batch: any): Observable<any> {
return this.http.post('/dds/batchruns', batch);
}
/**
* @param {string | number} batchRunId Batch run ID.
* @returns {Observable<any>} Batch run, including its previewed/posted rows.
*/
getDdsBatchRun(batchRunId: string | number): Observable<any> {
return this.http.get(`/dds/batchruns/${batchRunId}`);
}
/**
* @returns {Observable<any>} Every batch run, most recent first — who ran what, and whether it was posted.
*/
getDdsBatchRuns(): Observable<any> {
return this.http.get('/dds/batchruns');
}
/**
* Ends the relationship with an agent. Refused while they still have accounts assigned, hold
* collected cash, or are owed commission — distinct from deactivating, which is never refused.
*
* @param {string | number} agentId Agent ID.
* @returns {Observable<any>}
*/
closeAgent(agentId: string | number): Observable<any> {
return this.http.post(`/dds/agents/${agentId}`, {});
}
/**
* @param {string | number} batchRunId Batch run ID to post - applies exactly the rows it previewed.
* @returns {Observable<any>}
*/
postDdsBatchRun(batchRunId: string | number): Observable<any> {
return this.http.post(`/dds/batchruns/${batchRunId}`, {});
}
/**
* @param {string} reportKey One of the backend DDS report keys.
* @param {any} filters fromDate, toDate (ISO strings), agentFrom/To, partyFrom/To.
* @returns {Observable<any>} { reportKey, available, message, columns, rows }
*/
runDdsReport(reportKey: string, filters: any): Observable<any> {
let httpParams = new HttpParams();
Object.keys(filters || {}).forEach((key) => {
if (filters[key] !== undefined && filters[key] !== null && filters[key] !== '') {
httpParams = httpParams.set(key, filters[key]);
}
});
return this.http.get(`/dds/reports/${reportKey}`, { params: httpParams });
}
/**
* @param {any[]} currencies
* @returns {Observable<any>} Currencies data
*/
updateCurrencies(currencies: any[]): Observable<any> {
return this.http.put('/currencies', { currencies });
}
/**
* @returns {Observable<any>} SMS Campaigns data
*/
getSmsCampaigns(): Observable<any> {
return this.http.get('/smscampaigns');
}
/**
* @param {string} smsCampaignId SMS Campaign ID of SMS Campaign.
* @returns {Observable<any>} SMS Campaign.
*/
getSmsCampaign(campaignId: string): Observable<any> {
return this.http.get(`/smscampaigns/${campaignId}`);
}
/**
* @param {any} campaign Campaign to be created.
* @returns {Observable<any>}
*/
createSmsCampaign(campaign: any): Observable<any> {
return this.http.post('/smscampaigns', campaign);
}
/**
* @param {any} campaign Campaign to be updated.
* @returns {Observable<any>}
*/
updateSmsCampaign(campaign: any, campaignId: string): Observable<any> {
return this.http.put(`/smscampaigns/${campaignId}`, campaign);
}
/**
* @param {any} campaign Campaign to be deleted.
* @returns {Observable<any>}
*/
deleteSmsCampaign(campaignId: string): Observable<any> {
return this.http.delete(`/smscampaigns/${campaignId}`);
}
/**
* @returns {Observable<any>} SMS Campaign template
*/
getSmsCampaignTemplate(): Observable<any> {
return this.http.get('/smscampaigns/template');
}
/**
* @param {string} campaignId Campaign Id
* @param {any} data Data
* @param {string} command Command
* @returns {Observable<any>}
*/
executeSmsCampaignCommand(campaignId: string, data: any, command: string): Observable<any> {
const httpParams = new HttpParams().set('command', command.toString());
return this.http.post(`/smscampaigns/${campaignId}`, data, { params: httpParams });
}
/**
* @param {any} SMS
* @returns {Observable<any>} Messages Data
*/
getMessagebyStatus(SMS: any): Observable<any> {
let httpParams = new HttpParams()
.set('status', SMS.status.toString())
.set('locale', SMS.locale)
.set('dateFormat', SMS.dateFormat);
httpParams = SMS.fromDate ? httpParams.set('fromDate', SMS.fromDate) : httpParams;
httpParams = SMS.toDate ? httpParams.set('toDate', SMS.toDate) : httpParams;
return this.http.get(`/sms/${SMS.id}/messageByStatus`, { params: httpParams });
}
/**
* @returns {Observable<any>} Adhoc Queries data
*/
getAdhocQueries(): Observable<any> {
return this.http.get('/adhocquery');
}
/**
* @param {string} adhocQueryId Adhoc Query ID of adhoc query.
* @returns {Observable<any>} Adhoc query.
*/
getAdhocQuery(adhocQueryId: string): Observable<any> {
return this.http.get(`/adhocquery/${adhocQueryId}`);
}
/**
* @returns {Observable<any>} Adhoc query Template data
*/
getAdhocQueryTemplate(): Observable<any> {
return this.http.get(`/adhocquery/template`);
}
/**
* @param {string} adhocQueryId Adhoc Query ID of adhoc query.
* @returns {Observable<any>} Adhoc query and template.
*/
getAdhocQueryAndTemplate(adhocQueryId: string): Observable<any> {
const httpParams = new HttpParams().set('template', 'true');
return this.http.get(`/adhocquery/${adhocQueryId}`, { params: httpParams });
}
/**
* @param {any} adhocQuery Adhoc Query to be created.
* @returns {Observable<any>}
*/
createAdhocQuery(adhocQuery: any): Observable<any> {
return this.http.post('/adhocquery', adhocQuery);
}
/**
* @param {any} queryId Query Id
* @param {any} adhocQuery Adhoc Query to be created.
* @returns {Observable<any>}
*/
updateAdhocQuery(queryId: any, adhocQuery: any): Observable<any> {
return this.http.put(`/adhocquery/${queryId}`, adhocQuery);
}
/**
* @param {string} adhocQueryId Adhoc Query ID of adhoc query to be deleted.
* @returns {Observable<any>}
*/
deleteAdhocQuery(adhocQueryId: string): Observable<any> {
return this.http.delete(`/adhocquery/${adhocQueryId}`);
}
/**
* @returns {Observable<any>} Tellers data
*/
getTellers(): Observable<any> {
return this.http.get('/tellers');
}
/**
* @param {string} tellerId Teller ID of teller.
* @returns {Observable<any>} Teller.
*/
getTeller(tellerId: string): Observable<any> {
return this.http.get(`/tellers/${tellerId}`);
}
/**
* @param {string} tellerId Teller ID of teller.
* @returns {Observable<any>} Cashier data.
*/
getCashiers(tellerId: string): Observable<any> {
return this.http.get(`/tellers/${tellerId}/cashiers`);
}
/**
* @param {string} tellerId Teller ID of teller.
* @param {string} cashierId Cashier ID of cashier
* @returns {Observable<any>} Cashier data.
*/
getCashier(tellerId: string, cashierId: string): Observable<any> {
return this.http.get(`/tellers/${tellerId}/cashiers/${cashierId}`);
}
/**
* @param {string} tellerId Teller Id
* @param {string} cashierId Cashier Id
* @param {string} currencyCode Currency Code
* @returns {Observable<any>}
*/
getCashierSummaryAndTransactions(tellerId: string, cashierId: string, currencyCode: string): Observable<any> {
const httpParams = new HttpParams().set('currencyCode', currencyCode);
return this.http.get(`/tellers/${tellerId}/cashiers/${cashierId}/summaryandtransactions`, { params: httpParams });
}
/**
* Get Cashier Transaction template.
* @param {string} tellerId Teller Id.
* @param {string} cashierId Cashier Id.
* @returns {Observable<any>} Cashier Transaction data.
*/
getCashierTransactionTemplate(tellerId: string, cashierId: string): Observable<any> {
return this.http.get(`/tellers/${tellerId}/cashiers/${cashierId}/transactions/template`);
}
/**
* @param {string} tellerId Teller Id
* @param {any} cashier Cashier
* @returns {Observable<any>}
*/
createCashier(tellerId: string, cashier: any): Observable<any> {
return this.http.post(`/tellers/${tellerId}/cashiers`, cashier);
}
/**
* @param {string} tellerId Teller ID of teller.
* @param {string} cashierId Cashier ID of cashier
* @returns {Observable<any>}
*/
deleteCashier(tellerId: string, cashierId: string): Observable<any> {
return this.http.delete(`/tellers/${tellerId}/cashiers/${cashierId}`);
}
/**
* @param {string} tellerId Teller Id.
* @param {string} cashierId Cashier Id.
* @param {string} cashData Cash Data.
* @returns {Observable<any>}
*/
settleCash(tellerId: string, cashierId: string, cashData: any): Observable<any> {
const httpParams = new HttpParams().set('command', 'settle');
return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/settle`, cashData, { params: httpParams });
}
/**
* @param {string} tellerId Teller Id.
* @param {string} cashierId Cashier Id.
* @param {string} cashData Cash Data.
* @returns {Observable<any>}
*/
allocateCash(tellerId: string, cashierId: string, cashData: any): Observable<any> {
const httpParams = new HttpParams().set('command', 'allocate');
return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/allocate`, cashData, { params: httpParams });
}
/** Get Cashier Template.
* @param tellerId Teller ID.
* @returns {Observable<any>} Cashier template.
*/
getCashierTemplate(tellerId: string): Observable<any> {
return this.http.get(`/tellers/${tellerId}/cashiers/template`);
}
/**
* Update Cashier.
* @param tellerId Teller Id.
* @param cashierId Cashier Id.
* @param cashierData Cashier data to be updated.
* @returns {Observable<any>}
*/
updateCashier(tellerId: string, cashierId: string, cashierData: any): Observable<any> {
return this.http.put(`/tellers/${tellerId}/cashiers/${cashierId}`, cashierData);
}
/**
* @param {string} tellerId Teller ID of teller to be deleted.
* @returns {Observable<any>}
*/
deleteTeller(tellerId: string): Observable<any> {
return this.http.delete(`/tellers/${tellerId}`);
}
/**
* @param {any} teller Teller to be created.
* @returns {Observable<any>}
*/
createTeller(teller: any): Observable<any> {
return this.http.post('/tellers', teller);
}
/**
* @returns {Observable<any>} Payment Types data
*/
getPaymentTypes(): Observable<any> {
return this.http.get('/paymenttypes');
}
/**
* @returns {Observable<any>} Payment Types data
*/
getPaymentTypesWithCode(): Observable<any> {
return this.http.get('/paymenttypes?onlyWithCode=true');
}
/**
* @param {any} paymentType Payment type to be created.
* @returns {Observable<any>}
*/
createPaymentType(paymentType: any): Observable<any> {
return this.http.post('/paymenttypes', paymentType);
}
/**
* @param {string} paymentTypeId Payment type ID of payment type to be deleted.
* @returns {Observable<any>}
*/
deletePaymentType(paymentTypeId: string): Observable<any> {
return this.http.delete(`/paymenttypes/${paymentTypeId}`);
}
/**
* @param {string} paymentTypeId Payment type ID of payment type.
* @returns {Observable<any>} Payment type.
*/
getPaymentType(paymentTypeId: string): Observable<any> {
return this.http.get(`/paymenttypes/${paymentTypeId}`);
}
/**
* @param {string} paymentTypeId Payment type ID of Payment Type to be edited.
* @returns {Observable<any>}
*/
updatePaymentType(paymentTypeId: string, paymentType: any): Observable<any> {
return this.http.put(`/paymenttypes/${paymentTypeId}`, paymentType);
}
/**
* @returns {Observable<any>} Password Preferences Template data
*/
getPasswordPreferencesTemplate(): Observable<any> {
return this.http.get('/passwordpreferences/template');
}
/**
* @param {any} passwordPreferences Password Preferences data.
* @returns {Observable<any>}
*/
updatePasswordPreferences(passwordPreferences: any): Observable<any> {
return this.http.put('/passwordpreferences', passwordPreferences);
}
/**
* @param {number} offset Page offset.
* @param {number} limit Number of entries within the page.
* @returns {Observable<any>} Entity Data Table Checks data.
*/
getEntityDataTableChecks(offset: number = 0, limit: number = -1): Observable<any> {
const httpParams = new HttpParams().set('offset', offset.toString()).set('limit', limit.toString());
return this.http.get('/entityDatatableChecks', { params: httpParams });
}
/**
* Get Entity Data Table Checks Template.
*/
getEntityDataTableChecksTemplate(): Observable<any> {
return this.http.get('/entityDatatableChecks/template');
}
/**
* Create Entity Data Table Checks.
* @param entityData Data to be passed.
*/
createEntityDataTableChecks(entityData: any): Observable<any> {
return this.http.post('/entityDatatableChecks', entityData);
}
/**
* @param {string} entityDataTableCheckId Entity Data Table Check ID of entity data table to be deleted.
* @returns {Observable<any>}
*/
deleteEntityDataTableCheck(entityDataTableCheckId: string): Observable<any> {
return this.http.delete(`/entityDatatableChecks/${entityDataTableCheckId}`);
}
/**
* @returns {Observable<any>} Working days data.
*/
getWorkingDays(): Observable<any> {
return this.http.get('/workingdays');
}
/**
* @param {any} workingDays Working days data.
* @returns {Observable<any>}
*/
updateWorkingDays(workingDays: any): Observable<any> {
return this.http.put('/workingdays', workingDays);
}
/**
* @param {string} officeId Office ID of Holidays.
* @returns {Observable<any>} Holidays data.
*/
getHolidays(officeId: string): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId.toString());
return this.http.get('/holidays', { params: httpParams });
}
/**
* Get Holiday data.
* @param holidayId Holiday Id of holidays.
* @returns {Observable<any>} Holiday data.
*/
getHoliday(holidayId: string): Observable<any> {
return this.http.get(`/holidays/${holidayId}`);
}
/**
* Get Holiday template.
* @returns {Observable<any>} Holiday data.
*/
getHolidayTemplate(): Observable<any> {
return this.http.get('/holidays/template');
}
/**
* Create Holiday.
* @param holidayData Holiday data to be created.
* @returns {Observable<any>}
*/
createHoliday(holidayData: any): Observable<any> {
return this.http.post('/holidays', holidayData);
}
/**
* Update Holiday.
* @param holidayId Holiday Id to be updated.
* @param holidayData Holiday data to be updated.
* @returns {Observable<any>}
*/
updateHoliday(holidayId: any, holidayData: any): Observable<any> {
return this.http.put(`/holidays/${holidayId}`, holidayData);
}
/**
* Delete Holiday.
* @param holidayId Holiday Id to be deleted.
* @returns {Observable<any>} Resource Id.
*/
deleteHoliday(holidayId: string): Observable<any> {
return this.http.delete(`/holidays/${holidayId}`);
}
/**
* Activate Holiday.
* @param holidayId Holiday Id to be deleted.
* @returns {Observable<any>} Resource Id.
*/
activateHoliday(holidayId: string): Observable<any> {
const httpParams = new HttpParams().set('command', 'activate');
return this.http.post(`/holidays/${holidayId}`, null, { params: httpParams });
}
/**
* @param {any} employeeId Employee ID of Employee to be edited.
* @returns {Observable<any>}
*/
updateEmployee(employeeId: string, employee: any): Observable<any> {
return this.http.put(`/staff/${employeeId}`, employee);
}
/**
* @param {string} tellerId Teller ID of Teller to be edited.
* @returns {Observable<any>}
*/
updateTeller(tellerId: string, teller: any): Observable<any> {
return this.http.put(`/tellers/${tellerId}`, teller);
}
/**
* @returns {Observable<any>} Funds data
*/
getFunds(): Observable<any> {
return this.http.get('/funds');
}
/**
* @returns {Observable<any>} Fund data
*/
getFund(fundId: string): Observable<any> {
return this.http.get(`/funds/${fundId}`);
}
/**
* @param {any} fund Fund to be created.
* @returns {Observable<any>}
*/
createFund(fund: any): Observable<any> {
return this.http.post('/funds', fund);
}
/**
* @param {string} fundId Fund Id
* @param {any} fundData Fund Data
* @returns {Observable<any>}
*/
editFund(fundId: string, fundData: any): Observable<any> {
return this.http.put(`/funds/${fundId}`, fundData);
}
getStaffs(officeId: any): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId).set('status', 'all');
return this.http.get(`/staff`, { params: httpParams });
}
getCenters(officeId: any): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId).set('status', 'all');
return this.http.get(`/centers`, { params: httpParams });
}
getGroups(officeId: any): Observable<any> {
const httpParams = new HttpParams().set('officeId', officeId).set('status', 'all');
return this.http.get(`/groups`, { params: httpParams });
}
/**
* @param {number | string} officeId ID of office to retrieve staff from.
* @param {boolean} [isLoanOfficer] Optional flag to filter by loan officer status.
* @returns {Observable<any>} Staff data.
*/
getStaff(officeId: number | string, isLoanOfficer?: boolean): Observable<any> {
let httpParams = new HttpParams().set('officeId', officeId.toString()).set('status', 'active');
if (isLoanOfficer !== undefined) {
httpParams = httpParams.set('isLoanOfficer', isLoanOfficer.toString());
}
return this.http.get('/staff', { params: httpParams });
}
/**
* @param {string} entity Entity to get imports data for.
* @returns {Observable<any>} Imports data.
*/
getImports(entity: string): Observable<any> {
const httpParams = new HttpParams().set('entityType', entity);
return this.http.get('/imports', { params: httpParams });
}
/**
* @returns {Observable<any>}
*/
getAdvanceSearchTemplate(): Observable<any> {
return this.http.get('/search/template');
}
/**
* @returns {Observable<any>}
*/
retrieveAdvanceSearchResults(queryObject: any): Observable<any> {
return this.http.post('/search/advance', queryObject);
}
/**
* @returns {Observable<any>}
*/
getStandingInstructionTemplate(): Observable<any> {
return this.http.get('/standinginstructions/template');
}
/**
* @param {any} instruction
* @returns {Observable<any>} Standing Instructions
*/
getStandingInstructions(instruction: any): Observable<any> {
let httpParams = new HttpParams();
for (const key in instruction) {
if (instruction[key] !== '' && instruction[key] !== null) {
httpParams = httpParams.set(key, instruction[key]);
}
}
return this.http.get(`/standinginstructionrunhistory`, { params: httpParams });
}
/**
* @param urlSuffix of Bulk-Import
* @param officeId Office ID for template retrieval
* @param staffId Staff ID for template retrieval
* @param legalFormType Legal Form type fortemplate retrieval
* @returns {Observable<any>} Import Template
*/
getImportTemplate(urlSuffix: string, officeId: any, staffId: any, legalFormType: string): Observable<any> {
let httpParams = new HttpParams()
.set('tenantIdentifier', 'default')
.set('locale', this.settingsService.language.code)
.set('dateFormat', this.settingsService.dateFormat);
if (officeId) {
httpParams = httpParams.set('officeId', officeId.toString());
}
if (staffId) {
httpParams = httpParams.set('staffId', staffId.toString());
}
if (legalFormType.length) {
httpParams = httpParams.set('legalFormType', legalFormType);
}
return this.http.get(`${urlSuffix}/downloadtemplate`, {
params: httpParams,
responseType: 'arraybuffer',
observe: 'response'
});
}
/**
* @param {any} id Import ID for document retrieval
* @returns {Observable<any>} Import Document
*/
getImportDocument(id: any): Observable<any> {
const httpParams = new HttpParams().set('importDocumentId', id).set('tenantIdentifier', 'default');
return this.http.get('/imports/downloadOutputTemplate', {
params: httpParams,
responseType: 'arraybuffer',
observe: 'response'
});
}
/**
* @param {File} file File to be uploaded
* @param {string} urlSuffix URL suffix
* @param {string} legalFormType Legal Form type for file upload
* @returns {Observable<any>}
*/
uploadImportDocument(file: File, urlSuffix: string, legalFormType: string): Observable<any> {
let httpParams = new HttpParams();
if (legalFormType.length) {
httpParams = httpParams.set('legalFormType', legalFormType);
}
const formData = new FormData();
formData.append('file', file);
formData.append('locale', this.settingsService.language.code);
formData.append('dateFormat', this.settingsService.dateFormat);
return this.http.post(`${urlSuffix}/uploadtemplate`, formData, { params: httpParams });
}
/**
* @returns {Observable<any>} Loan Originators data
*/
getLoanOriginators(): Observable<any> {
return this.http.get('/loan-originators');
}
/**
* @returns {Observable<any>} Loan Originators Template data
*/
getLoanOriginatorsTemplate(): Observable<any> {
return this.http.get('/loan-originators/template');
}
/**
* @returns {Observable<any>} Loan Originator data
*/
getLoanOriginator(originatorId: string): Observable<any> {
return this.http.get(`/loan-originators/${originatorId}`);
}
/**
* @returns {Observable<any>}
*/
createLoanOriginator(payload: any): Observable<any> {
return this.http.post(`/loan-originators`, payload);
}
/**
* @returns {Observable<any>}
*/
updateLoanOriginator(originatorId: number, payload: any): Observable<any> {
return this.http.put(`/loan-originators/${originatorId}`, payload);
}
/**
* @returns {Observable<any>}
*/
deleteLoanOriginator(originatorId: number): Observable<any> {
return this.http.delete(`/loan-originators/${originatorId}`);
}
// ── Institution Profile ──
/** @returns {Observable<any>} The bank's own profile (name, legal name, code, contact...). */
getInstitutionProfile(): Observable<any> {
return this.http.get('/institutionprofile');
}
/** @returns {Observable<any>} */
updateInstitutionProfile(payload: any): Observable<any> {
return this.http.put('/institutionprofile', payload);
}
// ── Branch Profile ──
/** @returns {Observable<any[]>} Every office joined with its branch profile fields, if any. */
getBranchProfiles(): Observable<any> {
return this.http.get('/branchprofile');
}
/** @returns {Observable<any>} One office's branch profile, joined with its office fields. */
getBranchProfile(officeId: number): Observable<any> {
const params = new HttpParams().set('officeId', String(officeId));
return this.http.get('/branchprofile', { params });
}
/** @returns {Observable<any>} */
updateBranchProfile(officeId: number, payload: any): Observable<any> {
return this.http.put(`/branchprofile/${officeId}`, payload);
}
// ── Clearing GL Configuration ──
/** @returns {Observable<any[]>} Every clearing role (CTS/NACH/RTGS...) and its mapped GL account, if any. */
getClearingGlConfig(): Observable<any> {
return this.http.get('/clearingglconfig');
}
/** @returns {Observable<any>} Selectable GL accounts for mapping a clearing role. */
getClearingGlConfigTemplate(): Observable<any> {
return this.http.get('/clearingglconfig/template');
}
/** @returns {Observable<any>} */
updateClearingGlConfig(configKey: string, glAccountId: number | null): Observable<any> {
return this.http.put(`/clearingglconfig/${configKey}`, { glAccountId });
}
// ── RBI Reserve Configuration (Form 1 CRR / Form 9 SLR) ──
/**
* @returns {Observable<any>} `{ rates[], glRoles[] }` — the effective-dated CRR/SLR percentages
* and the GL accounts mapped to each reserve role. Roles with nothing mapped are included, so
* the screen can show the gaps rather than hide them.
*/
getRbiReserveConfig(): Observable<any> {
return this.http.get('/rbireserveconfig');
}
/** @returns {Observable<any>} Selectable (postable, non-header) GL accounts plus the rate types. */
getRbiReserveConfigTemplate(): Observable<any> {
return this.http.get('/rbireserveconfig/template');
}
/**
* Replaces the entire set of GL accounts mapped to one reserve role.
*
* Each mapping carries the portion of the account's balance the role takes and, on a liability
* head, whether that portion is a demand or a time liability. RBI treats part of a savings balance
* as demand and the rest as time, so the same account is sent twice under one role with different
* classes - which is why this is a list of mappings rather than a list of account ids.
*
* @param {string} configKey A built-in role (CASH_IN_HAND, BALANCE_WITH_OTHER_BANKS,
* DEMAND_TIME_LIABILITIES, SLR_INVESTMENTS) or the key of a head an administrator added.
*/
updateRbiReserveGlRole(
configKey: string,
mappings: { glAccountId: number; weightPercentage: number; liabilityClass: string | null }[]
): Observable<any> {
return this.http.put(`/rbireserveconfig/gl/${configKey}`, { mappings, locale: 'en' });
}
/**
* Adds a head to a return - a reserve, a tax payable, anything the bank's chart carries that the
* built-in roles do not name. `usage` states how the return consumes it: LIABILITY, ASSET_NET,
* MAINTAINED or MEMO.
*/
createRbiReserveRole(role: { label: string; description: string; group: string; usage: string }): Observable<any> {
return this.http.post('/rbireserveconfig/role', { ...role, locale: 'en' });
}
/** Removes an administrator-defined head and the accounts pinned to it. */
deleteRbiReserveRole(roleId: number): Observable<any> {
return this.http.delete(`/rbireserveconfig/role/${roleId}`);
}
/**
* Sets a CRR or SLR rate with effect from a date. Restating an existing effective date edits that
* row; a new date adds one, so past returns keep the rate that was actually in force.
*/
upsertRbiReserveRate(rateType: string, percentage: number, effectiveFrom: string): Observable<any> {
return this.http.post('/rbireserveconfig/rate', {
rateType,
percentage,
effectiveFrom,
locale: 'en',
dateFormat: 'yyyy-MM-dd'
});
}
/** @returns {Observable<any>} */
deleteRbiReserveRate(rateId: number): Observable<any> {
return this.http.delete(`/rbireserveconfig/rate/${rateId}`);
}
}