- Add cashier deposit service and submit flow via maker-checker - New CashierDepositService: submit, approve, reject, list endpoints - Transaction-entry: cashier SD deposit goes to deposit-requests instead of direct credit - Checker inbox: new Deposit Requests tab with approve/reject review dialog - Cashier nav: My Deposit Requests tracking page - Withdrawal requests: show voucher_no from backend instead of JS-padded id - clerk-withdrawal.service: disburse denominationData accepts null for non-cash - Role-based checker enforcement: only manager/head-cashier can approve/reject - Maker cannot approve own request (self-approval blocked at backend) - Denomination total validation: breakdown must match transaction amount Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
2.5 KiB
TypeScript
64 lines
2.5 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/.
|
|
*/
|
|
|
|
import { Injectable, inject } from '@angular/core';
|
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
|
|
/** HTTP service for Clerk Withdrawal Request maker-checker workflow. */
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ClerkWithdrawalService {
|
|
private http = inject(HttpClient);
|
|
|
|
submit(data: any): Observable<any> {
|
|
return this.http.post('/clerk/withdrawal-requests', data);
|
|
}
|
|
|
|
update(id: number, data: any): Observable<any> {
|
|
return this.http.put(`/clerk/withdrawal-requests/${id}`, data);
|
|
}
|
|
|
|
getMyRequests(status?: string, offset = 0, limit = 20, fromDate?: string, toDate?: string): Observable<any> {
|
|
let params = new HttpParams().set('offset', String(offset)).set('limit', String(limit));
|
|
if (status) params = params.set('status', status);
|
|
if (fromDate) params = params.set('fromDate', fromDate);
|
|
if (toDate) params = params.set('toDate', toDate);
|
|
return this.http.get('/clerk/withdrawal-requests/my', { params });
|
|
}
|
|
|
|
getPendingRequests(status = 'PENDING', offset = 0, limit = 20, fromDate?: string, toDate?: string): Observable<any> {
|
|
let params = new HttpParams().set('status', status).set('offset', String(offset)).set('limit', String(limit));
|
|
if (fromDate) params = params.set('fromDate', fromDate);
|
|
if (toDate) params = params.set('toDate', toDate);
|
|
return this.http.get('/clerk/withdrawal-requests', { params });
|
|
}
|
|
|
|
getById(id: number): Observable<any> {
|
|
return this.http.get(`/clerk/withdrawal-requests/${id}`);
|
|
}
|
|
|
|
approve(id: number): Observable<any> {
|
|
return this.http.post(`/clerk/withdrawal-requests/${id}/approve`, {});
|
|
}
|
|
|
|
reject(id: number, reason: string): Observable<any> {
|
|
return this.http.post(`/clerk/withdrawal-requests/${id}/reject`, { reason });
|
|
}
|
|
|
|
getByToken(token: string): Observable<any> {
|
|
return this.http.get(`/clerk/withdrawal-requests/by-token/${encodeURIComponent(token)}`);
|
|
}
|
|
|
|
disburse(id: number, denominationData: string | null, transactionAmount?: number): Observable<any> {
|
|
return this.http.post(`/clerk/withdrawal-requests/${id}/disburse`, {
|
|
denominationData,
|
|
transactionAmount: transactionAmount != null ? String(transactionAmount) : null
|
|
});
|
|
}
|
|
}
|