@tonder.io/ionic-full-sdk 0.0.5 → 0.0.7
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/dist/classes/inlineCheckout.d.ts +1 -4
- package/dist/helpers/template.d.ts +1 -0
- package/dist/helpers/utils.d.ts +14 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/classes/inlineCheckout.ts +10 -4
- package/src/helpers/template.ts +21 -7
- package/src/helpers/utils.ts +19 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonder.io/ionic-full-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Tonder ionic full SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tonder.io/ionic-lite-sdk": "^0.0.
|
|
13
|
+
"@tonder.io/ionic-lite-sdk": "^0.0.14",
|
|
14
14
|
"crypto-js": "^4.1.1",
|
|
15
15
|
"skyflow-js": "^1.34.1"
|
|
16
16
|
},
|
|
@@ -2,7 +2,8 @@ import { Card, cardItemsTemplate, cardTemplate, CollectorIds } from '../helpers/
|
|
|
2
2
|
import { LiteCheckout } from '@tonder.io/ionic-lite-sdk';
|
|
3
3
|
import {
|
|
4
4
|
showError,
|
|
5
|
-
showMessage
|
|
5
|
+
showMessage,
|
|
6
|
+
mapCards
|
|
6
7
|
} from '../helpers/utils';
|
|
7
8
|
import { initSkyflow } from '../helpers/skyflow'
|
|
8
9
|
import { ThreeDSHandler } from './3dsHandler';
|
|
@@ -149,7 +150,12 @@ export class InlineCheckout {
|
|
|
149
150
|
this.setCartItems(data.cart?.items)
|
|
150
151
|
const response: ErrorResponse | StartCheckoutResponse | false | undefined = await this.#checkout()
|
|
151
152
|
if (response) {
|
|
152
|
-
const process3ds = new ThreeDSHandler({
|
|
153
|
+
const process3ds = new ThreeDSHandler({
|
|
154
|
+
payload: response,
|
|
155
|
+
baseUrl: this.baseUrl,
|
|
156
|
+
apiKey: this.apiKeyTonder,
|
|
157
|
+
successUrl: this.successUrl
|
|
158
|
+
});
|
|
153
159
|
this.callBack(response);
|
|
154
160
|
if (!process3ds.redirectTo3DS()) {
|
|
155
161
|
resolve(response);
|
|
@@ -287,7 +293,7 @@ export class InlineCheckout {
|
|
|
287
293
|
|
|
288
294
|
if("cards" in cards) {
|
|
289
295
|
|
|
290
|
-
const cardsMapped: Card[] = cards.cards.map(
|
|
296
|
+
const cardsMapped: Card[] = cards.cards.map(mapCards)
|
|
291
297
|
|
|
292
298
|
this.loadCardsList(cardsMapped)
|
|
293
299
|
|
|
@@ -435,7 +441,7 @@ export class InlineCheckout {
|
|
|
435
441
|
|
|
436
442
|
if("cards" in cards) {
|
|
437
443
|
|
|
438
|
-
const cardsMapped: Card[] = cards.cards.map(card => (
|
|
444
|
+
const cardsMapped: Card[] = cards.cards.map((card) => mapCards(card))
|
|
439
445
|
|
|
440
446
|
this.loadCardsList(cardsMapped)
|
|
441
447
|
|
package/src/helpers/template.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type CollectorIds = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type Card = {
|
|
16
|
+
card_scheme: string,
|
|
16
17
|
cardholder_name: string,
|
|
17
18
|
card_number: string,
|
|
18
19
|
expiration_month: string,
|
|
@@ -25,7 +26,7 @@ export const cardTemplate = (external: boolean, collectorIds: CollectorIds) => `
|
|
|
25
26
|
<div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
|
|
26
27
|
<div class="pay-new-card">
|
|
27
28
|
<input checked id="new" name="card_selected" type="radio"/>
|
|
28
|
-
<label class="card-item-label" for="new">
|
|
29
|
+
<label class="card-item-label-new" for="new">
|
|
29
30
|
<img class="card-image" src="${getCardType("XXXX")}" />
|
|
30
31
|
<div class="card-number">Pagar con tarjeta</div>
|
|
31
32
|
</label>
|
|
@@ -204,11 +205,24 @@ ${external ? `` : `<style>
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
.card-image {
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
208
|
+
width: 39px;
|
|
209
|
+
height: 24px;
|
|
209
210
|
text-align: left;
|
|
210
211
|
}
|
|
211
212
|
|
|
213
|
+
.card-item-label-new {
|
|
214
|
+
display: flex;
|
|
215
|
+
justify-content: start;
|
|
216
|
+
align-items: center;
|
|
217
|
+
color: #1D1D1D;
|
|
218
|
+
gap: 33% 20px;
|
|
219
|
+
margin-top: 10px;
|
|
220
|
+
margin-bottom: 10px;
|
|
221
|
+
padding-left: 10px;
|
|
222
|
+
padding-right: 10px;
|
|
223
|
+
width: 90%;
|
|
224
|
+
}
|
|
225
|
+
|
|
212
226
|
</style>
|
|
213
227
|
`}`
|
|
214
228
|
|
|
@@ -219,7 +233,7 @@ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
|
|
|
219
233
|
<div class="card-item">
|
|
220
234
|
<input id="${card.skyflow_id}" name="card_selected" type="radio"/>
|
|
221
235
|
<label class="card-item-label" for="${card.skyflow_id}">
|
|
222
|
-
<img class="card-image" src="${getCardType(card.
|
|
236
|
+
<img class="card-image" src="${getCardType(card.card_scheme)}" />
|
|
223
237
|
<div class="card-number">${card.card_number}</div>
|
|
224
238
|
<div class="card-expiration">${card.expiration_month}/${card.expiration_year}</div>
|
|
225
239
|
</label>
|
|
@@ -233,7 +247,7 @@ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
|
|
|
233
247
|
|
|
234
248
|
.card-item-label {
|
|
235
249
|
display: flex;
|
|
236
|
-
justify-content:
|
|
250
|
+
justify-content: space-between;
|
|
237
251
|
align-items: center;
|
|
238
252
|
color: #1D1D1D;
|
|
239
253
|
gap: 33% 20px;
|
|
@@ -266,8 +280,8 @@ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
|
|
|
266
280
|
}
|
|
267
281
|
|
|
268
282
|
.card-image {
|
|
269
|
-
width:
|
|
270
|
-
height:
|
|
283
|
+
width: 39px;
|
|
284
|
+
height: 24px;
|
|
271
285
|
text-align: left;
|
|
272
286
|
}
|
|
273
287
|
|