paystack-sdk 2.4.1 → 2.5.3

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 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').Paystack;
35
+ const { Paystack } = require('paystack-sdk');
36
36
  const paystack = new Paystack('secret_key');
37
37
  ```
38
38
 
@@ -53,9 +53,9 @@ 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
- - [ ] Transaction Recipients
57
- - [ ] Transfers Control
58
- - [ ] Bulk Charges
56
+ - [x] Transaction Recipients
57
+ - [x] Transfers Control
58
+ - [x] Bulk Charges
59
59
  - [ ] Control Panel
60
60
  - [ ] Disputes
61
61
  - [ ] Refunds
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { Axios } from 'axios';
2
- import { ChargeCreated, ChargeCreatedResponse, CreateCharge, SubmitAddress, SubmitBirthday, SubmitOTP, SubmitPhone, SubmitPIN } from './interface';
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<ChargeCreated | BadRequest>;
12
- submitOTP(data: SubmitOTP): Promise<ChargeCreatedResponse | BadRequest>;
13
- submitPhone(data: SubmitPhone): Promise<ChargeCreatedResponse | BadRequest>;
14
- submitBirthday(data: SubmitBirthday): Promise<ChargeCreatedResponse | BadRequest>;
15
- submitAddress(data: SubmitAddress): Promise<ChargeCreatedResponse | BadRequest>;
16
- checkPending(reference: string): Promise<ChargeCreatedResponse | BadRequest>;
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
- export declare type ChargeCreatedResponse = ChargeCreated | ChargeCreatedWithOTP | ChargeCreatedWithPending | ChargeCreatedWithAddress | ChargeCreatedWithBankAuth | ChargeCreatedWithPin | ChargeCreatedWithPhone | ChargeCreatedWithBirthday | ChargeCreatedWithUSSD | ChargeCreatedWithMobileMoney | ChargeFailed;
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 ChargeCreated extends Response {
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 ChargeCreatedWithPending extends Response {
68
+ export interface ChargeCreatedWithPendingResponse extends Response {
64
69
  data: {
65
70
  reference: string;
66
71
  status: string;
67
72
  };
68
73
  }
69
- interface ChargeCreatedWithAddress extends Response {
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 ChargeCreatedWithMobileMoney extends Response {
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 ChargeCreatedWithUSSD extends Response {
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 ChargeCreatedWithBirthday extends Response {
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 ChargeCreatedWithBankAuth extends Response {
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 ChargeCreatedWithOTP extends Response {
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 ChargeCreatedWithPin extends Response {
114
+ export interface ChargeCreatedWithPinResponse extends Response {
127
115
  data: {
128
116
  refernce: string;
129
117
  status: string;
130
118
  };
131
119
  }
132
- interface ChargeCreatedWithPhone extends Response {
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 ChargeFailed extends Response {
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 {};
@@ -1,4 +1,4 @@
1
- import { Authorization } from '../charge';
1
+ import { Authorization } from '../charge/interface';
2
2
  import { Meta } from '../interface';
3
3
  import { SubAccount } from '../subaccounts/subaccount';
4
4
  import { Subscription } from '../subscription/interface';
@@ -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', { params: Object.assign({}, queryParams) });
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', { data: { account_number: accountNumber } });
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, Customer } from '../charge';
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;
@@ -1,4 +1,4 @@
1
- import { Customer } from '../charge';
1
+ import { Customer } from '../customer/interface';
2
2
  import { Meta, QueryParams, Response } from '../interface';
3
3
  import { Transaction } from '../transaction/interface';
4
4
  export interface CreateInvoice {
@@ -1,5 +1,5 @@
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';
package/dist/paystack.js CHANGED
@@ -3,7 +3,7 @@ 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");
@@ -4,6 +4,11 @@ import { CreateRecipient, ListRecipientResponse, RecipientCreatedResponse, Updat
4
4
  export declare class Recipient {
5
5
  private http;
6
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
+ */
7
12
  create(data: CreateRecipient | CreateRecipient[], isBulk?: boolean): Promise<RecipientCreatedResponse | BadRequest>;
8
13
  list(queryParams?: QueryParams): Promise<ListRecipientResponse | BadRequest>;
9
14
  fetch(id: string): Promise<ViewRecipientResponse | BadRequest>;
@@ -14,15 +14,20 @@ class Recipient {
14
14
  constructor(http) {
15
15
  this.http = http;
16
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
+ */
17
22
  create(data, isBulk) {
18
23
  return __awaiter(this, void 0, void 0, function* () {
19
24
  let body;
20
25
  let url = '/transferrecipient';
21
26
  body = data;
22
- if (isBulk)
27
+ if (isBulk) {
23
28
  url += '/bulk';
24
- if (isBulk)
25
29
  body = { batch: data };
30
+ }
26
31
  return yield this.http.post(url, JSON.stringify(body));
27
32
  });
28
33
  }
@@ -1,4 +1,4 @@
1
- import { Authorization } from '../charge';
1
+ import { Authorization } from '../charge/interface';
2
2
  import { Customer } from '../customer/interface';
3
3
  import { Meta } from '../interface';
4
4
  import { IPlan } from '../plan';
@@ -16,8 +16,7 @@ class Subscription {
16
16
  }
17
17
  create(data) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const response = yield this.http.post('/subscription', JSON.stringify(data));
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, Customer } from '../charge';
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: any;
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: any;
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, any>;
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
- const response = yield this.http.post('/transaction/initialize', JSON.stringify(data));
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
- const response = yield this.http.get('/transaction/verify', {
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
- const response = yield this.http.get('/transaction', {
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
- const response = yield this.http.get(`/transaction/:${id}`);
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
- const response = yield this.http.post('/transaction/charge_authorization', JSON.stringify(data));
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
- const response = yield this.http.post('/transaction/check_authorization', JSON.stringify(data));
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
- const response = yield this.http.post('/transaction/partial_debit', JSON.stringify(data));
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paystack-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.5.3",
4
4
  "description": "Paystack SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "author": "Tech Priest",