@crediblex.io/fineract-api-client
Version:
TypeScript client for Fineract APIs
86 lines • 3.66 kB
TypeScript
import { HttpClient } from "../utils/http-client";
import { SavingsProductsResponse } from "../types/savingsproducts";
import { ApproveSavingsAccountResponse } from "../types/savingsaccounts";
/**
* API client for Fineract Savings Products related operations.
* It uses the HttpClient for making requests.
*/
export declare class FineractSavingsProductsApi {
private readonly httpClient;
constructor(httpClient: HttpClient);
/**
* Retrieves all savings products from Fineract.
* Corresponds to the GET /savingsproducts endpoint.
*
* @returns A promise that resolves to the list of savings products or rejects with an error.
*/
getAll(): Promise<SavingsProductsResponse>;
/**
* Retrieves a specific savings product by ID from Fineract.
* Corresponds to the GET /savingsproducts/{productId} endpoint.
*
* @param productId The ID of the savings product to retrieve.
* @returns A promise that resolves to the savings product details or rejects with an error.
*/
getById(productId: number): Promise<any>;
/**
* Creates a new savings product in Fineract.
* Corresponds to the POST /savingsproducts endpoint.
*
* @param productData The data for the new savings product.
* @returns A promise that resolves to the creation response or rejects with an error.
*/
create(productData: any): Promise<any>;
/**
* Updates an existing savings product in Fineract.
* Corresponds to the PUT /savingsproducts/{productId} endpoint.
*
* @param productId The ID of the savings product to update.
* @param productData The updated data for the savings product.
* @returns A promise that resolves to the update response or rejects with an error.
*/
update(productId: number, productData: any): Promise<any>;
/**
* Deletes a savings product from Fineract.
* Corresponds to the DELETE /savingsproducts/{productId} endpoint.
*
* @param productId The ID of the savings product to delete.
* @returns A promise that resolves to the deletion response or rejects with an error.
*/
delete(productId: number): Promise<any>;
/**
* Retrieves template data for creating a new savings product.
* Corresponds to the GET /savingsproducts/template endpoint.
*
* @returns A promise that resolves to the template data or rejects with an error.
*/
getTemplate(): Promise<any>;
/**
* Approves a savings account.
* Corresponds to the POST /savingsaccounts/{accountId}?command=approve endpoint.
*
* @param accountId The ID of the savings account to approve.
* @param approvalData The data for the approval, including the approval date.
* @returns A promise that resolves to the approval response or rejects with an error.
*/
approve(accountId: number, approvalData: {
approvedOnDate: string;
note?: string;
dateFormat: string;
locale: string;
}): Promise<ApproveSavingsAccountResponse>;
/**
* Activates a savings account.
* Corresponds to the POST /savingsaccounts/{accountId}?command=activate endpoint.
*
* @param accountId The ID of the savings account to activate.
* @param activationData The data for the activation, including the activation date.
* @returns A promise that resolves to the activation response or rejects with an error.
*/
activate(accountId: number, activationData: {
activatedOnDate: string;
dateFormat: string;
locale: string;
}): Promise<any>;
}
//# sourceMappingURL=fineract-savingsproducts-api.d.ts.map