paystack-sdk 1.0.13 → 1.0.14

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.
@@ -1,36 +1,62 @@
1
- export class Charge {
2
- http;
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.Charge = void 0;
13
+ class Charge {
3
14
  constructor(http) {
4
15
  this.http = http;
5
16
  }
6
- async create(data) {
7
- const response = await this.http.post('/charge', JSON.stringify(data));
8
- return JSON.parse(response.data);
17
+ create(data) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const response = yield this.http.post('/charge', JSON.stringify(data));
20
+ return JSON.parse(response.data);
21
+ });
9
22
  }
10
- async submitPIN(data) {
11
- const response = await this.http.post('/charge/submit_pin', JSON.stringify(data));
12
- return JSON.parse(response.data);
23
+ submitPIN(data) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const response = yield this.http.post('/charge/submit_pin', JSON.stringify(data));
26
+ return JSON.parse(response.data);
27
+ });
13
28
  }
14
- async submitOTP(data) {
15
- const response = await this.http.post('/charge/submit_otp', JSON.stringify(data));
16
- return JSON.parse(response.data);
29
+ submitOTP(data) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const response = yield this.http.post('/charge/submit_otp', JSON.stringify(data));
32
+ return JSON.parse(response.data);
33
+ });
17
34
  }
18
- async submitPhone(data) {
19
- const response = await this.http.post('/charge/submit_phone', JSON.stringify(data));
20
- return JSON.parse(response.data);
35
+ submitPhone(data) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const response = yield this.http.post('/charge/submit_phone', JSON.stringify(data));
38
+ return JSON.parse(response.data);
39
+ });
21
40
  }
22
- async submitBirthday(data) {
23
- const response = await this.http.post('/charge/submit_birthday', JSON.stringify(data));
24
- return JSON.parse(response.data);
41
+ submitBirthday(data) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const response = yield this.http.post('/charge/submit_birthday', JSON.stringify(data));
44
+ return JSON.parse(response.data);
45
+ });
25
46
  }
26
- async submitAddress(data) {
27
- const response = await this.http.post('/charge/submit_address', JSON.stringify(data));
28
- return JSON.parse(response.data);
47
+ submitAddress(data) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const response = yield this.http.post('/charge/submit_address', JSON.stringify(data));
50
+ return JSON.parse(response.data);
51
+ });
29
52
  }
30
- async checkPending(reference) {
31
- const response = await this.http.get('/charge/submit_address', {
32
- params: { reference },
53
+ checkPending(reference) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const response = yield this.http.get('/charge/submit_address', {
56
+ params: { reference },
57
+ });
58
+ return JSON.parse(response.data);
33
59
  });
34
- return JSON.parse(response.data);
35
60
  }
36
61
  }
62
+ exports.Charge = Charge;
@@ -1,2 +1,14 @@
1
- export * from './charge';
2
- export * from './interface';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./charge"), exports);
14
+ __exportStar(require("./interface"), exports);
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
- import { Paystack } from './paystack';
2
- exports = Paystack;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const paystack_1 = require("./paystack");
4
+ exports = paystack_1.Paystack;
package/dist/paystack.js CHANGED
@@ -1,27 +1,26 @@
1
- import { Axios } from 'axios';
2
- import { Charge } from './charge';
3
- import { Plan } from './plan';
4
- import { Transaction } from './transaction';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Paystack = void 0;
4
+ const axios_1 = require("axios");
5
+ const charge_1 = require("./charge");
6
+ const plan_1 = require("./plan");
7
+ const transaction_1 = require("./transaction");
5
8
  /**
6
9
  * Paystack SDK
7
10
  * @author Asaju Enitan <@en1tan>
8
11
  */
