@tonder.io/ionic-lite-sdk 0.0.35-beta.7 → 0.0.36-beta.1
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/.gitlab-ci.yml +28 -28
- package/README.md +221 -202
- package/dist/classes/errorResponse.d.ts +1 -1
- package/dist/classes/liteCheckout.d.ts +32 -56
- package/dist/data/api.d.ts +1 -1
- package/dist/helpers/utils.d.ts +4 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/types/commons.d.ts +0 -37
- package/dist/types/requests.d.ts +3 -12
- package/dist/types/responses.d.ts +3 -0
- package/jest.config.ts +14 -14
- package/package.json +38 -38
- package/rollup.config.js +16 -16
- package/src/classes/3dsHandler.ts +237 -237
- package/src/classes/errorResponse.ts +16 -16
- package/src/classes/liteCheckout.ts +575 -598
- package/src/data/api.ts +20 -20
- package/src/helpers/constants.ts +63 -63
- package/src/helpers/mercadopago.ts +15 -15
- package/src/helpers/utils.ts +320 -120
- package/src/index.ts +4 -10
- package/src/types/commons.ts +83 -125
- package/src/types/requests.ts +105 -114
- package/src/types/responses.ts +193 -189
- package/src/types/skyflow.ts +17 -17
- package/tests/classes/liteCheckout.test.ts +57 -57
- package/tests/methods/createOrder.test.ts +142 -142
- package/tests/methods/createPayment.test.ts +122 -122
- package/tests/methods/customerRegister.test.ts +119 -119
- package/tests/methods/getBusiness.test.ts +115 -115
- package/tests/methods/getCustomerCards.test.ts +119 -113
- package/tests/methods/getOpenpayDeviceSessionID.test.ts +95 -0
- package/tests/methods/getSkyflowToken.test.ts +155 -0
- package/tests/methods/getVaultToken.test.ts +107 -0
- package/tests/methods/registerCustomerCard.test.ts +117 -117
- package/tests/methods/startCheckoutRouter.test.ts +119 -119
- package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
- package/tests/utils/defaultMock.ts +20 -21
- package/tests/utils/mockClasses.ts +656 -659
- package/tsconfig.json +18 -18
- package/.idea/aws.xml +0 -17
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -132
- package/dist/classes/BaseInlineCheckout.d.ts +0 -45
- package/dist/data/businessApi.d.ts +0 -2
- package/dist/data/cardApi.d.ts +0 -4
- package/dist/data/checkoutApi.d.ts +0 -4
- package/dist/data/customerApi.d.ts +0 -2
- package/dist/data/openPayApi.d.ts +0 -1
- package/dist/data/paymentMethodApi.d.ts +0 -5
- package/dist/data/skyflowApi.d.ts +0 -1
- package/dist/helpers/skyflow.d.ts +0 -3
- package/dist/helpers/validations.d.ts +0 -6
- package/dist/shared/catalog/paymentMethodsCatalog.d.ts +0 -1
- package/dist/shared/constants/messages.d.ts +0 -11
- package/dist/shared/constants/paymentMethodAPM.d.ts +0 -62
- package/dist/shared/constants/tonderUrl.d.ts +0 -7
- package/dist/types/card.d.ts +0 -29
- package/dist/types/checkout.d.ts +0 -103
- package/dist/types/customer.d.ts +0 -12
- package/dist/types/paymentMethod.d.ts +0 -22
- package/src/classes/BaseInlineCheckout.ts +0 -356
- package/src/data/businessApi.ts +0 -18
- package/src/data/cardApi.ts +0 -89
- package/src/data/checkoutApi.ts +0 -87
- package/src/data/customerApi.ts +0 -31
- package/src/data/openPayApi.ts +0 -12
- package/src/data/paymentMethodApi.ts +0 -37
- package/src/data/skyflowApi.ts +0 -20
- package/src/helpers/skyflow.ts +0 -91
- package/src/helpers/validations.ts +0 -55
- package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
- package/src/shared/constants/messages.ts +0 -11
- package/src/shared/constants/paymentMethodAPM.ts +0 -63
- package/src/shared/constants/tonderUrl.ts +0 -8
- package/src/types/card.ts +0 -34
- package/src/types/checkout.ts +0 -118
- package/src/types/customer.ts +0 -12
- package/src/types/index.d.ts +0 -10
- package/src/types/liteInlineCheckout.d.ts +0 -191
- package/src/types/paymentMethod.ts +0 -24
- package/src/types/validations.d.ts +0 -11
package/.gitlab-ci.yml
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
image: grupoapok/awscli:18
|
|
2
|
-
|
|
3
|
-
stages:
|
|
4
|
-
- test
|
|
5
|
-
- deploy
|
|
6
|
-
|
|
7
|
-
test:
|
|
8
|
-
stage: test
|
|
9
|
-
only:
|
|
10
|
-
- development
|
|
11
|
-
before_script:
|
|
12
|
-
- npm install
|
|
13
|
-
script:
|
|
14
|
-
- npm run test
|
|
15
|
-
|
|
16
|
-
deploy:
|
|
17
|
-
stage: deploy
|
|
18
|
-
only:
|
|
19
|
-
- tags
|
|
20
|
-
before_script:
|
|
21
|
-
- |
|
|
22
|
-
{
|
|
23
|
-
echo "@tonder.io:registry=https://registry.npmjs.org/"
|
|
24
|
-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}"
|
|
25
|
-
} | tee -a .npmrc
|
|
26
|
-
script:
|
|
27
|
-
- npm install
|
|
28
|
-
- npm run build
|
|
1
|
+
image: grupoapok/awscli:18
|
|
2
|
+
|
|
3
|
+
stages:
|
|
4
|
+
- test
|
|
5
|
+
- deploy
|
|
6
|
+
|
|
7
|
+
test:
|
|
8
|
+
stage: test
|
|
9
|
+
only:
|
|
10
|
+
- development
|
|
11
|
+
before_script:
|
|
12
|
+
- npm install
|
|
13
|
+
script:
|
|
14
|
+
- npm run test
|
|
15
|
+
|
|
16
|
+
deploy:
|
|
17
|
+
stage: deploy
|
|
18
|
+
only:
|
|
19
|
+
- tags
|
|
20
|
+
before_script:
|
|
21
|
+
- |
|
|
22
|
+
{
|
|
23
|
+
echo "@tonder.io:registry=https://registry.npmjs.org/"
|
|
24
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}"
|
|
25
|
+
} | tee -a .npmrc
|
|
26
|
+
script:
|
|
27
|
+
- npm install
|
|
28
|
+
- npm run build
|
|
29
29
|
- npm publish --access=public
|
package/README.md
CHANGED
|
@@ -1,202 +1,221 @@
|
|
|
1
|
-
# Tonder SDK
|
|
2
|
-
|
|
3
|
-
Tonder SDK Lite to integrate REST service
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
You can install using NPM
|
|
8
|
-
```bash
|
|
9
|
-
npm i @tonder.io/ionic-lite-sdk
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Add dependencies to the root of the app (index.html)
|
|
13
|
-
```html
|
|
14
|
-
<script src=https://openpay.s3.amazonaws.com/openpay.v1.min.js></script>
|
|
15
|
-
<script src=https://openpay.s3.amazonaws.com/openpay-data.v1.min.js></script>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
## Import LiteCheckout class
|
|
20
|
-
```javascript
|
|
21
|
-
import { LiteCheckout } from "@tonder.io/ionic-lite-sdk"
|
|
22
|
-
```
|
|
23
|
-
## Create instance
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
const liteCheckout = new LiteCheckout({
|
|
27
|
-
signal,
|
|
28
|
-
baseUrlTonder,
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
// To verify a 3ds transaction you can use the following method
|
|
33
|
-
// It should be called after the injectCheckout method
|
|
34
|
-
// The response status will be one of the following
|
|
35
|
-
// ['Declined', 'Cancelled', 'Failed', 'Success', 'Pending', 'Authorized']
|
|
36
|
-
|
|
37
|
-
inlineCheckout.verify3dsTransaction().then(response => {
|
|
38
|
-
console.log('Verify 3ds response', response)
|
|
39
|
-
})
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
| Property | Type | Description |
|
|
43
|
-
|:---------------:|:-------------:|:-----------------------------------------------------------------------:|
|
|
44
|
-
| signal | AborSignal | Signal from AbortController instance if it need cancel request |
|
|
45
|
-
| baseUrlTonder | string | Live server: http://stage.tonder.io |
|
|
46
|
-
| | | Mock Server: https://stoplight.io/mocks/tonder/tonder-api-v1-2/3152148 |
|
|
47
|
-
|
|
|
48
|
-
| | | |
|
|
49
|
-
|
|
50
|
-
# Class methods
|
|
51
|
-
|
|
52
|
-
# Checkout router
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
|
|
56
|
-
const returnUrl = "http://localhost:8100/payment/success";
|
|
57
|
-
|
|
58
|
-
let checkoutData = {
|
|
59
|
-
customer: {
|
|
60
|
-
name: "Jhon",
|
|
61
|
-
lastname: "Doe",
|
|
62
|
-
email: "john.c.calhoun@examplepetstore.com",
|
|
63
|
-
phone: "+58452258525"
|
|
64
|
-
},
|
|
65
|
-
order: {
|
|
66
|
-
items: [
|
|
67
|
-
{
|
|
68
|
-
description: "Test product description",
|
|
69
|
-
quantity: 1,
|
|
70
|
-
price_unit: 25,
|
|
71
|
-
discount: 1,
|
|
72
|
-
taxes: 12,
|
|
73
|
-
product_reference: 89456123,
|
|
74
|
-
name: "Test product",
|
|
75
|
-
amount_total: 25
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
return_url: returnUrl,
|
|
80
|
-
total: 25,
|
|
81
|
-
isSandbox: true,
|
|
82
|
-
metadata: {},
|
|
83
|
-
currency: "MXN",
|
|
84
|
-
skyflowTokens: {
|
|
85
|
-
cardholder_name: "",
|
|
86
|
-
card_number: "",
|
|
87
|
-
expiration_year: "",
|
|
88
|
-
expiration_month: "",
|
|
89
|
-
cvv: "",
|
|
90
|
-
skyflow_id: ""
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
<font size="4">It is required get the skyflow tokens to add it to the checkout router method, the values of the variable skyflowFields come from your html form</font>
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
|
|
100
|
-
const merchantData: any = await liteCheckout.getBusiness();
|
|
101
|
-
|
|
102
|
-
const { vault_id, vault_url } = merchantData;
|
|
103
|
-
|
|
104
|
-
const skyflowFields = {
|
|
105
|
-
card_number: this.paymentForm.value.cardNumber,
|
|
106
|
-
cvv: this.paymentForm.value.cvv,
|
|
107
|
-
expiration_month: this.paymentForm.value.month,
|
|
108
|
-
expiration_year: this.paymentForm.value.expirationYear,
|
|
109
|
-
cardholder_name: this.paymentForm.value.name
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const skyflowTokens = await liteCheckout.getSkyflowTokens({
|
|
113
|
-
vault_id: vault_id,
|
|
114
|
-
vault_url: vault_url,
|
|
115
|
-
data: skyflowFields
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
checkoutData.skyflowTokens = skyflowTokens;
|
|
119
|
-
|
|
120
|
-
const jsonResponseRouter: any = await liteCheckout.startCheckoutRouterFull(
|
|
121
|
-
checkoutData
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
<font size="4">Take actions on base to the checkout router response</font>
|
|
127
|
-
|
|
128
|
-
# Customer Cards(Register)
|
|
129
|
-
|
|
130
|
-
##
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
customer_auth_token
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
##
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
1
|
+
# Tonder SDK
|
|
2
|
+
|
|
3
|
+
Tonder SDK Lite to integrate REST service
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install using NPM
|
|
8
|
+
```bash
|
|
9
|
+
npm i @tonder.io/ionic-lite-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Add dependencies to the root of the app (index.html)
|
|
13
|
+
```html
|
|
14
|
+
<script src=https://openpay.s3.amazonaws.com/openpay.v1.min.js></script>
|
|
15
|
+
<script src=https://openpay.s3.amazonaws.com/openpay-data.v1.min.js></script>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
## Import LiteCheckout class
|
|
20
|
+
```javascript
|
|
21
|
+
import { LiteCheckout } from "@tonder.io/ionic-lite-sdk"
|
|
22
|
+
```
|
|
23
|
+
## Create instance
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const liteCheckout = new LiteCheckout({
|
|
27
|
+
signal,
|
|
28
|
+
baseUrlTonder,
|
|
29
|
+
publicApiKeyTonder
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// To verify a 3ds transaction you can use the following method
|
|
33
|
+
// It should be called after the injectCheckout method
|
|
34
|
+
// The response status will be one of the following
|
|
35
|
+
// ['Declined', 'Cancelled', 'Failed', 'Success', 'Pending', 'Authorized']
|
|
36
|
+
|
|
37
|
+
inlineCheckout.verify3dsTransaction().then(response => {
|
|
38
|
+
console.log('Verify 3ds response', response)
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Property | Type | Description |
|
|
43
|
+
|:---------------:|:-------------:|:-----------------------------------------------------------------------:|
|
|
44
|
+
| signal | AborSignal | Signal from AbortController instance if it need cancel request |
|
|
45
|
+
| baseUrlTonder | string | Live server: http://stage.tonder.io |
|
|
46
|
+
| | | Mock Server: https://stoplight.io/mocks/tonder/tonder-api-v1-2/3152148 |
|
|
47
|
+
| publicApiKeyTonder | string | You can take this from you Tonder Dashboard |
|
|
48
|
+
| | | |
|
|
49
|
+
|
|
50
|
+
# Class methods
|
|
51
|
+
|
|
52
|
+
# Checkout router
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
|
|
56
|
+
const returnUrl = "http://localhost:8100/payment/success";
|
|
57
|
+
|
|
58
|
+
let checkoutData = {
|
|
59
|
+
customer: {
|
|
60
|
+
name: "Jhon",
|
|
61
|
+
lastname: "Doe",
|
|
62
|
+
email: "john.c.calhoun@examplepetstore.com",
|
|
63
|
+
phone: "+58452258525"
|
|
64
|
+
},
|
|
65
|
+
order: {
|
|
66
|
+
items: [
|
|
67
|
+
{
|
|
68
|
+
description: "Test product description",
|
|
69
|
+
quantity: 1,
|
|
70
|
+
price_unit: 25,
|
|
71
|
+
discount: 1,
|
|
72
|
+
taxes: 12,
|
|
73
|
+
product_reference: 89456123,
|
|
74
|
+
name: "Test product",
|
|
75
|
+
amount_total: 25
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
return_url: returnUrl,
|
|
80
|
+
total: 25,
|
|
81
|
+
isSandbox: true,
|
|
82
|
+
metadata: {},
|
|
83
|
+
currency: "MXN",
|
|
84
|
+
skyflowTokens: {
|
|
85
|
+
cardholder_name: "",
|
|
86
|
+
card_number: "",
|
|
87
|
+
expiration_year: "",
|
|
88
|
+
expiration_month: "",
|
|
89
|
+
cvv: "",
|
|
90
|
+
skyflow_id: ""
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<font size="4">It is required get the skyflow tokens to add it to the checkout router method, the values of the variable skyflowFields come from your html form</font>
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
|
|
100
|
+
const merchantData: any = await liteCheckout.getBusiness();
|
|
101
|
+
|
|
102
|
+
const { vault_id, vault_url } = merchantData;
|
|
103
|
+
|
|
104
|
+
const skyflowFields = {
|
|
105
|
+
card_number: this.paymentForm.value.cardNumber,
|
|
106
|
+
cvv: this.paymentForm.value.cvv,
|
|
107
|
+
expiration_month: this.paymentForm.value.month,
|
|
108
|
+
expiration_year: this.paymentForm.value.expirationYear,
|
|
109
|
+
cardholder_name: this.paymentForm.value.name
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const skyflowTokens = await liteCheckout.getSkyflowTokens({
|
|
113
|
+
vault_id: vault_id,
|
|
114
|
+
vault_url: vault_url,
|
|
115
|
+
data: skyflowFields
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
checkoutData.skyflowTokens = skyflowTokens;
|
|
119
|
+
|
|
120
|
+
const jsonResponseRouter: any = await liteCheckout.startCheckoutRouterFull(
|
|
121
|
+
checkoutData
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
<font size="4">Take actions on base to the checkout router response</font>
|
|
127
|
+
|
|
128
|
+
# Customer Cards(Register)
|
|
129
|
+
|
|
130
|
+
## Request secure token
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
|
|
134
|
+
const jsonResponse = await liteCheckout.getSecureToken(
|
|
135
|
+
secretApiKey //You can take this from you Tonder Dashboard
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Return secure token
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
{
|
|
144
|
+
access: string;
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Register customer card
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
|
|
152
|
+
customer_auth_token: string;
|
|
153
|
+
|
|
154
|
+
data: {
|
|
155
|
+
skyflow_id: string;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const jsonResponseOrder = await liteCheckout.registerCustomerCard(
|
|
159
|
+
secureToken
|
|
160
|
+
customer_auth_token,
|
|
161
|
+
data
|
|
162
|
+
);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Return register customer card
|
|
166
|
+
```typescript
|
|
167
|
+
{
|
|
168
|
+
skyflow_id: string;
|
|
169
|
+
user_id: number;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
# Customer Cards(Get)
|
|
174
|
+
|
|
175
|
+
## Get customer cards
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
|
|
179
|
+
customer_auth_token: string;
|
|
180
|
+
|
|
181
|
+
query: string = "?ordering=<string>&search=<string>";
|
|
182
|
+
|
|
183
|
+
const jsonResponseOrder = await liteCheckout.getCustomerCards(
|
|
184
|
+
customer_auth_token,
|
|
185
|
+
query
|
|
186
|
+
);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Return get customer cards
|
|
190
|
+
```typescript
|
|
191
|
+
{
|
|
192
|
+
user_id: number,
|
|
193
|
+
cards: [
|
|
194
|
+
{
|
|
195
|
+
fields: {
|
|
196
|
+
card_number: string,
|
|
197
|
+
cardholder_name: string,
|
|
198
|
+
cvv: string,
|
|
199
|
+
expiration_month: string,
|
|
200
|
+
expiration_year: string,
|
|
201
|
+
skyflow_id: string
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Delete customer card
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
|
|
212
|
+
const deleted: boolean = await liteCheckout.deleteCustomerCard(
|
|
213
|
+
customer_auth_token,
|
|
214
|
+
skyflow_id
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -1,71 +1,47 @@
|
|
|
1
|
+
import CollectContainer from "skyflow-js/types/core/external/collect/collect-container";
|
|
2
|
+
import { APM, Business } from "../types/commons";
|
|
3
|
+
import { CreateOrderRequest, CreatePaymentRequest, RegisterCustomerCardRequest, StartCheckoutRequest, TokensRequest, StartCheckoutFullRequest, StartCheckoutIdRequest } from "../types/requests";
|
|
4
|
+
import { GetSecureTokenResponse, GetBusinessResponse, CustomerRegisterResponse, CreateOrderResponse, CreatePaymentResponse, StartCheckoutResponse, GetCustomerCardsResponse, RegisterCustomerCardResponse } from "../types/responses";
|
|
1
5
|
import { ErrorResponse } from "./errorResponse";
|
|
2
|
-
import {
|
|
3
|
-
import { APM, IInlineCheckoutBaseOptions, RegisterCustomerCardResponse, ISaveCardRequest, ICustomerCardsResponse, ISaveCardResponse, IPaymentMethod, GetBusinessResponse, TokensRequest, ICardFields, CustomerRegisterResponse, StartCheckoutFullRequest, CreateOrderRequest, CreatePaymentRequest, StartCheckoutRequest, StartCheckoutResponse, StartCheckoutIdRequest, CreatePaymentResponse, CreateOrderResponse, RegisterCustomerCardRequest } from "../types";
|
|
6
|
+
import { ThreeDSHandler } from "./3dsHandler";
|
|
4
7
|
declare global {
|
|
5
8
|
interface Window {
|
|
6
9
|
OpenPay: any;
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
export type LiteCheckoutConstructor = {
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
baseUrlTonder: string;
|
|
15
|
+
publicApiKeyTonder: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class LiteCheckout implements LiteCheckoutConstructor {
|
|
18
|
+
#private;
|
|
19
|
+
signal: AbortSignal;
|
|
20
|
+
baseUrlTonder: string;
|
|
21
|
+
publicApiKeyTonder: string;
|
|
22
|
+
process3ds: ThreeDSHandler;
|
|
12
23
|
activeAPMs: APM[];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getSkyflowTokens({ vault_id, vault_url, data, }: TokensRequest): Promise<any | ErrorResponse>;
|
|
21
|
-
_setCartTotal(total: string): void;
|
|
22
|
-
_checkout({ card, payment_method, isSandbox, }: {
|
|
23
|
-
card?: ICardFields | string;
|
|
24
|
-
payment_method?: string;
|
|
25
|
-
isSandbox?: boolean;
|
|
26
|
-
}): Promise<any>;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
29
|
-
* It is no longer necessary to use this method as customer registration is now automatically handled
|
|
30
|
-
* during the payment process or when using card management methods.
|
|
31
|
-
*/
|
|
24
|
+
merchantData?: Business | ErrorResponse;
|
|
25
|
+
constructor({ signal, baseUrlTonder, publicApiKeyTonder, }: LiteCheckoutConstructor);
|
|
26
|
+
getOpenpayDeviceSessionID(merchant_id: string, public_key: string, is_sandbox: boolean): Promise<string | ErrorResponse>;
|
|
27
|
+
getBusiness(): Promise<GetBusinessResponse | ErrorResponse>;
|
|
28
|
+
verify3dsTransaction(): Promise<false | StartCheckoutResponse | ErrorResponse | undefined>;
|
|
29
|
+
resumeCheckout(response: any): Promise<any>;
|
|
30
|
+
handle3dsRedirect(response: ErrorResponse | StartCheckoutResponse | false | undefined): Promise<false | StartCheckoutResponse | ErrorResponse | undefined>;
|
|
32
31
|
customerRegister(email: string): Promise<CustomerRegisterResponse | ErrorResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
35
|
-
* It is no longer necessary to use this method as order creation is now automatically
|
|
36
|
-
* handled when making a payment through the `payment` function.
|
|
37
|
-
*/
|
|
38
32
|
createOrder(orderItems: CreateOrderRequest): Promise<CreateOrderResponse | ErrorResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
41
|
-
* It is no longer necessary to use this method as payment creation is now automatically
|
|
42
|
-
* handled when making a payment through the `payment` function.
|
|
43
|
-
*/
|
|
44
33
|
createPayment(paymentItems: CreatePaymentRequest): Promise<CreatePaymentResponse | ErrorResponse>;
|
|
45
|
-
|
|
46
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
47
|
-
* Use the {@link payment} method
|
|
48
|
-
*/
|
|
34
|
+
handleCheckoutRouter(routerData: StartCheckoutRequest | StartCheckoutIdRequest): Promise<StartCheckoutResponse>;
|
|
49
35
|
startCheckoutRouter(routerData: StartCheckoutRequest | StartCheckoutIdRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
|
|
50
|
-
init3DSRedirect(checkoutResult: ErrorResponse | StartCheckoutResponse): Promise<false | ErrorResponse | StartCheckoutResponse | undefined>;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
53
|
-
* Use the {@link payment} method
|
|
54
|
-
*/
|
|
55
36
|
startCheckoutRouterFull(routerFullData: StartCheckoutFullRequest): Promise<StartCheckoutResponse | ErrorResponse | undefined>;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
registerCustomerCard(customerToken: string, data: RegisterCustomerCardRequest): Promise<RegisterCustomerCardResponse | ErrorResponse>;
|
|
61
|
-
|
|
62
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
63
|
-
* Use the {@link removeCustomerCard} method
|
|
64
|
-
*/
|
|
37
|
+
init3DSRedirect(checkoutResult: ErrorResponse | StartCheckoutResponse): Promise<false | StartCheckoutResponse | ErrorResponse | undefined>;
|
|
38
|
+
getSkyflowTokens({ vault_id, vault_url, data, }: TokensRequest): Promise<any | ErrorResponse>;
|
|
39
|
+
getVaultToken(): Promise<string>;
|
|
40
|
+
getFieldsPromise(data: any, collectContainer: CollectContainer): Promise<Promise<boolean>[]>;
|
|
41
|
+
registerCustomerCard(secureToken: string, customerToken: string, data: RegisterCustomerCardRequest): Promise<RegisterCustomerCardResponse | ErrorResponse>;
|
|
42
|
+
getCustomerCards(customerToken: string, bearerToken: string): Promise<GetCustomerCardsResponse | ErrorResponse>;
|
|
65
43
|
deleteCustomerCard(customerToken: string, skyflowId?: string): Promise<Boolean | ErrorResponse>;
|
|
66
|
-
|
|
67
|
-
* @deprecated This method is deprecated and will be removed in a future release.
|
|
68
|
-
* Use the {@link getCustomerPaymentMethods} method
|
|
69
|
-
*/
|
|
44
|
+
private getFields;
|
|
70
45
|
getActiveAPMs(): Promise<APM[]>;
|
|
46
|
+
getSecureToken(token: string): Promise<GetSecureTokenResponse | ErrorResponse>;
|
|
71
47
|
}
|
package/dist/data/api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getCustomerAPMs(baseUrlTonder: string,
|
|
1
|
+
export declare function getCustomerAPMs(baseUrlTonder: string, publicApiKeyTonder: string, query?: string, signal?: AbortSignal | null | undefined): Promise<any>;
|
package/dist/helpers/utils.d.ts
CHANGED
|
@@ -11,12 +11,8 @@ export declare const getBrowserInfo: () => {
|
|
|
11
11
|
export declare const getBusinessId: (merchantData: any) => any;
|
|
12
12
|
declare const buildErrorResponseFromCatch: (e: any) => ErrorResponse;
|
|
13
13
|
declare const buildErrorResponse: (response: Response, stack?: string | undefined) => Promise<ErrorResponse>;
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
message: string;
|
|
18
|
-
detail: any;
|
|
14
|
+
declare const getPaymentMethodDetails: (scheme_data: string) => {
|
|
15
|
+
icon: string;
|
|
16
|
+
label: string;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
declare const getCardType: (scheme: string) => "https://d35a75syrgujp0.cloudfront.net/cards/visa.png" | "https://d35a75syrgujp0.cloudfront.net/cards/mastercard.png" | "https://d35a75syrgujp0.cloudfront.net/cards/american_express.png" | "https://d35a75syrgujp0.cloudfront.net/cards/default_card.png";
|
|
22
|
-
export { buildErrorResponseFromCatch, buildErrorResponse, getCardType, formatPublicErrorResponse, clearSpace, };
|
|
18
|
+
export { buildErrorResponseFromCatch, buildErrorResponse, getPaymentMethodDetails };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { LiteCheckout } from './classes/liteCheckout';
|
|
2
|
-
|
|
3
|
-
export { LiteCheckout, validateCVV, validateCardNumber, validateCardholderName, validateExpirationMonth, validateExpirationYear };
|
|
2
|
+
export { LiteCheckout };
|