paystack-sdk 1.0.19 → 1.1.21

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/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ #### 1.0.4 (2021-12-06)
2
+
3
+ ##### Other Changes
4
+
5
+ * **plan:** added methods for plan ([d68ff371](https://github.com/en1tan/paystack-node/commit/d68ff371a90b363ea087bbd5d7cfbece14ca216b))
6
+
7
+ #### 1.0.3 (2021-12-06)
8
+
9
+ ##### Other Changes
10
+
11
+ * **transactions:** added initialize transaction, verify transaction, list transactions ([73c85a83](https://github.com/en1tan/paystack-node/commit/73c85a83b1ae52b4be63e3d77b8c8ff64588b8e2))
12
+ * **charge:** compeleted the endpoints, what remains is custom validtion and comments ([cc3165ce](https://github.com/en1tan/paystack-node/commit/cc3165ce772ac574cdfbcda082ff22f67e9c8945))
13
+
14
+ #### 1.0.3 (2021-12-06)
15
+
16
+ ##### Other Changes
17
+
18
+ * **charge:** compeleted the endpoints, what remains is custom validtion and comments ([cc3165ce](https://github.com/en1tan/paystack-node/commit/cc3165ce772ac574cdfbcda082ff22f67e9c8945))
19
+
20
+ - ✍🏻 UPDATE(charge): compeleted the endpoints, what remains is custom validtion and comments
21
+ - 1.0.3
22
+ - ✍🏻 UPDATE(charge): compeleted the endpoints, what remains is custom validtion and comments
23
+ - 1.0.2
24
+ - 🐞 FIX(main entry file):
25
+ - 1.0.1
26
+ - ✍🏻 UPDATE(travis): for automated builds
27
+ - 🐞 FIX(main entry file):
28
+ - 📦 NEW(set up sdk):
29
+ - Initial commit
package/README.md CHANGED
@@ -17,7 +17,7 @@ For NPM
17
17
  For Typescript
18
18
 
19
19
  ```
20
- import Paystack from 'paystack-sdk';
20
+ import {Paystack} from 'paystack-sdk';
21
21
 
22
22
  const paystack = new Paystack("secret_key);
23
23
  ```
@@ -25,7 +25,7 @@ const paystack = new Paystack("secret_key);
25
25
  For Javscript
26
26
 
27
27
  ```
28
- const Paystack = require('paystack-sdk');
28
+ const Paystack = require('paystack-sdk').Paystack;
29
29
  const paystack = new Paystack("secret_key");
30
30
  ```
31
31
 
@@ -33,7 +33,11 @@ All methods use promise meaning you can either use the `async...await` or `then.
33
33
 
34
34
  ### Available Functions
35
35
 
36
- - [Charge](https://github.com/en1tan/paystack-node/blob/main/src/charge/README.md)
37
- - [Transaction](https://github.com/en1tan/paystack-node/blob/main/src/transaction/README.md)
38
- - [Plan](https://github.com/en1tan/paystack-node/blob/main/src/plan/README.md)
39
- - [Customer](https://github.com/en1tan/paystack-node/blob/main/src/customer/README.md)
36
+ - Charge
37
+ - Customer
38
+ - Plan
39
+ - Product
40
+ - Subscription
41
+ - Transaction
42
+ - Transfer
43
+ - dedicated (For dedicated accounts)
@@ -159,13 +159,14 @@ export interface Authorization {
159
159
  account_name: string;
160
160
  }
161
161
  export interface Customer {
162
- customer_code: string;
163
- email: string;
164
162
  id: number;
165
- risk_action: string;
166
163
  first_name?: string;
167
164
  last_name?: string;
165
+ email: string;
166
+ customer_code: string;
167
+ risk_action: string;
168
168
  phone?: string | null;
169
169
  metadata?: Record<string, unknown> | null;
170
+ international_format_phone?: string | null;
170
171
  }
171
172
  export {};
@@ -0,0 +1,18 @@
1
+ import { Axios } from 'axios';
2
+ import { CreateDedicatedVirtualAccount, DeactivateDedicatedAccountResponse, DedicatedAccountCreatedResponse, FetchBankProvidersResponse, FetchDedicatedVirtualAccountResponse, ListDedicatedVirtualAccountsQueryParams, ListDedicatedVirtualAccountsResponse, RemoveSplitDedicatedAccountResponse, SplitDedicatedAccountTransaction, SplitDedicatedAccountTransactionResponse } from './interface';
3
+ interface BadRequest {
4
+ status: boolean;
5
+ message: string;
6
+ }
7
+ export declare class DedicatedAccount {
8
+ http: Axios;
9
+ constructor(http: Axios);
10
+ create(data: CreateDedicatedVirtualAccount): Promise<DedicatedAccountCreatedResponse | BadRequest>;
11
+ list(queryParams: ListDedicatedVirtualAccountsQueryParams): Promise<ListDedicatedVirtualAccountsResponse | BadRequest>;
12
+ fetch(dedicatedAccountId: string): Promise<FetchDedicatedVirtualAccountResponse | BadRequest>;
13
+ deactivate(dedicatedAccountId: string): Promise<DeactivateDedicatedAccountResponse | BadRequest>;
14
+ splitTransaction(data: SplitDedicatedAccountTransaction): Promise<SplitDedicatedAccountTransactionResponse | BadRequest>;
15
+ removeSplit(accountNumber: string): Promise<RemoveSplitDedicatedAccountResponse | BadRequest>;
16
+ providers(): Promise<FetchBankProvidersResponse | BadRequest>;
17
+ }
18
+ export {};
@@ -0,0 +1,53 @@
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.DedicatedAccount = void 0;
13
+ class DedicatedAccount {
14
+ constructor(http) {
15
+ this.http = http;
16
+ }
17
+ create(data) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ return yield this.http.post('/dedicated_account', JSON.stringify(data));
20
+ });
21
+ }
22
+ list(queryParams) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return yield this.http.get('/dedicated_account', { params: Object.assign({}, queryParams) });
25
+ });
26
+ }
27
+ fetch(dedicatedAccountId) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return yield this.http.get(`/dedicated_account/${dedicatedAccountId}`);
30
+ });
31
+ }
32
+ deactivate(dedicatedAccountId) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return yield this.http.delete(`/dedicated_account/${dedicatedAccountId}`);
35
+ });
36
+ }
37
+ splitTransaction(data) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return yield this.http.post('/dedicated_account/split', JSON.stringify(data));
40
+ });
41
+ }
42
+ removeSplit(accountNumber) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ return yield this.http.delete('/dedicated_account/split', { data: { account_number: accountNumber } });
45
+ });
46
+ }
47
+ providers() {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ return yield this.http.get('/dedicated_account/available_providers');
50
+ });
51
+ }
52
+ }
53
+ exports.DedicatedAccount = DedicatedAccount;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,157 @@
1
+ import { Authorization, Customer } from '../charge';
2
+ import { Meta } from '../interface';
3
+ import { Subscription } from '../subscription';
4
+ import { Response, TransactionData } from '../transaction';
5
+ export interface DedicatedAccountData {
6
+ id: number;
7
+ account_name: string;
8
+ account_number: string;
9
+ assigned: boolean;
10
+ currency: string;
11
+ metadata: Record<string, any> | null;
12
+ active: boolean;
13
+ split_config: Record<string, any> | null;
14
+ bank: Bank;
15
+ slug: string;
16
+ created_at: string;
17
+ updated_at: string;
18
+ assignment: Assignment;
19
+ customer: Customer;
20
+ }
21
+ export interface CreateDedicatedVirtualAccount {
22
+ customer: string;
23
+ preferred_bank: string;
24
+ subaccount?: string;
25
+ split_code?: string;
26
+ first_name?: string;
27
+ last_name?: string;
28
+ phone?: string;
29
+ }
30
+ export interface ListDedicatedVirtualAccountsQueryParams {
31
+ active: boolean;
32
+ currency: string;
33
+ provider_slug?: string;
34
+ bank_id?: string;
35
+ customer?: string;
36
+ }
37
+ export interface SplitDedicatedAccountTransaction {
38
+ customer: string;
39
+ subaccount?: string;
40
+ split_code?: string;
41
+ preferred_bank?: string;
42
+ }
43
+ export interface ListDedicatedVirtualAccountsResponse extends Response {
44
+ data: DedicatedAccountData[];
45
+ meta: Meta;
46
+ }
47
+ export interface DedicatedAccountCreatedResponse extends Response {
48
+ data: DedicatedAccountData;
49
+ }
50
+ export interface FetchDedicatedVirtualAccountResponse extends Response {
51
+ data: {
52
+ transactions: TransactionData[];
53
+ subscriptions: Subscription[];
54
+ authorizations: Authorization[];
55
+ first_name: string;
56
+ last_name: string;
57
+ email: string;
58
+ phone: string;
59
+ metadata: Record<string, any> | null;
60
+ domain: string;
61
+ customer_code: string;
62
+ risk_action: string;
63
+ id: number;
64
+ integration: number;
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ created_at: Date;
68
+ updated_at: Date;
69
+ total_transactions: number;
70
+ total_transaction_value: any[];
71
+ dedicated_account: {
72
+ id: number;
73
+ account_name: string;
74
+ account_number: string;
75
+ created_at: Date;
76
+ updated_at: Date;
77
+ currency: string;
78
+ active: boolean;
79
+ assigned: boolean;
80
+ provider: {
81
+ id: number;
82
+ provider_slug: string;
83
+ bank_id: number;
84
+ bank_name: string;
85
+ };
86
+ assignment: Assignment;
87
+ };
88
+ };
89
+ }
90
+ export interface DeactivateDedicatedAccountResponse {
91
+ data: {
92
+ bank: Bank;
93
+ account_name: string;
94
+ account_number: string;
95
+ assigned: boolean;
96
+ currency: string;
97
+ metadata: Record<string, any> | null;
98
+ active: boolean;
99
+ id: number;
100
+ created_at: Date;
101
+ updated_at: Date;
102
+ assignment: Assignment;
103
+ };
104
+ }
105
+ export interface SplitDedicatedAccountTransactionResponse extends Response {
106
+ data: {
107
+ id: number;
108
+ account_name: string;
109
+ account_number: string;
110
+ assigned: boolean;
111
+ currency: string;
112
+ metadata: Record<string, any> | null;
113
+ active: boolean;
114
+ bank: Bank;
115
+ assignment: Assignment;
116
+ created_at: Date;
117
+ updated_at: Date;
118
+ split_config: Record<string, any> | null;
119
+ customer: Customer;
120
+ };
121
+ }
122
+ export interface RemoveSplitDedicatedAccountResponse extends Response {
123
+ data: {
124
+ id: number;
125
+ account_name: string;
126
+ account_number: string;
127
+ assigned: boolean;
128
+ currency: string;
129
+ split_config: Record<string, any> | null;
130
+ active: boolean;
131
+ createdAt: Date;
132
+ updatedAt: Date;
133
+ };
134
+ }
135
+ export interface FetchBankProvidersResponse extends Response {
136
+ data: {
137
+ id: number;
138
+ provider_slug: string;
139
+ bank_id: number;
140
+ bank_name: string;
141
+ }[];
142
+ }
143
+ interface Bank {
144
+ id: number;
145
+ name: string;
146
+ slug: string;
147
+ }
148
+ interface Assignment {
149
+ integration: number;
150
+ assignee_id: number;
151
+ assignee_type: string;
152
+ expired: boolean;
153
+ account_type: string;
154
+ assigned_at: Date;
155
+ expired_at: Date | null;
156
+ }
157
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { Charge } from './charge';
2
2
  import { Customer } from './customer';
3
+ import { DedicatedAccount } from './dedicated/dedicated';
3
4
  import { Plan } from './plan';
4
5
  import { Product } from './product/product';
5
6
  import { Subscription } from './subscription/subscription';
@@ -14,6 +15,7 @@ export declare class Paystack {
14
15
  private readonly http;
15
16
  charge: Charge;
16
17
  customer: Customer;
18
+ dedicated: DedicatedAccount;
17
19
  plan: Plan;
18
20
  product: Product;
19
21
  subscription: Subscription;
package/dist/paystack.js CHANGED
@@ -4,6 +4,7 @@ exports.Paystack = void 0;
4
4
  const axios_1 = require("axios");
5
5
  const charge_1 = require("./charge");
6
6
  const customer_1 = require("./customer");
7
+ const dedicated_1 = require("./dedicated/dedicated");
7
8
  const plan_1 = require("./plan");
8
9
  const product_1 = require("./product/product");
9
10
  const subscription_1 = require("./subscription/subscription");
@@ -31,6 +32,7 @@ class Paystack {
31
32
  this.subscription = new subscription_1.Subscription(this.http);
32
33
  this.transaction = new transaction_1.Transaction(this.http);
33
34
  this.transfer = new transfer_1.Transfer(this.http);
35
+ this.dedicated = new dedicated_1.DedicatedAccount(this.http);
34
36
  }
35
37
  }
36
38
  exports.Paystack = Paystack;
@@ -1,5 +1,5 @@
1
1
  import { Axios } from 'axios';
2
- import { CheckAuthorizationResponse, ExportTransaction, ListTransactions, PartialDebitResponse, Timeline, TransactionData } from '.';
2
+ import { CheckAuthorizationResponse, ExportTransaction, ListTransactions, PartialDebitResponse, Timeline, TransactionData } from './interface';
3
3
  import { ChargeAuthorization, CheckAuthorization, InitializeTransaction, ListTransactionQueryParams, PartialDebit, TransactionInitialized } from './interface';
4
4
  interface BadRequest {
5
5
  status: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paystack-sdk",
3
- "version": "1.0.19",
3
+ "version": "1.1.21",
4
4
  "description": "Paystack SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "author": "Tech Priest",