paystack-sdk 2.5.27 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/apple/apple.js +7 -22
- package/dist/apple/interface.d.ts +2 -2
- package/dist/bulkcharge/bulkcharge.js +13 -34
- package/dist/charge/charge.js +15 -38
- package/dist/customer/customer.js +15 -38
- package/dist/dedicated/dedicated.js +16 -39
- package/dist/interface.d.ts +1 -1
- package/dist/invoice/interface.d.ts +1 -1
- package/dist/invoice/invoice.js +19 -46
- package/dist/misc/interface.d.ts +109 -0
- package/dist/misc/interface.js +2 -0
- package/dist/misc/misc.d.ts +10 -0
- package/dist/misc/misc.js +21 -0
- package/dist/payment/payment.js +12 -33
- package/dist/paystack.d.ts +2 -0
- package/dist/paystack.js +8 -3
- package/dist/plan/index.js +5 -1
- package/dist/plan/plan.js +9 -26
- package/dist/product/product.js +9 -26
- package/dist/recipient/recipient.js +18 -37
- package/dist/refund/refund.js +7 -22
- package/dist/settlement/interface.d.ts +2 -2
- package/dist/settlement/settlement.js +5 -18
- package/dist/split/interface.d.ts +2 -2
- package/dist/split/split.js +29 -50
- package/dist/subaccounts/subaccount.js +8 -25
- package/dist/subscription/index.js +5 -1
- package/dist/subscription/subscription.js +20 -43
- package/dist/transaction/transaction.js +23 -52
- package/dist/transfer/control.js +12 -33
- package/dist/transfer/transfer.js +13 -34
- package/dist/verification/interface.d.ts +2 -2
- package/dist/verification/verification.js +6 -21
- package/package.json +9 -6
package/dist/payment/payment.js
CHANGED
|
@@ -1,48 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PaymentPage = void 0;
|
|
13
4
|
class PaymentPage {
|
|
14
5
|
constructor(http) {
|
|
15
6
|
this.http = http;
|
|
16
7
|
}
|
|
17
|
-
create(data) {
|
|
18
|
-
return
|
|
19
|
-
return yield this.http.post('/page', JSON.stringify(data));
|
|
20
|
-
});
|
|
8
|
+
async create(data) {
|
|
9
|
+
return await this.http.post('/page', JSON.stringify(data));
|
|
21
10
|
}
|
|
22
|
-
list(queryParams) {
|
|
23
|
-
return
|
|
24
|
-
return yield this.http.get('/page', { params: Object.assign({}, queryParams) });
|
|
25
|
-
});
|
|
11
|
+
async list(queryParams) {
|
|
12
|
+
return await this.http.get('/page', { params: { ...queryParams } });
|
|
26
13
|
}
|
|
27
|
-
fetch(id) {
|
|
28
|
-
return
|
|
29
|
-
return yield this.http.get(`/page/${id}`);
|
|
30
|
-
});
|
|
14
|
+
async fetch(id) {
|
|
15
|
+
return await this.http.get(`/page/${id}`);
|
|
31
16
|
}
|
|
32
|
-
update(id, data) {
|
|
33
|
-
return
|
|
34
|
-
return yield this.http.put(`/page/${id}`, JSON.stringify(data));
|
|
35
|
-
});
|
|
17
|
+
async update(id, data) {
|
|
18
|
+
return await this.http.put(`/page/${id}`, JSON.stringify(data));
|
|
36
19
|
}
|
|
37
|
-
slugAvailable(slug) {
|
|
38
|
-
return
|
|
39
|
-
return yield this.http.get(`/page/check_slug_availability/${slug}`);
|
|
40
|
-
});
|
|
20
|
+
async slugAvailable(slug) {
|
|
21
|
+
return await this.http.get(`/page/check_slug_availability/${slug}`);
|
|
41
22
|
}
|
|
42
|
-
addProduct(id, products) {
|
|
43
|
-
return
|
|
44
|
-
return yield this.http.post(`/page/${id}/product`, JSON.stringify({ products }));
|
|
45
|
-
});
|
|
23
|
+
async addProduct(id, products) {
|
|
24
|
+
return await this.http.post(`/page/${id}/product`, JSON.stringify({ products }));
|
|
46
25
|
}
|
|
47
26
|
}
|
|
48
27
|
exports.PaymentPage = PaymentPage;
|
package/dist/paystack.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { Transfer } from './transfer/transfer';
|
|
|
16
16
|
import { BulkCharge } from './bulkcharge/bulkcharge';
|
|
17
17
|
import { Verification } from './verification/verification';
|
|
18
18
|
import { Refund } from './refund/refund';
|
|
19
|
+
import { Misc } from './misc/misc';
|
|
19
20
|
/**
|
|
20
21
|
* Paystack SDK
|
|
21
22
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -41,5 +42,6 @@ export declare class Paystack {
|
|
|
41
42
|
recipient: Recipient;
|
|
42
43
|
refund: Refund;
|
|
43
44
|
verification: Verification;
|
|
45
|
+
misc: Misc;
|
|
44
46
|
constructor(key: string);
|
|
45
47
|
}
|
package/dist/paystack.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Paystack = void 0;
|
|
4
|
-
const axios_1 = require("axios");
|
|
5
7
|
const apple_1 = require("./apple/apple");
|
|
6
8
|
const charge_1 = require("./charge/charge");
|
|
7
9
|
const customer_1 = require("./customer/customer");
|
|
@@ -20,6 +22,8 @@ const transfer_1 = require("./transfer/transfer");
|
|
|
20
22
|
const bulkcharge_1 = require("./bulkcharge/bulkcharge");
|
|
21
23
|
const verification_1 = require("./verification/verification");
|
|
22
24
|
const refund_1 = require("./refund/refund");
|
|
25
|
+
const misc_1 = require("./misc/misc");
|
|
26
|
+
const axios_1 = __importDefault(require("axios"));
|
|
23
27
|
/**
|
|
24
28
|
* Paystack SDK
|
|
25
29
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -27,14 +31,14 @@ const refund_1 = require("./refund/refund");
|
|
|
27
31
|
class Paystack {
|
|
28
32
|
constructor(key) {
|
|
29
33
|
this.key = key;
|
|
30
|
-
this.http =
|
|
34
|
+
this.http = axios_1.default.create({
|
|
31
35
|
baseURL: 'https://api.paystack.co',
|
|
32
36
|
headers: {
|
|
33
37
|
Authorization: `Bearer ${this.key}`,
|
|
34
38
|
'Content-Type': 'application/json',
|
|
35
39
|
},
|
|
36
40
|
});
|
|
37
|
-
this.http.interceptors.response.use((response) =>
|
|
41
|
+
this.http.interceptors.response.use((response) => response.data);
|
|
38
42
|
this.bulkcharge = new bulkcharge_1.BulkCharge(this.http);
|
|
39
43
|
this.charge = new charge_1.Charge(this.http);
|
|
40
44
|
this.customer = new customer_1.Customer(this.http);
|
|
@@ -53,6 +57,7 @@ class Paystack {
|
|
|
53
57
|
this.recipient = new recipient_1.Recipient(this.http);
|
|
54
58
|
this.refund = new refund_1.Refund(this.http);
|
|
55
59
|
this.verification = new verification_1.Verification(this.http);
|
|
60
|
+
this.misc = new misc_1.Misc(this.http);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
exports.Paystack = Paystack;
|
package/dist/plan/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/plan/plan.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Plan = void 0;
|
|
13
4
|
/**
|
|
@@ -26,10 +17,8 @@ class Plan {
|
|
|
26
17
|
* @param {CreatePlan} data Body Param
|
|
27
18
|
* @returns {Promise<PlanResponse | BadRequest>}
|
|
28
19
|
*/
|
|
29
|
-
create(data) {
|
|
30
|
-
return
|
|
31
|
-
return yield this.http.post('/plan', JSON.stringify(data));
|
|
32
|
-
});
|
|
20
|
+
async create(data) {
|
|
21
|
+
return await this.http.post('/plan', JSON.stringify(data));
|
|
33
22
|
}
|
|
34
23
|
/**
|
|
35
24
|
* ### List Plans
|
|
@@ -37,11 +26,9 @@ class Plan {
|
|
|
37
26
|
* @param queryParams Query Parameters
|
|
38
27
|
* @returns {Promise<PlanResponse | BadRequest>}
|
|
39
28
|
*/
|
|
40
|
-
list(queryParams) {
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
params: Object.assign({}, queryParams),
|
|
44
|
-
});
|
|
29
|
+
async list(queryParams) {
|
|
30
|
+
return await this.http.get('/plan', {
|
|
31
|
+
params: { ...queryParams },
|
|
45
32
|
});
|
|
46
33
|
}
|
|
47
34
|
/**
|
|
@@ -50,10 +37,8 @@ class Plan {
|
|
|
50
37
|
* @param id The plan `ID` or `code` you want to fetch
|
|
51
38
|
* @returns {Promise<PlanResponse | BadRequest>}
|
|
52
39
|
*/
|
|
53
|
-
fetch(id) {
|
|
54
|
-
return
|
|
55
|
-
return yield this.http.get(`/plan/${id}`);
|
|
56
|
-
});
|
|
40
|
+
async fetch(id) {
|
|
41
|
+
return await this.http.get(`/plan/${id}`);
|
|
57
42
|
}
|
|
58
43
|
/**
|
|
59
44
|
* ### Update Plan
|
|
@@ -62,10 +47,8 @@ class Plan {
|
|
|
62
47
|
* @param {UpdatePlan} data Update Plan Data
|
|
63
48
|
* @returns {Promise<PlanResponse | BadRequest>}
|
|
64
49
|
*/
|
|
65
|
-
update(id, data) {
|
|
66
|
-
return
|
|
67
|
-
return yield this.http.put(`/plan/${id}`, JSON.stringify(data));
|
|
68
|
-
});
|
|
50
|
+
async update(id, data) {
|
|
51
|
+
return await this.http.put(`/plan/${id}`, JSON.stringify(data));
|
|
69
52
|
}
|
|
70
53
|
}
|
|
71
54
|
exports.Plan = Plan;
|
package/dist/product/product.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Product = void 0;
|
|
13
4
|
/**
|
|
@@ -20,27 +11,19 @@ class Product {
|
|
|
20
11
|
constructor(http) {
|
|
21
12
|
this.http = http;
|
|
22
13
|
}
|
|
23
|
-
create(data) {
|
|
24
|
-
return
|
|
25
|
-
return yield this.http.post('/product', JSON.stringify(data));
|
|
26
|
-
});
|
|
14
|
+
async create(data) {
|
|
15
|
+
return await this.http.post('/product', JSON.stringify(data));
|
|
27
16
|
}
|
|
28
|
-
list(queryParams) {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
params: Object.assign({}, queryParams),
|
|
32
|
-
});
|
|
17
|
+
async list(queryParams) {
|
|
18
|
+
return await this.http.get('/product', {
|
|
19
|
+
params: { ...queryParams },
|
|
33
20
|
});
|
|
34
21
|
}
|
|
35
|
-
fetch(id) {
|
|
36
|
-
return
|
|
37
|
-
return yield this.http.get(`/product/${id}`);
|
|
38
|
-
});
|
|
22
|
+
async fetch(id) {
|
|
23
|
+
return await this.http.get(`/product/${id}`);
|
|
39
24
|
}
|
|
40
|
-
update(id, data) {
|
|
41
|
-
return
|
|
42
|
-
return yield this.http.put(`/product/${id}`, JSON.stringify(data));
|
|
43
|
-
});
|
|
25
|
+
async update(id, data) {
|
|
26
|
+
return await this.http.put(`/product/${id}`, JSON.stringify(data));
|
|
44
27
|
}
|
|
45
28
|
}
|
|
46
29
|
exports.Product = Product;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Recipient = void 0;
|
|
13
4
|
class Recipient {
|
|
@@ -19,39 +10,29 @@ class Recipient {
|
|
|
19
10
|
* A duplicate account number will lead to the retrieval of the existing record.
|
|
20
11
|
* If you set `isBulk` to true, you must set the data as an array of recipients
|
|
21
12
|
*/
|
|
22
|
-
create(data, isBulk) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return yield this.http.post(url, JSON.stringify(body));
|
|
32
|
-
});
|
|
13
|
+
async create(data, isBulk) {
|
|
14
|
+
let body;
|
|
15
|
+
let url = '/transferrecipient';
|
|
16
|
+
body = data;
|
|
17
|
+
if (isBulk) {
|
|
18
|
+
url += '/bulk';
|
|
19
|
+
body = { batch: data };
|
|
20
|
+
}
|
|
21
|
+
return await this.http.post(url, JSON.stringify(body));
|
|
33
22
|
}
|
|
34
|
-
list(queryParams) {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
params: Object.assign({}, queryParams),
|
|
38
|
-
});
|
|
23
|
+
async list(queryParams) {
|
|
24
|
+
return await this.http.get('/transferrecipient', {
|
|
25
|
+
params: { ...queryParams },
|
|
39
26
|
});
|
|
40
27
|
}
|
|
41
|
-
fetch(id) {
|
|
42
|
-
return
|
|
43
|
-
return yield this.http.get(`/transferrecipient/${id}`);
|
|
44
|
-
});
|
|
28
|
+
async fetch(id) {
|
|
29
|
+
return await this.http.get(`/transferrecipient/${id}`);
|
|
45
30
|
}
|
|
46
|
-
update(id, data) {
|
|
47
|
-
return
|
|
48
|
-
return yield this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
|
|
49
|
-
});
|
|
31
|
+
async update(id, data) {
|
|
32
|
+
return await this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
|
|
50
33
|
}
|
|
51
|
-
delete(id) {
|
|
52
|
-
return
|
|
53
|
-
return yield this.http.delete(`/transferrecipient/${id}`);
|
|
54
|
-
});
|
|
34
|
+
async delete(id) {
|
|
35
|
+
return await this.http.delete(`/transferrecipient/${id}`);
|
|
55
36
|
}
|
|
56
37
|
}
|
|
57
38
|
exports.Recipient = Recipient;
|
package/dist/refund/refund.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Refund = void 0;
|
|
13
4
|
class Refund {
|
|
@@ -18,30 +9,24 @@ class Refund {
|
|
|
18
9
|
* #### Create Refund
|
|
19
10
|
* Initiate a refund on your integration
|
|
20
11
|
*/
|
|
21
|
-
create(data) {
|
|
22
|
-
return
|
|
23
|
-
return yield this.http.post('/refund', JSON.stringify(data));
|
|
24
|
-
});
|
|
12
|
+
async create(data) {
|
|
13
|
+
return await this.http.post('/refund', JSON.stringify(data));
|
|
25
14
|
}
|
|
26
15
|
/**
|
|
27
16
|
* #### List Refunds
|
|
28
17
|
* List refunds available on your integration
|
|
29
18
|
*/
|
|
30
|
-
list(queryParams) {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
params: Object.assign({}, queryParams),
|
|
34
|
-
});
|
|
19
|
+
async list(queryParams) {
|
|
20
|
+
return await this.http.get('/refund', {
|
|
21
|
+
params: { ...queryParams },
|
|
35
22
|
});
|
|
36
23
|
}
|
|
37
24
|
/**
|
|
38
25
|
* #### Fetch Refund
|
|
39
26
|
* Get details of a refund on your integration
|
|
40
27
|
*/
|
|
41
|
-
fetch(reference) {
|
|
42
|
-
return
|
|
43
|
-
return yield this.http.get(`/refund/${reference}`);
|
|
44
|
-
});
|
|
28
|
+
async fetch(reference) {
|
|
29
|
+
return await this.http.get(`/refund/${reference}`);
|
|
45
30
|
}
|
|
46
31
|
}
|
|
47
32
|
exports.Refund = Refund;
|
|
@@ -23,8 +23,8 @@ export interface ListSettlementsResponse extends Response {
|
|
|
23
23
|
data: Settlement[];
|
|
24
24
|
meta: Meta;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type CustomerType = Pick<Customer, 'id' | 'first_name' | 'last_name' | 'email' | 'phone' | 'metadata' | 'customer_code' | 'risk_action'>;
|
|
27
|
+
type SubAccountType = Pick<SubAccount, 'id' | 'subaccount_code' | 'business_name' | 'description' | 'primary_contact_name' | 'primary_contact_email' | 'primary_contact_phone' | 'metadata' | 'percentage_charge' | 'settlement_bank' | 'account_number'>;
|
|
28
28
|
export interface SettlementTransaction {
|
|
29
29
|
id: number;
|
|
30
30
|
reference: string;
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Settlement = void 0;
|
|
13
4
|
class Settlement {
|
|
14
5
|
constructor(http) {
|
|
15
6
|
this.http = http;
|
|
16
7
|
}
|
|
17
|
-
list(queryParams) {
|
|
18
|
-
return
|
|
19
|
-
return yield this.http.get('/settlement', { params: Object.assign({}, queryParams) });
|
|
20
|
-
});
|
|
8
|
+
async list(queryParams) {
|
|
9
|
+
return await this.http.get('/settlement', { params: { ...queryParams } });
|
|
21
10
|
}
|
|
22
|
-
transactions(id, queryParams) {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
params: Object.assign({}, queryParams),
|
|
26
|
-
});
|
|
11
|
+
async transactions(id, queryParams) {
|
|
12
|
+
return await this.http.get(`/settlement/${id}/transactions`, {
|
|
13
|
+
params: { ...queryParams },
|
|
27
14
|
});
|
|
28
15
|
}
|
|
29
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta } from '../interface';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type SplitCurrrencyType = 'GHS' | 'NGN' | 'ZAR' | 'USD';
|
|
3
|
+
export type SplitType = 'percentage' | 'flat';
|
|
4
4
|
interface SubAccount {
|
|
5
5
|
id: number;
|
|
6
6
|
subaccount_code: string;
|
package/dist/split/split.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.TransactionSplit = void 0;
|
|
13
4
|
/**
|
|
@@ -22,73 +13,61 @@ class TransactionSplit {
|
|
|
22
13
|
/**
|
|
23
14
|
* Create a split payment on your integration
|
|
24
15
|
*/
|
|
25
|
-
create(data) {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
method: 'post',
|
|
31
|
-
});
|
|
16
|
+
async create(data) {
|
|
17
|
+
return await this.http.request({
|
|
18
|
+
url: '/split',
|
|
19
|
+
data: JSON.stringify(data),
|
|
20
|
+
method: 'post',
|
|
32
21
|
});
|
|
33
22
|
}
|
|
34
23
|
/**
|
|
35
24
|
* List/search for the transaction splits available on your integration.
|
|
36
25
|
*/
|
|
37
|
-
list(queryParams) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
method: 'get',
|
|
43
|
-
});
|
|
26
|
+
async list(queryParams) {
|
|
27
|
+
return await this.http.request({
|
|
28
|
+
url: '/split',
|
|
29
|
+
params: { ...queryParams },
|
|
30
|
+
method: 'get',
|
|
44
31
|
});
|
|
45
32
|
}
|
|
46
33
|
/**
|
|
47
34
|
* Get details of a split on your integration.
|
|
48
35
|
*/
|
|
49
|
-
fetch(splitId) {
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
method: 'get',
|
|
54
|
-
});
|
|
36
|
+
async fetch(splitId) {
|
|
37
|
+
return await this.http.request({
|
|
38
|
+
url: `/split/${splitId}`,
|
|
39
|
+
method: 'get',
|
|
55
40
|
});
|
|
56
41
|
}
|
|
57
42
|
/**
|
|
58
43
|
* Update a transaction split details on your integration
|
|
59
44
|
*/
|
|
60
|
-
update(splitId, data) {
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
method: 'put',
|
|
66
|
-
});
|
|
45
|
+
async update(splitId, data) {
|
|
46
|
+
return await this.http.request({
|
|
47
|
+
url: `/split/${splitId}`,
|
|
48
|
+
data: JSON.stringify(data),
|
|
49
|
+
method: 'put',
|
|
67
50
|
});
|
|
68
51
|
}
|
|
69
52
|
/**
|
|
70
53
|
* Add a Subaccount to a Transaction Split,
|
|
71
54
|
* or update the share of an existing Subaccount in a Transaction Split
|
|
72
55
|
*/
|
|
73
|
-
add(splitId, data) {
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
method: 'post',
|
|
79
|
-
});
|
|
56
|
+
async add(splitId, data) {
|
|
57
|
+
return await this.http.request({
|
|
58
|
+
url: `/split/${splitId}/subaccount/add`,
|
|
59
|
+
data: JSON.stringify(data),
|
|
60
|
+
method: 'post',
|
|
80
61
|
});
|
|
81
62
|
}
|
|
82
63
|
/**
|
|
83
64
|
* Remove a subaccount from a transaction split
|
|
84
65
|
*/
|
|
85
|
-
remove(splitId, subaccount) {
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
method: 'post',
|
|
91
|
-
});
|
|
66
|
+
async remove(splitId, subaccount) {
|
|
67
|
+
return await this.http.request({
|
|
68
|
+
url: `/split/${splitId}/subaccount/remove`,
|
|
69
|
+
data: JSON.stringify({ subaccount }),
|
|
70
|
+
method: 'post',
|
|
92
71
|
});
|
|
93
72
|
}
|
|
94
73
|
}
|
|
@@ -1,38 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SubAccount = void 0;
|
|
13
4
|
class SubAccount {
|
|
14
5
|
constructor(http) {
|
|
15
6
|
this.http = http;
|
|
16
7
|
}
|
|
17
|
-
create(data) {
|
|
18
|
-
return
|
|
19
|
-
return yield this.http.post('/subaccount', JSON.stringify(data));
|
|
20
|
-
});
|
|
8
|
+
async create(data) {
|
|
9
|
+
return await this.http.post('/subaccount', JSON.stringify(data));
|
|
21
10
|
}
|
|
22
|
-
list(queryParams) {
|
|
23
|
-
return
|
|
24
|
-
return yield this.http.get('/subaccount', { params: Object.assign({}, queryParams) });
|
|
25
|
-
});
|
|
11
|
+
async list(queryParams) {
|
|
12
|
+
return await this.http.get('/subaccount', { params: { ...queryParams } });
|
|
26
13
|
}
|
|
27
|
-
fetch(id) {
|
|
28
|
-
return
|
|
29
|
-
return yield this.http.get(`/subaccount/${id}`);
|
|
30
|
-
});
|
|
14
|
+
async fetch(id) {
|
|
15
|
+
return await this.http.get(`/subaccount/${id}`);
|
|
31
16
|
}
|
|
32
|
-
update(id, data) {
|
|
33
|
-
return
|
|
34
|
-
return yield this.http.put(`/subaccount/${id}`, JSON.stringify(data));
|
|
35
|
-
});
|
|
17
|
+
async update(id, data) {
|
|
18
|
+
return await this.http.put(`/subaccount/${id}`, JSON.stringify(data));
|
|
36
19
|
}
|
|
37
20
|
}
|
|
38
21
|
exports.SubAccount = SubAccount;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|