paystack-sdk 1.0.15 → 1.0.19
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 +8 -1
- package/dist/charge/charge.d.ts +8 -18
- package/dist/charge/charge.js +7 -14
- package/dist/charge/interface.d.ts +104 -76
- package/dist/customer/customer.d.ts +60 -0
- package/dist/customer/customer.js +96 -0
- package/dist/customer/index.d.ts +2 -0
- package/dist/customer/index.js +14 -0
- package/dist/customer/interface.d.ts +215 -0
- package/dist/customer/interface.js +13 -0
- package/dist/interface.d.ts +7 -0
- package/dist/interface.js +2 -0
- package/dist/paystack.d.ts +10 -2
- package/dist/paystack.js +12 -2
- package/dist/plan/interface.d.ts +26 -28
- package/dist/plan/plan.js +2 -2
- package/dist/product/index.d.ts +0 -0
- package/dist/product/index.js +1 -0
- package/dist/product/interface.d.ts +87 -0
- package/dist/product/interface.js +2 -0
- package/dist/product/product.d.ts +21 -0
- package/dist/product/product.js +46 -0
- package/dist/subscription/index.d.ts +1 -0
- package/dist/subscription/index.js +13 -0
- package/dist/subscription/interface.d.ts +118 -0
- package/dist/subscription/interface.js +2 -0
- package/dist/subscription/subscription.d.ts +18 -0
- package/dist/subscription/subscription.js +54 -0
- package/dist/transaction/interface.d.ts +75 -61
- package/dist/transaction/interface.js +0 -1
- package/dist/transaction/transaction.d.ts +12 -11
- package/dist/transaction/transaction.js +10 -13
- package/dist/transfer/interface.d.ts +105 -0
- package/dist/transfer/interface.js +2 -0
- package/dist/transfer/transfer.d.ts +26 -0
- package/dist/transfer/transfer.js +59 -0
- package/package.json +15 -12
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Paystack SDK
|
|
2
2
|
|
|
3
3
|
#### Why Another [Paystack](https://paystack.com) Package?
|
|
4
|
+
|
|
4
5
|
Other packages are either outdated or don't support types.
|
|
5
6
|
|
|
6
7
|
### Installation
|
|
8
|
+
|
|
7
9
|
For Yarn
|
|
8
10
|
`yarn add paystack-sdk`
|
|
9
11
|
|
|
@@ -11,7 +13,9 @@ For NPM
|
|
|
11
13
|
`npm install paystack-sdk`
|
|
12
14
|
|
|
13
15
|
### Usage
|
|
16
|
+
|
|
14
17
|
For Typescript
|
|
18
|
+
|
|
15
19
|
```
|
|
16
20
|
import Paystack from 'paystack-sdk';
|
|
17
21
|
|
|
@@ -19,6 +23,7 @@ const paystack = new Paystack("secret_key);
|
|
|
19
23
|
```
|
|
20
24
|
|
|
21
25
|
For Javscript
|
|
26
|
+
|
|
22
27
|
```
|
|
23
28
|
const Paystack = require('paystack-sdk');
|
|
24
29
|
const paystack = new Paystack("secret_key");
|
|
@@ -26,7 +31,9 @@ const paystack = new Paystack("secret_key");
|
|
|
26
31
|
|
|
27
32
|
All methods use promise meaning you can either use the `async...await` or `then...catch` or `try...catch`
|
|
28
33
|
|
|
29
|
-
### Available
|
|
34
|
+
### Available Functions
|
|
35
|
+
|
|
30
36
|
- [Charge](https://github.com/en1tan/paystack-node/blob/main/src/charge/README.md)
|
|
31
37
|
- [Transaction](https://github.com/en1tan/paystack-node/blob/main/src/transaction/README.md)
|
|
32
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)
|
package/dist/charge/charge.d.ts
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
import { Axios } from 'axios';
|
|
2
|
-
import { ChargeCreated, CreateCharge, SubmitAddress, SubmitBirthday, SubmitOTP, SubmitPhone, SubmitPIN } from '
|
|
2
|
+
import { ChargeCreated, ChargeCreatedResponse, CreateCharge, SubmitAddress, SubmitBirthday, SubmitOTP, SubmitPhone, SubmitPIN } from './interface';
|
|
3
3
|
interface BadRequest {
|
|
4
4
|
status: boolean;
|
|
5
5
|
message: string;
|
|
6
|
-
data: null;
|
|
7
6
|
}
|
|
8
|
-
export
|
|
9
|
-
create(data: CreateCharge): Promise<ChargeCreated | BadRequest>;
|
|
10
|
-
submitPIN(data: SubmitPIN): Promise<ChargeCreated | BadRequest>;
|
|
11
|
-
submitOTP(data: SubmitOTP): Promise<ChargeCreated | BadRequest>;
|
|
12
|
-
submitPhone(data: SubmitPhone): Promise<ChargeCreated | BadRequest>;
|
|
13
|
-
submitBirthday(data: SubmitBirthday): Promise<ChargeCreated | BadRequest>;
|
|
14
|
-
submitAddress(data: SubmitAddress): Promise<ChargeCreated | BadRequest>;
|
|
15
|
-
checkPending(reference: string): Promise<ChargeCreated | BadRequest>;
|
|
16
|
-
}
|
|
17
|
-
export declare class Charge implements ICharge {
|
|
7
|
+
export declare class Charge {
|
|
18
8
|
private http;
|
|
19
9
|
constructor(http: Axios);
|
|
20
|
-
create(data: CreateCharge): Promise<
|
|
10
|
+
create(data: CreateCharge): Promise<ChargeCreatedResponse | BadRequest>;
|
|
21
11
|
submitPIN(data: SubmitPIN): Promise<ChargeCreated | BadRequest>;
|
|
22
|
-
submitOTP(data: SubmitOTP): Promise<
|
|
23
|
-
submitPhone(data: SubmitPhone): Promise<
|
|
24
|
-
submitBirthday(data: SubmitBirthday): Promise<
|
|
25
|
-
submitAddress(data: SubmitAddress): Promise<
|
|
26
|
-
checkPending(reference: string): Promise<
|
|
12
|
+
submitOTP(data: SubmitOTP): Promise<ChargeCreatedResponse | BadRequest>;
|
|
13
|
+
submitPhone(data: SubmitPhone): Promise<ChargeCreatedResponse | BadRequest>;
|
|
14
|
+
submitBirthday(data: SubmitBirthday): Promise<ChargeCreatedResponse | BadRequest>;
|
|
15
|
+
submitAddress(data: SubmitAddress): Promise<ChargeCreatedResponse | BadRequest>;
|
|
16
|
+
checkPending(reference: string): Promise<ChargeCreatedResponse | BadRequest>;
|
|
27
17
|
}
|
|
28
18
|
export {};
|
package/dist/charge/charge.js
CHANGED
|
@@ -16,46 +16,39 @@ class Charge {
|
|
|
16
16
|
}
|
|
17
17
|
create(data) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
return JSON.parse(response.data);
|
|
19
|
+
return yield this.http.post('/charge', JSON.stringify(data));
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
22
|
submitPIN(data) {
|
|
24
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
return JSON.parse(response.data);
|
|
24
|
+
return yield this.http.post('/charge/submit_pin', JSON.stringify(data));
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
submitOTP(data) {
|
|
30
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
|
|
32
|
-
return JSON.parse(response.data);
|
|
29
|
+
return yield this.http.post('/charge/submit_otp', JSON.stringify(data));
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
32
|
submitPhone(data) {
|
|
36
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
|
|
38
|
-
return JSON.parse(response.data);
|
|
34
|
+
return yield this.http.post('/charge/submit_phone', JSON.stringify(data));
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
submitBirthday(data) {
|
|
42
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
44
|
-
return JSON.parse(response.data);
|
|
39
|
+
return yield this.http.post('/charge/submit_birthday', JSON.stringify(data));
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
42
|
submitAddress(data) {
|
|
48
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
|
|
50
|
-
return JSON.parse(response.data);
|
|
44
|
+
return yield this.http.post('/charge/submit_address', JSON.stringify(data));
|
|
51
45
|
});
|
|
52
46
|
}
|
|
53
47
|
checkPending(reference) {
|
|
54
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
|
|
49
|
+
return yield this.http.get('/charge/submit_address', {
|
|
56
50
|
params: { reference },
|
|
57
51
|
});
|
|
58
|
-
return JSON.parse(response.data);
|
|
59
52
|
});
|
|
60
53
|
}
|
|
61
54
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Response } from '../transaction';
|
|
2
|
+
export declare type ChargeCreatedResponse = ChargeCreated | ChargeCreatedWithOTP | ChargeCreatedWithPending | ChargeCreatedWithAddress | ChargeCreatedWithBankAuth | ChargeCreatedWithPin | ChargeCreatedWithPhone | ChargeCreatedWithBirthday | ChargeCreatedWithUSSD | ChargeCreatedWithMobileMoney | ChargeFailed;
|
|
1
3
|
export interface CreateCharge {
|
|
2
4
|
email: string;
|
|
3
5
|
amount: string;
|
|
@@ -14,106 +16,132 @@ export interface CreateCharge {
|
|
|
14
16
|
device_id?: string;
|
|
15
17
|
birthday?: string;
|
|
16
18
|
}
|
|
17
|
-
export interface
|
|
19
|
+
export interface SubmitPIN {
|
|
18
20
|
reference: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SubmitPIN extends Submit {
|
|
21
21
|
pin: string;
|
|
22
22
|
}
|
|
23
|
-
export interface SubmitOTP
|
|
23
|
+
export interface SubmitOTP {
|
|
24
|
+
reference: string;
|
|
24
25
|
otp: string;
|
|
25
26
|
}
|
|
26
|
-
export interface SubmitPhone
|
|
27
|
+
export interface SubmitPhone {
|
|
28
|
+
reference: string;
|
|
27
29
|
phone: string;
|
|
28
30
|
}
|
|
29
|
-
export interface SubmitBirthday
|
|
31
|
+
export interface SubmitBirthday {
|
|
32
|
+
reference: string;
|
|
30
33
|
birthday: Date;
|
|
31
34
|
}
|
|
32
|
-
export interface SubmitAddress
|
|
35
|
+
export interface SubmitAddress {
|
|
36
|
+
reference: string;
|
|
33
37
|
address: string;
|
|
34
38
|
city: string;
|
|
35
39
|
state: string;
|
|
36
40
|
zip_code: string;
|
|
37
41
|
}
|
|
38
|
-
export interface ChargeCreated {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
export interface ChargeCreated extends Response {
|
|
43
|
+
data: {
|
|
44
|
+
amount: number;
|
|
45
|
+
currency: string;
|
|
46
|
+
transaction_date: string;
|
|
47
|
+
status: string;
|
|
48
|
+
reference: string;
|
|
49
|
+
domain: string;
|
|
50
|
+
metadata: Record<string, unknown>;
|
|
51
|
+
gateway_response: string;
|
|
52
|
+
message: string;
|
|
53
|
+
channel: string;
|
|
54
|
+
ip_address: string;
|
|
55
|
+
log: unknown;
|
|
56
|
+
fees: number;
|
|
57
|
+
authorization: Authorization;
|
|
58
|
+
customer: Customer;
|
|
59
|
+
display_text: string;
|
|
60
|
+
plan: unknown;
|
|
61
|
+
};
|
|
42
62
|
}
|
|
43
|
-
interface
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
reference: string;
|
|
49
|
-
domain: string;
|
|
50
|
-
metadata: Record<string, unknown>;
|
|
51
|
-
gateway_response: string;
|
|
52
|
-
message: string;
|
|
53
|
-
channel: string;
|
|
54
|
-
ip_address: string;
|
|
55
|
-
log: any | null;
|
|
56
|
-
fees: number;
|
|
57
|
-
authorization: Authorization;
|
|
58
|
-
customer: Customer;
|
|
59
|
-
display_text: string;
|
|
60
|
-
plan: string | null;
|
|
61
|
-
}
|
|
62
|
-
interface ChargeCreatedResponseWithPending {
|
|
63
|
-
reference: string;
|
|
64
|
-
status: string;
|
|
63
|
+
interface ChargeCreatedWithPending extends Response {
|
|
64
|
+
data: {
|
|
65
|
+
reference: string;
|
|
66
|
+
status: string;
|
|
67
|
+
};
|
|
65
68
|
}
|
|
66
|
-
interface
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
interface ChargeCreatedWithAddress extends Response {
|
|
70
|
+
data: {
|
|
71
|
+
display_text: string;
|
|
72
|
+
reference: string;
|
|
73
|
+
status: string;
|
|
74
|
+
country_code: string;
|
|
75
|
+
};
|
|
71
76
|
}
|
|
72
|
-
interface
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
interface ChargeCreatedWithMobileMoney extends Response {
|
|
78
|
+
data: {
|
|
79
|
+
amount: number;
|
|
80
|
+
channel: string;
|
|
81
|
+
created_at: Date;
|
|
82
|
+
currency: string;
|
|
83
|
+
domain: string;
|
|
84
|
+
fees: number;
|
|
85
|
+
gateway_response: string;
|
|
86
|
+
id: number;
|
|
87
|
+
ip_address: string;
|
|
88
|
+
message: string;
|
|
89
|
+
paid_at: Date;
|
|
90
|
+
reference: string;
|
|
91
|
+
status: string;
|
|
92
|
+
transaction_date: Date;
|
|
93
|
+
authorization: Authorization;
|
|
94
|
+
customer: Customer;
|
|
95
|
+
};
|
|
89
96
|
}
|
|
90
|
-
interface
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
interface ChargeCreatedWithUSSD extends Response {
|
|
98
|
+
data: {
|
|
99
|
+
reference: string;
|
|
100
|
+
status: string;
|
|
101
|
+
display_text: string;
|
|
102
|
+
ussd_code: string;
|
|
103
|
+
};
|
|
95
104
|
}
|
|
96
|
-
interface
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
interface ChargeCreatedWithBirthday extends Response {
|
|
106
|
+
data: {
|
|
107
|
+
reference: string;
|
|
108
|
+
status: string;
|
|
109
|
+
display_text: string;
|
|
110
|
+
};
|
|
100
111
|
}
|
|
101
|
-
interface
|
|
112
|
+
interface ChargeCreatedWithBankAuth extends Response {
|
|
113
|
+
data: {
|
|
114
|
+
refernce: string;
|
|
115
|
+
uri: string;
|
|
116
|
+
status: string;
|
|
117
|
+
};
|
|
102
118
|
}
|
|
103
|
-
interface
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
119
|
+
interface ChargeCreatedWithOTP extends Response {
|
|
120
|
+
data: {
|
|
121
|
+
refernce: string;
|
|
122
|
+
status: string;
|
|
123
|
+
display_text: string;
|
|
124
|
+
};
|
|
107
125
|
}
|
|
108
|
-
interface
|
|
126
|
+
interface ChargeCreatedWithPin extends Response {
|
|
127
|
+
data: {
|
|
128
|
+
refernce: string;
|
|
129
|
+
status: string;
|
|
130
|
+
};
|
|
109
131
|
}
|
|
110
|
-
interface
|
|
111
|
-
|
|
132
|
+
interface ChargeCreatedWithPhone extends Response {
|
|
133
|
+
data: {
|
|
134
|
+
refernce: string;
|
|
135
|
+
status: string;
|
|
136
|
+
display_text: string;
|
|
137
|
+
};
|
|
112
138
|
}
|
|
113
|
-
interface ChargeFailed {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
interface ChargeFailed extends Response {
|
|
140
|
+
data: {
|
|
141
|
+
refernce: string;
|
|
142
|
+
message: string;
|
|
143
|
+
status: string;
|
|
144
|
+
};
|
|
117
145
|
}
|
|
118
146
|
export interface Authorization {
|
|
119
147
|
authorization_code: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Axios } from 'axios';
|
|
2
|
+
import { ListCustomersResponse } from '.';
|
|
3
|
+
import { CreateCustomer, CustomerCreated, CustomerData, ListCustomerQueryParams, SetRiskAction, UpdateCustomer, ValidateCustomer } from './interface';
|
|
4
|
+
interface BadRequest {
|
|
5
|
+
status: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
data: null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* # Customers
|
|
11
|
+
* The Customers API allows you create and manage
|
|
12
|
+
* customers on your integration
|
|
13
|
+
*/
|
|
14
|
+
export declare class Customer {
|
|
15
|
+
private http;
|
|
16
|
+
constructor(http: Axios);
|
|
17
|
+
/**
|
|
18
|
+
* ## Create Customer
|
|
19
|
+
* Create a customer on your integration
|
|
20
|
+
* @param {CreateCustomer} data
|
|
21
|
+
*/
|
|
22
|
+
create(data: CreateCustomer): Promise<CustomerCreated | BadRequest>;
|
|
23
|
+
/**
|
|
24
|
+
* ## List Customers
|
|
25
|
+
* List customers available on your integration
|
|
26
|
+
* @param {ListCustomerQueryParams} queryParams
|
|
27
|
+
*/
|
|
28
|
+
list(queryParams?: ListCustomerQueryParams): Promise<ListCustomersResponse | BadRequest>;
|
|
29
|
+
/**
|
|
30
|
+
* ## Fetch Customer
|
|
31
|
+
* Get details of a customer on your integration
|
|
32
|
+
* @param {String} email_or_code
|
|
33
|
+
*/
|
|
34
|
+
fetch(emailCode: string): Promise<CustomerData | BadRequest>;
|
|
35
|
+
/**
|
|
36
|
+
* ## Update CUstomer
|
|
37
|
+
* Update a customer's details on your integration
|
|
38
|
+
*/
|
|
39
|
+
update(code: string, data: UpdateCustomer): Promise<CustomerData | BadRequest>;
|
|
40
|
+
/**
|
|
41
|
+
* ## Validate Customer
|
|
42
|
+
* Validate a customer's identity
|
|
43
|
+
* @param {String} customer_code
|
|
44
|
+
* @param {ValidateCustomer} data
|
|
45
|
+
*/
|
|
46
|
+
validate(customerCode: string, data: ValidateCustomer): Promise<Response | BadRequest>;
|
|
47
|
+
/**
|
|
48
|
+
* ## Whitelist/Blacklist Customer
|
|
49
|
+
* Whitelist or black a customer on your integration
|
|
50
|
+
* @param {SetRiskAction} data
|
|
51
|
+
*/
|
|
52
|
+
setRiskAction(data: SetRiskAction): Promise<CustomerData | BadRequest>;
|
|
53
|
+
/**
|
|
54
|
+
* ## Deactivate Authorization
|
|
55
|
+
* Deactivate an authorization when the card needs to be forgotten
|
|
56
|
+
* @param {String} authorizaion_code
|
|
57
|
+
*/
|
|
58
|
+
deactivateAutorization(authorizationCode: string): Promise<Response>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
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.Customer = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* # Customers
|
|
15
|
+
* The Customers API allows you create and manage
|
|
16
|
+
* customers on your integration
|
|
17
|
+
*/
|
|
18
|
+
class Customer {
|
|
19
|
+
constructor(http) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ## Create Customer
|
|
24
|
+
* Create a customer on your integration
|
|
25
|
+
* @param {CreateCustomer} data
|
|
26
|
+
*/
|
|
27
|
+
create(data) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return yield this.http.post('/customer', JSON.stringify(data));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ## List Customers
|
|
34
|
+
* List customers available on your integration
|
|
35
|
+
* @param {ListCustomerQueryParams} queryParams
|
|
36
|
+
*/
|
|
37
|
+
list(queryParams) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.http.get('/customer', {
|
|
40
|
+
params: Object.assign({}, queryParams),
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ## Fetch Customer
|
|
46
|
+
* Get details of a customer on your integration
|
|
47
|
+
* @param {String} email_or_code
|
|
48
|
+
*/
|
|
49
|
+
fetch(emailCode) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return yield this.http.get(`/customer/${emailCode}`);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* ## Update CUstomer
|
|
56
|
+
* Update a customer's details on your integration
|
|
57
|
+
*/
|
|
58
|
+
update(code, data) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
return yield this.http.put(`/customer/${code}`, JSON.stringify(data));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* ## Validate Customer
|
|
65
|
+
* Validate a customer's identity
|
|
66
|
+
* @param {String} customer_code
|
|
67
|
+
* @param {ValidateCustomer} data
|
|
68
|
+
*/
|
|
69
|
+
validate(customerCode, data) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return yield this.http.post(`/customer/${customerCode}/identification`, JSON.stringify(data));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* ## Whitelist/Blacklist Customer
|
|
76
|
+
* Whitelist or black a customer on your integration
|
|
77
|
+
* @param {SetRiskAction} data
|
|
78
|
+
*/
|
|
79
|
+
setRiskAction(data) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return yield this.http.post('/customer/set_risk_action', JSON.stringify(data));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* ## Deactivate Authorization
|
|
86
|
+
* Deactivate an authorization when the card needs to be forgotten
|
|
87
|
+
* @param {String} authorizaion_code
|
|
88
|
+
*/
|
|
89
|
+
deactivateAutorization(authorizationCode) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const response = yield this.http.post('/customer/deactivate_authorization', JSON.stringify({ authorizaion_code: authorizationCode }));
|
|
92
|
+
return response;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.Customer = Customer;
|
|
@@ -0,0 +1,14 @@
|
|
|
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("./customer"), exports);
|