logix-payment-shift4 1.1.6 → 1.1.8
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.cjs.js +9 -2
- package/dist/index.esm.js +9 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -215,7 +215,7 @@ function PaymentForm(_ref) {
|
|
|
215
215
|
initializedRef.current = true;
|
|
216
216
|
var initPayment = /*#__PURE__*/function () {
|
|
217
217
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
218
|
-
var response, _yield$response$json, publicKeys, script, _t;
|
|
218
|
+
var response, _yield$response$json, publicKeys, isProd, script, _t;
|
|
219
219
|
return _regenerator().w(function (_context) {
|
|
220
220
|
while (1) switch (_context.p = _context.n) {
|
|
221
221
|
case 0:
|
|
@@ -230,9 +230,10 @@ function PaymentForm(_ref) {
|
|
|
230
230
|
case 2:
|
|
231
231
|
_yield$response$json = _context.v;
|
|
232
232
|
publicKeys = _yield$response$json.publicKeys;
|
|
233
|
+
isProd = _yield$response$json.isProd;
|
|
233
234
|
if (!publicKeys) errorPage("Public key is empty");
|
|
234
235
|
script = document.createElement("script");
|
|
235
|
-
script.src = "https://js.dev.shift4.com/shift4.js";
|
|
236
|
+
script.src = isProd ? "https://js.shift4.com/shift4.js" : "https://js.dev.shift4.com/shift4.js";
|
|
236
237
|
script.async = true;
|
|
237
238
|
script.onload = function () {
|
|
238
239
|
if (!window.Shift4) return;
|
|
@@ -286,6 +287,7 @@ function PaymentForm(_ref) {
|
|
|
286
287
|
break;
|
|
287
288
|
}
|
|
288
289
|
errorPage("Payment form is not ready yet. Please try again.");
|
|
290
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
289
291
|
return _context2.a(2);
|
|
290
292
|
case 3:
|
|
291
293
|
setIsSubmitting(true);
|
|
@@ -296,6 +298,7 @@ function PaymentForm(_ref) {
|
|
|
296
298
|
token = _context2.v;
|
|
297
299
|
if (!(token !== null && token !== void 0 && token.id)) {
|
|
298
300
|
errorPage("Card tokenization failed. Please check your details and try again.");
|
|
301
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
299
302
|
}
|
|
300
303
|
request = {
|
|
301
304
|
amount: amount,
|
|
@@ -309,6 +312,7 @@ function PaymentForm(_ref) {
|
|
|
309
312
|
threeDSecureToken = _context2.v;
|
|
310
313
|
if (!(threeDSecureToken !== null && threeDSecureToken !== void 0 && threeDSecureToken.id)) {
|
|
311
314
|
errorPage("3D Secure verification failed. Please try again.");
|
|
315
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
312
316
|
}
|
|
313
317
|
apiBase = baseUrl + "charge/" + userId;
|
|
314
318
|
_context2.n = 7;
|
|
@@ -335,15 +339,18 @@ function PaymentForm(_ref) {
|
|
|
335
339
|
break;
|
|
336
340
|
}
|
|
337
341
|
if (typeof errorPage === "function") errorPage(result);
|
|
342
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
338
343
|
return _context2.a(2);
|
|
339
344
|
case 9:
|
|
340
345
|
if (typeof successPage === "function") successPage(result.message);
|
|
346
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
341
347
|
_context2.n = 11;
|
|
342
348
|
break;
|
|
343
349
|
case 10:
|
|
344
350
|
_context2.p = 10;
|
|
345
351
|
_t2 = _context2.v;
|
|
346
352
|
if (typeof errorPage === "function") errorPage(_t2.message);
|
|
353
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
347
354
|
case 11:
|
|
348
355
|
_context2.p = 11;
|
|
349
356
|
setIsSubmitting(false);
|
package/dist/index.esm.js
CHANGED
|
@@ -213,7 +213,7 @@ function PaymentForm(_ref) {
|
|
|
213
213
|
initializedRef.current = true;
|
|
214
214
|
var initPayment = /*#__PURE__*/function () {
|
|
215
215
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
216
|
-
var response, _yield$response$json, publicKeys, script, _t;
|
|
216
|
+
var response, _yield$response$json, publicKeys, isProd, script, _t;
|
|
217
217
|
return _regenerator().w(function (_context) {
|
|
218
218
|
while (1) switch (_context.p = _context.n) {
|
|
219
219
|
case 0:
|
|
@@ -228,9 +228,10 @@ function PaymentForm(_ref) {
|
|
|
228
228
|
case 2:
|
|
229
229
|
_yield$response$json = _context.v;
|
|
230
230
|
publicKeys = _yield$response$json.publicKeys;
|
|
231
|
+
isProd = _yield$response$json.isProd;
|
|
231
232
|
if (!publicKeys) errorPage("Public key is empty");
|
|
232
233
|
script = document.createElement("script");
|
|
233
|
-
script.src = "https://js.dev.shift4.com/shift4.js";
|
|
234
|
+
script.src = isProd ? "https://js.shift4.com/shift4.js" : "https://js.dev.shift4.com/shift4.js";
|
|
234
235
|
script.async = true;
|
|
235
236
|
script.onload = function () {
|
|
236
237
|
if (!window.Shift4) return;
|
|
@@ -284,6 +285,7 @@ function PaymentForm(_ref) {
|
|
|
284
285
|
break;
|
|
285
286
|
}
|
|
286
287
|
errorPage("Payment form is not ready yet. Please try again.");
|
|
288
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
287
289
|
return _context2.a(2);
|
|
288
290
|
case 3:
|
|
289
291
|
setIsSubmitting(true);
|
|
@@ -294,6 +296,7 @@ function PaymentForm(_ref) {
|
|
|
294
296
|
token = _context2.v;
|
|
295
297
|
if (!(token !== null && token !== void 0 && token.id)) {
|
|
296
298
|
errorPage("Card tokenization failed. Please check your details and try again.");
|
|
299
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
297
300
|
}
|
|
298
301
|
request = {
|
|
299
302
|
amount: amount,
|
|
@@ -307,6 +310,7 @@ function PaymentForm(_ref) {
|
|
|
307
310
|
threeDSecureToken = _context2.v;
|
|
308
311
|
if (!(threeDSecureToken !== null && threeDSecureToken !== void 0 && threeDSecureToken.id)) {
|
|
309
312
|
errorPage("3D Secure verification failed. Please try again.");
|
|
313
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
310
314
|
}
|
|
311
315
|
apiBase = baseUrl + "charge/" + userId;
|
|
312
316
|
_context2.n = 7;
|
|
@@ -333,15 +337,18 @@ function PaymentForm(_ref) {
|
|
|
333
337
|
break;
|
|
334
338
|
}
|
|
335
339
|
if (typeof errorPage === "function") errorPage(result);
|
|
340
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
336
341
|
return _context2.a(2);
|
|
337
342
|
case 9:
|
|
338
343
|
if (typeof successPage === "function") successPage(result.message);
|
|
344
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
339
345
|
_context2.n = 11;
|
|
340
346
|
break;
|
|
341
347
|
case 10:
|
|
342
348
|
_context2.p = 10;
|
|
343
349
|
_t2 = _context2.v;
|
|
344
350
|
if (typeof errorPage === "function") errorPage(_t2.message);
|
|
351
|
+
if (componentsRef.current) componentsRef.current.clear();
|
|
345
352
|
case 11:
|
|
346
353
|
_context2.p = 11;
|
|
347
354
|
setIsSubmitting(false);
|