paystack-sdk 2.5.6 → 2.5.10
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/paystack.d.ts +4 -0
- package/dist/paystack.js +4 -0
- package/dist/plan/plan.js +4 -8
- package/dist/transaction/transaction.d.ts +1 -1
- package/dist/verification/interface.d.ts +94 -0
- package/dist/verification/interface.js +14 -0
- package/dist/verification/verification.d.ts +36 -0
- package/dist/verification/verification.js +54 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/paystack.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ import { SubAccount } from './subaccounts/subaccount';
|
|
|
13
13
|
import { Subscription } from './subscription/subscription';
|
|
14
14
|
import { Transaction } from './transaction/transaction';
|
|
15
15
|
import { Transfer } from './transfer/transfer';
|
|
16
|
+
import { BulkCharge } from './bulkcharge/bulkcharge';
|
|
17
|
+
import { Verification } from './verification/verification';
|
|
16
18
|
/**
|
|
17
19
|
* Paystack SDK
|
|
18
20
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -20,6 +22,7 @@ import { Transfer } from './transfer/transfer';
|
|
|
20
22
|
export declare class Paystack {
|
|
21
23
|
private readonly key;
|
|
22
24
|
private readonly http;
|
|
25
|
+
bulkcharge: BulkCharge;
|
|
23
26
|
charge: Charge;
|
|
24
27
|
customer: Customer;
|
|
25
28
|
dedicated: DedicatedAccount;
|
|
@@ -35,5 +38,6 @@ export declare class Paystack {
|
|
|
35
38
|
invoice: Invoice;
|
|
36
39
|
settlement: Settlement;
|
|
37
40
|
recipient: Recipient;
|
|
41
|
+
verification: Verification;
|
|
38
42
|
constructor(key: string);
|
|
39
43
|
}
|
package/dist/paystack.js
CHANGED
|
@@ -17,6 +17,8 @@ const subaccount_1 = require("./subaccounts/subaccount");
|
|
|
17
17
|
const subscription_1 = require("./subscription/subscription");
|
|
18
18
|
const transaction_1 = require("./transaction/transaction");
|
|
19
19
|
const transfer_1 = require("./transfer/transfer");
|
|
20
|
+
const bulkcharge_1 = require("./bulkcharge/bulkcharge");
|
|
21
|
+
const verification_1 = require("./verification/verification");
|
|
20
22
|
/**
|
|
21
23
|
* Paystack SDK
|
|
22
24
|
* @author Asaju Enitan <@tPriest>
|
|
@@ -32,6 +34,7 @@ class Paystack {
|
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
this.http.interceptors.response.use((response) => (response.data = JSON.parse(response.data)));
|
|
37
|
+
this.bulkcharge = new bulkcharge_1.BulkCharge(this.http);
|
|
35
38
|
this.charge = new charge_1.Charge(this.http);
|
|
36
39
|
this.customer = new customer_1.Customer(this.http);
|
|
37
40
|
this.dedicated = new dedicated_1.DedicatedAccount(this.http);
|
|
@@ -47,6 +50,7 @@ class Paystack {
|
|
|
47
50
|
this.invoice = new invoice_1.Invoice(this.http);
|
|
48
51
|
this.settlement = new settlement_1.Settlement(this.http);
|
|
49
52
|
this.recipient = new recipient_1.Recipient(this.http);
|
|
53
|
+
this.verification = new verification_1.Verification(this.http);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
exports.Paystack = Paystack;
|
package/dist/plan/plan.js
CHANGED
|
@@ -28,8 +28,7 @@ class Plan {
|
|
|
28
28
|
*/
|
|
29
29
|
create(data) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
|
|
32
|
-
return JSON.parse(response.data);
|
|
31
|
+
return yield this.http.post('/plan', JSON.stringify(data));
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
@@ -40,10 +39,9 @@ class Plan {
|
|
|
40
39
|
*/
|
|
41
40
|
list(queryParams) {
|
|
42
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
42
|
+
return yield this.http.get('/plan', {
|
|
44
43
|
params: Object.assign({}, queryParams),
|
|
45
44
|
});
|
|
46
|
-
return JSON.parse(response.data);
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
@@ -54,8 +52,7 @@ class Plan {
|
|
|
54
52
|
*/
|
|
55
53
|
fetch(id) {
|
|
56
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
|
|
58
|
-
return JSON.parse(response.data);
|
|
55
|
+
return yield this.http.get(`/plan/${id}`);
|
|
59
56
|
});
|
|
60
57
|
}
|
|
61
58
|
/**
|
|
@@ -67,8 +64,7 @@ class Plan {
|
|
|
67
64
|
*/
|
|
68
65
|
update(id, data) {
|
|
69
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
|
|
71
|
-
return JSON.parse(response.data);
|
|
67
|
+
return yield this.http.put(`/plan/${id}`, JSON.stringify(data));
|
|
72
68
|
});
|
|
73
69
|
}
|
|
74
70
|
}
|
|
@@ -19,7 +19,7 @@ export declare class Transaction {
|
|
|
19
19
|
* @param {InitializeTransaction} data **Body Param**
|
|
20
20
|
*/
|
|
21
21
|
initialize(data: InitializeTransaction): Promise<TransactionInitialized | BadRequest>;
|
|
22
|
-
verify(reference:
|
|
22
|
+
verify(reference: string): Promise<GetTransactionResponse | BadRequest>;
|
|
23
23
|
list(queryParams?: ListTransactionQueryParams): Promise<ListTransactions | BadRequest>;
|
|
24
24
|
fetch(id: string): Promise<GetTransactionResponse | BadRequest>;
|
|
25
25
|
chargeAuthorization(data: ChargeAuthorization): Promise<GetTransactionResponse | BadRequest>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export interface Response {
|
|
2
|
+
status: boolean;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ResolveAccount {
|
|
6
|
+
/**
|
|
7
|
+
* Account Number
|
|
8
|
+
*/
|
|
9
|
+
account_number: string;
|
|
10
|
+
/**
|
|
11
|
+
* You can get the list of bank codes
|
|
12
|
+
* by calling the List Banks endpoint
|
|
13
|
+
*/
|
|
14
|
+
bank_code: string;
|
|
15
|
+
}
|
|
16
|
+
export declare enum AccountType {
|
|
17
|
+
personal = "personal",
|
|
18
|
+
business = "business"
|
|
19
|
+
}
|
|
20
|
+
export declare enum DocumentType {
|
|
21
|
+
idNumber = "identityNumber",
|
|
22
|
+
passportNumber = "passportNumber",
|
|
23
|
+
businessRegNumber = "businessRegistrationNumber"
|
|
24
|
+
}
|
|
25
|
+
export interface AccountResolved extends Response {
|
|
26
|
+
data: {
|
|
27
|
+
/**
|
|
28
|
+
* Verified Account Number
|
|
29
|
+
*/
|
|
30
|
+
account_number: string;
|
|
31
|
+
/**
|
|
32
|
+
* Verified Account Name
|
|
33
|
+
*/
|
|
34
|
+
account_name: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface ValidateAccount {
|
|
38
|
+
/**
|
|
39
|
+
* The bank code of the customer’s bank.
|
|
40
|
+
* You can fetch the bank codes
|
|
41
|
+
* by using our List Banks endpoint
|
|
42
|
+
*/
|
|
43
|
+
bank_code: string;
|
|
44
|
+
/**
|
|
45
|
+
* The two digit ISO code of the customer’s bank
|
|
46
|
+
*/
|
|
47
|
+
country_code: string;
|
|
48
|
+
/**
|
|
49
|
+
* Customer’s account number
|
|
50
|
+
*/
|
|
51
|
+
account_number: string;
|
|
52
|
+
/**
|
|
53
|
+
* Customer's first and last name registered with their bank
|
|
54
|
+
*/
|
|
55
|
+
account_name: string;
|
|
56
|
+
/**
|
|
57
|
+
* This can take one of: [ personal, business ]
|
|
58
|
+
*/
|
|
59
|
+
account_type: AccountType;
|
|
60
|
+
/**
|
|
61
|
+
* Customer’s mode of identity.
|
|
62
|
+
* This could be one of:
|
|
63
|
+
* [ identityNumber, passportNumber, businessRegistrationNumber ]
|
|
64
|
+
*/
|
|
65
|
+
document_type: DocumentType;
|
|
66
|
+
/**
|
|
67
|
+
* Customer’s mode of identity number
|
|
68
|
+
*/
|
|
69
|
+
document_number: string;
|
|
70
|
+
}
|
|
71
|
+
export interface AccountVerified extends Response {
|
|
72
|
+
data: {
|
|
73
|
+
/**
|
|
74
|
+
* Verification Status
|
|
75
|
+
*/
|
|
76
|
+
verified: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Verification Message
|
|
79
|
+
*/
|
|
80
|
+
verificationMessage: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface BinResolved extends Response {
|
|
84
|
+
data: {
|
|
85
|
+
bin: string;
|
|
86
|
+
brand: string;
|
|
87
|
+
sub_brand: string;
|
|
88
|
+
country_code: string;
|
|
89
|
+
country_name: string;
|
|
90
|
+
card_type: string;
|
|
91
|
+
bank: string;
|
|
92
|
+
linked_bank_id: number;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
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 = {}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { ResolveAccount, AccountResolved, ValidateAccount, AccountVerified, BinResolved } from './interface';
|
|
3
|
+
interface BadRequest {
|
|
4
|
+
status: boolean;
|
|
5
|
+
message: string;
|
|
6
|
+
data: null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* # Verification
|
|
10
|
+
* The Verification API allows you perform KYC processes.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Verification {
|
|
13
|
+
private http;
|
|
14
|
+
constructor(http: Axios);
|
|
15
|
+
/**
|
|
16
|
+
* # Resolve Account
|
|
17
|
+
* Confirm an account belongs to the right customer
|
|
18
|
+
* @param {ResolveAccount} data **Query Param**
|
|
19
|
+
*/
|
|
20
|
+
resolveAccount(data: ResolveAccount): Promise<AccountResolved | BadRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* # Validate Account
|
|
23
|
+
* Confirm the authenticity of a customer's account number
|
|
24
|
+
* before sending money
|
|
25
|
+
* @param {ValidateAccount} data **Data Param**
|
|
26
|
+
*/
|
|
27
|
+
validateAccount(data: ValidateAccount): Promise<AccountVerified | BadRequest>;
|
|
28
|
+
/**
|
|
29
|
+
* # Resolve Card BIN
|
|
30
|
+
* Get more information about a customer's card
|
|
31
|
+
* using the first 6 characters of the card
|
|
32
|
+
* @param {string} bin **Path Param**
|
|
33
|
+
*/
|
|
34
|
+
resolveCard(bin: number): Promise<BinResolved | BadRequest>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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.Verification = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* # Verification
|
|
15
|
+
* The Verification API allows you perform KYC processes.
|
|
16
|
+
*/
|
|
17
|
+
class Verification {
|
|
18
|
+
constructor(http) {
|
|
19
|
+
this.http = http;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* # Resolve Account
|
|
23
|
+
* Confirm an account belongs to the right customer
|
|
24
|
+
* @param {ResolveAccount} data **Query Param**
|
|
25
|
+
*/
|
|
26
|
+
resolveAccount(data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return yield this.http.get('/bank/resolve', { params: Object.assign({}, data) });
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* # Validate Account
|
|
33
|
+
* Confirm the authenticity of a customer's account number
|
|
34
|
+
* before sending money
|
|
35
|
+
* @param {ValidateAccount} data **Data Param**
|
|
36
|
+
*/
|
|
37
|
+
validateAccount(data) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.http.post('/bank/validate', JSON.stringify(data));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* # Resolve Card BIN
|
|
44
|
+
* Get more information about a customer's card
|
|
45
|
+
* using the first 6 characters of the card
|
|
46
|
+
* @param {string} bin **Path Param**
|
|
47
|
+
*/
|
|
48
|
+
resolveCard(bin) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
return yield this.http.get(`/decision/bin/${bin}`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.Verification = Verification;
|