paystack-sdk 3.4.1 → 3.6.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 +14 -3
- package/dist/paystack.d.ts +6 -0
- package/dist/paystack.js +6 -0
- package/dist/refund/interface.d.ts +43 -19
- package/dist/refund/refund.d.ts +3 -5
- package/dist/refund/refund.js +7 -5
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ For Typescript
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
import {Paystack} from 'paystack-sdk';
|
|
24
|
+
// or
|
|
25
|
+
import Paystack from 'paystack-sdk';
|
|
24
26
|
|
|
25
27
|
const paystack = new Paystack("secret_key");
|
|
26
28
|
```
|
|
@@ -29,6 +31,9 @@ For Javscript
|
|
|
29
31
|
|
|
30
32
|
```javascript
|
|
31
33
|
const Paystack = require('paystack-sdk').Paystack;
|
|
34
|
+
// or
|
|
35
|
+
const Paystack = require('paystack-sdk');
|
|
36
|
+
|
|
32
37
|
const paystack = new Paystack('secret_key');
|
|
33
38
|
```
|
|
34
39
|
|
|
@@ -56,14 +61,20 @@ All methods use promise meaning you can either use the `async...await` or `then.
|
|
|
56
61
|
- [x] Transaction Splits
|
|
57
62
|
- [x] Settlements
|
|
58
63
|
- [x] Invoices
|
|
59
|
-
- [x]
|
|
64
|
+
- [x] Transfer Recipients
|
|
60
65
|
- [x] Transfers Control
|
|
61
66
|
- [x] Bulk Charges
|
|
62
|
-
- [ ] Control Panel
|
|
63
|
-
- [ ] Disputes
|
|
64
67
|
- [x] Refunds
|
|
65
68
|
- [x] Verification
|
|
66
69
|
- [x] Miscellaneous
|
|
70
|
+
- [ ] Disputes
|
|
71
|
+
- [ ] Control Panel
|
|
72
|
+
- [ ] Terminal
|
|
73
|
+
- [ ] Virtual Terminal
|
|
74
|
+
- [ ] Direct Debit
|
|
75
|
+
- [ ] Payment Pages
|
|
76
|
+
- [ ] Payment Requests
|
|
77
|
+
- [ ] Integration
|
|
67
78
|
|
|
68
79
|
## CONTRIBUTING
|
|
69
80
|
|
package/dist/paystack.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ import { Misc } from './misc/misc';
|
|
|
21
21
|
* Paystack SDK
|
|
22
22
|
* @author Asaju Enitan <@tPriest>
|
|
23
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated This named export is deprecated and will be removed
|
|
26
|
+
* in version `4.0.0`.
|
|
27
|
+
* Use the default export instead:
|
|
28
|
+
* Use `import Paystack from 'paystack-sdk'`
|
|
29
|
+
*/
|
|
24
30
|
export declare class Paystack {
|
|
25
31
|
private readonly key;
|
|
26
32
|
private readonly http;
|
package/dist/paystack.js
CHANGED
|
@@ -28,6 +28,12 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
28
28
|
* Paystack SDK
|
|
29
29
|
* @author Asaju Enitan <@tPriest>
|
|
30
30
|
*/
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated This named export is deprecated and will be removed
|
|
33
|
+
* in version `4.0.0`.
|
|
34
|
+
* Use the default export instead:
|
|
35
|
+
* Use `import Paystack from 'paystack-sdk'`
|
|
36
|
+
*/
|
|
31
37
|
class Paystack {
|
|
32
38
|
constructor(key) {
|
|
33
39
|
this.key = key;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Customer } from '../customer/interface';
|
|
1
2
|
import { Currency, QueryParams, Response } from '../interface';
|
|
2
3
|
import { Transaction } from '../transaction/interface';
|
|
3
|
-
export
|
|
4
|
+
export type CreateRefund = {
|
|
4
5
|
/**
|
|
5
6
|
* Transaction reference or id
|
|
6
7
|
*/
|
|
@@ -23,26 +24,43 @@ export interface CreateRefund {
|
|
|
23
24
|
* Merchant reason
|
|
24
25
|
*/
|
|
25
26
|
merchant_note?: string;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
27
|
+
};
|
|
28
|
+
export type ListRefundQueryParams = QueryParams & {
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
+
* Any of the [supported currency](https://paystack.com/docs/api/#supported-currency)
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
currency: Currency;
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
+
* The transaction ID of the refunded transaction
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
export
|
|
36
|
+
transaction: string;
|
|
37
|
+
};
|
|
38
|
+
export type RetryAccountDetails = {
|
|
39
|
+
/**
|
|
40
|
+
* The currency of the customer's bank account. It should be the same as the currency the payment was made
|
|
41
|
+
*/
|
|
42
|
+
currency: string;
|
|
43
|
+
/**
|
|
44
|
+
* The customer's account number
|
|
45
|
+
*/
|
|
46
|
+
account_number: string;
|
|
47
|
+
/**
|
|
48
|
+
* The ID representing the customer's bank. You can get the list of bank IDs by calling the List Banks endpoint.
|
|
49
|
+
*/
|
|
50
|
+
bank_id: string;
|
|
51
|
+
};
|
|
52
|
+
export type ListRefundsResponse = Response & {
|
|
38
53
|
data: Refund[];
|
|
39
|
-
}
|
|
40
|
-
export
|
|
54
|
+
};
|
|
55
|
+
export type RefundCreatedResponse = Response & {
|
|
41
56
|
data: Refund;
|
|
42
|
-
}
|
|
43
|
-
export
|
|
57
|
+
};
|
|
58
|
+
export type FetchRefundResponse = Response & {
|
|
44
59
|
data: Refund;
|
|
45
|
-
}
|
|
60
|
+
};
|
|
61
|
+
export type RetryRefundResponse = Response & {
|
|
62
|
+
data: Refund;
|
|
63
|
+
};
|
|
46
64
|
export interface Refund {
|
|
47
65
|
id: number;
|
|
48
66
|
integration: number;
|
|
@@ -55,12 +73,18 @@ export interface Refund {
|
|
|
55
73
|
channel: string;
|
|
56
74
|
fully_deducted: boolean;
|
|
57
75
|
refunded_by: string;
|
|
58
|
-
refunded_at?:
|
|
59
|
-
expected_at:
|
|
76
|
+
refunded_at?: Date;
|
|
77
|
+
expected_at: Date;
|
|
60
78
|
settlement: number;
|
|
61
79
|
customer_note: string;
|
|
62
80
|
merchant_note: string;
|
|
63
|
-
createdAt:
|
|
64
|
-
updatedAt:
|
|
65
|
-
status:
|
|
81
|
+
createdAt: Date;
|
|
82
|
+
updatedAt: Date;
|
|
83
|
+
status: 'pending' | 'processing' | 'needs-attention';
|
|
84
|
+
bank_reference?: string;
|
|
85
|
+
reason: string;
|
|
86
|
+
customer?: Customer;
|
|
87
|
+
initiated_at: string;
|
|
88
|
+
reversed_at?: Date;
|
|
89
|
+
session_id?: string;
|
|
66
90
|
}
|
package/dist/refund/refund.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
-
import { FetchRefundResponse, CreateRefund, ListRefundQueryParams, ListRefundsResponse, RefundCreatedResponse } from './interface';
|
|
2
|
+
import { FetchRefundResponse, CreateRefund, ListRefundQueryParams, ListRefundsResponse, RefundCreatedResponse, RetryRefundResponse, RetryAccountDetails } from './interface';
|
|
3
3
|
import { BadRequest } from '../interface';
|
|
4
4
|
export declare class Refund {
|
|
5
5
|
private http;
|
|
6
6
|
constructor(http: Axios);
|
|
7
7
|
/**
|
|
8
|
-
* #### Create Refund
|
|
9
8
|
* Initiate a refund on your integration
|
|
10
9
|
*/
|
|
11
10
|
create(data: CreateRefund): Promise<RefundCreatedResponse | BadRequest>;
|
|
12
11
|
/**
|
|
13
|
-
* #### List Refunds
|
|
14
12
|
* List refunds available on your integration
|
|
15
13
|
*/
|
|
16
14
|
list(queryParams?: ListRefundQueryParams): Promise<ListRefundsResponse | BadRequest>;
|
|
17
15
|
/**
|
|
18
|
-
* #### Fetch Refund
|
|
19
16
|
* Get details of a refund on your integration
|
|
20
17
|
*/
|
|
21
|
-
fetch(
|
|
18
|
+
fetch(id: number): Promise<FetchRefundResponse | BadRequest>;
|
|
19
|
+
retry(id: number, data: RetryAccountDetails): Promise<RetryRefundResponse | BadRequest>;
|
|
22
20
|
}
|
package/dist/refund/refund.js
CHANGED
|
@@ -6,14 +6,12 @@ class Refund {
|
|
|
6
6
|
this.http = http;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* #### Create Refund
|
|
10
9
|
* Initiate a refund on your integration
|
|
11
10
|
*/
|
|
12
11
|
async create(data) {
|
|
13
12
|
return await this.http.post('/refund', JSON.stringify(data));
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
|
-
* #### List Refunds
|
|
17
15
|
* List refunds available on your integration
|
|
18
16
|
*/
|
|
19
17
|
async list(queryParams) {
|
|
@@ -22,11 +20,15 @@ class Refund {
|
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
|
-
* #### Fetch Refund
|
|
26
23
|
* Get details of a refund on your integration
|
|
27
24
|
*/
|
|
28
|
-
async fetch(
|
|
29
|
-
return await this.http.get(`/refund/${
|
|
25
|
+
async fetch(id) {
|
|
26
|
+
return await this.http.get(`/refund/${id}`);
|
|
27
|
+
}
|
|
28
|
+
async retry(id, data) {
|
|
29
|
+
return await this.http.post(`/refund/retry_with_customer_details/${id}`, {
|
|
30
|
+
refund_account_details: data,
|
|
31
|
+
});
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
exports.Refund = Refund;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paystack-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Paystack SDK written in Typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Tech Priest",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"lint": "eslint . --ext .ts",
|
|
13
13
|
"prepare": "npm run build",
|
|
14
14
|
"prepublishOnly": "npm run lint",
|
|
15
|
-
"preversion": "npm run lint",
|
|
16
|
-
"version": "npm run format && git add -A src",
|
|
15
|
+
"preversion": "npm run format && npm run lint && git add -A src",
|
|
17
16
|
"postversion": "git push && git push --tags",
|
|
18
17
|
"test": "jest"
|
|
19
18
|
},
|
|
@@ -41,7 +40,9 @@
|
|
|
41
40
|
"Paystack",
|
|
42
41
|
"Typescript",
|
|
43
42
|
"payment",
|
|
44
|
-
"node"
|
|
43
|
+
"node",
|
|
44
|
+
"API",
|
|
45
|
+
"naira"
|
|
45
46
|
],
|
|
46
47
|
"repository": {
|
|
47
48
|
"type": "git",
|