@crediblex.io/fineract-api-client 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/fineract-creditlines-api.d.ts +95 -0
- package/dist/api/fineract-creditlines-api.d.ts.map +1 -0
- package/dist/api/fineract-creditlines-api.js +196 -0
- package/dist/api/fineract-creditlines-api.js.map +1 -0
- package/dist/api/fineract-datatable-api.d.ts +64 -0
- package/dist/api/fineract-datatable-api.d.ts.map +1 -0
- package/dist/api/fineract-datatable-api.js +146 -0
- package/dist/api/fineract-datatable-api.js.map +1 -0
- package/dist/api/fineract-holidays-api.d.ts +29 -0
- package/dist/api/fineract-holidays-api.d.ts.map +1 -0
- package/dist/api/fineract-holidays-api.js +57 -0
- package/dist/api/fineract-holidays-api.js.map +1 -0
- package/dist/api/fineract-loanproducts-api.d.ts +57 -0
- package/dist/api/fineract-loanproducts-api.d.ts.map +1 -0
- package/dist/api/fineract-loanproducts-api.js +140 -0
- package/dist/api/fineract-loanproducts-api.js.map +1 -0
- package/dist/api/fineract-loansaccounts-api.d.ts +77 -0
- package/dist/api/fineract-loansaccounts-api.d.ts.map +1 -0
- package/dist/api/fineract-loansaccounts-api.js +209 -0
- package/dist/api/fineract-loansaccounts-api.js.map +1 -0
- package/dist/api/fineract-reports-api.d.ts +33 -0
- package/dist/api/fineract-reports-api.d.ts.map +1 -0
- package/dist/api/fineract-reports-api.js +94 -0
- package/dist/api/fineract-reports-api.js.map +1 -0
- package/dist/api/fineract-savingsaccounts-api.d.ts +59 -0
- package/dist/api/fineract-savingsaccounts-api.d.ts.map +1 -0
- package/dist/api/fineract-savingsaccounts-api.js +141 -0
- package/dist/api/fineract-savingsaccounts-api.js.map +1 -0
- package/dist/api/fineract-savingsproducts-api.d.ts +86 -0
- package/dist/api/fineract-savingsproducts-api.d.ts.map +1 -0
- package/dist/api/fineract-savingsproducts-api.js +184 -0
- package/dist/api/fineract-savingsproducts-api.js.map +1 -0
- package/dist/api/fineract-sme-api.d.ts +39 -0
- package/dist/api/fineract-sme-api.d.ts.map +1 -0
- package/dist/api/fineract-sme-api.js +82 -0
- package/dist/api/fineract-sme-api.js.map +1 -0
- package/dist/api/fineract-workingdays-api.d.ts +28 -0
- package/dist/api/fineract-workingdays-api.d.ts.map +1 -0
- package/dist/api/fineract-workingdays-api.js +84 -0
- package/dist/api/fineract-workingdays-api.js.map +1 -0
- package/dist/examples/run-examples.d.ts +2 -0
- package/dist/examples/run-examples.d.ts.map +1 -0
- package/dist/examples/run-examples.js +868 -0
- package/dist/examples/run-examples.js.map +1 -0
- package/dist/fineract-sdk.d.ts +50 -0
- package/dist/fineract-sdk.d.ts.map +1 -0
- package/dist/fineract-sdk.js +55 -0
- package/dist/fineract-sdk.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/types/creditlines.d.ts +271 -0
- package/dist/types/creditlines.d.ts.map +1 -0
- package/dist/types/creditlines.js +3 -0
- package/dist/types/creditlines.js.map +1 -0
- package/dist/types/datatable.d.ts +36 -0
- package/dist/types/datatable.d.ts.map +1 -0
- package/dist/types/datatable.js +3 -0
- package/dist/types/datatable.js.map +1 -0
- package/dist/types/errors.d.ts +7 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +17 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/holidays.d.ts +32 -0
- package/dist/types/holidays.d.ts.map +1 -0
- package/dist/types/holidays.js +3 -0
- package/dist/types/holidays.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/loanproducts.d.ts +1 -0
- package/dist/types/loanproducts.d.ts.map +1 -0
- package/dist/types/loanproducts.js +2 -0
- package/dist/types/loanproducts.js.map +1 -0
- package/dist/types/loansaccounts.d.ts +195 -0
- package/dist/types/loansaccounts.d.ts.map +1 -0
- package/dist/types/loansaccounts.js +3 -0
- package/dist/types/loansaccounts.js.map +1 -0
- package/dist/types/reports.d.ts +49 -0
- package/dist/types/reports.d.ts.map +1 -0
- package/dist/types/reports.js +4 -0
- package/dist/types/reports.js.map +1 -0
- package/dist/types/savingsaccounts.d.ts +145 -0
- package/dist/types/savingsaccounts.d.ts.map +1 -0
- package/dist/types/savingsaccounts.js +3 -0
- package/dist/types/savingsaccounts.js.map +1 -0
- package/dist/types/savingsproducts.d.ts +83 -0
- package/dist/types/savingsproducts.d.ts.map +1 -0
- package/dist/types/savingsproducts.js +3 -0
- package/dist/types/savingsproducts.js.map +1 -0
- package/dist/types/sme.d.ts +68 -0
- package/dist/types/sme.d.ts.map +1 -0
- package/dist/types/sme.js +3 -0
- package/dist/types/sme.js.map +1 -0
- package/dist/types/workingdays.d.ts +41 -0
- package/dist/types/workingdays.d.ts.map +1 -0
- package/dist/types/workingdays.js +3 -0
- package/dist/types/workingdays.js.map +1 -0
- package/dist/utils/http-client.d.ts +29 -0
- package/dist/utils/http-client.d.ts.map +1 -0
- package/dist/utils/http-client.js +93 -0
- package/dist/utils/http-client.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HttpClient } from "../utils/http-client";
|
|
2
|
+
import { CreateSavingsAccountRequest, CreateSavingsAccountResponse, DepositTransactionRequest, DepositTransactionResponse, SavingsTransactionTemplateResponse } from "../types/savingsaccounts";
|
|
3
|
+
/**
|
|
4
|
+
* API client for Fineract Savings Accounts related operations.
|
|
5
|
+
* It uses the HttpClient for making requests.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FineractSavingsAccountsApi {
|
|
8
|
+
private readonly httpClient;
|
|
9
|
+
constructor(httpClient: HttpClient);
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves all savings accounts from Fineract.
|
|
12
|
+
* Corresponds to the GET /savingsaccounts endpoint.
|
|
13
|
+
*
|
|
14
|
+
* @returns A promise that resolves to the list of savings accounts or rejects with an error.
|
|
15
|
+
*/
|
|
16
|
+
getAll(): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a specific savings account by ID from Fineract.
|
|
19
|
+
* Corresponds to the GET /savingsaccounts/{accountId} endpoint.
|
|
20
|
+
*
|
|
21
|
+
* @param accountId The ID of the savings account to retrieve.
|
|
22
|
+
* @returns A promise that resolves to the savings account details or rejects with an error.
|
|
23
|
+
*/
|
|
24
|
+
getById(accountId: number): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new savings account in Fineract.
|
|
27
|
+
* Corresponds to the POST /savingsaccounts endpoint.
|
|
28
|
+
*
|
|
29
|
+
* @param accountData The data for the new savings account.
|
|
30
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
31
|
+
*/
|
|
32
|
+
create(accountData: CreateSavingsAccountRequest): Promise<CreateSavingsAccountResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Deletes a savings account from Fineract.
|
|
35
|
+
* Corresponds to the DELETE /savingsaccounts/{accountId} endpoint.
|
|
36
|
+
*
|
|
37
|
+
* @param accountId The ID of the savings account to delete.
|
|
38
|
+
* @returns A promise that resolves to the deletion response or rejects with an error.
|
|
39
|
+
*/
|
|
40
|
+
delete(accountId: number): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a deposit transaction for a savings account in Fineract.
|
|
43
|
+
* Corresponds to the POST /savingsaccounts/{accountId}/transactions?command=deposit endpoint.
|
|
44
|
+
*
|
|
45
|
+
* @param accountId The ID of the savings account to deposit into.
|
|
46
|
+
* @param transactionData The data for the deposit transaction.
|
|
47
|
+
* @returns A promise that resolves to the deposit transaction response or rejects with an error.
|
|
48
|
+
*/
|
|
49
|
+
deposit(accountId: number, transactionData: DepositTransactionRequest): Promise<DepositTransactionResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves the transaction template for a savings account in Fineract.
|
|
52
|
+
* Corresponds to the GET /savingsaccounts/{accountId}/transactions/template endpoint.
|
|
53
|
+
*
|
|
54
|
+
* @param accountId The ID of the savings account to get the transaction template for.
|
|
55
|
+
* @returns A promise that resolves to the transaction template response or rejects with an error.
|
|
56
|
+
*/
|
|
57
|
+
getTransactionTemplate(accountId: number): Promise<SavingsTransactionTemplateResponse>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=fineract-savingsaccounts-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-savingsaccounts-api.d.ts","sourceRoot":"","sources":["../../src/api/fineract-savingsaccounts-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,kCAAkC,EACnC,MAAM,0BAA0B,CAAC;AAElC;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC;IAoB5B;;;;;;OAMG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB9C;;;;;;OAMG;IACG,MAAM,CACV,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,4BAA4B,CAAC;IAuBxC;;;;;;OAMG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB7C;;;;;;;OAOG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,yBAAyB,GACzC,OAAO,CAAC,0BAA0B,CAAC;IAuBtC;;;;;;OAMG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,kCAAkC,CAAC;CAoB/C"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FineractSavingsAccountsApi = void 0;
|
|
4
|
+
const errors_1 = require("../types/errors");
|
|
5
|
+
/**
|
|
6
|
+
* API client for Fineract Savings Accounts related operations.
|
|
7
|
+
* It uses the HttpClient for making requests.
|
|
8
|
+
*/
|
|
9
|
+
class FineractSavingsAccountsApi {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.httpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves all savings accounts from Fineract.
|
|
15
|
+
* Corresponds to the GET /savingsaccounts endpoint.
|
|
16
|
+
*
|
|
17
|
+
* @returns A promise that resolves to the list of savings accounts or rejects with an error.
|
|
18
|
+
*/
|
|
19
|
+
async getAll() {
|
|
20
|
+
try {
|
|
21
|
+
const apiPath = "/fineract-provider/api/v1/savingsaccounts";
|
|
22
|
+
const response = await this.httpClient.get(apiPath);
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
catch (rawError) {
|
|
26
|
+
const errorPayload = rawError;
|
|
27
|
+
const message = errorPayload?.message ||
|
|
28
|
+
errorPayload?.error ||
|
|
29
|
+
"Fineract API request failed";
|
|
30
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a specific savings account by ID from Fineract.
|
|
35
|
+
* Corresponds to the GET /savingsaccounts/{accountId} endpoint.
|
|
36
|
+
*
|
|
37
|
+
* @param accountId The ID of the savings account to retrieve.
|
|
38
|
+
* @returns A promise that resolves to the savings account details or rejects with an error.
|
|
39
|
+
*/
|
|
40
|
+
async getById(accountId) {
|
|
41
|
+
try {
|
|
42
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}`;
|
|
43
|
+
const response = await this.httpClient.get(apiPath);
|
|
44
|
+
return response.data;
|
|
45
|
+
}
|
|
46
|
+
catch (rawError) {
|
|
47
|
+
const errorPayload = rawError;
|
|
48
|
+
const message = errorPayload?.message ||
|
|
49
|
+
errorPayload?.error ||
|
|
50
|
+
"Fineract API request failed";
|
|
51
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new savings account in Fineract.
|
|
56
|
+
* Corresponds to the POST /savingsaccounts endpoint.
|
|
57
|
+
*
|
|
58
|
+
* @param accountData The data for the new savings account.
|
|
59
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
60
|
+
*/
|
|
61
|
+
async create(accountData) {
|
|
62
|
+
try {
|
|
63
|
+
const apiPath = "/fineract-provider/api/v1/savingsaccounts";
|
|
64
|
+
const response = await this.httpClient.post(apiPath, accountData);
|
|
65
|
+
return response.data;
|
|
66
|
+
}
|
|
67
|
+
catch (rawError) {
|
|
68
|
+
const errorPayload = rawError;
|
|
69
|
+
const message = errorPayload?.message ||
|
|
70
|
+
errorPayload?.error ||
|
|
71
|
+
"Fineract API request failed";
|
|
72
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Deletes a savings account from Fineract.
|
|
77
|
+
* Corresponds to the DELETE /savingsaccounts/{accountId} endpoint.
|
|
78
|
+
*
|
|
79
|
+
* @param accountId The ID of the savings account to delete.
|
|
80
|
+
* @returns A promise that resolves to the deletion response or rejects with an error.
|
|
81
|
+
*/
|
|
82
|
+
async delete(accountId) {
|
|
83
|
+
try {
|
|
84
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}`;
|
|
85
|
+
const response = await this.httpClient.delete(apiPath);
|
|
86
|
+
return response.data;
|
|
87
|
+
}
|
|
88
|
+
catch (rawError) {
|
|
89
|
+
const errorPayload = rawError;
|
|
90
|
+
const message = errorPayload?.message ||
|
|
91
|
+
errorPayload?.error ||
|
|
92
|
+
"Fineract API request failed";
|
|
93
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Creates a deposit transaction for a savings account in Fineract.
|
|
98
|
+
* Corresponds to the POST /savingsaccounts/{accountId}/transactions?command=deposit endpoint.
|
|
99
|
+
*
|
|
100
|
+
* @param accountId The ID of the savings account to deposit into.
|
|
101
|
+
* @param transactionData The data for the deposit transaction.
|
|
102
|
+
* @returns A promise that resolves to the deposit transaction response or rejects with an error.
|
|
103
|
+
*/
|
|
104
|
+
async deposit(accountId, transactionData) {
|
|
105
|
+
try {
|
|
106
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}/transactions?command=deposit`;
|
|
107
|
+
const response = await this.httpClient.post(apiPath, transactionData);
|
|
108
|
+
return response.data;
|
|
109
|
+
}
|
|
110
|
+
catch (rawError) {
|
|
111
|
+
const errorPayload = rawError;
|
|
112
|
+
const message = errorPayload?.message ||
|
|
113
|
+
errorPayload?.error ||
|
|
114
|
+
"Fineract API request failed";
|
|
115
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves the transaction template for a savings account in Fineract.
|
|
120
|
+
* Corresponds to the GET /savingsaccounts/{accountId}/transactions/template endpoint.
|
|
121
|
+
*
|
|
122
|
+
* @param accountId The ID of the savings account to get the transaction template for.
|
|
123
|
+
* @returns A promise that resolves to the transaction template response or rejects with an error.
|
|
124
|
+
*/
|
|
125
|
+
async getTransactionTemplate(accountId) {
|
|
126
|
+
try {
|
|
127
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}/transactions/template`;
|
|
128
|
+
const response = await this.httpClient.get(apiPath);
|
|
129
|
+
return response.data;
|
|
130
|
+
}
|
|
131
|
+
catch (rawError) {
|
|
132
|
+
const errorPayload = rawError;
|
|
133
|
+
const message = errorPayload?.message ||
|
|
134
|
+
errorPayload?.error ||
|
|
135
|
+
"Fineract API request failed";
|
|
136
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.FineractSavingsAccountsApi = FineractSavingsAccountsApi;
|
|
141
|
+
//# sourceMappingURL=fineract-savingsaccounts-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-savingsaccounts-api.js","sourceRoot":"","sources":["../../src/api/fineract-savingsaccounts-api.ts"],"names":[],"mappings":";;;AAEA,4CAAmD;AASnD;;;GAGG;AACH,MAAa,0BAA0B;IAGrC,YAAY,UAAsB;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,2CAA2C,CAAC;YAC5D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAM,OAAO,CAAC,CAAC;YACzD,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,QAAQ,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,QAAiC,CAAC;YACvD,MAAM,OAAO,GACX,YAAY,EAAE,OAAO;gBACrB,YAAY,EAAE,KAAK;gBACnB,6BAA6B,CAAC;YAChC,MAAM,IAAI,yBAAgB,CACxB,OAAO,EACP,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,KAAK,CACpB,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,SAAiB;QAC7B,IAAI,CAAC;YACH,MAAM,OAAO,GA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AM,YAAY,GAAG,QAAiC,CAAC;YACvD,MAAM,OAAO,GACX,YAAY,EAAE,OAAO;gBACrB,YAAY,EAAE,KAAK;gBACnB,6BAA6B,CAAC;YAChC,MAAM,IAAI,yBAAgB,CACxB,OAAO,EACP,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,KAAK,CACpB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAtLD,gEAsLC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { HttpClient } from "../utils/http-client";
|
|
2
|
+
import { SavingsProductsResponse } from "../types/savingsproducts";
|
|
3
|
+
import { ApproveSavingsAccountResponse } from "../types/savingsaccounts";
|
|
4
|
+
/**
|
|
5
|
+
* API client for Fineract Savings Products related operations.
|
|
6
|
+
* It uses the HttpClient for making requests.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FineractSavingsProductsApi {
|
|
9
|
+
private readonly httpClient;
|
|
10
|
+
constructor(httpClient: HttpClient);
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves all savings products from Fineract.
|
|
13
|
+
* Corresponds to the GET /savingsproducts endpoint.
|
|
14
|
+
*
|
|
15
|
+
* @returns A promise that resolves to the list of savings products or rejects with an error.
|
|
16
|
+
*/
|
|
17
|
+
getAll(): Promise<SavingsProductsResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves a specific savings product by ID from Fineract.
|
|
20
|
+
* Corresponds to the GET /savingsproducts/{productId} endpoint.
|
|
21
|
+
*
|
|
22
|
+
* @param productId The ID of the savings product to retrieve.
|
|
23
|
+
* @returns A promise that resolves to the savings product details or rejects with an error.
|
|
24
|
+
*/
|
|
25
|
+
getById(productId: number): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new savings product in Fineract.
|
|
28
|
+
* Corresponds to the POST /savingsproducts endpoint.
|
|
29
|
+
*
|
|
30
|
+
* @param productData The data for the new savings product.
|
|
31
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
32
|
+
*/
|
|
33
|
+
create(productData: any): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Updates an existing savings product in Fineract.
|
|
36
|
+
* Corresponds to the PUT /savingsproducts/{productId} endpoint.
|
|
37
|
+
*
|
|
38
|
+
* @param productId The ID of the savings product to update.
|
|
39
|
+
* @param productData The updated data for the savings product.
|
|
40
|
+
* @returns A promise that resolves to the update response or rejects with an error.
|
|
41
|
+
*/
|
|
42
|
+
update(productId: number, productData: any): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a savings product from Fineract.
|
|
45
|
+
* Corresponds to the DELETE /savingsproducts/{productId} endpoint.
|
|
46
|
+
*
|
|
47
|
+
* @param productId The ID of the savings product to delete.
|
|
48
|
+
* @returns A promise that resolves to the deletion response or rejects with an error.
|
|
49
|
+
*/
|
|
50
|
+
delete(productId: number): Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves template data for creating a new savings product.
|
|
53
|
+
* Corresponds to the GET /savingsproducts/template endpoint.
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise that resolves to the template data or rejects with an error.
|
|
56
|
+
*/
|
|
57
|
+
getTemplate(): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Approves a savings account.
|
|
60
|
+
* Corresponds to the POST /savingsaccounts/{accountId}?command=approve endpoint.
|
|
61
|
+
*
|
|
62
|
+
* @param accountId The ID of the savings account to approve.
|
|
63
|
+
* @param approvalData The data for the approval, including the approval date.
|
|
64
|
+
* @returns A promise that resolves to the approval response or rejects with an error.
|
|
65
|
+
*/
|
|
66
|
+
approve(accountId: number, approvalData: {
|
|
67
|
+
approvedOnDate: string;
|
|
68
|
+
note?: string;
|
|
69
|
+
dateFormat: string;
|
|
70
|
+
locale: string;
|
|
71
|
+
}): Promise<ApproveSavingsAccountResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Activates a savings account.
|
|
74
|
+
* Corresponds to the POST /savingsaccounts/{accountId}?command=activate endpoint.
|
|
75
|
+
*
|
|
76
|
+
* @param accountId The ID of the savings account to activate.
|
|
77
|
+
* @param activationData The data for the activation, including the activation date.
|
|
78
|
+
* @returns A promise that resolves to the activation response or rejects with an error.
|
|
79
|
+
*/
|
|
80
|
+
activate(accountId: number, activationData: {
|
|
81
|
+
activatedOnDate: string;
|
|
82
|
+
dateFormat: string;
|
|
83
|
+
locale: string;
|
|
84
|
+
}): Promise<any>;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=fineract-savingsproducts-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-savingsproducts-api.d.ts","sourceRoot":"","sources":["../../src/api/fineract-savingsproducts-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAsBhD;;;;;;OAMG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB9C;;;;;;OAMG;IACG,MAAM,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB5C;;;;;;;OAOG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB/D;;;;;;OAMG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAoB7C;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAoBjC;;;;;;;OAOG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,GACA,OAAO,CAAC,6BAA6B,CAAC;IAwBzC;;;;;;;OAOG;IACG,QAAQ,CACZ,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,GACA,OAAO,CAAC,GAAG,CAAC;CAmBhB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FineractSavingsProductsApi = void 0;
|
|
4
|
+
const errors_1 = require("../types/errors");
|
|
5
|
+
/**
|
|
6
|
+
* API client for Fineract Savings Products related operations.
|
|
7
|
+
* It uses the HttpClient for making requests.
|
|
8
|
+
*/
|
|
9
|
+
class FineractSavingsProductsApi {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.httpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves all savings products from Fineract.
|
|
15
|
+
* Corresponds to the GET /savingsproducts endpoint.
|
|
16
|
+
*
|
|
17
|
+
* @returns A promise that resolves to the list of savings products or rejects with an error.
|
|
18
|
+
*/
|
|
19
|
+
async getAll() {
|
|
20
|
+
try {
|
|
21
|
+
const apiPath = "/fineract-provider/api/v1/savingsproducts";
|
|
22
|
+
const response = await this.httpClient.get(apiPath);
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
catch (rawError) {
|
|
26
|
+
const errorPayload = rawError;
|
|
27
|
+
const message = errorPayload?.message ||
|
|
28
|
+
errorPayload?.error ||
|
|
29
|
+
"Fineract API request failed";
|
|
30
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a specific savings product by ID from Fineract.
|
|
35
|
+
* Corresponds to the GET /savingsproducts/{productId} endpoint.
|
|
36
|
+
*
|
|
37
|
+
* @param productId The ID of the savings product to retrieve.
|
|
38
|
+
* @returns A promise that resolves to the savings product details or rejects with an error.
|
|
39
|
+
*/
|
|
40
|
+
async getById(productId) {
|
|
41
|
+
try {
|
|
42
|
+
const apiPath = `/fineract-provider/api/v1/savingsproducts/${productId}`;
|
|
43
|
+
const response = await this.httpClient.get(apiPath);
|
|
44
|
+
return response.data;
|
|
45
|
+
}
|
|
46
|
+
catch (rawError) {
|
|
47
|
+
const errorPayload = rawError;
|
|
48
|
+
const message = errorPayload?.message ||
|
|
49
|
+
errorPayload?.error ||
|
|
50
|
+
"Fineract API request failed";
|
|
51
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new savings product in Fineract.
|
|
56
|
+
* Corresponds to the POST /savingsproducts endpoint.
|
|
57
|
+
*
|
|
58
|
+
* @param productData The data for the new savings product.
|
|
59
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
60
|
+
*/
|
|
61
|
+
async create(productData) {
|
|
62
|
+
try {
|
|
63
|
+
const apiPath = "/fineract-provider/api/v1/savingsproducts";
|
|
64
|
+
const response = await this.httpClient.post(apiPath, productData);
|
|
65
|
+
return response.data;
|
|
66
|
+
}
|
|
67
|
+
catch (rawError) {
|
|
68
|
+
const errorPayload = rawError;
|
|
69
|
+
const message = errorPayload?.message ||
|
|
70
|
+
errorPayload?.error ||
|
|
71
|
+
"Fineract API request failed";
|
|
72
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Updates an existing savings product in Fineract.
|
|
77
|
+
* Corresponds to the PUT /savingsproducts/{productId} endpoint.
|
|
78
|
+
*
|
|
79
|
+
* @param productId The ID of the savings product to update.
|
|
80
|
+
* @param productData The updated data for the savings product.
|
|
81
|
+
* @returns A promise that resolves to the update response or rejects with an error.
|
|
82
|
+
*/
|
|
83
|
+
async update(productId, productData) {
|
|
84
|
+
try {
|
|
85
|
+
const apiPath = `/fineract-provider/api/v1/savingsproducts/${productId}`;
|
|
86
|
+
const response = await this.httpClient.put(apiPath, productData);
|
|
87
|
+
return response.data;
|
|
88
|
+
}
|
|
89
|
+
catch (rawError) {
|
|
90
|
+
const errorPayload = rawError;
|
|
91
|
+
const message = errorPayload?.message ||
|
|
92
|
+
errorPayload?.error ||
|
|
93
|
+
"Fineract API request failed";
|
|
94
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Deletes a savings product from Fineract.
|
|
99
|
+
* Corresponds to the DELETE /savingsproducts/{productId} endpoint.
|
|
100
|
+
*
|
|
101
|
+
* @param productId The ID of the savings product to delete.
|
|
102
|
+
* @returns A promise that resolves to the deletion response or rejects with an error.
|
|
103
|
+
*/
|
|
104
|
+
async delete(productId) {
|
|
105
|
+
try {
|
|
106
|
+
const apiPath = `/fineract-provider/api/v1/savingsproducts/${productId}`;
|
|
107
|
+
const response = await this.httpClient.delete(apiPath);
|
|
108
|
+
return response.data;
|
|
109
|
+
}
|
|
110
|
+
catch (rawError) {
|
|
111
|
+
const errorPayload = rawError;
|
|
112
|
+
const message = errorPayload?.message ||
|
|
113
|
+
errorPayload?.error ||
|
|
114
|
+
"Fineract API request failed";
|
|
115
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves template data for creating a new savings product.
|
|
120
|
+
* Corresponds to the GET /savingsproducts/template endpoint.
|
|
121
|
+
*
|
|
122
|
+
* @returns A promise that resolves to the template data or rejects with an error.
|
|
123
|
+
*/
|
|
124
|
+
async getTemplate() {
|
|
125
|
+
try {
|
|
126
|
+
const apiPath = "/fineract-provider/api/v1/savingsproducts/template";
|
|
127
|
+
const response = await this.httpClient.get(apiPath);
|
|
128
|
+
return response.data;
|
|
129
|
+
}
|
|
130
|
+
catch (rawError) {
|
|
131
|
+
const errorPayload = rawError;
|
|
132
|
+
const message = errorPayload?.message ||
|
|
133
|
+
errorPayload?.error ||
|
|
134
|
+
"Fineract API request failed";
|
|
135
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Approves a savings account.
|
|
140
|
+
* Corresponds to the POST /savingsaccounts/{accountId}?command=approve endpoint.
|
|
141
|
+
*
|
|
142
|
+
* @param accountId The ID of the savings account to approve.
|
|
143
|
+
* @param approvalData The data for the approval, including the approval date.
|
|
144
|
+
* @returns A promise that resolves to the approval response or rejects with an error.
|
|
145
|
+
*/
|
|
146
|
+
async approve(accountId, approvalData) {
|
|
147
|
+
try {
|
|
148
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}?command=approve`;
|
|
149
|
+
const response = await this.httpClient.post(apiPath, approvalData);
|
|
150
|
+
return response.data;
|
|
151
|
+
}
|
|
152
|
+
catch (rawError) {
|
|
153
|
+
const errorPayload = rawError;
|
|
154
|
+
const message = errorPayload?.message ||
|
|
155
|
+
errorPayload?.error ||
|
|
156
|
+
"Fineract API request failed";
|
|
157
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Activates a savings account.
|
|
162
|
+
* Corresponds to the POST /savingsaccounts/{accountId}?command=activate endpoint.
|
|
163
|
+
*
|
|
164
|
+
* @param accountId The ID of the savings account to activate.
|
|
165
|
+
* @param activationData The data for the activation, including the activation date.
|
|
166
|
+
* @returns A promise that resolves to the activation response or rejects with an error.
|
|
167
|
+
*/
|
|
168
|
+
async activate(accountId, activationData) {
|
|
169
|
+
try {
|
|
170
|
+
const apiPath = `/fineract-provider/api/v1/savingsaccounts/${accountId}?command=activate`;
|
|
171
|
+
const response = await this.httpClient.post(apiPath, activationData);
|
|
172
|
+
return response.data;
|
|
173
|
+
}
|
|
174
|
+
catch (rawError) {
|
|
175
|
+
const errorPayload = rawError;
|
|
176
|
+
const message = errorPayload?.message ||
|
|
177
|
+
errorPayload?.error ||
|
|
178
|
+
"Fineract API request failed";
|
|
179
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.FineractSavingsProductsApi = FineractSavingsProductsApi;
|
|
184
|
+
//# sourceMappingURL=fineract-savingsproducts-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-savingsproducts-api.js","sourceRoot":"","sources":["../../src/api/fineract-savingsproducts-api.ts"],"names":[],"mappings":";;;AAEA,4CAAmD;AAGnD;;;GAGG;AACH,MAAa,0BAA0B;IAGrC,YAAY,UAAsB;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,2CAA2C,CAAC;YAC5D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CACxC,OAAO,CACR,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,QAAQ,EAAE,CAAC;YAClB,MAAM,YAA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CAAC;YACH,MAAM,OAAO,GAAG,6CAA6C,SAAS,mBAAmB,CAAC;YAC1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAM,OAAO,EAAE,cAAc,CAAC,CAAC;YAC1E,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,QAAQ,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,QAAiC,CAAC;YACvD,MAAM,OAAO,GACX,YAAY,EAAE,OAAO;gBACrB,YAAY,EAAE,KAAK;gBACnB,6BAA6B,CAAC;YAChC,MAAM,IAAI,yBAAgB,CACxB,OAAO,EACP,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,KAAK,CACpB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AApPD,gEAoPC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { HttpClient } from "../utils/http-client";
|
|
2
|
+
import { CreateSmeRequest, CreateSmeResponse, SmeDetails } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* API client for Fineract SME related operations.
|
|
5
|
+
* It uses the HttpClient for making requests.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FineractSmeApi {
|
|
8
|
+
private readonly httpClient;
|
|
9
|
+
constructor(httpClient: HttpClient);
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new sme in Fineract.
|
|
12
|
+
* Corresponds to the POST /create endpoint in your `clients.ts`.
|
|
13
|
+
*
|
|
14
|
+
* @param smeData The data for the new sme.
|
|
15
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
16
|
+
* @remarks SME is referred as client in fineract system
|
|
17
|
+
*/
|
|
18
|
+
create(smeData: CreateSmeRequest): Promise<CreateSmeResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves details for a specific client from Fineract.
|
|
21
|
+
* Corresponds to the GET /details/:clientId endpoint in your `clients.ts`.
|
|
22
|
+
*
|
|
23
|
+
* @param clientId The ID of the client to retrieve.
|
|
24
|
+
* @returns A promise that resolves to the client details or rejects with an error.
|
|
25
|
+
* @remarks The actual API path for retrieving client details (e.g., `/clients/${clientId}`)
|
|
26
|
+
* needs to be verified from your Fineract API documentation or the SDK.
|
|
27
|
+
*/
|
|
28
|
+
getDetails(clientId: number): Promise<SmeDetails>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves details for a specific client from Fineract using external ID.
|
|
31
|
+
* Corresponds to the GET /v1/clients/external-id/{externalId} endpoint.
|
|
32
|
+
*
|
|
33
|
+
* @param externalId The external ID of the client to retrieve.
|
|
34
|
+
* @returns A promise that resolves to the client details or rejects with an error.
|
|
35
|
+
* @remarks SME is referred as client in fineract system
|
|
36
|
+
*/
|
|
37
|
+
getDetailsByExternalId(externalId: string): Promise<SmeDetails>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=fineract-sme-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-sme-api.d.ts","sourceRoot":"","sources":["../../src/api/fineract-sme-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAEjB,UAAU,EACX,MAAM,UAAU,CAAC;AAGlB;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,UAAU,EAAE,UAAU;IAIlC;;;;;;;OAOG;IACG,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBnE;;;;;;;;OAQG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoBvD;;;;;;;OAOG;IACG,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAmBtE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FineractSmeApi = void 0;
|
|
4
|
+
const errors_1 = require("../types/errors");
|
|
5
|
+
/**
|
|
6
|
+
* API client for Fineract SME related operations.
|
|
7
|
+
* It uses the HttpClient for making requests.
|
|
8
|
+
*/
|
|
9
|
+
class FineractSmeApi {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.httpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new sme in Fineract.
|
|
15
|
+
* Corresponds to the POST /create endpoint in your `clients.ts`.
|
|
16
|
+
*
|
|
17
|
+
* @param smeData The data for the new sme.
|
|
18
|
+
* @returns A promise that resolves to the creation response or rejects with an error.
|
|
19
|
+
* @remarks SME is referred as client in fineract system
|
|
20
|
+
*/
|
|
21
|
+
async create(smeData) {
|
|
22
|
+
try {
|
|
23
|
+
const apiPath = "/fineract-provider/api/v1/clients";
|
|
24
|
+
const response = await this.httpClient.post(apiPath, smeData);
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
catch (rawError) {
|
|
28
|
+
const errorPayload = rawError;
|
|
29
|
+
const message = errorPayload?.message ||
|
|
30
|
+
errorPayload?.error ||
|
|
31
|
+
"Fineract API request failed";
|
|
32
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves details for a specific client from Fineract.
|
|
37
|
+
* Corresponds to the GET /details/:clientId endpoint in your `clients.ts`.
|
|
38
|
+
*
|
|
39
|
+
* @param clientId The ID of the client to retrieve.
|
|
40
|
+
* @returns A promise that resolves to the client details or rejects with an error.
|
|
41
|
+
* @remarks The actual API path for retrieving client details (e.g., `/clients/${clientId}`)
|
|
42
|
+
* needs to be verified from your Fineract API documentation or the SDK.
|
|
43
|
+
*/
|
|
44
|
+
async getDetails(clientId) {
|
|
45
|
+
try {
|
|
46
|
+
const apiPath = `/fineract-provider/api/v1/clients/${clientId}`; // Example path
|
|
47
|
+
const response = await this.httpClient.get(apiPath);
|
|
48
|
+
return response.data;
|
|
49
|
+
}
|
|
50
|
+
catch (rawError) {
|
|
51
|
+
const errorPayload = rawError;
|
|
52
|
+
const message = errorPayload?.message ||
|
|
53
|
+
errorPayload?.error ||
|
|
54
|
+
"Fineract API request failed";
|
|
55
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves details for a specific client from Fineract using external ID.
|
|
60
|
+
* Corresponds to the GET /v1/clients/external-id/{externalId} endpoint.
|
|
61
|
+
*
|
|
62
|
+
* @param externalId The external ID of the client to retrieve.
|
|
63
|
+
* @returns A promise that resolves to the client details or rejects with an error.
|
|
64
|
+
* @remarks SME is referred as client in fineract system
|
|
65
|
+
*/
|
|
66
|
+
async getDetailsByExternalId(externalId) {
|
|
67
|
+
try {
|
|
68
|
+
const apiPath = `/fineract-provider/api/v1/clients/external-id/${externalId}`;
|
|
69
|
+
const response = await this.httpClient.get(apiPath);
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
catch (rawError) {
|
|
73
|
+
const errorPayload = rawError;
|
|
74
|
+
const message = errorPayload?.message ||
|
|
75
|
+
errorPayload?.error ||
|
|
76
|
+
"Fineract API request failed";
|
|
77
|
+
throw new errors_1.FineractApiError(message, errorPayload?.statusCode, errorPayload?.details, errorPayload?.error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.FineractSmeApi = FineractSmeApi;
|
|
82
|
+
//# sourceMappingURL=fineract-sme-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fineract-sme-api.js","sourceRoot":"","sources":["../../src/api/fineract-sme-api.ts"],"names":[],"mappings":";;;AAOA,4CAAmD;A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;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,sBAAsB,CAAC,UAAkB;QAC7C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,iDAAiD,UAAU,EAAE,CAAC;YAC9E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAa,OAAO,CAAC,CAAC;YAChE,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,QAAQ,EAAE,CAAC;YAClB,MAAM,YAAY,GAAG,QAAiC,CAAC;YACvD,MAAM,OAAO,GACX,YAAY,EAAE,OAAO;gBACrB,YAAY,EAAE,KAAK;gBACnB,6BAA6B,CAAC;YAChC,MAAM,IAAI,yBAAgB,CACxB,OAAO,EACP,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,KAAK,CACpB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA9FD,wCA8FC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HttpClient } from "../utils/http-client";
|
|
2
|
+
import { WorkingDaysResponse } from "../types/workingdays";
|
|
3
|
+
/**
|
|
4
|
+
* API client for Fineract Working Days related operations.
|
|
5
|
+
* It uses the HttpClient for making requests.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FineractWorkingDaysApi {
|
|
8
|
+
private readonly httpClient;
|
|
9
|
+
constructor(httpClient: HttpClient);
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves working days configuration from Fineract and formats it for easy consumption.
|
|
12
|
+
* Corresponds to the GET /workingdays endpoint.
|
|
13
|
+
* Returns a formatted object with each day of the week mapped to a boolean indicating if it's a working day.
|
|
14
|
+
*
|
|
15
|
+
* @returns A promise that resolves to the formatted working days configuration or rejects with an error.
|
|
16
|
+
*/
|
|
17
|
+
getWorkingDays(): Promise<WorkingDaysResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Parses the RRULE recurrence string to determine which days are working days.
|
|
20
|
+
* Expected format: "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,"
|
|
21
|
+
*
|
|
22
|
+
* @param recurrence The recurrence string from Fineract API
|
|
23
|
+
* @returns Formatted working days object
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private parseRecurrenceString;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=fineract-workingdays-api.d.ts.map
|