@everymatrix/cashier-method-details 1.26.0 → 1.27.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/cashier-method-details",
3
- "version": "1.26.0",
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": "5abe76b491406787c17e946ad3c79676a0554d8b"
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
 
@@ -105,11 +106,13 @@
105
106
  }
106
107
  export let endpoint: string;
107
108
  export let session: string;
108
- export let lang: string;
109
+ export let lang: string = 'en';
110
+ export let local: string = 'en-US';
109
111
  export let translationurl: string;
110
112
  export let customerid: string;
111
113
  export let currency: string;
112
114
  export let amount: number;
115
+ export let assetsurl: string;
113
116
  export let selectedpaymentmethodname: string;
114
117
  export let clientstyling:string = '';
115
118
  export let clientstylingurl:string = ''
@@ -131,6 +134,7 @@
131
134
  let customStylingContainer:HTMLElement;
132
135
  let prepareRequest;
133
136
  let showConfirmModal:boolean = false;
137
+ let showReceiptPage:boolean = false;
134
138
  let redirectUrl: string;
135
139
  let windowRedirect: Window;
136
140
  let showRedirectNotification: boolean;
@@ -138,7 +142,7 @@
138
142
  let showRetryNotification: boolean;
139
143
  let isProcessingTxn: boolean;
140
144
  let isTranslationLoaded: boolean;
141
- let openedLookup: number | null;
145
+ let openedLookup: string | null;
142
146
  let clickedElem: HTMLElement;
143
147
  let qrCodeContainer: HTMLElement[] = [];
144
148
  let qrCodeScriptSrc: string = 'https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js';
@@ -148,6 +152,10 @@
148
152
  let userAgent:string = window.navigator.userAgent;
149
153
  let mediaQuery = window.matchMedia('(max-width: 750px)');
150
154
  let innerWidth: number;
155
+ let formatter = new Intl.NumberFormat(local, {minimumFractionDigits: 2 });
156
+ let amountError = '';
157
+ let showError = {};
158
+ let fieldValidation = {};
151
159
 
152
160
  $: endpoint && session && selectedpaymentmethodname && currency && getPaymentDetails();
153
161
  $: clientstyling && customStylingContainer && setClientStyling();
@@ -156,7 +164,8 @@
156
164
  $: lang && translationurl && setTranslationUrl();
157
165
  $: selectedpaymentmethodname && qrCodeContainer.length && generateQr();
158
166
  $: innerWidth && onWindowResize();
