paystack-sdk 2.3.1 → 2.5.2
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 +2 -2
- package/dist/bulkcharge/bulkcharge.d.ts +13 -0
- package/dist/bulkcharge/bulkcharge.js +50 -0
- package/dist/bulkcharge/interface.d.ts +35 -0
- package/dist/bulkcharge/interface.js +2 -0
- package/dist/charge/charge.d.ts +8 -7
- package/dist/charge/interface.d.ts +37 -61
- package/dist/customer/interface.d.ts +1 -1
- package/dist/dedicated/dedicated.js +6 -2
- package/dist/dedicated/interface.d.ts +2 -1
- package/dist/invoice/interface.d.ts +1 -1
- package/dist/paystack.d.ts +3 -1
- package/dist/paystack.js +3 -1
- package/dist/recipient/interface.d.ts +73 -0
- package/dist/recipient/interface.js +2 -0
- package/dist/recipient/recipient.d.ts +17 -0
- package/dist/recipient/recipient.js +57 -0
- package/dist/subscription/interface.d.ts +1 -1
- package/dist/subscription/subscription.js +1 -2
- package/dist/transaction/interface.d.ts +5 -4
- package/dist/transaction/transaction.js +7 -14
- package/dist/transfer/control.d.ts +13 -0
- package/dist/transfer/control.js +48 -0
- package/dist/transfer/interface.d.ts +33 -6
- package/dist/transfer/transfer.d.ts +2 -0
- package/dist/transfer/transfer.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ const paystack = new Paystack('secret_key');
|
|
|
32
32
|
OR
|
|
33
33
|
|
|
34
34
|
```javascript
|
|
35
|
-
const { Paystack } = require('paystack-sdk')
|
|
35
|
+
const { Paystack } = require('paystack-sdk');
|
|
36
36
|
const paystack = new Paystack('secret_key');
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -53,7 +53,7 @@ All methods use promise meaning you can either use the `async...await` or `then.
|
|
|
53
53
|
- [x] Transaction Splits
|
|
54
54
|
- [x] Settlements
|
|
55
55
|
- [x] Invoices
|
|
56
|
-
- [
|
|
56
|
+
- [x] Transaction Recipients
|
|
57
57
|
- [ ] Transfers Control
|
|
58
58
|
- [ ] Bulk Charges
|
|
59
59
|
- [ ] Control Panel
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { BadRequest, QueryParams, Response } from '../interface';
|
|
3
|
+
import { FetchBulkBatchChargeResponse, FetchChargesInBatchResponse, InitiateBulkCharge, InitiateBulkChargeResponse, ListBulkChargeBatchesResponse, QueryBatchChargesParams } from './interface';
|
|
4
|
+
export declare class BulkCharge {
|
|
5
|
+
http: Axios;
|
|
6
|
+
constructor(http: Axios);
|
|
7
|
+
initiate(data: InitiateBulkCharge[]): Promise<InitiateBulkChargeResponse | BadRequest>;
|
|
8
|
+
list(queryParams?: QueryParams): Promise<ListBulkChargeBatchesResponse | BadRequest>;
|
|
9
|
+
fetchBulkCharge(id: string): Promise<FetchBulkBatchChargeResponse | BadRequest>;
|
|
10
|
+
fetchBatchChrges(id: string, queryParams?: QueryBatchChargesParams): Promise<FetchChargesInBatchResponse | BadRequest>;
|
|
11
|
+
pause(batchCode: string): Promise<Response | BadRequest>;
|
|
12
|
+
resume(batchCode: string): Promise<Response | BadRequest>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BulkCharge = void 0;
|
|
13
|
+
class BulkCharge {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
initiate(data) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return yield this.http.post('/bulkcharge', JSON.stringify(data));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
list(queryParams) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return yield this.http.get('/bulkcharge', { params: Object.assign({}, queryParams) });
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
fetchBulkCharge(id) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.http.get(`/bulkcharge/${id}`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
fetchBatchChrges(id, queryParams) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return yield this.http.get(`/bulkcharge/${id}/charges`, {
|
|
35
|
+
params: Object.assign({}, queryParams),
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
pause(batchCode) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return yield this.http.get(`/bulkcharge/pause/${batchCode}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
resume(batchCode) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return yield this.http.get(`/bulkcharge/resume/${batchCode}`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.BulkCharge = BulkCharge;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Charge } from '../charge/interface';
|
|
2
|
+
import { Meta, QueryParams, Response } from '../interface';
|
|
3
|
+
export interface InitiateBulkCharge {
|
|
4
|
+
authorization: string;
|
|
5
|
+
amount: number;
|
|
6
|
+
reference: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BulkCharge {
|
|
9
|
+
id: number;
|
|
10
|
+
domain: string;
|
|
11
|
+
batch_code: string;
|
|
12
|
+
status: 'active' | 'paused' | 'complete';
|
|
13
|
+
integration?: number;
|
|
14
|
+
reference?: string;
|
|
15
|
+
total_charges?: number;
|
|
16
|
+
pending_charges?: number;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface ListBulkChargeBatchesResponse extends Response {
|
|
21
|
+
data: BulkCharge[];
|
|
22
|
+
meta: Meta;
|
|
23
|
+
}
|
|
24
|
+
export interface InitiateBulkChargeResponse extends Response {
|
|
25
|
+
data: BulkCharge;
|
|
26
|
+
}
|
|
27
|
+
export interface FetchBulkBatchChargeResponse extends Response {
|
|
28
|
+
data: BulkCharge;
|
|
29
|
+
}
|
|
30
|
+
export interface FetchChargesInBatchResponse extends Response {
|
|
31
|
+
data: Charge;
|
|
32
|
+
}
|
|
33
|
+
export interface QueryBatchChargesParams extends QueryParams {
|
|
34
|
+
status: 'pending' | 'success' | 'failed';
|
|
35
|
+
}
|
package/dist/charge/charge.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import { ChargeCreatedWithAddressResponse, ChargeCreatedWithBirthdayResponse, ChargeCreatedWithOTPResponse, ChargeCreatedWithPendingResponse, ChargeCreatedWithPhoneResponse } from './interface';
|
|
3
|
+
import { ChargeCreatedResponse, ChargeCreatedWithPinResponse, CreateCharge, SubmitAddress, SubmitBirthday, SubmitOTP, SubmitPhone, SubmitPIN } from './interface';
|
|
3
4
|
interface BadRequest {
|
|
4
5
|
status: boolean;
|
|
5
6
|
message: string;
|
|
@@ -8,11 +9,11 @@ export declare class Charge {
|
|
|
8
9
|
private http;
|
|
9
10
|
constructor(http: Axios);
|
|
10
11
|
create(data: CreateCharge): Promise<ChargeCreatedResponse | BadRequest>;
|
|
11
|
-
submitPIN(data: SubmitPIN): Promise<
|
|
12
|
-
submitOTP(data: SubmitOTP): Promise<
|
|
13
|
-
submitPhone(data: SubmitPhone): Promise<
|
|
14
|
-
submitBirthday(data: SubmitBirthday): Promise<
|
|
15
|
-
submitAddress(data: SubmitAddress): Promise<
|
|
16
|
-
checkPending(reference: string): Promise<
|
|
12
|
+
submitPIN(data: SubmitPIN): Promise<ChargeCreatedWithPinResponse | BadRequest>;
|
|
13
|
+
submitOTP(data: SubmitOTP): Promise<ChargeCreatedWithOTPResponse | BadRequest>;
|
|
14
|
+
submitPhone(data: SubmitPhone): Promise<ChargeCreatedWithPhoneResponse | BadRequest>;
|
|
15
|
+
submitBirthday(data: SubmitBirthday): Promise<ChargeCreatedWithBirthdayResponse | BadRequest>;
|
|
16
|
+
submitAddress(data: SubmitAddress): Promise<ChargeCreatedWithAddressResponse | BadRequest>;
|
|
17
|
+
checkPending(reference: string): Promise<ChargeCreatedWithPendingResponse | BadRequest>;
|
|
17
18
|
}
|
|
18
19
|
export {};
|
|
@@ -1,5 +1,28 @@
|
|
|
1
|
+
import { Customer } from '../customer/interface';
|
|
1
2
|
import { Response } from '../interface';
|
|
2
|
-
|
|
3
|
+
import { Transaction } from '../transaction/interface';
|
|
4
|
+
export interface Charge {
|
|
5
|
+
amount: number;
|
|
6
|
+
currency: string;
|
|
7
|
+
transaction_date: string;
|
|
8
|
+
status: string;
|
|
9
|
+
reference: string;
|
|
10
|
+
domain: string;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
gateway_response: string;
|
|
13
|
+
message: string;
|
|
14
|
+
channel: string;
|
|
15
|
+
ip_address: string;
|
|
16
|
+
log?: unknown;
|
|
17
|
+
fees: number;
|
|
18
|
+
authorization: Authorization;
|
|
19
|
+
customer: Customer;
|
|
20
|
+
transaction?: Transaction;
|
|
21
|
+
display_text: string;
|
|
22
|
+
plan: unknown;
|
|
23
|
+
fees_split?: string;
|
|
24
|
+
paid_at: Date;
|
|
25
|
+
}
|
|
3
26
|
export interface CreateCharge {
|
|
4
27
|
email: string;
|
|
5
28
|
amount: string;
|
|
@@ -39,34 +62,16 @@ export interface SubmitAddress {
|
|
|
39
62
|
state: string;
|
|
40
63
|
zip_code: string;
|
|
41
64
|
}
|
|
42
|
-
export interface
|
|
43
|
-
data:
|
|
44
|
-
amount: number;
|
|
45
|
-
currency: string;
|
|
46
|
-
transaction_date: string;
|
|
47
|
-
status: string;
|
|
48
|
-
reference: string;
|
|
49
|
-
domain: string;
|
|
50
|
-
metadata: Record<string, unknown>;
|
|
51
|
-
gateway_response: string;
|
|
52
|
-
message: string;
|
|
53
|
-
channel: string;
|
|
54
|
-
ip_address: string;
|
|
55
|
-
log: unknown;
|
|
56
|
-
fees: number;
|
|
57
|
-
authorization: Authorization;
|
|
58
|
-
customer: Customer;
|
|
59
|
-
display_text: string;
|
|
60
|
-
plan: unknown;
|
|
61
|
-
};
|
|
65
|
+
export interface ChargeCreatedResponse extends Response {
|
|
66
|
+
data: Charge;
|
|
62
67
|
}
|
|
63
|
-
interface
|
|
68
|
+
export interface ChargeCreatedWithPendingResponse extends Response {
|
|
64
69
|
data: {
|
|
65
70
|
reference: string;
|
|
66
71
|
status: string;
|
|
67
72
|
};
|
|
68
73
|
}
|
|
69
|
-
interface
|
|
74
|
+
export interface ChargeCreatedWithAddressResponse extends Response {
|
|
70
75
|
data: {
|
|
71
76
|
display_text: string;
|
|
72
77
|
reference: string;
|
|
@@ -74,27 +79,10 @@ interface ChargeCreatedWithAddress extends Response {
|
|
|
74
79
|
country_code: string;
|
|
75
80
|
};
|
|
76
81
|
}
|
|
77
|
-
interface
|
|
78
|
-
data:
|
|
79
|
-
amount: number;
|
|
80
|
-
channel: string;
|
|
81
|
-
created_at: Date;
|
|
82
|
-
currency: string;
|
|
83
|
-
domain: string;
|
|
84
|
-
fees: number;
|
|
85
|
-
gateway_response: string;
|
|
86
|
-
id: number;
|
|
87
|
-
ip_address: string;
|
|
88
|
-
message: string;
|
|
89
|
-
paid_at: Date;
|
|
90
|
-
reference: string;
|
|
91
|
-
status: string;
|
|
92
|
-
transaction_date: Date;
|
|
93
|
-
authorization: Authorization;
|
|
94
|
-
customer: Customer;
|
|
95
|
-
};
|
|
82
|
+
export interface ChargeCreatedWithMobileMoneyResponse extends Response {
|
|
83
|
+
data: Charge;
|
|
96
84
|
}
|
|
97
|
-
interface
|
|
85
|
+
export interface ChargeCreatedWithUSSDResponse extends Response {
|
|
98
86
|
data: {
|
|
99
87
|
reference: string;
|
|
100
88
|
status: string;
|
|
@@ -102,41 +90,41 @@ interface ChargeCreatedWithUSSD extends Response {
|
|
|
102
90
|
ussd_code: string;
|
|
103
91
|
};
|
|
104
92
|
}
|
|
105
|
-
interface
|
|
93
|
+
export interface ChargeCreatedWithBirthdayResponse extends Response {
|
|
106
94
|
data: {
|
|
107
95
|
reference: string;
|
|
108
96
|
status: string;
|
|
109
97
|
display_text: string;
|
|
110
98
|
};
|
|
111
99
|
}
|
|
112
|
-
interface
|
|
100
|
+
export interface ChargeCreatedWithBankAuthResponse extends Response {
|
|
113
101
|
data: {
|
|
114
102
|
refernce: string;
|
|
115
103
|
uri: string;
|
|
116
104
|
status: string;
|
|
117
105
|
};
|
|
118
106
|
}
|
|
119
|
-
interface
|
|
107
|
+
export interface ChargeCreatedWithOTPResponse extends Response {
|
|
120
108
|
data: {
|
|
121
109
|
refernce: string;
|
|
122
110
|
status: string;
|
|
123
111
|
display_text: string;
|
|
124
112
|
};
|
|
125
113
|
}
|
|
126
|
-
interface
|
|
114
|
+
export interface ChargeCreatedWithPinResponse extends Response {
|
|
127
115
|
data: {
|
|
128
116
|
refernce: string;
|
|
129
117
|
status: string;
|
|
130
118
|
};
|
|
131
119
|
}
|
|
132
|
-
interface
|
|
120
|
+
export interface ChargeCreatedWithPhoneResponse extends Response {
|
|
133
121
|
data: {
|
|
134
122
|
refernce: string;
|
|
135
123
|
status: string;
|
|
136
124
|
display_text: string;
|
|
137
125
|
};
|
|
138
126
|
}
|
|
139
|
-
interface
|
|
127
|
+
export interface ChargeFailedResponse extends Response {
|
|
140
128
|
data: {
|
|
141
129
|
refernce: string;
|
|
142
130
|
message: string;
|
|
@@ -158,15 +146,3 @@ export interface Authorization {
|
|
|
158
146
|
signature: string;
|
|
159
147
|
account_name: string;
|
|
160
148
|
}
|
|
161
|
-
export interface Customer {
|
|
162
|
-
id: number;
|
|
163
|
-
first_name?: string;
|
|
164
|
-
last_name?: string;
|
|
165
|
-
email: string;
|
|
166
|
-
customer_code: string;
|
|
167
|
-
risk_action: string;
|
|
168
|
-
phone?: string | null;
|
|
169
|
-
metadata?: Record<string, unknown> | null;
|
|
170
|
-
international_format_phone?: string | null;
|
|
171
|
-
}
|
|
172
|
-
export {};
|
|
@@ -21,7 +21,9 @@ class DedicatedAccount {
|
|
|
21
21
|
}
|
|
22
22
|
list(queryParams) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return yield this.http.get('/dedicated_account', {
|
|
24
|
+
return yield this.http.get('/dedicated_account', {
|
|
25
|
+
params: Object.assign({}, queryParams),
|
|
26
|
+
});
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
29
|
fetch(dedicatedAccountId) {
|
|
@@ -41,7 +43,9 @@ class DedicatedAccount {
|
|
|
41
43
|
}
|
|
42
44
|
removeSplit(accountNumber) {
|
|
43
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
return yield this.http.delete('/dedicated_account/split', {
|
|
46
|
+
return yield this.http.delete('/dedicated_account/split', {
|
|
47
|
+
data: { account_number: accountNumber },
|
|
48
|
+
});
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
providers() {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Authorization
|
|
1
|
+
import { Authorization } from '../charge/interface';
|
|
2
2
|
import { Meta } from '../interface';
|
|
3
3
|
import { Subscription } from '../subscription';
|
|
4
4
|
import { Response } from '../interface';
|
|
5
5
|
import { Transaction } from '../transaction/interface';
|
|
6
|
+
import { Customer } from '../customer/interface';
|
|
6
7
|
export interface DedicatedAccountData {
|
|
7
8
|
id: number;
|
|
8
9
|
account_name: string;
|
package/dist/paystack.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ApplePay } from './apple/apple';
|
|
2
|
-
import { Charge } from './charge';
|
|
2
|
+
import { Charge } from './charge/charge';
|
|
3
3
|
import { Customer } from './customer/customer';
|
|
4
4
|
import { DedicatedAccount } from './dedicated/dedicated';
|
|
5
5
|
import { Invoice } from './invoice/invoice';
|
|
6
6
|
import { PaymentPage } from './payment/payment';
|
|
7
7
|
import { Plan } from './plan';
|
|
8
8
|
import { Product } from './product/product';
|
|
9
|
+
import { Recipient } from './recipient/recipient';
|
|
9
10
|
import { Settlement } from './settlement/settlement';
|
|
10
11
|
import { TransactionSplit } from './split/split';
|
|
11
12
|
import { SubAccount } from './subaccounts/subaccount';
|
|
@@ -33,5 +34,6 @@ export declare class Paystack {
|
|
|
33
34
|
page: PaymentPage;
|
|
34
35
|
invoice: Invoice;
|
|
35
36
|
settlement: Settlement;
|
|
37
|
+
recipient: Recipient;
|
|
36
38
|
constructor(key: string);
|
|
37
39
|
}
|
package/dist/paystack.js
CHANGED
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Paystack = void 0;
|
|
4
4
|
const axios_1 = require("axios");
|
|
5
5
|
const apple_1 = require("./apple/apple");
|
|
6
|
-
const charge_1 = require("./charge");
|
|
6
|
+
const charge_1 = require("./charge/charge");
|
|
7
7
|
const customer_1 = require("./customer/customer");
|
|
8
8
|
const dedicated_1 = require("./dedicated/dedicated");
|
|
9
9
|
const invoice_1 = require("./invoice/invoice");
|
|
10
10
|
const payment_1 = require("./payment/payment");
|
|
11
11
|
const plan_1 = require("./plan");
|
|
12
12
|
const product_1 = require("./product/product");
|
|
13
|
+
const recipient_1 = require("./recipient/recipient");
|
|
13
14
|
const settlement_1 = require("./settlement/settlement");
|
|
14
15
|
const split_1 = require("./split/split");
|
|
15
16
|
const subaccount_1 = require("./subaccounts/subaccount");
|
|
@@ -45,6 +46,7 @@ class Paystack {
|
|
|
45
46
|
this.page = new payment_1.PaymentPage(this.http);
|
|
46
47
|
this.invoice = new invoice_1.Invoice(this.http);
|
|
47
48
|
this.settlement = new settlement_1.Settlement(this.http);
|
|
49
|
+
this.recipient = new recipient_1.Recipient(this.http);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
exports.Paystack = Paystack;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Meta, Response } from '../interface';
|
|
2
|
+
export interface CreateRecipient {
|
|
3
|
+
/**
|
|
4
|
+
* Recipient Type.
|
|
5
|
+
* It could be one of: `nuban`, `mobile_money` or `basa`
|
|
6
|
+
*/
|
|
7
|
+
type: string;
|
|
8
|
+
/** A name for the recipient */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Required if type is `nuban` or `basa` */
|
|
11
|
+
account_number: string;
|
|
12
|
+
/**
|
|
13
|
+
* Required if type is nuban or basa.
|
|
14
|
+
* You can get the list of Bank Codes by calling the List Banks endpoint.
|
|
15
|
+
*/
|
|
16
|
+
bank_code: string;
|
|
17
|
+
/** A description for this recipient */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Currency for the account receiving the transfer */
|
|
20
|
+
currency?: string;
|
|
21
|
+
/** An authorization code from a previous transaction */
|
|
22
|
+
authorization_code?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Store additional information about your
|
|
25
|
+
* recipient in a structured format, JSON
|
|
26
|
+
*/
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export interface UpdateRecipient {
|
|
30
|
+
name: string;
|
|
31
|
+
email?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface Recipient {
|
|
34
|
+
id: number;
|
|
35
|
+
active: boolean;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
currency: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
domain: string;
|
|
40
|
+
email?: string;
|
|
41
|
+
integration: number;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
name: string;
|
|
44
|
+
recipient_code: string;
|
|
45
|
+
type: string;
|
|
46
|
+
updatedAt: Date;
|
|
47
|
+
is_deleted: boolean;
|
|
48
|
+
isDeleted: boolean;
|
|
49
|
+
details: RecipientDetails;
|
|
50
|
+
}
|
|
51
|
+
export interface RecipientDetails {
|
|
52
|
+
authorization_code?: string;
|
|
53
|
+
account_number: string;
|
|
54
|
+
account_name: string;
|
|
55
|
+
bank_code: string;
|
|
56
|
+
bank_name: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ViewRecipientResponse extends Response {
|
|
59
|
+
data: Recipient;
|
|
60
|
+
}
|
|
61
|
+
export interface RecipientCreatedResponse extends Response {
|
|
62
|
+
data: Recipient;
|
|
63
|
+
}
|
|
64
|
+
export interface BulkRecipientsCreatedResponse extends Response {
|
|
65
|
+
data: {
|
|
66
|
+
success: Recipient[];
|
|
67
|
+
errors: Record<string, unknown>[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface ListRecipientResponse extends Response {
|
|
71
|
+
data: Recipient[];
|
|
72
|
+
meta: Meta;
|
|
73
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { BadRequest, QueryParams, Response } from '../interface';
|
|
3
|
+
import { CreateRecipient, ListRecipientResponse, RecipientCreatedResponse, UpdateRecipient, ViewRecipientResponse } from './interface';
|
|
4
|
+
export declare class Recipient {
|
|
5
|
+
private http;
|
|
6
|
+
constructor(http: Axios);
|
|
7
|
+
/**
|
|
8
|
+
* Create multiple transfer recipients in batches.
|
|
9
|
+
* A duplicate account number will lead to the retrieval of the existing record.
|
|
10
|
+
* If you set `isBulk` to true, you must set the data as an array of recipients
|
|
11
|
+
*/
|
|
12
|
+
create(data: CreateRecipient | CreateRecipient[], isBulk?: boolean): Promise<RecipientCreatedResponse | BadRequest>;
|
|
13
|
+
list(queryParams?: QueryParams): Promise<ListRecipientResponse | BadRequest>;
|
|
14
|
+
fetch(id: string): Promise<ViewRecipientResponse | BadRequest>;
|
|
15
|
+
update(id: string, data: UpdateRecipient): Promise<ViewRecipientResponse | BadRequest>;
|
|
16
|
+
delete(id: string): Promise<Response | BadRequest>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Recipient = void 0;
|
|
13
|
+
class Recipient {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create multiple transfer recipients in batches.
|
|
19
|
+
* A duplicate account number will lead to the retrieval of the existing record.
|
|
20
|
+
* If you set `isBulk` to true, you must set the data as an array of recipients
|
|
21
|
+
*/
|
|
22
|
+
create(data, isBulk) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let body;
|
|
25
|
+
let url = '/transferrecipient';
|
|
26
|
+
body = data;
|
|
27
|
+
if (isBulk) {
|
|
28
|
+
url += '/bulk';
|
|
29
|
+
body = { batch: data };
|
|
30
|
+
}
|
|
31
|
+
return yield this.http.post(url, JSON.stringify(body));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
list(queryParams) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return yield this.http.get('/transferrecipient', {
|
|
37
|
+
params: Object.assign({}, queryParams),
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
fetch(id) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return yield this.http.get(`/transferrecipient/${id}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
update(id, data) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return yield this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
delete(id) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return yield this.http.delete(`/transferrecipient/${id}`);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.Recipient = Recipient;
|
|
@@ -16,8 +16,7 @@ class Subscription {
|
|
|
16
16
|
}
|
|
17
17
|
create(data) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
return response;
|
|
19
|
+
return yield this.http.post('/subscription', JSON.stringify(data));
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
22
|
list(queryParams) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Authorization
|
|
1
|
+
import { Authorization } from '../charge/interface';
|
|
2
|
+
import { Customer } from '../customer/interface';
|
|
2
3
|
import { Meta } from '../interface';
|
|
3
4
|
export interface InitializeTransaction {
|
|
4
5
|
/**
|
|
@@ -100,7 +101,7 @@ export interface Transaction {
|
|
|
100
101
|
{
|
|
101
102
|
time_spent: number;
|
|
102
103
|
attempt: number;
|
|
103
|
-
authentication
|
|
104
|
+
authentication?: unknown;
|
|
104
105
|
errors: number;
|
|
105
106
|
success: boolean;
|
|
106
107
|
mobile: boolean;
|
|
@@ -132,7 +133,7 @@ export interface Timeline extends Response {
|
|
|
132
133
|
data: {
|
|
133
134
|
time_spent: number;
|
|
134
135
|
attempts: number;
|
|
135
|
-
authentication
|
|
136
|
+
authentication?: unknown;
|
|
136
137
|
errors: number;
|
|
137
138
|
success: boolean;
|
|
138
139
|
mobile: boolean;
|
|
@@ -300,7 +301,7 @@ export interface PartialDebit {
|
|
|
300
301
|
at_least: string;
|
|
301
302
|
}
|
|
302
303
|
export interface PartialDebitResponse extends Response {
|
|
303
|
-
data: Record<string,
|
|
304
|
+
data: Record<string, unknown>;
|
|
304
305
|
}
|
|
305
306
|
export interface CheckAuthorizationResponse extends Response {
|
|
306
307
|
data: {
|
|
@@ -25,42 +25,36 @@ class Transaction {
|
|
|
25
25
|
*/
|
|
26
26
|
initialize(data) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
return response;
|
|
28
|
+
return yield this.http.post('/transaction/initialize', JSON.stringify(data));
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
verify(reference) {
|
|
33
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
33
|
+
return yield this.http.get('/transaction/verify', {
|
|
35
34
|
params: { reference },
|
|
36
35
|
});
|
|
37
|
-
return response;
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
list(queryParams) {
|
|
41
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
|
|
40
|
+
return yield this.http.get('/transaction', {
|
|
43
41
|
params: Object.assign({}, queryParams),
|
|
44
42
|
});
|
|
45
|
-
return response;
|
|
46
43
|
});
|
|
47
44
|
}
|
|
48
45
|
fetch(id) {
|
|
49
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
|
|
51
|
-
return response;
|
|
47
|
+
return yield this.http.get(`/transaction/:${id}`);
|
|
52
48
|
});
|
|
53
49
|
}
|
|
54
50
|
chargeAuthorization(data) {
|
|
55
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
|
|
57
|
-
return response;
|
|
52
|
+
return yield this.http.post('/transaction/charge_authorization', JSON.stringify(data));
|
|
58
53
|
});
|
|
59
54
|
}
|
|
60
55
|
checkAuthorization(data) {
|
|
61
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
|
|
63
|
-
return response;
|
|
57
|
+
return yield this.http.post('/transaction/check_authorization', JSON.stringify(data));
|
|
64
58
|
});
|
|
65
59
|
}
|
|
66
60
|
viewTimeline(id) {
|
|
@@ -84,8 +78,7 @@ class Transaction {
|
|
|
84
78
|
}
|
|
85
79
|
partialDebit(data) {
|
|
86
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
|
|
88
|
-
return JSON.parse(response.data);
|
|
81
|
+
return yield this.http.post('/transaction/partial_debit', JSON.stringify(data));
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
84
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { BadRequest, Response } from '../interface';
|
|
3
|
+
import { CheckBalanceResponse, LedgerBalanceResponse, ResendTransferOTP } from './interface';
|
|
4
|
+
export declare class Control {
|
|
5
|
+
http: Axios;
|
|
6
|
+
constructor(http: Axios);
|
|
7
|
+
balance(): Promise<CheckBalanceResponse | BadRequest>;
|
|
8
|
+
ledgerBalance(): Promise<LedgerBalanceResponse | BadRequest>;
|
|
9
|
+
resendOTP(data: ResendTransferOTP): Promise<Response | BadRequest>;
|
|
10
|
+
disableOTP(): Promise<Response | BadRequest>;
|
|
11
|
+
finalizeDisableOTP(otp: string): Promise<Response | BadRequest>;
|
|
12
|
+
enableOTP(): Promise<Response | BadRequest>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Control = void 0;
|
|
13
|
+
class Control {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
balance() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return yield this.http.get('/balance');
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
ledgerBalance() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return yield this.http.get('/balance/ledger');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
resendOTP(data) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.http.post('/transfer/resend_otp', JSON.stringify(data));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
disableOTP() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return yield this.http.post('/transfer/disable_otp');
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
finalizeDisableOTP(otp) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.http.post('/transfer/disable_otp_finalize', JSON.stringify({ otp }));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
enableOTP() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield this.http.post('/transfer/enable_otp');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Control = Control;
|
|
@@ -24,12 +24,6 @@ export interface InitiateTransfer {
|
|
|
24
24
|
*/
|
|
25
25
|
reference?: string;
|
|
26
26
|
}
|
|
27
|
-
export interface FinalizeTransfer extends Response {
|
|
28
|
-
data: Transfer;
|
|
29
|
-
}
|
|
30
|
-
export interface TransferInitiated extends Response {
|
|
31
|
-
data: Transfer;
|
|
32
|
-
}
|
|
33
27
|
export interface InitiateBulkTransfer {
|
|
34
28
|
/**
|
|
35
29
|
* Where should we transfer from? Only `balance` for now
|
|
@@ -44,6 +38,16 @@ export interface InitiateBulkTransfer {
|
|
|
44
38
|
reference: string;
|
|
45
39
|
}[];
|
|
46
40
|
}
|
|
41
|
+
export interface ResendTransferOTP {
|
|
42
|
+
transfer_code: string;
|
|
43
|
+
reason: 'resend_otp' | 'transfer';
|
|
44
|
+
}
|
|
45
|
+
export interface FinalizeTransfer extends Response {
|
|
46
|
+
data: Transfer;
|
|
47
|
+
}
|
|
48
|
+
export interface TransferInitiated extends Response {
|
|
49
|
+
data: Transfer;
|
|
50
|
+
}
|
|
47
51
|
export interface BulkTransferInitiated extends Response {
|
|
48
52
|
data: Transfer[];
|
|
49
53
|
}
|
|
@@ -98,4 +102,27 @@ interface Transfer {
|
|
|
98
102
|
createdAt: Date;
|
|
99
103
|
updatedAt: Date;
|
|
100
104
|
}
|
|
105
|
+
export interface LedgerBalance {
|
|
106
|
+
id: number;
|
|
107
|
+
integration: number;
|
|
108
|
+
domain: string;
|
|
109
|
+
balance: number;
|
|
110
|
+
currency: string;
|
|
111
|
+
difference: number;
|
|
112
|
+
reason: string;
|
|
113
|
+
model_responsible: string;
|
|
114
|
+
model_row: number;
|
|
115
|
+
createdAt: Date;
|
|
116
|
+
updatedAt: Date;
|
|
117
|
+
}
|
|
118
|
+
export interface Balance {
|
|
119
|
+
currency: string;
|
|
120
|
+
balance: number;
|
|
121
|
+
}
|
|
122
|
+
export interface CheckBalanceResponse extends Response {
|
|
123
|
+
data: Balance[];
|
|
124
|
+
}
|
|
125
|
+
export interface LedgerBalanceResponse extends Response {
|
|
126
|
+
data: LedgerBalance[];
|
|
127
|
+
}
|
|
101
128
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
+
import { Control } from './control';
|
|
2
3
|
import { BulkTransferInitiated, FetchTransfer, FinalizeTransfer, InitiateBulkTransfer, InitiateTransfer, ListTransferQueryParams, ListTransfers, TransferInitiated, VerifyTransfer } from './interface';
|
|
3
4
|
interface BadRequest {
|
|
4
5
|
status: boolean;
|
|
@@ -6,6 +7,7 @@ interface BadRequest {
|
|
|
6
7
|
}
|
|
7
8
|
export declare class Transfer {
|
|
8
9
|
http: Axios;
|
|
10
|
+
control: Control;
|
|
9
11
|
constructor(http: Axios);
|
|
10
12
|
/**
|
|
11
13
|
* # Initiate Transfer
|
|
@@ -10,9 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Transfer = void 0;
|
|
13
|
+
const control_1 = require("./control");
|
|
13
14
|
class Transfer {
|
|
14
15
|
constructor(http) {
|
|
15
16
|
this.http = http;
|
|
17
|
+
this.control = new control_1.Control(http);
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* # Initiate Transfer
|