paystack-sdk 3.6.0 → 3.7.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 +25 -18
- package/dist/dedicated/dedicated.d.ts +2 -1
- package/dist/dedicated/dedicated.js +3 -0
- package/dist/dedicated/interface.d.ts +16 -0
- package/dist/misc/interface.d.ts +1 -1
- package/dist/paystack.d.ts +0 -6
- package/dist/paystack.js +0 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
#### Why Another [Paystack](https://paystack.com) Package?
|
|
4
4
|
|
|
5
|
-
Existing Paystack libraries are either outdated, lack modern features, or fail to support TypeScript. This package addresses these gaps by providing:
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
5
|
+
Existing Paystack libraries are either outdated, lack modern features, or fail to support TypeScript. This package addresses these gaps by providing:
|
|
6
|
+
|
|
7
|
+
- Full TypeScript support for type safety and better developer experience.
|
|
8
|
+
- A modern, actively maintained library aligned with Paystack’s latest API updates.
|
|
9
|
+
- Clean, intuitive APIs designed for ease of use.
|
|
10
|
+
|
|
11
|
+
## Deprecation Notice
|
|
12
|
+
|
|
13
|
+
Named import will be removed in version 4.0.0. Migrate to default import.
|
|
14
|
+
Change
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Paystack } from 'paystack-sdk';
|
|
18
|
+
const Paystack = require('paystack-sdk').Paystack;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import Paystack from 'paystack-sdk';
|
|
25
|
+
const Paystack = require('paystack-sdk');
|
|
26
|
+
```
|
|
9
27
|
|
|
10
28
|
### Installation
|
|
11
29
|
|
|
@@ -19,31 +37,20 @@ For NPM
|
|
|
19
37
|
|
|
20
38
|
For Typescript
|
|
21
39
|
|
|
22
|
-
```
|
|
23
|
-
import {Paystack} from 'paystack-sdk';
|
|
24
|
-
// or
|
|
40
|
+
```ts
|
|
25
41
|
import Paystack from 'paystack-sdk';
|
|
26
42
|
|
|
27
|
-
const paystack = new Paystack(
|
|
43
|
+
const paystack = new Paystack('secret_key');
|
|
28
44
|
```
|
|
29
45
|
|
|
30
46
|
For Javscript
|
|
31
47
|
|
|
32
|
-
```
|
|
33
|
-
const Paystack = require('paystack-sdk').Paystack;
|
|
34
|
-
// or
|
|
48
|
+
```js
|
|
35
49
|
const Paystack = require('paystack-sdk');
|
|
36
50
|
|
|
37
51
|
const paystack = new Paystack('secret_key');
|
|
38
52
|
```
|
|
39
53
|
|
|
40
|
-
OR
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
const { Paystack } = require('paystack-sdk');
|
|
44
|
-
const paystack = new Paystack('secret_key');
|
|
45
|
-
```
|
|
46
|
-
|
|
47
54
|
All methods use promise meaning you can either use the `async...await` or `then...catch` or `try...catch`
|
|
48
55
|
|
|
49
56
|
### Modules
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
-
import { CreateDedicatedVirtualAccount, DeactivateDedicatedAccountResponse, DedicatedAccountCreatedResponse, FetchBankProvidersResponse, FetchDedicatedVirtualAccountResponse, ListDedicatedVirtualAccountsQueryParams, ListDedicatedVirtualAccountsResponse, RemoveSplitDedicatedAccountResponse, SplitDedicatedAccountTransaction, SplitDedicatedAccountTransactionResponse } from './interface';
|
|
2
|
+
import { AssignDedicatedVirtualAccount, CreateDedicatedVirtualAccount, DeactivateDedicatedAccountResponse, DedicatedAccountAssignedResponse, DedicatedAccountCreatedResponse, FetchBankProvidersResponse, FetchDedicatedVirtualAccountResponse, ListDedicatedVirtualAccountsQueryParams, ListDedicatedVirtualAccountsResponse, RemoveSplitDedicatedAccountResponse, SplitDedicatedAccountTransaction, SplitDedicatedAccountTransactionResponse } from './interface';
|
|
3
3
|
interface BadRequest {
|
|
4
4
|
status: boolean;
|
|
5
5
|
message: string;
|
|
@@ -8,6 +8,7 @@ export declare class DedicatedAccount {
|
|
|
8
8
|
http: Axios;
|
|
9
9
|
constructor(http: Axios);
|
|
10
10
|
create(data: CreateDedicatedVirtualAccount): Promise<DedicatedAccountCreatedResponse | BadRequest>;
|
|
11
|
+
assign(data: AssignDedicatedVirtualAccount): Promise<DedicatedAccountAssignedResponse | BadRequest>;
|
|
11
12
|
list(queryParams: ListDedicatedVirtualAccountsQueryParams): Promise<ListDedicatedVirtualAccountsResponse | BadRequest>;
|
|
12
13
|
fetch(dedicatedAccountId: string): Promise<FetchDedicatedVirtualAccountResponse | BadRequest>;
|
|
13
14
|
deactivate(dedicatedAccountId: string): Promise<DeactivateDedicatedAccountResponse | BadRequest>;
|
|
@@ -8,6 +8,9 @@ class DedicatedAccount {
|
|
|
8
8
|
async create(data) {
|
|
9
9
|
return await this.http.post('/dedicated_account', JSON.stringify(data));
|
|
10
10
|
}
|
|
11
|
+
async assign(data) {
|
|
12
|
+
return await this.http.post('/dedicated_account/assign', JSON.stringify(data));
|
|
13
|
+
}
|
|
11
14
|
async list(queryParams) {
|
|
12
15
|
return await this.http.get('/dedicated_account', {
|
|
13
16
|
params: { ...queryParams },
|
|
@@ -29,6 +29,22 @@ export interface CreateDedicatedVirtualAccount {
|
|
|
29
29
|
last_name?: string;
|
|
30
30
|
phone?: string;
|
|
31
31
|
}
|
|
32
|
+
export interface AssignDedicatedVirtualAccount {
|
|
33
|
+
email: string;
|
|
34
|
+
first_name: string;
|
|
35
|
+
last_name: string;
|
|
36
|
+
phone: string;
|
|
37
|
+
preferred_bank: string;
|
|
38
|
+
country: 'NG' | 'GH';
|
|
39
|
+
account_number?: string;
|
|
40
|
+
bvn?: string;
|
|
41
|
+
bank_code?: string;
|
|
42
|
+
subaccount?: string;
|
|
43
|
+
split_code?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface DedicatedAccountAssignedResponse extends Response {
|
|
46
|
+
data: AssignDedicatedVirtualAccount;
|
|
47
|
+
}
|
|
32
48
|
export interface ListDedicatedVirtualAccountsQueryParams {
|
|
33
49
|
active: boolean;
|
|
34
50
|
currency: string;
|
package/dist/misc/interface.d.ts
CHANGED
package/dist/paystack.d.ts
CHANGED
|
@@ -21,12 +21,6 @@ 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
|
-
*/
|
|
30
24
|
export declare class Paystack {
|
|
31
25
|
private readonly key;
|
|
32
26
|
private readonly http;
|
package/dist/paystack.js
CHANGED
|
@@ -28,12 +28,6 @@ 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
|
-
*/
|
|
37
31
|
class Paystack {
|
|
38
32
|
constructor(key) {
|
|
39
33
|
this.key = key;
|