@@ -13,6 +13,120 @@ import { HttpClient, HttpParams } from '@angular/common/http';
1313/** rxjs Imports */
1414import { Observable } from 'rxjs' ;
1515
16+ export type FineractId = string | number ;
17+
18+ export interface DepositSearchResult {
19+ id ?: FineractId ;
20+ entityId ?: FineractId ;
21+ accountId ?: FineractId ;
22+ clientId ?: FineractId ;
23+ accountNo ?: string ;
24+ entityAccountNo ?: string ;
25+ displayName ?: string ;
26+ entityName ?: string ;
27+ name ?: string ;
28+ entityType ?: string ;
29+ subEntityType ?: string ;
30+ accountType ?: string ;
31+ }
32+
33+ export interface DepositClient {
34+ id ?: FineractId ;
35+ accountNo ?: string ;
36+ displayName ?: string ;
37+ fullname ?: string ;
38+ name ?: string ;
39+ externalId ?: string ;
40+ }
41+
42+ export interface DepositSavingsAccount {
43+ id ?: FineractId ;
44+ accountId ?: FineractId ;
45+ savingsId ?: FineractId ;
46+ accountNo ?: string ;
47+ accountNumber ?: string ;
48+ productName ?: string ;
49+ savingsProductName ?: string ;
50+ clientId ?: FineractId ;
51+ clientName ?: string ;
52+ clientDisplayName ?: string ;
53+ currency ?: { code ?: string } ;
54+ currencyCode ?: string ;
55+ status ?:
56+ | {
57+ active ?: boolean ;
58+ value ?: string ;
59+ code ?: string ;
60+ }
61+ | string ;
62+ summary ?: {
63+ accountBalance ?: number | null ;
64+ availableBalance ?: number | null ;
65+ } ;
66+ accountBalance ?: number | null ;
67+ }
68+
69+ export interface DepositClientAccounts {
70+ savingsAccounts ?: DepositSavingsAccount [ ] ;
71+ savingAccounts ?: DepositSavingsAccount [ ] ;
72+ }
73+
74+ export interface DepositPaymentType {
75+ id : FineractId ;
76+ name ?: string ;
77+ value ?: string ;
78+ description ?: string ;
79+ isCashPayment ?: boolean ;
80+ position ?: number ;
81+ codeName ?: string ;
82+ isSystemDefined ?: boolean ;
83+ }
84+
85+ export interface SavingsDepositTemplate {
86+ paymentTypeOptions ?: DepositPaymentType [ ] ;
87+ }
88+
89+ export interface SavingsDepositCommandPayload {
90+ transactionDate : string ;
91+ transactionAmount : number ;
92+ paymentTypeId : FineractId ;
93+ dateFormat : string ;
94+ locale : string ;
95+ accountNumber ?: string ;
96+ checkNumber ?: string ;
97+ routingCode ?: string ;
98+ receiptNumber ?: string ;
99+ bankNumber ?: string ;
100+ note ?: string ;
101+ }
102+
103+ export interface SavingsDepositCommandResult {
104+ resourceId ?: FineractId ;
105+ entityId ?: FineractId ;
106+ transactionId ?: FineractId ;
107+ savingsId ?: FineractId ;
108+ changes ?: Record < string , unknown > ;
109+ }
110+
111+ export interface SavingsDepositReceipt extends SavingsDepositCommandResult {
112+ id ?: FineractId ;
113+ accountNo ?: string ;
114+ accountNumber ?: string ;
115+ amount ?: number | null ;
116+ transactionAmount ?: number | null ;
117+ runningBalance ?: number | null ;
118+ cumulativeBalance ?: number | null ;
119+ paymentDetailData ?: {
120+ receiptNumber ?: string ;
121+ paymentType ?: {
122+ name ?: string ;
123+ } ;
124+ } ;
125+ transactionType ?: {
126+ value ?: string ;
127+ } ;
128+ }
129+
16130/**
17131 * Base Teller service.
18132 */
@@ -63,4 +177,66 @@ export class BaseTellerService {
63177 getSavingsOpeningReceipt ( receiptNumber : string | number ) : Observable < any > {
64178 return this . http . get ( `${ this . savingsAccountOpeningsPath } /${ receiptNumber } ` ) ;
65179 }
180+
181+ /**
182+ * Searches clients and savings accounts using the authoritative platform search endpoint.
183+ */
184+ searchDepositCustomersAndAccounts (
185+ searchTerm : string
186+ ) : Observable < DepositSearchResult [ ] | { pageItems ?: DepositSearchResult [ ] } > {
187+ const params = new HttpParams ( )
188+ . set ( 'exactMatch' , 'false' )
189+ . set ( 'query' , searchTerm )
190+ . set ( 'resource' , 'clients,savings' ) ;
191+ return this . http . get < DepositSearchResult [ ] | { pageItems ?: DepositSearchResult [ ] } > ( '/search' , { params } ) ;
192+ }
193+
194+ /**
195+ * Retrieves a client profile.
196+ */
197+ getDepositClient ( clientId : FineractId ) : Observable < DepositClient > {
198+ return this . http . get < DepositClient > ( `/clients/${ clientId } ` ) ;
199+ }
200+
201+ /**
202+ * Retrieves the customer's accounts so an existing active savings account can be selected.
203+ */
204+ getDepositClientAccounts ( clientId : FineractId ) : Observable < DepositClientAccounts > {
205+ return this . http . get < DepositClientAccounts > ( `/clients/${ clientId } /accounts` ) ;
206+ }
207+
208+ /**
209+ * Retrieves the selected savings account with server-provided balances and status.
210+ */
211+ getDepositSavingsAccount ( savingsId : FineractId ) : Observable < DepositSavingsAccount > {
212+ const params = new HttpParams ( ) . set ( 'associations' , 'all' ) ;
213+ return this . http . get < DepositSavingsAccount > ( `/savingsaccounts/${ savingsId } ` , { params } ) ;
214+ }
215+
216+ /**
217+ * Retrieves payment type options for the savings transaction command.
218+ */
219+ getSavingsDepositTemplate ( savingsId : FineractId ) : Observable < SavingsDepositTemplate > {
220+ return this . http . get < SavingsDepositTemplate > ( `/savingsaccounts/${ savingsId } /transactions/template` ) ;
221+ }
222+
223+ /**
224+ * Deposits funds into an existing savings account.
225+ */
226+ depositToSavingsAccount (
227+ savingsId : FineractId ,
228+ payload : SavingsDepositCommandPayload
229+ ) : Observable < SavingsDepositCommandResult > {
230+ const params = new HttpParams ( ) . set ( 'command' , 'deposit' ) ;
231+ return this . http . post < SavingsDepositCommandResult > ( `/savingsaccounts/${ savingsId } /transactions` , payload , {
232+ params
233+ } ) ;
234+ }
235+
236+ /**
237+ * Retrieves the saved transaction as the authoritative receipt/details response.
238+ */
239+ getSavingsDepositReceipt ( savingsId : FineractId , transactionId : FineractId ) : Observable < SavingsDepositReceipt > {
240+ return this . http . get < SavingsDepositReceipt > ( `/savingsaccounts/${ savingsId } /transactions/${ transactionId } ` ) ;
241+ }
66242}
0 commit comments