paystack-sdk 1.0.0 → 1.0.4
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 +31 -0
- package/dist/index.d.ts +2 -11
- package/dist/index.js +5 -23
- package/dist/paystack.d.ts +13 -0
- package/dist/paystack.js +29 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Paystack SDK
|
|
2
|
+
|
|
3
|
+
#### Why Another [Paystack](https://paystack.com) Package?
|
|
4
|
+
Other packages are either outdated or don't support types.
|
|
5
|
+
|
|
6
|
+
### Installation
|
|
7
|
+
For Yarn
|
|
8
|
+
`yarn add paystack-sdk`
|
|
9
|
+
|
|
10
|
+
For NPM
|
|
11
|
+
`npm install paystack-sdk`
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
For Typescript
|
|
15
|
+
```
|
|
16
|
+
import Paystack from 'paystack-sdk';
|
|
17
|
+
|
|
18
|
+
const paystack = new Paystack("secret_key);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For Javscript
|
|
22
|
+
```
|
|
23
|
+
const Paystack = require('paystack-sdk');
|
|
24
|
+
const paystack = new Paystack("secret_key");
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
All methods use promise meaning you can either use the `async...await` or `then...catch` or `try...catch`
|
|
28
|
+
|
|
29
|
+
### Available Docs
|
|
30
|
+
- [Charge](https://github.com/en1tan/paystack-node/blob/main/src/charge/README.md)
|
|
31
|
+
- [Transaction](https://github.com/en1tan/paystack-node/blob/main/src/transaction/README.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* Paystack SDK
|
|
4
|
-
* @author Asaju Enitan <@en1tan>
|
|
5
|
-
*/
|
|
6
|
-
export declare class Paystack {
|
|
7
|
-
readonly key: string;
|
|
8
|
-
private http;
|
|
9
|
-
charge: Charge;
|
|
10
|
-
constructor(key: string);
|
|
11
|
-
}
|
|
1
|
+
import Paystack from './paystack';
|
|
2
|
+
export = Paystack;
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Paystack SDK
|
|
8
|
-
* @author Asaju Enitan <@en1tan>
|
|
9
|
-
*/
|
|
10
|
-
var Paystack = /** @class */ (function () {
|
|
11
|
-
function Paystack(key) {
|
|
12
|
-
this.key = key;
|
|
13
|
-
this.http = new axios_1.Axios({
|
|
14
|
-
baseURL: 'https://api.paystack.co',
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: "Bearer ".concat(this.key),
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
this.charge = new charge_1.Charge(this.http);
|
|
21
|
-
}
|
|
22
|
-
return Paystack;
|
|
23
|
-
}());
|
|
24
|
-
exports.Paystack = Paystack;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const paystack_1 = __importDefault(require("./paystack"));
|
|
6
|
+
module.exports = paystack_1.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ICharge } from './charge/charge';
|
|
2
|
+
import { ITransaction } from './transaction/transaction';
|
|
3
|
+
/**
|
|
4
|
+
* Paystack SDK
|
|
5
|
+
* @author Asaju Enitan <@en1tan>
|
|
6
|
+
*/
|
|
7
|
+
export default class Paystack {
|
|
8
|
+
readonly key: string;
|
|
9
|
+
private http;
|
|
10
|
+
charge: ICharge;
|
|
11
|
+
transaction: ITransaction;
|
|
12
|
+
constructor(key: string);
|
|
13
|
+
}
|
package/dist/paystack.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axios_1 = require("axios");
|
|
4
|
+
const charge_1 = require("./charge/charge");
|
|
5
|
+
const transaction_1 = require("./transaction/transaction");
|
|
6
|
+
/**
|
|
7
|
+
* Paystack SDK
|
|
8
|
+
* @author Asaju Enitan <@en1tan>
|
|
9
|
+
*/
|
|
10
|
+
class Paystack {
|
|
11
|
+
key;
|
|
12
|
+
http;
|
|
13
|
+
charge;
|
|
14
|
+
transaction;
|
|
15
|
+
constructor(key) {
|
|
16
|
+
this.key = key;
|
|
17
|
+
this.http = new axios_1.Axios({
|
|
18
|
+
baseURL: 'https://api.paystack.co',
|
|
19
|
+
headers: {
|
|
20
|
+
Authorization: `Bearer ${this.key}`,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
},
|
|
23
|
+
responseType: 'json',
|
|
24
|
+
});
|
|
25
|
+
this.charge = new charge_1.Charge(this.http);
|
|
26
|
+
this.transaction = new transaction_1.Transaction(this.http);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = Paystack;
|
package/package.json
CHANGED