paystack-sdk 2.5.11 → 2.5.12
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/interface.d.ts +9 -0
- package/dist/paystack.d.ts +2 -0
- package/dist/paystack.js +2 -0
- package/dist/refund/interface.d.ts +66 -0
- package/dist/refund/interface.js +2 -0
- package/dist/refund/refund.d.ts +22 -0
- package/dist/refund/refund.js +47 -0
- package/dist/transfer/transfer.d.ts +1 -1
- package/dist/verification/interface.d.ts +5 -15
- package/dist/verification/interface.js +0 -12
- package/dist/verification/verification.d.ts +8 -13
- package/dist/verification/verification.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ For Typescript
|
|
|
19
19
|
```typescript
|
|
20
20
|
import {Paystack} from 'paystack-sdk';
|
|
21
21
|
|
|
22
|
-
const paystack = new Paystack("secret_key);
|
|
22
|
+
const paystack = new Paystack("secret_key");
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
For Javscript
|
|
@@ -58,7 +58,7 @@ All methods use promise meaning you can either use the `async...await` or `then.
|
|
|
58
58
|
- [x] Bulk Charges
|
|
59
59
|
- [ ] Control Panel
|
|
60
60
|
- [ ] Disputes
|
|
61
|
-
- [
|
|
61
|
+
- [x] Refunds
|
|
62
62
|
- [x] Verification
|
|
63
63
|
- [ ] Miscellaneous
|
|
64
64
|
|
package/dist/interface.d.ts
CHANGED
|
@@ -34,3 +34,12 @@ export interface QueryParams {
|
|
|
34
34
|
*/
|
|
35
35
|
to?: Date;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Paystack makes use of the ISO 4217 format for currency codes.
|
|
39
|
+
* When sending an amount, it must be sent in the subunit of that currency.
|
|
40
|
+
*
|
|
41
|
+
* Sending an amount in subunits simply means multiplying the base amount by 100.
|
|
42
|
+
* For example, if a customer is supposed to make a payment of NGN 100,
|
|
43
|
+
* you would send 10000 = 100 * 100 in your request.
|
|
44
|
+
*/
|
|
45
|
+
export declare type Currency = 'NGN' | 'USD' | 'GHS' | 'ZAR' | 'KES';
|
package/dist/paystack.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { Transaction } from './transaction/transaction';
|
|
|
15
15
|
import { Transfer } from './transfer/transfer';
|
|
16
16
|
import { BulkCharge } from './bulkcharge/bulkcharge';
|
|
17
17
|
import { Verification } from './verification/verification';
|
|
18
|
+
import { Refund } from './refund/refund';
|
|
18
19
|
/**
|
|
19
20
|
* Paystack SDK
|
|
20
21
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -38,6 +39,7 @@ export declare class Paystack {
|
|
|
38
39
|
invoice: Invoice;
|
|
39
40
|
settlement: Settlement;
|
|
40
41
|
recipient: Recipient;
|
|
42
|
+
refund: Refund;
|
|
41
43
|
verification: Verification;
|
|
42
44
|
constructor(key: string);
|
|
43
45
|
}
|
package/dist/paystack.js
CHANGED
|
@@ -19,6 +19,7 @@ const transaction_1 = require("./transaction/transaction");
|
|
|
19
19
|
const transfer_1 = require("./transfer/transfer");
|
|
20
20
|
const bulkcharge_1 = require("./bulkcharge/bulkcharge");
|
|
21
21
|
const verification_1 = require("./verification/verification");
|
|
22
|
+
const refund_1 = require("./refund/refund");
|
|
22
23
|
/**
|
|
23
24
|
* Paystack SDK
|
|
24
25
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -50,6 +51,7 @@ class Paystack {
|
|
|
50
51
|
this.invoice = new invoice_1.Invoice(this.http);
|
|
51
52
|
this.settlement = new settlement_1.Settlement(this.http);
|
|
52
53
|
this.recipient = new recipient_1.Recipient(this.http);
|
|
54
|
+
this.refund = new refund_1.Refund(this.http);
|
|
53
55
|
this.verification = new verification_1.Verification(this.http);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Currency, QueryParams, Response } from '../interface';
|
|
2
|
+
import { Transaction } from '../transaction/interface';
|
|
3
|
+
export interface CreateRefund {
|
|
4
|
+
/**
|
|
5
|
+
* Transaction reference or id
|
|
6
|
+
*/
|
|
7
|
+
transaction: string;
|
|
8
|
+
/**
|
|
9
|
+
* Amount to be refunded to the customer.
|
|
10
|
+
* Amount is optional(defaults to original transaction amount)
|
|
11
|
+
* and cannot be more than the original transaction amount.
|
|
12
|
+
*/
|
|
13
|
+
amount?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Any of the supported currency
|
|
16
|
+
*/
|
|
17
|
+
currency?: Currency;
|
|
18
|
+
/**
|
|
19
|
+
* Customer reason
|
|
20
|
+
*/
|
|
21
|
+
customer_note?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Merchant reason
|
|
24
|
+
*/
|
|
25
|
+
merchant_note?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ListRefundQueryParams extends QueryParams {
|
|
28
|
+
/**
|
|
29
|
+
* Identifier for transaction to be refunded
|
|
30
|
+
*/
|
|
31
|
+
reference: string;
|
|
32
|
+
/**
|
|
33
|
+
* Any of the supported currency
|
|
34
|
+
*/
|
|
35
|
+
currency: Currency;
|
|
36
|
+
}
|
|
37
|
+
export interface ListRefundsResponse extends Response {
|
|
38
|
+
data: Refund[];
|
|
39
|
+
}
|
|
40
|
+
export interface RefundCreatedResponse extends Response {
|
|
41
|
+
data: Refund;
|
|
42
|
+
}
|
|
43
|
+
export interface FetchRefundResponse extends Response {
|
|
44
|
+
data: Refund;
|
|
45
|
+
}
|
|
46
|
+
export interface Refund {
|
|
47
|
+
id: number;
|
|
48
|
+
integration: number;
|
|
49
|
+
domain: string;
|
|
50
|
+
transaction: number | Transaction;
|
|
51
|
+
dispute: number;
|
|
52
|
+
amount: number;
|
|
53
|
+
deducted_amount: number;
|
|
54
|
+
currency: string;
|
|
55
|
+
channel: string;
|
|
56
|
+
fully_deducted: boolean;
|
|
57
|
+
refunded_by: string;
|
|
58
|
+
refunded_at?: string;
|
|
59
|
+
expected_at: string;
|
|
60
|
+
settlement: number;
|
|
61
|
+
customer_note: string;
|
|
62
|
+
merchant_note: string;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
status: string;
|
|
66
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { FetchRefundResponse, CreateRefund, ListRefundQueryParams, ListRefundsResponse, RefundCreatedResponse } from './interface';
|
|
3
|
+
import { BadRequest } from '../interface';
|
|
4
|
+
export declare class Refund {
|
|
5
|
+
private http;
|
|
6
|
+
constructor(http: Axios);
|
|
7
|
+
/**
|
|
8
|
+
* #### Create Refund
|
|
9
|
+
* Initiate a refund on your integration
|
|
10
|
+
*/
|
|
11
|
+
create(data: CreateRefund): Promise<RefundCreatedResponse | BadRequest>;
|
|
12
|
+
/**
|
|
13
|
+
* #### List Refunds
|
|
14
|
+
* List refunds available on your integration
|
|
15
|
+
*/
|
|
16
|
+
list(queryParams?: ListRefundQueryParams): Promise<ListRefundsResponse | BadRequest>;
|
|
17
|
+
/**
|
|
18
|
+
* #### Fetch Refund
|
|
19
|
+
* Get details of a refund on your integration
|
|
20
|
+
*/
|
|
21
|
+
fetch(reference: string): Promise<FetchRefundResponse | BadRequest>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.Refund = void 0;
|
|
13
|
+
class Refund {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* #### Create Refund
|
|
19
|
+
* Initiate a refund on your integration
|
|
20
|
+
*/
|
|
21
|
+
create(data) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return yield this.http.post('/refund', JSON.stringify(data));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* #### List Refunds
|
|
28
|
+
* List refunds available on your integration
|
|
29
|
+
*/
|
|
30
|
+
list(queryParams) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return yield this.http.get('/refund', {
|
|
33
|
+
params: Object.assign({}, queryParams),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* #### Fetch Refund
|
|
39
|
+
* Get details of a refund on your integration
|
|
40
|
+
*/
|
|
41
|
+
fetch(reference) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return yield this.http.get(`/refund/${reference}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Refund = Refund;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
status: boolean;
|
|
3
|
-
message: string;
|
|
4
|
-
}
|
|
1
|
+
import { Response } from '../interface';
|
|
5
2
|
export interface ResolveAccount {
|
|
6
3
|
/**
|
|
7
4
|
* Account Number
|
|
@@ -13,15 +10,8 @@ export interface ResolveAccount {
|
|
|
13
10
|
*/
|
|
14
11
|
bank_code: string;
|
|
15
12
|
}
|
|
16
|
-
export declare
|
|
17
|
-
|
|
18
|
-
business = "business"
|
|
19
|
-
}
|
|
20
|
-
export declare enum DocumentType {
|
|
21
|
-
idNumber = "identityNumber",
|
|
22
|
-
passportNumber = "passportNumber",
|
|
23
|
-
businessRegNumber = "businessRegistrationNumber"
|
|
24
|
-
}
|
|
13
|
+
export declare type AccountType = 'personal' | 'business';
|
|
14
|
+
export declare type DocumentType = 'identityNumber' | 'passportNumber' | 'businessRegistrationNumber';
|
|
25
15
|
export interface AccountResolved extends Response {
|
|
26
16
|
data: {
|
|
27
17
|
/**
|
|
@@ -68,7 +58,7 @@ export interface ValidateAccount {
|
|
|
68
58
|
*/
|
|
69
59
|
document_number: string;
|
|
70
60
|
}
|
|
71
|
-
export interface
|
|
61
|
+
export interface AccountVerifiedResponse extends Response {
|
|
72
62
|
data: {
|
|
73
63
|
/**
|
|
74
64
|
* Verification Status
|
|
@@ -80,7 +70,7 @@ export interface AccountVerified extends Response {
|
|
|
80
70
|
verificationMessage: string;
|
|
81
71
|
};
|
|
82
72
|
}
|
|
83
|
-
export interface
|
|
73
|
+
export interface BinResolvedResponse extends Response {
|
|
84
74
|
data: {
|
|
85
75
|
bin: string;
|
|
86
76
|
brand: string;
|
|
@@ -1,14 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentType = exports.AccountType = void 0;
|
|
4
|
-
var AccountType;
|
|
5
|
-
(function (AccountType) {
|
|
6
|
-
AccountType["personal"] = "personal";
|
|
7
|
-
AccountType["business"] = "business";
|
|
8
|
-
})(AccountType = exports.AccountType || (exports.AccountType = {}));
|
|
9
|
-
var DocumentType;
|
|
10
|
-
(function (DocumentType) {
|
|
11
|
-
DocumentType["idNumber"] = "identityNumber";
|
|
12
|
-
DocumentType["passportNumber"] = "passportNumber";
|
|
13
|
-
DocumentType["businessRegNumber"] = "businessRegistrationNumber";
|
|
14
|
-
})(DocumentType = exports.DocumentType || (exports.DocumentType = {}));
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
-
import { ResolveAccount, AccountResolved, ValidateAccount,
|
|
3
|
-
|
|
4
|
-
status: boolean;
|
|
5
|
-
message: string;
|
|
6
|
-
data: null;
|
|
7
|
-
}
|
|
2
|
+
import { ResolveAccount, AccountResolved, ValidateAccount, AccountVerifiedResponse, BinResolvedResponse } from './interface';
|
|
3
|
+
import { BadRequest } from '../interface';
|
|
8
4
|
/**
|
|
9
|
-
*
|
|
5
|
+
* ## Verification
|
|
10
6
|
* The Verification API allows you perform KYC processes.
|
|
11
7
|
*/
|
|
12
8
|
export declare class Verification {
|
|
13
9
|
private http;
|
|
14
10
|
constructor(http: Axios);
|
|
15
11
|
/**
|
|
16
|
-
*
|
|
12
|
+
* #### Resolve Account
|
|
17
13
|
* Confirm an account belongs to the right customer
|
|
18
14
|
* @param {ResolveAccount} data **Query Param**
|
|
19
15
|
*/
|
|
20
16
|
resolveAccount(data: ResolveAccount): Promise<AccountResolved | BadRequest>;
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
18
|
+
* #### Validate Account
|
|
23
19
|
* Confirm the authenticity of a customer's account number
|
|
24
20
|
* before sending money
|
|
25
21
|
* @param {ValidateAccount} data **Data Param**
|
|
26
22
|
*/
|
|
27
|
-
validateAccount(data: ValidateAccount): Promise<
|
|
23
|
+
validateAccount(data: ValidateAccount): Promise<AccountVerifiedResponse | BadRequest>;
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* #### Resolve Card BIN
|
|
30
26
|
* Get more information about a customer's card
|
|
31
27
|
* using the first 6 characters of the card
|
|
32
28
|
* @param {string} bin **Path Param**
|
|
33
29
|
*/
|
|
34
|
-
resolveCard(bin: number): Promise<
|
|
30
|
+
resolveCard(bin: number): Promise<BinResolvedResponse | BadRequest>;
|
|
35
31
|
}
|
|
36
|
-
export {};
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Verification = void 0;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* ## Verification
|
|
15
15
|
* The Verification API allows you perform KYC processes.
|
|
16
16
|
*/
|
|
17
17
|
class Verification {
|
|
@@ -19,7 +19,7 @@ class Verification {
|
|
|
19
19
|
this.http = http;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* #### Resolve Account
|
|
23
23
|
* Confirm an account belongs to the right customer
|
|
24
24
|
* @param {ResolveAccount} data **Query Param**
|
|
25
25
|
*/
|
|
@@ -29,7 +29,7 @@ class Verification {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* #### Validate Account
|
|
33
33
|
* Confirm the authenticity of a customer's account number
|
|
34
34
|
* before sending money
|
|
35
35
|
* @param {ValidateAccount} data **Data Param**
|
|
@@ -40,7 +40,7 @@ class Verification {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* #### Resolve Card BIN
|
|
44
44
|
* Get more information about a customer's card
|
|
45
45
|
* using the first 6 characters of the card
|
|
46
46
|
* @param {string} bin **Path Param**
|