9
- export class Paystack {
10
- key;
11
- http;
12
- charge;
13
- transaction;
14
- plan;
12
+ class Paystack {
15
13
  constructor(key) {
16
14
  this.key = key;
17
- this.http = new Axios({
15
+ this.http = new axios_1.Axios({
18
16
  baseURL: 'https://api.paystack.co',
19
17
  headers: {
20
18
  Authorization: `Bearer ${this.key}`,
21
19
  },
22
20
  });
23
- this.charge = new Charge(this.http);
24
- this.transaction = new Transaction(this.http);
25
- this.plan = new Plan(this.http);
21
+ this.charge = new charge_1.Charge(this.http);
22
+ this.transaction = new transaction_1.Transaction(this.http);
23
+ this.plan = new plan_1.Plan(this.http);
26
24
  }
27
25
  }
26
+ exports.Paystack = Paystack;
@@ -1,2 +1,14 @@
1
- export * from './interface';
2
- export * from './plan';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./interface"), exports);
14
+ __exportStar(require("./plan"), exports);
@@ -1,2 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  [];
2
- export {};
package/dist/plan/plan.js CHANGED
@@ -1,11 +1,22 @@
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.Plan = void 0;
1
13
  /**
2
14
  * ## Plans
3
15
  * The Plans API allows you create and manage installment
4
16
  * payment options on your integration
5
17
  * @class Plan
6
18
  */
7
- export class Plan {
8
- http;
19
+ class Plan {
9
20
  constructor(http) {
10
21
  this.http = http;
11
22
  }
@@ -15,9 +26,11 @@ export class Plan {
15
26
  * @param {CreatePlan} data Body Param
16
27
  * @returns {Promise<PlanResponse | BadRequest>}
17
28
  */
18
- async create(data) {
19
- const response = await this.http.post('/plan', data);
20
- return response.data;
29
+ create(data) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const response = yield this.http.post('/plan', data);
32
+ return response.data;
33
+ });
21
34
  }
22
35
  /**
23
36
  * ### List Plans
@@ -25,11 +38,13 @@ export class Plan {
25
38
  * @param queryParams Query Parameters
26
39
  * @returns {Promise<PlanResponse | BadRequest>}
27
40
  */
28
- async list(queryParams) {
29
- const response = await this.http.get('/plan', {
30
- params: { ...queryParams },
41
+ list(queryParams) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const response = yield this.http.get('/plan', {
44
+ params: Object.assign({}, queryParams),
45
+ });
46
+ return JSON.parse(response.data);
31
47
  });
32
- return JSON.parse(response.data);
33
48
  }
34
49
  /**
35
50
  * ### Fetch Plan
@@ -37,9 +52,11 @@ export class Plan {
37
52
  * @param id The plan `ID` or `code` you want to fetch
38
53
  * @returns {Promise<PlanResponse | BadRequest>}
39
54
  */
40
- async fetch(id) {
41
- const response = await this.http.get(`/plan/${id}`);
42
- return JSON.parse(response.data);
55
+ fetch(id) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const response = yield this.http.get(`/plan/${id}`);
58
+ return JSON.parse(response.data);
59
+ });
43
60
  }
44
61
  /**
45
62
  * ### Update Plan
@@ -48,8 +65,11 @@ export class Plan {
48
65
  * @param {UpdatePlan} data Update Plan Data
49
66
  * @returns {Promise<PlanResponse | BadRequest>}
50
67
  */
51
- async update(id, data) {
52
- const response = await this.http.put(`/plan/${id}`, JSON.stringify(data));
53
- return JSON.parse(response.data);
68
+ update(id, data) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const response = yield this.http.put(`/plan/${id}`, JSON.stringify(data));
71
+ return JSON.parse(response.data);
72
+ });
54
73
  }
55
74
  }
75
+ exports.Plan = Plan;
@@ -1,2 +1,14 @@
1
- export * from './interface';
2
- export * from './transaction';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./interface"), exports);
14
+ __exportStar(require("./transaction"), exports);
@@ -1,2 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  [];
2
- export {};
@@ -1,10 +1,21 @@
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.Transaction = void 0;
1
13
  /**
2
14
  * # Tansactions
3
15
  * The transaction API allows you create and manage
4
16
  * payments on your integration
5
17
  */
