@everymatrix/cashier-method-details 1.34.2 → 1.35.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.34.2",
3
+ "version": "1.35.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": "99004a0501ea8fb9219aac803a986e470f556838"
38
+ "gitHead": "cad27ef6706d0e17f1eda3810fee31f1ec373fa9"
39
39
  }
@@ -52,8 +52,8 @@
52
52
  this.description = element.Description || null;
53
53
  this.type = fieldTypeMap.get(element.Type) || null;
54
54
  this.defaultValue = this.calcDefaultValue(element);
55
- this.format = this.setPlaceHolderOrFormat(element, FieldParams.Format);
56
- this.placeholder = this.setPlaceHolderOrFormat(element, FieldParams.Placeholder);
55
+ this.format = this.setPlaceholderOrFormat(element, FieldParams.Format);
56
+ this.placeholder = this.setPlaceholderOrFormat(element, FieldParams.Placeholder);
57
57
  this.isReadonly = element.IsReadonly || false;
58
58
  this.isRequired = element.IsRequired || false;
59
59
  this.maxValue = this.setValue(element, FieldParams.MaxValue);
@@ -115,6 +115,12 @@
115
115
  Withdraw='Withdraw'
116
116
  }
117
117
 
118
+ enum ResponseCode {
119
+ PlayerSessionIsNotValid = 'PlayerSessionIsNotValid',
120
+ Success = 'Success',
121
+ JwtTokenError = 'JwtTokenError'
122
+ }
123
+
118
124
  const VISIBLE_FIELD_TYPES: string[] = 'Text,Number,Money,Boolean,Lookup,Date,Time,DateTime,Password,Label,Link,QRCode'.split(',');
119
125
 
120
126
  enum RedirectionModeStringEnum {
@@ -379,11 +385,22 @@
379
385
  window.postMessage({type: 'ShowSessionError', error: data.error}, window.location.href)
380
386
  return;
381
387
  }
382
- if (data.ResponseCode !== 'Success') {
388
+ if (data.ResponseCode === ResponseCode.PlayerSessionIsNotValid) {
389
+ errorResponseCode = data.ResponseCode;
390
+ setErrorResponseCode();
391
+ return;
392
+ }
393
+
394
+ if (data.ResponseCode === ResponseCode.JwtTokenError) {
383
395
  errorResponseCode = data.ResponseCode;
384
396
  setErrorResponseCode();
385
397
  return;
386
398
  }
399
+
400
+ if (data.ResponseCode !== ResponseCode.Success) {
401
+ errorResponseCode = data.ResponseCode;
402
+ return;
403
+ }
387
404
  xPaymentSessionToken = data.XPaymentSessionToken;
388
405
  selectedPaymentMethod = data.PaymentMethod;
389
406
  editedAmount = Number(amount);
@@ -518,10 +535,21 @@
518
535
  postMessage({type: 'ShowSessionError', error: data.error}, window.location.href)
519
536
  return;
520
537
  }
521
- if (data.ResponseCode !== 'Success') {
538
+ if (data.ResponseCode === ResponseCode.PlayerSessionIsNotValid) {
522
539
  errorResponseCode = data.ResponseCode
523
- isProcessingTxn = false;
524
540
  setErrorResponseCode();
541
+ return;
542
+ }
543
+
544
+ if (data.ResponseCode === ResponseCode.JwtTokenError) {
545
+ errorResponseCode = data.ResponseCode
546
+ setErrorResponseCode();
547
+ return;
548
+ }
549
+
550
+ if (data.ResponseCode !== ResponseCode.Success) {
551
+ errorResponseCode = data.ResponseCode
552
+ isProcessingTxn = false;
525
553
  toggleDisableActionOnPage();
526
554
  showModal()
527
555
  return;
@@ -545,7 +573,7 @@
545
573
  }
546
574
  const showModal = () => {
547
575
  showErrorModal = true;
548
- window.postMessage({ type: 'ShowCashierModal' }, window.location.href)
576
+ window.postMessage({ type: 'ShowCashierModal', modalErrorMessage: errorResponseCode}, window.location.href)
549
577
  }
550
578
  const backToMethodList = () => {
551
579
  dispatchEvent(new CustomEvent('backToMethodList', {
@@ -601,7 +629,19 @@
601
629
  })
602
630
  }
603
631
  fetch(url, requestParams).then((res) => res.json()).then(data => {
604
- if (data.ResponseCode !== 'Success') {
632
+ if(data.ResponseCode === ResponseCode.PlayerSessionIsNotValid) {
633
+ errorResponseCode = data.ResponseCode
634
+ setErrorResponseCode();
635
+ return;
636
+ }
637
+
638
+ if(data.ResponseCode === ResponseCode.JwtTokenError) {
639
+ errorResponseCode = data.ResponseCode
640
+ setErrorResponseCode();
641
+ return;
642
+ }
643
+
644
+ if (data.ResponseCode !== ResponseCode.Success) {
605
645
  errorResponseCode = data.ResponseCode;
606
646
  isProcessingTxn = false;
607
647
  toggleDisableActionOnPage();