@tonder.io/ionic-full-sdk 0.0.14-beta → 0.0.15-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/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/helpers/skyflow.ts +16 -21
package/package.json
CHANGED
package/src/helpers/skyflow.ts
CHANGED
|
@@ -63,9 +63,20 @@ export async function initSkyflow(
|
|
|
63
63
|
type: Skyflow.ValidationRuleType.LENGTH_MATCH_RULE,
|
|
64
64
|
params: {
|
|
65
65
|
max: 70,
|
|
66
|
+
error: "El campo nombre del titular debe tener menos de 70 caracteres"
|
|
66
67
|
},
|
|
67
68
|
};
|
|
68
69
|
|
|
70
|
+
const regexEmpty = RegExp("^(?!\s*$).+");
|
|
71
|
+
|
|
72
|
+
const regexMatchRule = {
|
|
73
|
+
type: Skyflow.ValidationRuleType.REGEX_MATCH_RULE,
|
|
74
|
+
params: {
|
|
75
|
+
regex: regexEmpty,
|
|
76
|
+
error: "El campo es requerido" // Optional, default error is 'VALIDATION FAILED'.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
const cardHolderNameElement: CollectElement | RevealElement | ComposableElement = await collectContainer.create({
|
|
70
81
|
table: "cards",
|
|
71
82
|
column: "cardholder_name",
|
|
@@ -73,13 +84,9 @@ export async function initSkyflow(
|
|
|
73
84
|
label: "Titular de la tarjeta",
|
|
74
85
|
placeholder: "Nombre como aparece en la tarjeta",
|
|
75
86
|
type: Skyflow.ElementType.CARDHOLDER_NAME,
|
|
76
|
-
validations: [lengthMatchRule],
|
|
87
|
+
validations: [regexMatchRule, lengthMatchRule],
|
|
77
88
|
});
|
|
78
89
|
|
|
79
|
-
if("setError" in cardHolderNameElement) {
|
|
80
|
-
cardHolderNameElement.setError('Inválido')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
90
|
// Create collect elements.
|
|
84
91
|
const cardNumberElement: CollectElement | RevealElement | ComposableElement = await collectContainer.create({
|
|
85
92
|
table: "cards",
|
|
@@ -92,12 +99,9 @@ export async function initSkyflow(
|
|
|
92
99
|
label: "Número de tarjeta",
|
|
93
100
|
placeholder: "1234 1234 1234 1234",
|
|
94
101
|
type: Skyflow.ElementType.CARD_NUMBER,
|
|
102
|
+
validations: [regexMatchRule],
|
|
95
103
|
});
|
|
96
104
|
|
|
97
|
-
if("setError" in cardNumberElement) {
|
|
98
|
-
cardNumberElement.setError('Inválido')
|
|
99
|
-
}
|
|
100
|
-
|
|
101
105
|
const cvvElement: CollectElement | RevealElement | ComposableElement = await collectContainer.create({
|
|
102
106
|
table: "cards",
|
|
103
107
|
column: "cvv",
|
|
@@ -105,11 +109,8 @@ export async function initSkyflow(
|
|
|
105
109
|
label: "CVC/CVV",
|
|
106
110
|
placeholder: "3-4 dígitos",
|
|
107
111
|
type: Skyflow.ElementType.CVV,
|
|
112
|
+
validations: [regexMatchRule],
|
|
108
113
|
});
|
|
109
|
-
|
|
110
|
-
if("setError" in cvvElement) {
|
|
111
|
-
cvvElement.setError('Inválido')
|
|
112
|
-
}
|
|
113
114
|
|
|
114
115
|
const expiryMonthElement: CollectElement | RevealElement | ComposableElement = await collectContainer.create({
|
|
115
116
|
table: "cards",
|
|
@@ -118,12 +119,9 @@ export async function initSkyflow(
|
|
|
118
119
|
label: "Fecha de expiración",
|
|
119
120
|
placeholder: "MM",
|
|
120
121
|
type: Skyflow.ElementType.EXPIRATION_MONTH,
|
|
122
|
+
validations: [regexMatchRule],
|
|
121
123
|
});
|
|
122
124
|
|
|
123
|
-
if("setError" in expiryMonthElement) {
|
|
124
|
-
expiryMonthElement.setError('Inválido')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
125
|
const expiryYearElement: CollectElement | RevealElement | ComposableElement = await collectContainer.create({
|
|
128
126
|
table: "cards",
|
|
129
127
|
column: "expiration_year",
|
|
@@ -131,12 +129,9 @@ export async function initSkyflow(
|
|
|
131
129
|
label: "",
|
|
132
130
|
placeholder: "AA",
|
|
133
131
|
type: Skyflow.ElementType.EXPIRATION_YEAR,
|
|
132
|
+
validations: [regexMatchRule],
|
|
134
133
|
});
|
|
135
134
|
|
|
136
|
-
if("setError" in expiryYearElement) {
|
|
137
|
-
expiryYearElement.setError('Inválido')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
135
|
await mountElements(
|
|
141
136
|
{ id: collectorIds.cardNumber, element: cardNumberElement },
|
|
142
137
|
{ id: collectorIds.cvv, element: cvvElement },
|