@everymatrix/cashier-method-details 1.27.0 → 1.27.2
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 +251 -223
- package/dist/cashier-method-details.js.map +1 -1
- package/package.json +2 -2
- package/src/CashierMethodDetails.svelte +172 -133
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/cashier-method-details",
|
3
|
-
"version": "1.27.
|
3
|
+
"version": "1.27.2",
|
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": "0c03a79deed2ad6c051e5842c9c172ccdfee2b46"
|
39
39
|
}
|
@@ -7,6 +7,7 @@
|
|
7
7
|
import { TRANSLATIONS } from './translations';
|
8
8
|
|
9
9
|
import '@everymatrix/cashier-iframe-redirect';
|
10
|
+
import '@everymatrix/cashier-receipt-page';
|
10
11
|
import '@everymatrix/cashier-confirm-modal'
|
11
12
|
import '@everymatrix/cashier-notifications'
|
12
13
|
|
@@ -111,6 +112,7 @@
|
|
111
112
|
export let customerid: string;
|
112
113
|
export let currency: string;
|
113
114
|
export let amount: number;
|
115
|
+
export let assetsurl: string;
|
114
116
|
export let selectedpaymentmethodname: string;
|
115
117
|
export let clientstyling:string = '';
|
116
118
|
export let clientstylingurl:string = ''
|
@@ -132,6 +134,7 @@
|
|
132
134
|
let customStylingContainer:HTMLElement;
|
133
135
|
let prepareRequest;
|
134
136
|
let showConfirmModal:boolean = false;
|
137
|
+
let showReceiptPage:boolean = false;
|
135
138
|
let redirectUrl: string;
|
136
139
|
let windowRedirect: Window;
|
137
140
|
let showRedirectNotification: boolean;
|
@@ -257,6 +260,7 @@
|
|
257
260
|
window.addEventListener('confirmModal', confirmTxn, false);
|
258
261
|
window.addEventListener('closeIframe', closeIframe, false);
|
259
262
|
window.addEventListener('notificationButtonClick', retryRedirect, false);
|
263
|
+
window.addEventListener('closeCashierReceiptPage', closeReceiptPage, false);
|
260
264
|
document.addEventListener('click',closeAllLookups)
|
261
265
|
|
262
266
|
return () => {
|
@@ -264,6 +268,7 @@
|
|
264
268
|
window.removeEventListener('confirmModal', confirmTxn);
|
265
269
|
window.removeEventListener('closeIframe', closeIframe);
|
266
270
|
window.removeEventListener('notificationButtonClick', retryRedirect);
|
271
|
+
window.removeEventListener('closeCashierReceiptPage', closeReceiptPage);
|
267
272
|
}
|
268
273
|
});
|
269
274
|
|
@@ -342,6 +347,7 @@
|
|
342
347
|
}
|
343
348
|
const closeIframe = () => {
|
344
349
|
redirectUrl = null;
|
350
|
+
showReceiptPage = true;
|
345
351
|
}
|
346
352
|
const closeModal = () => {
|
347
353
|
showConfirmModal = false;
|
@@ -365,6 +371,9 @@
|
|
365
371
|
redirectUrl = data.RedirectUrl;
|
366
372
|
redirectMode = data.RedirectionMode;
|
367
373
|
isProcessingTxn = false;
|
374
|
+
if (!redirectUrl) {
|
375
|
+
showReceiptPage = true;
|
376
|
+
}
|
368
377
|
if (data.RedirectionMode === RedirectionModeStringEnum.RedirectWithRetry) {
|
369
378
|
windowRedirect = window.open(data.RedirectUrl, '_blank');
|
370
379
|
showRedirectNotification = !!windowRedirect;
|
@@ -380,6 +389,9 @@
|
|
380
389
|
showRetryNotification = false;
|
381
390
|
}
|
382
391
|
|
392
|
+
const closeReceiptPage = () => {
|
393
|
+
showReceiptPage = false
|
394
|
+
}
|
383
395
|
const openUrlInNewTab = (url) => {
|
384
396
|
if (!url) {
|
385
397
|
return
|
@@ -435,7 +447,7 @@
|
|
435
447
|
}
|
436
448
|
|
437
449
|
const amountMultiplierError = () => {
|
438
|
-
if (selectedPaymentMethod.AmountMultiplier && (selectedPaymentMethod.AmountMultiplier
|
450
|
+
if (selectedPaymentMethod.AmountMultiplier && (amount % selectedPaymentMethod.AmountMultiplier !== 0)) {
|
439
451
|
return $_('amountMultiplierError', {
|
440
452
|
values: {
|
441
453
|
multiplier: selectedPaymentMethod.AmountMultiplier
|
@@ -496,143 +508,145 @@
|
|
496
508
|
<div class="CashierMethodDetails" bind:this={customStylingContainer}>
|
497
509
|
{#if selectedPaymentMethod?.Name}
|
498
510
|
<div class="MethodsDetails">
|
499
|
-
|
500
|
-
<
|
501
|
-
<div class="
|
502
|
-
<div class="
|
503
|
-
<
|
504
|
-
|
505
|
-
|
506
|
-
|
511
|
+
{#if !showReceiptPage}
|
512
|
+
<form on:submit|preventDefault={prepareTxn}>
|
513
|
+
<div class="FieldWrapper">
|
514
|
+
<div class="FormLogo">
|
515
|
+
<div class="SelectedLogoWrapper">
|
516
|
+
<img src={selectedPaymentMethod.Logos[0].LogoUrl} alt={selectedPaymentMethod.Label} />
|
517
|
+
</div>
|
518
|
+
<div class="SelectedLogoDescription">
|
519
|
+
{selectedPaymentMethod.Label}
|
520
|
+
</div>
|
521
|
+
{#if mobileView}
|
522
|
+
<div on:click={() => backToMethodList()} class="ChangePaymeth">{$_('change')}</div>
|
523
|
+
{/if}
|
507
524
|
</div>
|
508
|
-
{#if
|
509
|
-
<div
|
525
|
+
{#if selectedPaymentMethod.Description}
|
526
|
+
<div class="SelectedMethodDescription">
|
527
|
+
{selectedPaymentMethod.Description}
|
528
|
+
</div>
|
510
529
|
{/if}
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
{
|
532
|
-
<span class="
|
533
|
-
{
|
534
|
-
{selectedPaymentMethod.DisplayCurrency.MaxAmountLimit ? `/ ${$_('generalMax')} ${formatter.format(selectedPaymentMethod.DisplayCurrency.MaxAmountLimit)} ${currency}` : ''}
|
530
|
+
{#if !selectedPaymentMethod.HideAmountField}
|
531
|
+
<div class="Amount" class:Invalid={amountError && showError['amount']}>
|
532
|
+
<label>
|
533
|
+
<span class="Required">
|
534
|
+
{$_('amountLabel')}
|
535
|
+
</span>
|
536
|
+
{#if selectedPaymentMethod.IsAmountConfigurable}
|
537
|
+
<input type="number"
|
538
|
+
bind:value={amount}
|
539
|
+
on:input={() => validateAmount()}
|
540
|
+
on:blur={() => {showError['amount'] = true; validateAmount()}}
|
541
|
+
placeholder="{$_('amountPlaceholder')}"
|
542
|
+
>
|
543
|
+
<span class="Alert">{amountError}</span>
|
544
|
+
{#if selectedPaymentMethod.DisplayCurrency}
|
545
|
+
<span class="AmountLimits">
|
546
|
+
{selectedPaymentMethod.DisplayCurrency.MinAmountLimit ? `${$_('generalMin')} ${formatter.format(selectedPaymentMethod.DisplayCurrency.MinAmountLimit)} ${currency}` : ''}
|
547
|
+
{selectedPaymentMethod.DisplayCurrency.MaxAmountLimit ? `/ ${$_('generalMax')} ${formatter.format(selectedPaymentMethod.DisplayCurrency.MaxAmountLimit)} ${currency}` : ''}
|
548
|
+
</span>
|
549
|
+
{/if}
|
550
|
+
{:else}
|
551
|
+
<span class="NonConfigurableAmount">
|
552
|
+
{formatter.format(amount)} {currency}
|
535
553
|
</span>
|
536
554
|
{/if}
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
</span>
|
541
|
-
{/if}
|
542
|
-
</label>
|
555
|
+
</label>
|
556
|
+
</div>
|
557
|
+
{/if}
|
543
558
|
</div>
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
on:input="{() => { validateField(field) }}"
|
567
|
-
on:blur="{() => { showError[field.name] = true; validateField(field) }}"
|
568
|
-
>
|
569
|
-
{:else if field.type === FieldTypes.Password}
|
570
|
-
<input type="password" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}"
|
571
|
-
on:input="{() => { validateField(field) }}"
|
572
|
-
on:blur="{() => { showError[field.name] = true; validateField(field) }}"
|
573
|
-
>
|
574
|
-
{:else if field.type === FieldTypes.Hidden}
|
575
|
-
<input type="hidden" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
|
576
|
-
|
577
|
-
{:else if field.type === FieldTypes.Lookup}
|
578
|
-
<div class="CustomSelect">
|
579
|
-
<div class="Selected" id="{index}" on:click="{(e) => showLookup(e, field.name)}">{prepareFields[field.name] || ''}</div>
|
580
|
-
<div class="OptionList" class:Opened={openedLookup === field.name}>
|
581
|
-
{#each field.values as value}
|
582
|
-
<div on:click="{() => {prepareFields[field.name] = value.Name; fields = fields}}">
|
583
|
-
<span>{value.Value}</span>
|
584
|
-
</div>
|
585
|
-
{/each}
|
586
|
-
</div>
|
587
|
-
</div>
|
588
|
-
{:else if field.type === FieldTypes.Boolean}
|
589
|
-
<div class="Checkbox">
|
590
|
-
<input type="checkbox" bind:checked={prepareFields[field.name]} placeholder="{field.placeholder}"
|
591
|
-
on:change="{() => { showError[field.name] = true; validateField(field) }}"
|
559
|
+
{#each fields as field, index}
|
560
|
+
{#if showField(field)}
|
561
|
+
<div class="FieldWrapper"
|
562
|
+
class:Hidden={field.type === FieldTypes.Hidden}
|
563
|
+
class:Invalid={showError[field.name] && fieldValidation[field.name]}>
|
564
|
+
<label>
|
565
|
+
{#if field.label && field.type !== FieldTypes.Link && field.type !== FieldTypes.Boolean}
|
566
|
+
<span class:Required={field.isRequired}>{field.label}</span>
|
567
|
+
{/if}
|
568
|
+
{#if field.description && field.description !== field.label && field.type !== FieldTypes.QRCode && field.type !== FieldTypes.Boolean && field.type !== FieldTypes.Link}
|
569
|
+
<span class="Description">{field.description}</span>
|
570
|
+
{/if}
|
571
|
+
{#if field.type === FieldTypes.Text}
|
572
|
+
<input type="text" bind:value={prepareFields[field.name]}
|
573
|
+
placeholder="{field.placeholder}"
|
574
|
+
on:input="{() => { validateField(field) }}"
|
575
|
+
on:blur="{() => { showError[field.name] = true; validateField(field) }}">
|
576
|
+
|
577
|
+
{:else if field.type === FieldTypes.Number || field.type === FieldTypes.Money}
|
578
|
+
<input type="number" placeholder="{field.placeholder}" bind:value={prepareFields[field.name]}
|
579
|
+
on:input="{() => { validateField(field) }}"
|
580
|
+
on:blur="{() => { showError[field.name] = true; validateField(field) }}"
|
592
581
|
>
|
593
|
-
|
594
|
-
<
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
582
|
+
{:else if field.type === FieldTypes.Password}
|
583
|
+
<input type="password" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}"
|
584
|
+
on:input="{() => { validateField(field) }}"
|
585
|
+
on:blur="{() => { showError[field.name] = true; validateField(field) }}"
|
586
|
+
>
|
587
|
+
{:else if field.type === FieldTypes.Hidden}
|
588
|
+
<input type="hidden" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
|
589
|
+
|
590
|
+
{:else if field.type === FieldTypes.Lookup}
|
591
|
+
<div class="CustomSelect">
|
592
|
+
<div class="Selected" id="{index}" on:click="{(e) => showLookup(e, field.name)}">{prepareFields[field.name] || ''}</div>
|
593
|
+
<div class="OptionList" class:Opened={openedLookup === field.name}>
|
594
|
+
{#each field.values as value}
|
595
|
+
<div on:click="{() => {prepareFields[field.name] = value.Name; fields = fields}}">
|
596
|
+
<span>{value.Value}</span>
|
597
|
+
</div>
|
598
|
+
{/each}
|
599
|
+
</div>
|
600
|
+
</div>
|
601
|
+
{:else if field.type === FieldTypes.Boolean}
|
602
|
+
<div class="Checkbox">
|
603
|
+
<input type="checkbox" bind:checked={prepareFields[field.name]} placeholder="{field.placeholder}"
|
604
|
+
on:change="{() => { showError[field.name] = true; validateField(field) }}"
|
605
|
+
>
|
606
|
+
<span class="Checkmark"></span>
|
607
|
+
<span class="Description">{@html field.descriptionWithLink}</span>
|
608
|
+
</div>
|
609
|
+
{:else if field.type === FieldTypes.QRCode}
|
610
|
+
<div class="QRCode" on:click={() => {openUrlInNewTab(field.description)}}>
|
611
|
+
<div bind:this={qrCodeContainer[qrCodeContainer.length]}>{field.defaultValue}</div>
|
612
|
+
</div>
|
613
|
+
{:else if field.type === FieldTypes.Link}
|
614
|
+
<span>{@html field.descriptionWithLink}</span>
|
615
|
+
{:else if field.type === FieldTypes.Label}
|
616
|
+
<span class="Label"></span>
|
617
|
+
{:else}
|
618
|
+
<input type="text" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
|
619
|
+
{/if}
|
620
|
+
</label>
|
621
|
+
<span class="Alert">{ fieldValidation[field.name] || '' }</span>
|
622
|
+
</div>
|
623
|
+
{/if}
|
624
|
+
{/each}
|
625
|
+
{#if !isProcessingTxn}
|
626
|
+
<button class="PrimaryButton" type="submit" disabled="{isSubmitDisabled(amountError, fieldValidation)}">
|
627
|
+
<svg class="ButtonLock" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
628
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51564 0.574496C6.49714 0.733152 5.5928 1.46162 5.21164 2.43037C5.01714 2.92471 4.98674 3.24368 4.98671 4.78987L4.98668 5.99306L4.55336 6.00671C4.20693 6.01762 4.08258 6.03221 3.93336 6.07946C3.43136 6.23846 3.00318 6.58293 2.73943 7.04C2.70133 7.106 2.63639 7.256 2.59508 7.37334L2.52002 7.58665V13.9067L2.59268 14.12C2.6993 14.4331 2.83849 14.6518 3.09336 14.9067C3.34821 15.1615 3.56693 15.3007 3.88002 15.4073L4.09336 15.48H11.9067L12.12 15.4073C12.4331 15.3007 12.6518 15.1615 12.9067 14.9067C13.1616 14.6518 13.3007 14.4331 13.4074 14.12L13.48 13.9067V7.58665L13.405 7.37334C13.1846 6.74712 12.6999 6.27875 12.0667 6.08C11.9191 6.03371 11.7891 6.0184 11.4467 6.00696L11.0134 5.99253L11.0133 4.78959C11.0133 4.128 11.0008 3.45465 10.9855 3.29334C10.9257 2.66268 10.7188 2.13556 10.3497 1.67368C9.66549 0.817589 8.6023 0.405214 7.51564 0.574496ZM8.46436 1.58665C9.01596 1.7035 9.52999 2.11659 9.79758 2.65809C9.98521 3.03771 9.98202 3.00646 9.99305 4.58L10.003 6H5.99702L6.00699 4.58C6.01802 3.00646 6.01483 3.03771 6.20246 2.65809C6.31793 2.42446 6.43799 2.26065 6.61818 2.09103C6.89043 1.83468 7.21371 1.65496 7.52352 1.58775C7.74977 1.53865 8.23518 1.53809 8.46436 1.58665ZM11.9201 7.0955C12.0975 7.17871 12.2992 7.37412 12.3874 7.54806C12.4231 7.61846 12.465 7.75796 12.4805 7.85803C12.4993 7.97978 12.5061 8.97962 12.501 10.88L12.4934 13.72L12.4082 13.8997C12.26 14.2127 12.0016 14.419 11.6821 14.4796C11.4864 14.5167 4.51364 14.5167 4.31793 14.4796C3.99843 14.419 3.74008 14.2127 3.59183 13.8997L3.50668 13.72L3.49905 10.88C3.49393 8.97728 3.50074 7.97987 3.51964 7.85778C3.57627 7.49218 3.79218 7.21543 4.12918 7.0765L4.28002 7.01431L8.02668 7.0205L11.7734 7.02665L11.9201 7.0955Z" fill="white"/>
|
629
|
+
</svg>
|
630
|
+
{$_('makeDepositButton')}
|
631
|
+
<span class="ButtonAmount">{formatter.format(amount)} {currency}</span>
|
632
|
+
</button>
|
633
|
+
{:else}
|
634
|
+
<button class="PrimaryButton">
|
635
|
+
<svg class="ButtonSpinner" xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
|
636
|
+
<path d="M14.0282 6.58425C13.9037 4.05374 12.3688 1.68916 10.0872 0.61058C7.59818 -0.509483 4.56986 -0.0531603 2.49567 1.68916C0.504443 3.34851 -0.408201 6.04496 0.172573 8.57547C0.711862 11.0645 2.6616 13.0972 5.10915 13.7609C8.0545 14.5906 10.7509 13.1802 12.4103 10.7741C10.9169 12.7653 8.63527 14.0928 6.10476 13.6365C3.57424 13.1802 1.50005 11.2719 0.919281 8.78289C0.297024 6.12793 1.54154 3.34851 3.90612 1.97955C6.35366 0.569097 9.79682 1.10839 11.4147 3.51445C11.8295 4.09522 12.1199 4.80045 12.2444 5.50567C12.3688 6.08644 12.3273 6.7087 12.4103 7.28947C12.4933 7.82876 12.9496 8.53399 13.5718 8.16063C14.1111 7.82876 14.0696 7.12354 14.0282 6.58425C14.0696 6.87464 14.0282 6.41831 14.0282 6.58425Z" fill="white"/>
|
637
|
+
</svg>
|
638
|
+
{$_('processingButton')}
|
639
|
+
</button>
|
640
|
+
{/if}
|
641
|
+
{#if showRetryNotification}
|
642
|
+
<cashier-notifications
|
643
|
+
text="{$_('retryText')}"
|
644
|
+
button="{$_('retryButton')}"
|
645
|
+
>
|
646
|
+
</cashier-notifications>
|
647
|
+
{/if}
|
648
|
+
</form>
|
649
|
+
{/if}
|
636
650
|
{#if showRedirectNotification}
|
637
651
|
<div class="RedirectionNotification">
|
638
652
|
<img src="//static.everymatrix.com/mmstage/cashier/assets/redirect.png" alt="">
|
@@ -641,6 +655,20 @@
|
|
641
655
|
<div class="RedirectionClose" on:click={() => {showRedirectNotification = false}}>{$_('backToPayment')}</div>
|
642
656
|
</div>
|
643
657
|
{/if}
|
658
|
+
{#if showReceiptPage}
|
659
|
+
<div class="ReceiptPage">
|
660
|
+
<cashier-receipt-page
|
661
|
+
{lang}
|
662
|
+
{translationurl}
|
663
|
+
{local}
|
664
|
+
{endpoint}
|
665
|
+
{customerid}
|
666
|
+
{assetsurl}
|
667
|
+
session="{xPaymentSessionToken}"
|
668
|
+
>
|
669
|
+
</cashier-receipt-page>
|
670
|
+
</div>
|
671
|
+
{/if}
|
644
672
|
</div>
|
645
673
|
{/if}
|
646
674
|
{#if redirectUrl && redirectMode === RedirectionModeStringEnum.Default}
|
@@ -670,6 +698,17 @@
|
|
670
698
|
transform: rotate(360deg)
|
671
699
|
}
|
672
700
|
}
|
701
|
+
|
702
|
+
input::-webkit-outer-spin-button,
|
703
|
+
input::-webkit-inner-spin-button {
|
704
|
+
-webkit-appearance: none;
|
705
|
+
margin: 0;
|
706
|
+
}
|
707
|
+
|
708
|
+
input[type=number] {
|
709
|
+
-moz-appearance: textfield;
|
710
|
+
}
|
711
|
+
|
673
712
|
.MethodsDetails {
|
674
713
|
position: relative;
|
675
714
|
display: flex;
|
@@ -721,7 +760,7 @@
|
|
721
760
|
}
|
722
761
|
.RedirectionNotification {
|
723
762
|
height: 100%;
|
724
|
-
width:
|
763
|
+
width: 100%;
|
725
764
|
position: absolute;
|
726
765
|
display: flex;
|
727
766
|
flex-direction: column;
|