6
- export class Transaction {
7
- http;
18
+ class Transaction {
8
19
  constructor(http) {
9
20
  this.http = http;
10
21
  }
@@ -12,52 +23,73 @@ export class Transaction {
12
23
  * Initialize a transaction
13
24
  * @param {InitializeTransaction} data **Body Param**
14
25
  */
15
- async initialize(data) {
16
- const response = await this.http.post('/transaction/initialize', JSON.stringify(data));
17
- return JSON.parse(response.data);
26
+ initialize(data) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const response = yield this.http.post('/transaction/initialize', JSON.stringify(data));
29
+ return JSON.parse(response.data);
30
+ });
18
31
  }
19
- async verify(reference) {
20
- const response = await this.http.get('/transaction/verify', {
21
- params: { reference },
32
+ verify(reference) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const response = yield this.http.get('/transaction/verify', {
35
+ params: { reference },
36
+ });
37
+ return JSON.parse(response.data);
22
38
  });
23
- return JSON.parse(response.data);
24
39
  }
25
- async list(queryParams) {
26
- const response = await this.http.get('/transaction', {
27
- params: { ...queryParams },
40
+ list(queryParams) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const response = yield this.http.get('/transaction', {
43
+ params: Object.assign({}, queryParams),
44
+ });
45
+ return JSON.parse(response.data);
28
46
  });
29
- return JSON.parse(response.data);
30
47
  }
31
- async fetch(id) {
32
- const response = await this.http.get(`/transaction/:${id}`);
33
- return JSON.parse(response.data);
48
+ fetch(id) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const response = yield this.http.get(`/transaction/:${id}`);
51
+ return JSON.parse(response.data);
52
+ });
34
53
  }
35
- async chargeAuthorization(data) {
36
- const response = await this.http.post('/transaction/charge_authorization', JSON.stringify(data));
37
- return JSON.parse(response.data);
54
+ chargeAuthorization(data) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const response = yield this.http.post('/transaction/charge_authorization', JSON.stringify(data));
57
+ return JSON.parse(response.data);
58
+ });
38
59
  }
39
- async checkAuthorization(data) {
40
- const response = await this.http.post('/transaction/check_authorization', JSON.stringify(data));
41
- return JSON.parse(response.data);
60
+ checkAuthorization(data) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const response = yield this.http.post('/transaction/check_authorization', JSON.stringify(data));
63
+ return JSON.parse(response.data);
64
+ });
42
65
  }
43
- async viewTimeline(id) {
44
- const response = await this.http.get(`/transaction/timeline/${id}`);
45
- return JSON.parse(response.data);
66
+ viewTimeline(id) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const response = yield this.http.get(`/transaction/timeline/${id}`);
69
+ return JSON.parse(response.data);
70
+ });
46
71
  }
47
- async totals(queryParams) {
48
- const response = await this.http.get('/transaction/totals', {
49
- params: { ...queryParams },
72
+ totals(queryParams) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const response = yield this.http.get('/transaction/totals', {
75
+ params: Object.assign({}, queryParams),
76
+ });
77
+ return JSON.parse(response.data);
50
78
  });
51
- return JSON.parse(response.data);
52
79
  }
53
- async export(queryParams) {
54
- const response = await this.http.get('/transaction/export', {
55
- params: { ...queryParams },
80
+ export(queryParams) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const response = yield this.http.get('/transaction/export', {
83
+ params: Object.assign({}, queryParams),
84
+ });
85
+ return JSON.parse(response.data);
56
86
  });
57
- return JSON.parse(response.data);
58
87
  }
59
- async partialDebit(data) {
60
- const response = await this.http.post('/transaction/partial_debit', JSON.stringify(data));
61
- return JSON.parse(response.data);
88
+ partialDebit(data) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const response = yield this.http.post('/transaction/partial_debit', JSON.stringify(data));
91
+ return JSON.parse(response.data);
92
+ });
62
93
  }
63
94
  }
95
+ exports.Transaction = Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paystack-sdk",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Paystack SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "author": "Koderant",