@everymatrix/cashier-page 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-page",
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
  }
@@ -5,7 +5,7 @@
5
5
  import {TRANSLATIONS} from './translations';
6
6
 
7
7
  import type {PaymentMethod} from "./CashierPage.types";
8
- import {TxnChannel, TxnType} from "./CashierPage.types";
8
+ import {TxnChannel, TxnType, ResponseCode} from "./CashierPage.types";
9
9
 
10
10
  import '@everymatrix/cashier-methods-list';
11
11
  import '@everymatrix/cashier-method-details';
@@ -74,6 +74,7 @@
74
74
  let confirmAmount: number;
75
75
  let hideAmountField: boolean;
76
76
  let redirectMode: RedirectionModeStringEnum;
77
+ let modalErrorMessage: string;
77
78
 
78
79
  $: endpoint && session && customerid && lang && channel && type && successurl && failurl && cancelurl && getPlayerSession();
79
80
  $: clientstyling && customStylingContainer && setClientStyling();
@@ -129,7 +130,16 @@
129
130
  if (data.error) {
130
131
  errorMessage = data.error
131
132
  }
132
- if (data.ResponseCode !== 'Success') {
133
+ if (data.ResponseCode === ResponseCode.PlayerSessionIsNotValid) {
134
+ errorResponseCode = data.ResponseCode;
135
+ setErrorResponseCode();
136
+ return;
137
+ }
138
+ if (data.ResponseCode === ResponseCode.JwtTokenError) {
139
+ errorResponseCode = data.ResponseCode;
140
+ setErrorResponseCode();
141
+ }
142
+ if (data.ResponseCode !== ResponseCode.Success) {
133
143
  errorResponseCode = data.ResponseCode;
134
144
  setErrorResponseCode();
135
145
  return;
@@ -203,24 +213,27 @@
203
213
  }
204
214
 
205
215
  const messageHandler = (e:any) => {
206
- if (e.data.type == 'ShowSessionError') {
216
+ if (e.data.type === 'ShowSessionError') {
207
217
  errorMessage = e.data.error
208
218
  }
209
219
  if (e.data.type === 'ToggleDisableActionOnPage') {
210
220
  isProcessingTxn = e.data.disable
211
221
  }
212
- if (e.data.type == 'ErrorResponseCode') {
222
+ if (e.data.type === 'ErrorResponseCode') {
213
223
  errorResponseCode = e.data.errorResponseCode;
214
224
  }
215
- if (e.data.type == 'ShowConfirmModal') {
225
+ if (e.data.type === 'ShowConfirmModal') {
216
226
  showConfirmModal = e.data.showConfirmModal;
217
227
  confirmAmount = e.data.editedAmount;
218
228
  hideAmountField = e.data.hideAmountField;
219
229
  }
220
- if (e.data.type == 'RedirectInfo') {
230
+ if (e.data.type === 'RedirectInfo') {
221
231
  redirectUrl = e.data.redirectUrl;
222
232
  redirectMode = e.data.redirectMode;
223
233
  }
234
+ if (e.data.type === 'ShowCashierModal') {
235
+ modalErrorMessage = e.data.modalErrorMessage;
236
+ }
224
237
  }
225
238
 
226
239
  </script>
@@ -248,7 +261,7 @@
248
261
  {translationurl}
249
262
  {clientstylingurl}
250
263
  {clientstyling}
251
- errorcode={errorResponseCode}
264
+ errorcode={modalErrorMessage}
252
265
  >
253
266
  <div slot="button" class="ModalButton" on:click={hideModal}>{$_('closeModal')}</div>
254
267
  </cashier-error>
@@ -72,3 +72,9 @@ export enum TxnChannel {
72
72
  Mobile='Mobile',
73
73
  NativeApp='NativeApp'
74
74
  }
75
+
76
+ export enum ResponseCode {
77
+ PlayerSessionIsNotValid ='PlayerSessionIsNotValid',
78
+ Success = 'Success',
79
+ JwtTokenError = 'JwtTokenError'
80
+ }