paystack-sdk
Version:
Paystack SDK written in Typescript
55 lines (54 loc) • 1.53 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Plan = void 0;
/**
* ## Plans
* The Plans API allows you create and manage installment
* payment options on your integration
* @class Plan
*/
class Plan {
constructor(http) {
this.http = http;
}
/**
* ### Create Plan
* Create a plan on your integration
* @param {CreatePlan} data Body Param
* @returns {Promise<PlanResponse | BadRequest>}
*/
async create(data) {
return await this.http.post('/plan', JSON.stringify(data));
}
/**
* ### List Plans
* List plans available on your integration
* @param queryParams Query Parameters
* @returns {Promise<PlanResponse | BadRequest>}
*/
async list(queryParams) {
return await this.http.get('/plan', {
params: { ...queryParams },
});
}
/**
* ### Fetch Plan
* Get details of a plan on your integration
* @param id The plan `ID` or `code` you want to fetch
* @returns {Promise<PlanResponse | BadRequest>}
*/
async fetch(id) {
return await this.http.get(`/plan/${id}`);
}
/**
* ### Update Plan
* Update a plan details on your integration
* @param id Plans's `ID` or `code`
* @param {UpdatePlan} data Update Plan Data
* @returns {Promise<PlanResponse | BadRequest>}
*/
async update(id, data) {
return await this.http.put(`/plan/${id}`, JSON.stringify(data));
}
}
exports.Plan = Plan;
;