paystack-sdk
Version:
Paystack SDK written in Typescript
39 lines (38 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Recipient = void 0;
class Recipient {
constructor(http) {
this.http = http;
}
/**
* Create multiple transfer recipients in batches.
* A duplicate account number will lead to the retrieval of the existing record.
* If you set `isBulk` to true, you must set the data as an array of recipients
*/
async create(data, isBulk) {
let body;
let url = '/transferrecipient';
body = data;
if (isBulk) {
url += '/bulk';
body = { batch: data };
}
return await this.http.post(url, JSON.stringify(body));
}
async list(queryParams) {
return await this.http.get('/transferrecipient', {
params: { ...queryParams },
});
}
async fetch(id) {
return await this.http.get(`/transferrecipient/${id}`);
}
async update(id, data) {
return await this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
}
async delete(id) {
return await this.http.delete(`/transferrecipient/${id}`);
}
}
exports.Recipient = Recipient;