UNPKG

paystack-sdk

Version:
96 lines (95 loc) 3.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.TransactionSplit = void 0; /** * The Transaction Splits API enables merchants * split the settlement for a transaction across * their payout account, and one or more Subaccounts. */ class TransactionSplit { constructor(http) { this.http = http; } /** * Create a split payment on your integration */ create(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: '/split', data: JSON.stringify(data), method: 'post', }); }); } /** * List/search for the transaction splits available on your integration. */ list(queryParams) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: '/split', params: Object.assign({}, queryParams), method: 'get', }); }); } /** * Get details of a split on your integration. */ fetch(splitId) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: `/split/${splitId}`, method: 'get', }); }); } /** * Update a transaction split details on your integration */ update(splitId, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: `/split/${splitId}`, data: JSON.stringify(data), method: 'put', }); }); } /** * Add a Subaccount to a Transaction Split, * or update the share of an existing Subaccount in a Transaction Split */ add(splitId, data) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: `/split/${splitId}/subaccount/add`, data: JSON.stringify(data), method: 'post', }); }); } /** * Remove a subaccount from a transaction split */ remove(splitId, subaccount) { return __awaiter(this, void 0, void 0, function* () { return yield this.http.request({ url: `/split/${splitId}/subaccount/remove`, data: JSON.stringify({ subaccount }), method: 'post', }); }); } } exports.TransactionSplit = TransactionSplit;