@everymatrix/cashier-method-details 1.29.8 → 1.30.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/cashier-method-details",
3
- "version": "1.29.8",
3
+ "version": "1.30.0",
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": "a6ce52ac3c8209814f7d801c927c7d2d9224b2ae"
38
+ "gitHead": "b9795b320e7d96e10963f25cdea2d9300029d8d7"
39
39
  }
@@ -154,6 +154,7 @@
154
154
  ].reduce(mapReducer, []))
155
155
  export let endpoint: string;
156
156
  export let session: string;
157
+ export let playersession: string;
157
158
  export let lang: string = 'en';
158
159
  export let local: string = 'en-US';
159
160
  export let dateformat: string = "d/m/Y";
@@ -168,6 +169,7 @@
168
169
  export let selectedpaymentmethodname: string;
169
170
  export let clientstyling:string = '';
170
171
  export let clientstylingurl:string = ''
172
+ export let ismobileview:string
171
173
 
172
174
  let xPaymentSessionToken: string;
173
175
  let selectedPaymentMethod: PaymentMethod = {} as PaymentMethod;
@@ -208,16 +210,16 @@
208
210
  let errorResponseCode: string;
209
211
  let isDisabled: boolean;
210
212
  let showErrorModal = false;
213
+ let transactionId = '';
211
214
 
212
215
  $: endpoint && session && selectedpaymentmethodname && currency && reinitMethod();
213
216
  $: clientstyling && customStylingContainer && setClientStyling();
214
217
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
215
218
  $: lang && setActiveLanguage();
216
219
  $: lang && translationurl && setTranslationUrl();
220
+ $: ismobileview && setDevice()
217
221
  $: fields.length && qrCodeContainer.length && generateQr();
218
222
  $: fields.length && flatpickrEl.length && createDatePicker();
219
- $: innerWidth && onWindowResize();
220
- $: mobileView.toString() && hideMethodsList();
221
223
 
222
224
 
223
225
  const reinitMethod = () => {
@@ -243,6 +245,10 @@
243
245
  getPaymentDetails();
244
246
  }
245
247
 
248
+ const setDevice = () => {
249
+ mobileView = ismobileview === 'true';
250
+ }
251
+
246
252
  const generateQr = () => {
247
253
  qrCodeContainer.forEach(elem => {
248
254
  if (elem && elem.innerText) {
@@ -350,6 +356,8 @@
350
356
  editedAmount = Number(amount);
351
357
  if (!selectedPaymentMethod.HideAmountField) {
352
358
  validateAmount();
359
+ } else {
360
+ amountError = '';
353
361
  }
354
362
  fields = selectedPaymentMethod.Fields && selectedPaymentMethod.Fields.map(field => new PaymentMethodDetails(field));
355
363
  fields.forEach(field => {
@@ -386,10 +394,6 @@
386
394
  });
387
395
  }
388
396
 
389
- const onWindowResize = () => {
390
- mobileView = isMobile(userAgent) || mediaQuery.matches
391
- }
392
-
393
397
  const messageHandler = (e:any) => {
394
398
  if (e.data.type == 'ErrorResponseCode') {
395
399
  errorResponseCode = e.data.errorResponseCode;
@@ -495,13 +499,13 @@
495
499
  }
496
500
 
497
501
  const setErrorResponseCode = () => {
498
- window.postMessage({type: 'ErrorResponseCode', errorResponseCode});
502
+ window.postMessage({type: 'ErrorResponseCode', errorResponseCode}, window.location.href);
499
503
  }
500
504
  const setConfirmModalInfo = () => {
501
- window.postMessage({type:'ShowConfirmModal', showConfirmModal, editedAmount});
505
+ window.postMessage({type:'ShowConfirmModal', showConfirmModal, editedAmount}, window.location.href);
502
506
  }
503
507
  const setRedirectInfo = () => {
504
- window.postMessage({type: 'RedirectInfo', redirectMode, redirectUrl});
508
+ window.postMessage({type: 'RedirectInfo', redirectMode, redirectUrl}, window.location.href);
505
509
  }
506
510
  const showModal = () => {
507
511
  showErrorModal = true;
@@ -517,7 +521,7 @@
517
521
  }
518
522
 
519
523
  const toggleDisableActionOnPage = () => {
520
- window.postMessage({type: 'ToggleDisableActionOnPage', disable: isProcessingTxn})
524
+ window.postMessage({type: 'ToggleDisableActionOnPage', disable: isProcessingTxn}, window.location.href)
521
525
  }
522
526
 
523
527
  const hidePaymentDetails = () => {
@@ -569,8 +573,9 @@
569
573
  return;
570
574
  }
571
575
  xPaymentSessionToken = data.XPaymentSessionToken;
576
+ transactionId = data.Transaction.Code;
572
577
  redirectUrl = data.RedirectUrl;
573
- redirectMode = redirectModeMap.get(data.RedirectionMode);
578
+ redirectMode = redirectModeMap.get('Default');
574
579
  isProcessingTxn = false;
575
580
  toggleDisableActionOnPage();
576
581
  setRedirectInfo();
@@ -887,7 +892,7 @@
887
892
  </svg>
888
893
  {$_(`${type.toLowerCase()}.makeTxnButton`)}
889
894
  {#if !selectedPaymentMethod.HideAmountField}
890
- <span class="ButtonAmount">{formatter.format(editedAmount ?? 0)} {currency}</span>
895
+ <span class="ButtonAmount">{formatter.format(editedAmount || 0)} {currency}</span>
891
896
  {/if}
892
897
  </button>
893
898
  {:else}
@@ -924,25 +929,26 @@
924
929
  {endpoint}
925
930
  {customerid}
926
931
  {assetsurl}
927
- session="{xPaymentSessionToken}"
932
+ transactionid="{transactionId}"
933
+ session="{playersession}"
928
934
  >
929
935
  </cashier-receipt-page>
930
936
  </div>
931
937
  {/if}
932
938
  </div>
939
+ {/if}
933
940
  {#if errorResponseCode && !showErrorModal}
934
941
  <cashier-error
935
942
  {assetsurl}
936
943
  {translationurl}
937
944
  {clientstylingurl}
938
945
  {clientstyling}
939
- hidebuttons="{!mobileView || ''}"
946
+ hidebuttons="{`${!mobileView}`}"
940
947
  errorcode={errorResponseCode}
941
948
  >
942
949
  <div slot="button" class="ModalButton" on:click={backToMethodList}>{$_('backToMethodList')}</div>
943
950
  </cashier-error>
944
951
  {/if}
945
- {/if}
946
952
  </div>
947
953
 
948
954