@everymatrix/cashier-method-details 1.29.5 → 1.29.6
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1 -0
- package/dist/cashier-method-details.js +115 -120
- package/dist/cashier-method-details.js.map +1 -1
- package/package.json +2 -2
- package/src/CashierMethodDetails.svelte +36 -52
- package/src/translations.js +0 -11
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/cashier-method-details",
|
3
|
-
"version": "1.29.
|
3
|
+
"version": "1.29.6",
|
4
4
|
"main": "index.js",
|
5
5
|
"svelte": "src/index.ts",
|
6
6
|
"scripts": {
|
@@ -35,5 +35,5 @@
|
|
35
35
|
"publishConfig": {
|
36
36
|
"access": "public"
|
37
37
|
},
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "a67714e03295f6cdb76990ce33c8baeec7819b9f"
|
39
39
|
}
|
@@ -162,7 +162,7 @@
|
|
162
162
|
export let translationurl: string;
|
163
163
|
export let customerid: string;
|
164
164
|
export let currency: string;
|
165
|
-
export let amount:
|
165
|
+
export let amount: string;
|
166
166
|
export let assetsurl: string;
|
167
167
|
export let type: string = TxnType.Deposit;
|
168
168
|
export let selectedpaymentmethodname: string;
|
@@ -207,6 +207,7 @@
|
|
207
207
|
let editedAmount: number;
|
208
208
|
let errorResponseCode: string;
|
209
209
|
let isDisabled: boolean;
|
210
|
+
let showErrorModal = false;
|
210
211
|
|
211
212
|
$: endpoint && session && selectedpaymentmethodname && currency && reinitMethod();
|
212
213
|
$: clientstyling && customStylingContainer && setClientStyling();
|
@@ -236,7 +237,9 @@
|
|
236
237
|
fieldValidation = {};
|
237
238
|
qrCodeContainer = [];
|
238
239
|
selectedPaymentMethod = null;
|
239
|
-
errorResponseCode = ''
|
240
|
+
errorResponseCode = '';
|
241
|
+
showErrorModal = false;
|
242
|
+
setErrorResponseCode();
|
240
243
|
getPaymentDetails();
|
241
244
|
}
|
242
245
|
|
@@ -339,11 +342,12 @@
|
|
339
342
|
}
|
340
343
|
if (data.ResponseCode !== 'Success') {
|
341
344
|
errorResponseCode = data.ResponseCode;
|
345
|
+
setErrorResponseCode();
|
342
346
|
return;
|
343
347
|
}
|
344
348
|
xPaymentSessionToken = data.XPaymentSessionToken;
|
345
349
|
selectedPaymentMethod = data.PaymentMethod;
|
346
|
-
editedAmount = amount;
|
350
|
+
editedAmount = Number(amount);
|
347
351
|
if (!selectedPaymentMethod.HideAmountField) {
|
348
352
|
validateAmount();
|
349
353
|
}
|
@@ -354,6 +358,8 @@
|
|
354
358
|
}
|
355
359
|
validateField(field);
|
356
360
|
})
|
361
|
+
setConfirmModalInfo();
|
362
|
+
setErrorResponseCode();
|
357
363
|
hideMethodsList();
|
358
364
|
})
|
359
365
|
}
|
@@ -384,6 +390,13 @@
|
|
384
390
|
mobileView = isMobile(userAgent) || mediaQuery.matches
|
385
391
|
}
|
386
392
|
|
393
|
+
const messageHandler = (e:any) => {
|
394
|
+
if (e.data.type == 'ErrorResponseCode') {
|
395
|
+
errorResponseCode = e.data.errorResponseCode;
|
396
|
+
showReceiptPage = e.data.showReceiptPage;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
387
400
|
onMount(() => {
|
388
401
|
window.addEventListener('closeModal', closeModal, false);
|
389
402
|
window.addEventListener('confirmModal', confirmTxn, false);
|
@@ -391,6 +404,7 @@
|
|
391
404
|
window.addEventListener('notificationButtonClick', retryRedirect, false);
|
392
405
|
window.addEventListener('closeCashierReceiptPage', closeReceiptPage, false);
|
393
406
|
document.addEventListener('click',closeAllLookups);
|
407
|
+
window.addEventListener('message', messageHandler, false);
|
394
408
|
dayjs.extend(customParseFormat);
|
395
409
|
|
396
410
|
return () => {
|
@@ -399,6 +413,7 @@
|
|
399
413
|
window.removeEventListener('closeIframe', closeIframe);
|
400
414
|
window.removeEventListener('notificationButtonClick', retryRedirect);
|
401
415
|
window.removeEventListener('closeCashierReceiptPage', closeReceiptPage);
|
416
|
+
window.removeEventListener('message', messageHandler);
|
402
417
|
}
|
403
418
|
});
|
404
419
|
|
@@ -466,6 +481,7 @@
|
|
466
481
|
if (data.ResponseCode !== 'Success') {
|
467
482
|
errorResponseCode = data.ResponseCode
|
468
483
|
isProcessingTxn = false;
|
484
|
+
setErrorResponseCode();
|
469
485
|
toggleDisableActionOnPage();
|
470
486
|
showModal()
|
471
487
|
return;
|
@@ -473,18 +489,24 @@
|
|
473
489
|
xPaymentSessionToken = data.XPaymentSessionToken;
|
474
490
|
isProcessingTxn = false;
|
475
491
|
showConfirmModal = true;
|
492
|
+
setConfirmModalInfo();
|
476
493
|
toggleDisableActionOnPage();
|
477
494
|
})
|
478
495
|
}
|
479
496
|
|
497
|
+
const setErrorResponseCode = () => {
|
498
|
+
window.postMessage({type: 'ErrorResponseCode', errorResponseCode});
|
499
|
+
}
|
500
|
+
const setConfirmModalInfo = () => {
|
501
|
+
window.postMessage({type:'ShowConfirmModal', showConfirmModal, editedAmount});
|
502
|
+
}
|
503
|
+
const setRedirectInfo = () => {
|
504
|
+
window.postMessage({type: 'RedirectInfo', redirectMode, redirectUrl});
|
505
|
+
}
|
480
506
|
const showModal = () => {
|
507
|
+
showErrorModal = true;
|
481
508
|
window.postMessage({ type: 'ShowCashierModal' }, window.location.href)
|
482
509
|
}
|
483
|
-
|
484
|
-
const hideModal = () => {
|
485
|
-
window.postMessage({ type: 'HideCashierModal' }, window.location.href)
|
486
|
-
}
|
487
|
-
|
488
510
|
const backToMethodList = () => {
|
489
511
|
dispatchEvent(new CustomEvent('backToMethodList', {
|
490
512
|
bubbles: true,
|
@@ -518,6 +540,7 @@
|
|
518
540
|
const closeIframe = () => {
|
519
541
|
redirectUrl = null;
|
520
542
|
showReceiptPage = true;
|
543
|
+
setRedirectInfo();
|
521
544
|
}
|
522
545
|
const closeModal = () => {
|
523
546
|
showConfirmModal = false;
|
@@ -541,6 +564,7 @@
|
|
541
564
|
if (data.ResponseCode !== 'Success') {
|
542
565
|
errorResponseCode = data.ResponseCode;
|
543
566
|
isProcessingTxn = false;
|
567
|
+
toggleDisableActionOnPage();
|
544
568
|
showModal();
|
545
569
|
return;
|
546
570
|
}
|
@@ -549,6 +573,7 @@
|
|
549
573
|
redirectMode = redirectModeMap.get(data.RedirectionMode);
|
550
574
|
isProcessingTxn = false;
|
551
575
|
toggleDisableActionOnPage();
|
576
|
+
setRedirectInfo();
|
552
577
|
if (!redirectUrl) {
|
553
578
|
showReceiptPage = true;
|
554
579
|
}
|
@@ -565,6 +590,7 @@
|
|
565
590
|
windowRedirect = window.open(redirectUrl, '_blank');
|
566
591
|
showRedirectNotification = true;
|
567
592
|
showRetryNotification = false;
|
593
|
+
setRedirectInfo();
|
568
594
|
}
|
569
595
|
|
570
596
|
const closeReceiptPage = () => {
|
@@ -723,7 +749,7 @@
|
|
723
749
|
<div class="CashierMethodDetails" bind:this={customStylingContainer}>
|
724
750
|
{#if selectedPaymentMethod?.Name}
|
725
751
|
<div class="MethodsDetails">
|
726
|
-
{#if !showReceiptPage}
|
752
|
+
{#if !showReceiptPage && !errorResponseCode || (errorResponseCode && showErrorModal)}
|
727
753
|
<form on:submit|preventDefault={prepareTxn} novalidate>
|
728
754
|
<div class="FieldWrapper">
|
729
755
|
<div class="FormLogo">
|
@@ -904,7 +930,7 @@
|
|
904
930
|
</div>
|
905
931
|
{/if}
|
906
932
|
</div>
|
907
|
-
{
|
933
|
+
{#if errorResponseCode && !showErrorModal}
|
908
934
|
<cashier-error
|
909
935
|
{assetsurl}
|
910
936
|
{translationurl}
|
@@ -916,33 +942,7 @@
|
|
916
942
|
<div slot="button" class="ModalButton" on:click={backToMethodList}>{$_('backToMethodList')}</div>
|
917
943
|
</cashier-error>
|
918
944
|
{/if}
|
919
|
-
{#if redirectUrl && redirectMode === RedirectionModeStringEnum.Default}
|
920
|
-
<div class="IframeRedirect">
|
921
|
-
<cashier-iframe-redirect
|
922
|
-
lang="{lang}"
|
923
|
-
translationurl="{translationurl}"
|
924
|
-
iframeurl="{redirectUrl}"
|
925
|
-
></cashier-iframe-redirect>
|
926
|
-
</div>
|
927
|
-
{/if}
|
928
|
-
{#if showConfirmModal}
|
929
|
-
<cashier-confirm-modal>
|
930
|
-
<span slot="text">{$_(`${type.toLowerCase()}.confirmText`,
|
931
|
-
{ values: !selectedPaymentMethod.HideAmountField ? { amount: formatter.format(editedAmount ?? 0), currency } : {amount: '', currency: ''}})}</span>
|
932
|
-
<div slot="confirm">{$_(`${type.toLowerCase()}.confirmButton`)}</div>
|
933
|
-
</cashier-confirm-modal>
|
934
945
|
{/if}
|
935
|
-
<cashier-modal>
|
936
|
-
<cashier-error
|
937
|
-
{assetsurl}
|
938
|
-
{translationurl}
|
939
|
-
{clientstylingurl}
|
940
|
-
{clientstyling}
|
941
|
-
errorcode={errorResponseCode}
|
942
|
-
>
|
943
|
-
<div slot="button" class="ModalButton" on:click={hideModal}>{$_('closeModal')}</div>
|
944
|
-
</cashier-error>
|
945
|
-
</cashier-modal>
|
946
946
|
</div>
|
947
947
|
|
948
948
|
|
@@ -1088,22 +1088,6 @@
|
|
1088
1088
|
text-transform: none;
|
1089
1089
|
}
|
1090
1090
|
}
|
1091
|
-
cashier-iframe-redirect {
|
1092
|
-
height: inherit;
|
1093
|
-
width: inherit;
|
1094
|
-
}
|
1095
|
-
.IframeRedirect {
|
1096
|
-
display: flex;
|
1097
|
-
position: absolute;
|
1098
|
-
align-items: center;
|
1099
|
-
justify-content: center;
|
1100
|
-
width: 100%;
|
1101
|
-
height: 100%;
|
1102
|
-
z-index: 100;
|
1103
|
-
top: 0;
|
1104
|
-
left: 0;
|
1105
|
-
background-color: var(--emw--color-white, #FFF);
|
1106
|
-
}
|
1107
1091
|
.FieldWrapper, label{
|
1108
1092
|
display: flex;
|
1109
1093
|
flex-direction: column ;
|
package/src/translations.js
CHANGED
@@ -19,17 +19,6 @@ export const TRANSLATIONS = {
|
|
19
19
|
"amountIntError": "Amount should be integer value",
|
20
20
|
"amountDecimalError": "Amount should have 2 or less digits after decimal point",
|
21
21
|
"invalidFieldError": "{field} is invalid",
|
22
|
-
"closeModal": "CLOSE",
|
23
22
|
"backToMethodList": "BACK TO PAYMENT METHODS",
|
24
|
-
"deposit": {
|
25
|
-
"makeTxnButton": "DEPOSIT",
|
26
|
-
"confirmText": "You're going to deposit {amount} {currency} to your account",
|
27
|
-
"confirmButton": "Ok"
|
28
|
-
},
|
29
|
-
"withdraw": {
|
30
|
-
"makeTxnButton": "WITHDRAW",
|
31
|
-
"confirmText": "You're going to withdraw {amount} {currency} from your account",
|
32
|
-
"confirmButton": "Ok"
|
33
|
-
}
|
34
23
|
}
|
35
24
|
}
|