159
- $: mobileView.toString() && hideMethodsList()
167
+ $: mobileView.toString() && hideMethodsList();
168
+
160
169
  const generateQr = () => {
161
170
  qrCodeContainer.forEach(elem => {
162
171
  if (elem && elem.innerText) {
@@ -210,8 +219,12 @@
210
219
  fetch(url, requestParams).then(res => res.json()).then(data => {
211
220
  xPaymentSessionToken = data.XPaymentSessionToken;
212
221
  selectedPaymentMethod = data.PaymentMethod;
213
- fields = selectedPaymentMethod.Fields && selectedPaymentMethod.Fields.map(field => new PaymentMethodDetails(field));
222
+ showError = {};
214
223
  prepareFields = {};
224
+ fieldValidation = {};
225
+ validateAmount();
226
+ fields = selectedPaymentMethod.Fields && selectedPaymentMethod.Fields.map(field => new PaymentMethodDetails(field));
227
+ fields.forEach(field => { validateField(field) })
215
228
  hideMethodsList();
216
229
  })
217
230
  }
@@ -247,6 +260,7 @@
247
260
  window.addEventListener('confirmModal', confirmTxn, false);
248
261
  window.addEventListener('closeIframe', closeIframe, false);
249
262
  window.addEventListener('notificationButtonClick', retryRedirect, false);
263
+ window.addEventListener('closeCashierReceiptPage', closeReceiptPage, false);
250
264
  document.addEventListener('click',closeAllLookups)
251
265
 
252
266
  return () => {
@@ -254,22 +268,27 @@
254
268
  window.removeEventListener('confirmModal', confirmTxn);
255
269
  window.removeEventListener('closeIframe', closeIframe);
256
270
  window.removeEventListener('notificationButtonClick', retryRedirect);
271
+ window.removeEventListener('closeCashierReceiptPage', closeReceiptPage);
257
272
  }
258
273
  });
259
274
 
260
275
  const closeAllLookups = (e) => {
276
+ if (openedLookup) {
277
+ showError[openedLookup] = true;
278
+ validateField(fields.find(field => field.name === openedLookup));
279
+ }
261
280
  if(!e.composedPath().includes(clickedElem)){
262
281
  openedLookup = null;
263
282
  }
264
283
  }
265
284
 
266
- const showLookup = (event, index) => {
267
- if (index === openedLookup) {
285
+ const showLookup = (event, name) => {
286
+ if (name === openedLookup) {
268
287
  openedLookup = null
269
288
  return;
270
289
  }
271
290
  clickedElem = event.composedPath()[0]
272
- openedLookup = index
291
+ openedLookup = name
273
292
  }
274
293
 
275
294
  const prepareTxn = () => {
@@ -328,6 +347,7 @@
328
347
  }
329
348
  const closeIframe = () => {
330
349
  redirectUrl = null;
350
+ showReceiptPage = true;
331
351
  }
332
352
  const closeModal = () => {
333
353
  showConfirmModal = false;
@@ -351,6 +371,9 @@
351
371
  redirectUrl = data.RedirectUrl;
352
372
  redirectMode = data.RedirectionMode;
353
373
  isProcessingTxn = false;
374
+ if (!redirectUrl) {
375
+ showReceiptPage = true;
376
+ }
354
377
  if (data.RedirectionMode === RedirectionModeStringEnum.RedirectWithRetry) {
355
378
  windowRedirect = window.open(data.RedirectUrl, '_blank');
356
379
  showRedirectNotification = !!windowRedirect;
@@ -366,6 +389,9 @@
366
389
  showRetryNotification = false;
367
390
  }
368
391
 
392
+ const closeReceiptPage = () => {
393
+ showReceiptPage = false
394
+ }
369
395
  const openUrlInNewTab = (url) => {
370
396
  if (!url) {
371
397
  return
@@ -373,6 +399,11 @@
373
399
  window.postMessage({ type: 'NavigateTo', path: url, target: blankPageTarget || null, externalLink: externalLink || false }, window.location.href);
374
400
  }
375
401
 
402
+ const onLookUpChanged = (field, value) => {
403
+ prepareFields[field.name] = value;
404
+ validateField(field);
405
+ }
406
+
376
407
  const showField = (field) => {
377
408
  if (!field.correlationFieldName) {
378
409
  return true;
@@ -384,128 +415,238 @@
384
415
  return isCorrelatedFieldVisible
385
416
  }
386
417
 
418
+ const emptyAmountError = ():string => {
419
+ if (!amount) {
420
+ return $_('errorEmptyField')
421
+ }
422
+ return ''
423
+ }
424
+
425
+ const minAmountError = () => {
426
+ if (selectedPaymentMethod.DisplayCurrency.MinAmountLimit > amount) {
427
+ return $_('minAmountError', {
428
+ values: {
429
+ amount: formatter.format(selectedPaymentMethod.DisplayCurrency.MinAmountLimit),
430
+ currency: selectedPaymentMethod.DisplayCurrency.Name
431
+ }
432
+ })
433
+ }
434
+ return ''
435
+ }
436
+
437
+ const maxAmountError = () => {
438
+ if (selectedPaymentMethod.DisplayCurrency.MaxAmountLimit < amount) {
439
+ return $_('maxAmountError', {
440
+ values: {
441
+ amount: formatter.format(selectedPaymentMethod.DisplayCurrency.MaxAmountLimit),
442
+ currency: selectedPaymentMethod.DisplayCurrency.Name
443
+ }
444
+ })
445
+ }
446
+ return ''
447
+ }
448
+
449
+ const amountMultiplierError = () => {
450
+ if (selectedPaymentMethod.AmountMultiplier && (amount % selectedPaymentMethod.AmountMultiplier !== 0)) {
451
+ return $_('amountMultiplierError', {
452
+ values: {
453
+ multiplier: selectedPaymentMethod.AmountMultiplier
454
+ }
455
+ })
456
+ }
457
+ return ''
458
+ }
459
+
460
+ const amountIntError = ():string => {
461
+ if (selectedPaymentMethod.IsIntegerAmount && !Number.isInteger(amount)) {
462
+ return $_('amountIntError')
463
+ }
464
+ return ''
465
+ }
466
+
467
+ const amountDecimalError = ():string => {
468
+ if (Number(amount).toFixed(2) != amount) {
469
+ return $_('amountDecimalError')
470
+ }
471
+ return ''
472
+ }
473
+
474
+ const patternMatchesError = (field, value):string => {
475
+ if (field.format && !value.toString().match(field.format)) {
476
+ return $_('invalidFieldError',{ values: { field: field.label }})
477
+ }
478
+ return ''
479
+ }
480
+
481
+ const emptyFieldError = (field, value):string => {
482
+ if (field.isRequired && (!value || !value.toString().trim())) {
483
+ return $_('errorEmptyField')
484
+ }
485
+ return ''
486
+ }
487
+
488
+ const validateAmount = () => {
489
+ amountError = emptyAmountError() || minAmountError() ||
490
+ maxAmountError() || amountMultiplierError() ||
491
+ amountIntError() || amountDecimalError();
492
+ }
493
+
494
+ const validateField = (field) => {
495
+ const value = prepareFields[field.name]
496
+ fieldValidation[field.name] = emptyFieldError(field, value) || patternMatchesError(field, value);
497
+ }
498
+
499
+ const isSubmitDisabled = (amountError, fieldValidation) => {
500
+ return !!amountError || Object.values(fieldValidation).some(error => !!error)
501
+ }
502
+
387
503
  </script>
388
504
  <svelte:window bind:innerWidth={innerWidth} />
389
505
  <svelte:head>
390
506
  <script src={qrCodeScriptSrc}></script>
391
507
  </svelte:head>
392
508
  <div class="CashierMethodDetails" bind:this={customStylingContainer}>
393
- {#if selectedPaymentMethod.Name}
509
+ {#if selectedPaymentMethod?.Name}
394
510
  <div class="MethodsDetails">
395
- <form on:submit|preventDefault={prepareTxn}>
396
- <div class="FieldWrapper">
397
- <div class="form-logo">
398
- <div class="SelectedLogoWrapper">
399
- <img src={selectedPaymentMethod.Logos[0].LogoUrl} alt={selectedPaymentMethod.Label} />
400
- </div>
401
- <div class="SelectedLogoDescription">
402
- {selectedPaymentMethod.Label}
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}
403
524
  </div>
404
- {#if mobileView}
405
- <div on:click={() => backToMethodList()} class="ChangePaymeth">{$_('change')}</div>
525
+ {#if selectedPaymentMethod.Description}
526
+ <div class="SelectedMethodDescription">
527
+ {selectedPaymentMethod.Description}
528
+ </div>
406
529
  {/if}
407
- </div>
408
- {#if !selectedPaymentMethod.HideAmountField}
409
- <div class="Amount">
410
- <label>
411
- <span class="Required">
412
- {$_('amountLabel')}
413
- </span>
414
- {#if selectedPaymentMethod.IsAmountConfigurable}
415
- <input type="number" bind:value={amount} placeholder="{$_('amountPlaceholder')}">
416
- {#if selectedPaymentMethod.DisplayCurrency}
417
- <span class="AmountLimits">
418
- {selectedPaymentMethod.DisplayCurrency.MinAmountLimit ? `${$_('generalMin')} ${selectedPaymentMethod.DisplayCurrency.MinAmountLimit} ${currency}` : ''}
419
- {selectedPaymentMethod.DisplayCurrency.MaxAmountLimit ? `/ ${$_('generalMax')} ${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}
420
553
  </span>
421
554
  {/if}
422
- {:else}
423
- <span class="NonConfigurableAmount">
424
- {amount} {currency}
425
- </span>
426
- {/if}
427
- </label>
555
+ </label>
556
+ </div>
557
+ {/if}
428
558
  </div>
429
- {/if}
430
- </div>
431
- {#each fields as field, index}
432
- {#if showField(field)}
433
- <div class="FieldWrapper" class:Hidden={field.type === FieldTypes.Hidden}>
434
- <label>
435
- {#if field.label && field.type !== FieldTypes.Link && field.type !== FieldTypes.Boolean}
436
- <span class:Required={field.isRequired}>{field.label}</span>
437
- {/if}
438
- {#if field.description && field.description !== field.label && field.type !== FieldTypes.QRCode && field.type !== FieldTypes.Boolean && field.type !== FieldTypes.Link}
439
- <span class="Description">{field.description}</span>
440
- {/if}
441
- {#if field.type === FieldTypes.Text}
442
- <input type="text" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
443
-
444
- {:else if field.type === FieldTypes.Number || field.type === FieldTypes.Money}
445
- <input type="number" placeholder="{field.placeholder}" bind:value={prepareFields[field.name]}>
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) }}">
446
576
 
447
- {:else if field.type === FieldTypes.Password}
448
- <input type="password" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
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) }}"
581
+ >
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}">
449
589
 
450
- {:else if field.type === FieldTypes.Hidden}
451
- <input type="hidden" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
452
-
453
- {:else if field.type === FieldTypes.Lookup}
454
- <div class="CustomSelect">
455
- <div class="Selected" id="{index}" on:click="{(e) => showLookup(e,index)}">{prepareFields[field.name] || ''}</div>
456
- <div class="OptionList" class:Opened={openedLookup === index}>
457
- {#each field.values as value}
458
- <div on:click="{() => {prepareFields[field.name] = value.Name; fields = fields}}">
459
- <span>{value.Value}</span>
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}
460
599
  </div>
461
- {/each}
462
- </div>
463
- </div>
464
- {:else if field.type === FieldTypes.Boolean}
465
- <div class="Checkbox">
466
- <input type="checkbox" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
467
- <span class="Checkmark"></span>
468
- <span class="Description">{@html field.descriptionWithLink}</span>
469
- </div>
470
- {:else if field.type === FieldTypes.QRCode}
471
- <div class="QRCode" on:click={() => {openUrlInNewTab(field.description)}}>
472
- <div bind:this={qrCodeContainer[qrCodeContainer.length]}>{field.defaultValue}</div>
473
- </div>
474
- {:else if field.type === FieldTypes.Link}
475
- <span>{@html field.descriptionWithLink}</span>
476
- {:else if field.type === FieldTypes.Label}
477
- <span class="Label"></span>
478
- {:else}
479
- <input type="text" bind:value={prepareFields[field.name]} placeholder="{field.placeholder}">
480
- {/if}
481
- </label>
482
- </div>
483
- {/if}
484
- {/each}
485
- {#if !isProcessingTxn}
486
- <button class="PrimaryButton" type="submit">
487
- <svg class="ButtonLock" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
488
- <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"/>
489
- </svg>
490
- {$_('makeDepositButton')}
491
- <span class="ButtonAmount">{amount || $_('amountPlaceholder')} {currency}</span>
492
- </button>
493
- {:else}
494
- <button class="PrimaryButton">
495
- <svg class="ButtonSpinner" xmlns="http://www.w3.org/2000/svg" width="15" height="14" viewBox="0 0 15 14" fill="none">
496
- <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"/>
497
- </svg>
498
- {$_('processingButton')}
499
- </button>
500
- {/if}
501
- {#if showRetryNotification}
502
- <cashier-notifications
503
- text="{$_('retryText')}"
504
- button="{$_('retryButton')}"
505
- >
506
- </cashier-notifications>
507
- {/if}
508
- </form>
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}
509
650
  {#if showRedirectNotification}
510
651
  <div class="RedirectionNotification">
511
652
  <img src="//static.everymatrix.com/mmstage/cashier/assets/redirect.png" alt="">
@@ -514,6 +655,20 @@
514
655
  <div class="RedirectionClose" on:click={() => {showRedirectNotification = false}}>{$_('backToPayment')}</div>
515
656
  </div>
516
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}
517
672
  </div>
518
673
  {/if}
519
674
  {#if redirectUrl && redirectMode === RedirectionModeStringEnum.Default}
@@ -527,7 +682,7 @@
527
682
  {/if}
528
683
  {#if showConfirmModal}
529
684
  <cashier-confirm-modal>
530
- <span slot="text">{$_('confirmDepositText')} {amount} {currency} ?</span>
685
+ <span slot="text">{$_('confirmDepositText')} {formatter.format(amount)} {currency} ?</span>
531
686
  <div slot="confirm">{$_('confirmDepositButton')}</div>
532
687
  </cashier-confirm-modal>
533
688
  {/if}
@@ -543,6 +698,17 @@
543
698
  transform: rotate(360deg)
544
699
  }
545
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
+
546
712
  .MethodsDetails {
547
713
  position: relative;
548
714
  display: flex;
@@ -552,7 +718,7 @@
552
718
  visibility: hidden;
553
719
  }
554
720
  }
555
- .form-logo {
721
+ .FormLogo {
556
722
  align-items: center;
557
723
  display: flex;
558
724
  height: 50px;
@@ -586,9 +752,15 @@
586
752
  text-decoration-line: underline;
587
753
  }
588
754
  }
755
+ .SelectedMethodDescription {
756
+ color: var(--emw--color-gray-300, #666);
757
+ font-size: var(--emw--font-size-x-small, 12px);
758
+ margin: 10px 0 5px;
759
+ line-height: var(--emw--font-size-x-small, 12px);
760
+ }
589
761
  .RedirectionNotification {
590
762
  height: 100%;
591
- width: inherit;
763
+ width: 100%;
592
764
  position: absolute;
593
765
  display: flex;
594
766
  flex-direction: column;
@@ -664,6 +836,26 @@
664
836
  padding: 0;
665
837
  }
666
838
  }
839
+ .Alert {
840
+ display: none;
841
+ }
842
+ .Invalid {
843
+ input, .Selected {
844
+ border-color: var(--emw--color-error, #FE0101);
845
+ }
846
+ .Alert {
847
+ display: inline-block;
848
+ }
849
+ .AmountLimits {
850
+ display: none;
851
+ }
852
+ }
853
+ .Alert {
854
+ color: var(--emw--color-error, #FE0101);
855
+ font-size: var(--emw--font-size-x-small, 12px);
856
+ margin: 5px 0 0 2px;
857
+ line-height: var(--emw--font-size-x-small, 12px);
858
+ }
667
859
  .AmountLimits {
668
860
  color: var(--emw--color-gray-300, #666);
669
861
  font-size: var(--emw--font-size-x-small, 12px);
@@ -702,7 +894,7 @@
702
894
  .PrimaryButton {
703
895
  color: var(--emw--color-white, #FFF);
704
896
  text-align: center;
705
- font-size: var(--emw--font-size-small, 14px);
897
+ font-size: var(--emw--font-size-x-small, 12px);
706
898
  font-style: normal;
707
899
  font-weight: 400;
708
900
  height: 46px;
@@ -713,9 +905,27 @@
713
905
  width: 100%;
714
906
  margin: 12px 0;
715
907
  cursor: pointer;
716
- text-transform: uppercase;
908
+ display: flex;
909
+ align-items: center;
910
+ justify-content: center;
911
+ gap: 5px;
912
+ .ButtonAmount {
913
+ font-weight: 600;
914
+ }
717
915
  .ButtonSpinner {
718
- animation: loading-spinner 1s linear infinite
916
+ animation: loading-spinner 1s linear infinite;
917
+ background: var(--emw--color-active, #5C950F);
918
+ }
919
+ &[disabled] {
920
+ background: var(--emw--color-disabled, #99999980);
921
+ cursor: auto;
922
+ pointer-events: none;
923
+ }
924
+ &:hover {
925
+ background: var(--emw--color-hover, #71B11B);
926
+ }
927
+ &:active {
928
+ background: var(--emw--color-active, #5C950F);
719
929
  }
720
930
  }
721
931
  .QRCode {