@tonder.io/ionic-lite-sdk 0.0.31-beta → 0.0.32-beta
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 +1 -400
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,11 +9,6 @@ You can install using NPM
|
|
|
9
9
|
npm i @tonder.io/ionic-lite-sdk
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
or using an script tag
|
|
13
|
-
```html
|
|
14
|
-
// TO DO
|
|
15
|
-
```
|
|
16
|
-
|
|
17
12
|
Add dependencies to the root of the app (index.html)
|
|
18
13
|
```html
|
|
19
14
|
<script src=https://openpay.s3.amazonaws.com/openpay.v1.min.js></script>
|
|
@@ -45,402 +40,8 @@ const liteCheckout = new LiteCheckout({
|
|
|
45
40
|
|
|
46
41
|
# Class methods
|
|
47
42
|
|
|
48
|
-
# Business
|
|
49
|
-
|
|
50
|
-
## Get business
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const merchantData = await liteCheckout.getBusiness();
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Return business data
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
{
|
|
60
|
-
business: {
|
|
61
|
-
pk: number,
|
|
62
|
-
name: string,
|
|
63
|
-
categories: [
|
|
64
|
-
{
|
|
65
|
-
pk: number,
|
|
66
|
-
name: string
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
web: string,
|
|
70
|
-
logo: string,
|
|
71
|
-
full_logo_url: string,
|
|
72
|
-
background_color: string,
|
|
73
|
-
primary_color: string,
|
|
74
|
-
checkout_mode: boolean,
|
|
75
|
-
textCheckoutColor: string,
|
|
76
|
-
textDetailsColor: string,
|
|
77
|
-
checkout_logo: string
|
|
78
|
-
},
|
|
79
|
-
openpay_keys: {
|
|
80
|
-
merchant_id: string,
|
|
81
|
-
public_key: string
|
|
82
|
-
},
|
|
83
|
-
fintoc_keys: {
|
|
84
|
-
public_key: string
|
|
85
|
-
},
|
|
86
|
-
vault_id: string,
|
|
87
|
-
vault_url: string,
|
|
88
|
-
reference: number,
|
|
89
|
-
is_installments_available: boolean
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
# OpenPay
|
|
94
|
-
|
|
95
|
-
## Get OpenPay session id
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
98
|
-
const { openpay_keys } = merchantData;
|
|
99
|
-
|
|
100
|
-
const deviceSessionIdTonder = await liteCheckout.getOpenpayDeviceSessionID(
|
|
101
|
-
openpay_keys.merchant_id,
|
|
102
|
-
openpay_keys.public_key,
|
|
103
|
-
is_sandbox: true
|
|
104
|
-
);
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Return OpenPay device session id
|
|
108
|
-
|
|
109
|
-
string
|
|
110
|
-
|
|
111
|
-
# Customer
|
|
112
|
-
|
|
113
|
-
## Get customer authorization token
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
const customerEmail = "john.c.calhoun@examplepetstore.com";
|
|
117
|
-
|
|
118
|
-
const { auth_token } = await liteCheckout.customerRegister(customerEmail);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Return customer data
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
{
|
|
125
|
-
id: number,
|
|
126
|
-
email: string,
|
|
127
|
-
auth_token: string
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
# Order
|
|
132
|
-
|
|
133
|
-
## Create order
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
const cartItems = [
|
|
137
|
-
{
|
|
138
|
-
description: "Test product description",
|
|
139
|
-
quantity: 1,
|
|
140
|
-
price_unit: 25,
|
|
141
|
-
discount: 0,
|
|
142
|
-
taxes: 12,
|
|
143
|
-
product_reference: 65421,
|
|
144
|
-
name: "Test product",
|
|
145
|
-
amount_total: 25
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
|
|
149
|
-
const { reference } = merchantData;
|
|
150
|
-
|
|
151
|
-
const orderData = {
|
|
152
|
-
business: apiKeyTonder,
|
|
153
|
-
client: auth_token,
|
|
154
|
-
billing_address_id: null,
|
|
155
|
-
shipping_address_id: null,
|
|
156
|
-
amount: total,
|
|
157
|
-
status: "A",
|
|
158
|
-
reference: reference,
|
|
159
|
-
is_oneclick: true,
|
|
160
|
-
items: cartItems,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const jsonResponseOrder = await liteCheckout.createOrder(
|
|
164
|
-
orderData
|
|
165
|
-
);
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Return order data
|
|
169
|
-
```typescript
|
|
170
|
-
{
|
|
171
|
-
id: number,
|
|
172
|
-
created: string,
|
|
173
|
-
amount: string,
|
|
174
|
-
status: string,
|
|
175
|
-
payment_method?: string,
|
|
176
|
-
reference?: string,
|
|
177
|
-
is_oneclick: boolean,
|
|
178
|
-
items: [
|
|
179
|
-
{
|
|
180
|
-
description: string,
|
|
181
|
-
product_reference: string,
|
|
182
|
-
quantity: string,
|
|
183
|
-
price_unit: string,
|
|
184
|
-
discount: string,
|
|
185
|
-
taxes: string,
|
|
186
|
-
amount_total: string
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
billing_address?: string,
|
|
190
|
-
shipping_address?: string,
|
|
191
|
-
client: {
|
|
192
|
-
email: string,
|
|
193
|
-
name: string,
|
|
194
|
-
first_name: string,
|
|
195
|
-
last_name: string,
|
|
196
|
-
client_profile: {
|
|
197
|
-
gender: string,
|
|
198
|
-
date_birth?: string,
|
|
199
|
-
terms: boolean,
|
|
200
|
-
phone: string
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
# Payment
|
|
207
|
-
|
|
208
|
-
## Create payment
|
|
209
|
-
```javascript
|
|
210
|
-
const now = new Date();
|
|
211
|
-
const dateString = now.toISOString();
|
|
212
|
-
|
|
213
|
-
const { id: customerId } = await liteCheckout.customerRegister(customerEmail);
|
|
214
|
-
|
|
215
|
-
const paymentData = {
|
|
216
|
-
business_pk: business.pk,
|
|
217
|
-
amount: total,
|
|
218
|
-
date: dateString,
|
|
219
|
-
order_id: jsonResponseOrder.id,
|
|
220
|
-
client_id: customerId,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const jsonResponsePayment = await liteCheckout.createPayment(
|
|
224
|
-
paymentData
|
|
225
|
-
);
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Return payment data
|
|
229
|
-
```javascript
|
|
230
|
-
{
|
|
231
|
-
pk: number,
|
|
232
|
-
order?: string,
|
|
233
|
-
amount: string,
|
|
234
|
-
status: string,
|
|
235
|
-
date: string,
|
|
236
|
-
paid_date?: string,
|
|
237
|
-
shipping_address: {
|
|
238
|
-
street: string,
|
|
239
|
-
number: string,
|
|
240
|
-
suburb: string,
|
|
241
|
-
city: {
|
|
242
|
-
name: string
|
|
243
|
-
},
|
|
244
|
-
state: {
|
|
245
|
-
name: string,
|
|
246
|
-
country: {
|
|
247
|
-
name: string
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
zip_code: string
|
|
251
|
-
},
|
|
252
|
-
shipping_address_id?: string,
|
|
253
|
-
billing_address: {
|
|
254
|
-
street: string,
|
|
255
|
-
number: string,
|
|
256
|
-
suburb: string,
|
|
257
|
-
city: {
|
|
258
|
-
name: string
|
|
259
|
-
},
|
|
260
|
-
state: {
|
|
261
|
-
name: string,
|
|
262
|
-
country: {
|
|
263
|
-
name: string
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
zip_code: string
|
|
267
|
-
},
|
|
268
|
-
billing_address_id?: string,
|
|
269
|
-
client?: string,
|
|
270
|
-
customer_order_reference?: string
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
# Skyflow tokens
|
|
275
|
-
|
|
276
|
-
## Get skyflow payment form tokenized values
|
|
277
|
-
|
|
278
|
-
The values of the variable skyflowTokens come from your html form
|
|
279
|
-
|
|
280
|
-
```javascript
|
|
281
|
-
|
|
282
|
-
const skyflowFields = {
|
|
283
|
-
card_number: this.paymentForm.value.cardNumber,
|
|
284
|
-
cvv: this.paymentForm.value.cvv,
|
|
285
|
-
expiration_month: this.paymentForm.value.month,
|
|
286
|
-
expiration_year: this.paymentForm.value.expirationYear,
|
|
287
|
-
cardholder_name: this.paymentForm.value.name
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const { vault_id, vault_url } = merchantData;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const skyflowTokens = await liteCheckout.getSkyflowTokens({
|
|
294
|
-
vault_id: vault_id,
|
|
295
|
-
vault_url: vault_url,
|
|
296
|
-
data: skyflowFields
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
## Return skyflow tokenized data
|
|
302
|
-
```typescript
|
|
303
|
-
{
|
|
304
|
-
vaultID: string,
|
|
305
|
-
responses: [
|
|
306
|
-
{
|
|
307
|
-
records: [
|
|
308
|
-
{
|
|
309
|
-
skyflow_id: string
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
fields: {
|
|
315
|
-
card_number: string,
|
|
316
|
-
cardholder_name: string,
|
|
317
|
-
cvv: string,
|
|
318
|
-
expiration_month: string,
|
|
319
|
-
expiration_year: string,
|
|
320
|
-
skyflow_id: string
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
]
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
|
|
327
43
|
# Checkout router
|
|
328
44
|
|
|
329
|
-
## Get checkout router data
|
|
330
|
-
|
|
331
|
-
```javascript
|
|
332
|
-
|
|
333
|
-
const customerPhone = "+11111111";
|
|
334
|
-
const returnUrl = "http://localhost:8100/payment/success";
|
|
335
|
-
|
|
336
|
-
const routerData = {
|
|
337
|
-
card: skyflowTokens,
|
|
338
|
-
name: customerName,
|
|
339
|
-
last_name: customerLastName,
|
|
340
|
-
email_client: customerEmail,
|
|
341
|
-
phone_number: customerPhone,
|
|
342
|
-
return_url: returnUrl,
|
|
343
|
-
id_product: "no_id",
|
|
344
|
-
quantity_product: 1,
|
|
345
|
-
id_ship: "0",
|
|
346
|
-
instance_id_ship: "0",
|
|
347
|
-
amount: total,
|
|
348
|
-
title_ship: "shipping",
|
|
349
|
-
description: "Transaction from the lite SDK",
|
|
350
|
-
device_session_id: deviceSessionIdTonder,
|
|
351
|
-
token_id: "",
|
|
352
|
-
order_id: jsonResponseOrder.id,
|
|
353
|
-
business_id: business.pk,
|
|
354
|
-
payment_id: jsonResponsePayment.pk,
|
|
355
|
-
source: 'ionic-lite-sdk',
|
|
356
|
-
metadata: {
|
|
357
|
-
name: "xxxxx"
|
|
358
|
-
},
|
|
359
|
-
currency: "MXN"
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
const jsonResponseRouter = await liteCheckout.startCheckoutRouter(
|
|
363
|
-
routerData
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
## Return checkout router data
|
|
369
|
-
|
|
370
|
-
```typescript
|
|
371
|
-
{
|
|
372
|
-
status: 200,
|
|
373
|
-
message: "Success",
|
|
374
|
-
psp_response: {
|
|
375
|
-
id: string,
|
|
376
|
-
authorization: number,
|
|
377
|
-
operation_type: string,
|
|
378
|
-
transaction_type: string,
|
|
379
|
-
status: string,
|
|
380
|
-
conciliated: boolean,
|
|
381
|
-
creation_date: string,
|
|
382
|
-
operation_date: string,
|
|
383
|
-
description: string,
|
|
384
|
-
error_message?: string,
|
|
385
|
-
order_id?: string,
|
|
386
|
-
card: {
|
|
387
|
-
type: string,
|
|
388
|
-
brand: string,
|
|
389
|
-
address?: string,
|
|
390
|
-
card_number: string,
|
|
391
|
-
holder_name: string,
|
|
392
|
-
expiration_year: string,
|
|
393
|
-
expiration_month: string,
|
|
394
|
-
allows_charges: boolean,
|
|
395
|
-
allows_payouts: boolean,
|
|
396
|
-
bank_name: string,
|
|
397
|
-
points_type: string,
|
|
398
|
-
points_card: boolean,
|
|
399
|
-
bank_code: number
|
|
400
|
-
},
|
|
401
|
-
customer_id: string,
|
|
402
|
-
gateway_card_present: string,
|
|
403
|
-
amount: number,
|
|
404
|
-
fee: {
|
|
405
|
-
amount: number,
|
|
406
|
-
tax: number,
|
|
407
|
-
currency: string
|
|
408
|
-
},
|
|
409
|
-
payment_method: {
|
|
410
|
-
type: string,
|
|
411
|
-
url: string
|
|
412
|
-
},
|
|
413
|
-
currency: string,
|
|
414
|
-
method: string,
|
|
415
|
-
object: string
|
|
416
|
-
},
|
|
417
|
-
transaction_status: string,
|
|
418
|
-
transaction_id: number,
|
|
419
|
-
payment_id: number,
|
|
420
|
-
provider: string,
|
|
421
|
-
next_action: {
|
|
422
|
-
redirect_to_url: {
|
|
423
|
-
url: string,
|
|
424
|
-
return_url: string,
|
|
425
|
-
verify_transaction_status_url: string
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
actions: [
|
|
429
|
-
{
|
|
430
|
-
name: string,
|
|
431
|
-
url: string,
|
|
432
|
-
method: string
|
|
433
|
-
}
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
## Take actions on base to the checkout router response
|
|
439
|
-
|
|
440
|
-
# Checkout router full
|
|
441
|
-
|
|
442
|
-
<font size="4">This method integrate the create order, create payment and checkout router methods into one method, the info required to this method is:</font>
|
|
443
|
-
|
|
444
45
|
```typescript
|
|
445
46
|
|
|
446
47
|
const returnUrl = "http://localhost:8100/payment/success";
|
|
@@ -513,7 +114,7 @@ const jsonResponseRouter: any = await liteCheckout.startCheckoutRouterFull(
|
|
|
513
114
|
|
|
514
115
|
```
|
|
515
116
|
|
|
516
|
-
<font size="4">
|
|
117
|
+
<font size="4">Take actions on base to the checkout router response</font>
|
|
517
118
|
|
|
518
119
|
# Customer Cards(Register)
|
|
519
120
|
|