UNPKG

paystack-sdk

Version:
58 lines (57 loc) 2.28 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; 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 */ create(data, isBulk) { return __awaiter(this, void 0, void 0, function* () { let body; let url = '/transferrecipient'; body = data; if (isBulk) { url += '/bulk'; body = { batch: data }; } return yield this.http.post(url, JSON.stringify(body)); }); } list(queryParams) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.get('/transferrecipient', { params: Object.assign({}, queryParams), }); }); } fetch(id) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.get(`/transferrecipient/${id}`); }); } update(id, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.put(`/transferrecipient/${id}`, JSON.stringify(data)); }); } delete(id) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.delete(`/transferrecipient/${id}`); }); } } exports.Recipient = Recipient;