UNPKG

paystack-sdk

Version:
75 lines (74 loc) 2.07 kB
"use strict"; 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 */ async create(data) { return await this.http.request({ url: '/split', data: JSON.stringify(data), method: 'post', }); } /** * List/search for the transaction splits available on your integration. */ async list(queryParams) { return await this.http.request({ url: '/split', params: { ...queryParams }, method: 'get', }); } /** * Get details of a split on your integration. */ async fetch(splitId) { return await this.http.request({ url: `/split/${splitId}`, method: 'get', }); } /** * Update a transaction split details on your integration */ async update(splitId, data) { return await 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 */ async add(splitId, data) { return await this.http.request({ url: `/split/${splitId}/subaccount/add`, data: JSON.stringify(data), method: 'post', }); } /** * Remove a subaccount from a transaction split */ async remove(splitId, subaccount) { return await this.http.request({ url: `/split/${splitId}/subaccount/remove`, data: JSON.stringify({ subaccount }), method: 'post', }); } } exports.TransactionSplit = TransactionSplit;