@akinon/pz-masterpass-rest 2.0.14-rc.1 → 2.0.14

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.
@@ -1,7 +1,6 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Input, Icon } from '@akinon/next/components';
3
3
  import { detectCardType, getCardIcon, getCvcLength } from '../utils/card-utils';
4
- import { getCappedRewardTotal } from '../utils/reward-utils';
5
4
  import type { CardListProps } from '../types/custom-render.types';
6
5
  import MasterpassSecurityInfo from './masterpass-security-info';
7
6
 
@@ -14,12 +13,6 @@ const CardList: React.FC<CardListProps> = ({
14
13
  cvc = '',
15
14
  onCvcChange,
16
15
  cvcRequired = false,
17
- availableRewards = [],
18
- selectedRewards = [],
19
- isLoadingRewards = false,
20
- onOpenRewardModal,
21
- rewardCurrency,
22
- rewardPayableAmount,
23
16
  texts
24
17
  }) => {
25
18
  const [localCvc, setLocalCvc] = useState(cvc);
@@ -30,21 +23,9 @@ const CardList: React.FC<CardListProps> = ({
30
23
  onCvcChange?.(numericValue);
31
24
  };
32
25
 
33
- const orderedCards = useMemo(() => {
34
- if (!selectedCard) return cards;
35
- const idx = cards.findIndex(
36
- (c) => c.uniqueCardNumber === selectedCard.uniqueCardNumber
37
- );
38
- if (idx <= 0) return cards;
39
- const reordered = [...cards];
40
- const [picked] = reordered.splice(idx, 1);
41
- reordered.unshift(picked);
42
- return reordered;
43
- }, [cards, selectedCard]);
44
-
45
26
  return (
46
27
  <div className="flex flex-col gap-4">
47
- {orderedCards.map((card) => {
28
+ {cards.map((card) => {
48
29
  const isSelected =
49
30
  selectedCard?.uniqueCardNumber === card.uniqueCardNumber;
50
31
  const expectedCvcLength = getCvcLength(detectCardType(card.cardBin));
@@ -138,57 +119,6 @@ const CardList: React.FC<CardListProps> = ({
138
119
  )}
139
120
  </div>
140
121
 
141
- {isSelected &&
142
- (isLoadingRewards || availableRewards.length > 0) && (
143
- <div
144
- className="border-t border-[#eeeeee] p-4 bg-[#fafafa] flex items-center justify-between gap-3"
145
- onClick={(e) => e.stopPropagation()}
146
- >
147
- <div className="flex items-center gap-2 min-w-0">
148
- <Icon name="gift" size={16} className="text-[#000000]" />
149
- <div className="min-w-0">
150
- <p className="text-sm font-medium text-[#4a4f54] truncate">
151
- {texts.rewardOpenButtonText}
152
- </p>
153
- {selectedRewards.length > 0 ? (
154
- <p className="text-xs text-[#00a63d] truncate">
155
- {(texts.rewardSelectedSummaryText || '').replace(
156
- '{count}',
157
- String(selectedRewards.length)
158
- )}
159
- {' · '}
160
- {getCappedRewardTotal(
161
- selectedRewards,
162
- rewardPayableAmount
163
- ).toFixed(2)}{' '}
164
- {(rewardCurrency || '').toUpperCase()}
165
- </p>
166
- ) : (
167
- <p className="text-xs text-[#9d9d9d] truncate">
168
- {(texts.rewardAvailableSummaryText || '').replace(
169
- '{count}',
170
- String(availableRewards.length)
171
- )}
172
- </p>
173
- )}
174
- </div>
175
- </div>
176
- <button
177
- type="button"
178
- onClick={(e) => {
179
- e.stopPropagation();
180
- onOpenRewardModal?.();
181
- }}
182
- disabled={isLoadingRewards}
183
- className="px-3 py-1.5 text-xs border border-[#000000] text-[#000000] hover:bg-[#000000] hover:text-white transition-colors disabled:opacity-50 shrink-0"
184
- >
185
- {selectedRewards.length > 0
186
- ? texts.rewardModalConfirmText
187
- : texts.rewardOpenButtonText}
188
- </button>
189
- </div>
190
- )}
191
-
192
122
  {isSelected && cvcRequired && (
193
123
  <div
194
124
  className="border-t border-[#eeeeee] p-4 bg-[#f7f7f7]"
@@ -184,7 +184,7 @@ const CreditCardForm: React.FC<CreditCardFormProps> = ({
184
184
  setValue('cardNumber', formatted, { shouldValidate: true });
185
185
  }}
186
186
  error={errors.cardNumber}
187
- maxLength={19}
187
+ maxLength={23}
188
188
  className="pr-20"
189
189
  />
190
190
  {cardType !== 'unknown' && (
@@ -118,7 +118,7 @@ const InstallmentList: React.FC<InstallmentListProps> = ({
118
118
  <Button
119
119
  onClick={onProceedToPayment}
120
120
  disabled={isLoading || paymentLoading}
121
- className="w-full cursor-pointer bg-[#000000] text-[#ffffff] hover:bg-[#ffffff] hover:text-[#000000] border border-solid border-[#000000] disabled:opacity-50 disabled:cursor-not-allowed"
121
+ className="w-full cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"
122
122
  >
123
123
  {paymentLoading ? (
124
124
  <div className="flex items-center justify-center">
@@ -204,21 +204,15 @@ const OTPModal: React.FC<OTPModalProps> = ({
204
204
  >
205
205
  <div className="px-6">
206
206
  {getTitle() && (
207
- <h3 className="text-center mt-4 text-lg font-semibold">
208
- {getTitle()}
209
- </h3>
207
+ <h3 className="text-center mt-4 text-lg font-semibold">{getTitle()}</h3>
210
208
  )}
211
- <p className="text-center mt-2 text-sm text-gray-600">
212
- {getDescription()}
213
- </p>
209
+ <p className="text-center mt-2 text-sm text-gray-600">{getDescription()}</p>
214
210
  <div className="flex flex-col gap-3 p-5 w-3/4 m-auto">
215
211
  <Input
216
212
  type="text"
217
213
  value={otp}
218
214
  onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
219
- setOtp(
220
- e.target.value.replace(/\D/g, '').slice(0, getMaxLength())
221
- );
215
+ setOtp(e.target.value.replace(/\D/g, '').slice(0, getMaxLength()));
222
216
  setError(null);
223
217
  }}
224
218
  maxLength={getMaxLength()}
@@ -228,9 +222,7 @@ const OTPModal: React.FC<OTPModalProps> = ({
228
222
  placeholder={getPlaceholder()}
229
223
  />
230
224
  {getHelperText() && (
231
- <p className="text-xs text-gray-500 text-center">
232
- {getHelperText()}
233
- </p>
225
+ <p className="text-xs text-gray-500 text-center">{getHelperText()}</p>
234
226
  )}
235
227
  {error && (
236
228
  <p className="text-[#d72b01] text-xs text-center">{error}</p>
@@ -40,16 +40,7 @@ export const useMasterpassAccount = () => {
40
40
 
41
41
  const initializeAccount = useCallback(
42
42
  async (newTokenData: any, rawToken?: string) => {
43
- if (!newTokenData?.AccountKey) {
44
- dispatch(
45
- setAccountStatus({
46
- isAccountNotFound: false,
47
- isAccountNotLinked: true,
48
- shouldShowDirectForm: true
49
- })
50
- );
51
- return;
52
- }
43
+ if (!newTokenData?.AccountKey) return;
53
44
 
54
45
  const accountService = new AccountService(rawToken || token, newTokenData?.MerchantId);
55
46
 
@@ -135,10 +126,7 @@ export const useMasterpassAccount = () => {
135
126
  dispatch(resetState());
136
127
  }, [dispatch]);
137
128
 
138
- const refreshToken = async (options?: {
139
- three_d?: boolean;
140
- skipReset?: boolean;
141
- }) => {
129
+ const refreshToken = async (options?: { three_d?: boolean; skipReset?: boolean }) => {
142
130
  if (options?.three_d !== false && !options?.skipReset) {
143
131
  resetData();
144
132
  }
@@ -230,12 +218,8 @@ export const useMasterpassAccount = () => {
230
218
  informationModalData: {
231
219
  type: 'warning',
232
220
  title: texts?.sessionExpiredTitle || 'Session Expired',
233
- message:
234
- texts?.sessionExpiredMessage ||
235
- 'Your session has expired due to inactivity. Please restart the process to continue.',
236
- secondaryMessage:
237
- texts?.sessionExpiredSecondaryMessage ||
238
- 'For security reasons, verification codes are only valid for a limited time.',
221
+ message: texts?.sessionExpiredMessage || 'Your session has expired due to inactivity. Please restart the process to continue.',
222
+ secondaryMessage: texts?.sessionExpiredSecondaryMessage || 'For security reasons, verification codes are only valid for a limited time.',
239
223
  buttonText: texts?.sessionExpiredButton || 'Start Again'
240
224
  }
241
225
  })
@@ -351,7 +335,7 @@ export const useMasterpassAccount = () => {
351
335
  const activeMerchantId = freshResult?.merchantId || tokenData?.MerchantId;
352
336
 
353
337
  if (!activeTokenData?.AccountKey) {
354
- return { success: false, message: '' };
338
+ throw new Error('Token data not available');
355
339
  }
356
340
 
357
341
  const accountService = new AccountService(activeToken, activeMerchantId);
@@ -5,9 +5,7 @@ import {
5
5
  useSetMasterpassRestBinNumberMutation,
6
6
  useCheckoutMasterpassInstallmentMutation,
7
7
  usePrepareMasterpassOrderMutation,
8
- useFinalizeMasterpassOrderMutation,
9
- useQueryMasterpassRewardsMutation,
10
- useSelectMasterpassRewardsMutation
8
+ useFinalizeMasterpassOrderMutation
11
9
  } from '../redux/api';
12
10
  import {
13
11
  updatePaymentState,
@@ -16,12 +14,7 @@ import {
16
14
  setInstallments,
17
15
  setCardType,
18
16
  setOrderData,
19
- setOrderCompleted,
20
- setAvailableRewards,
21
- setSelectedRewards,
22
- setLoadingRewards,
23
- setShowRewardModal,
24
- clearRewards
17
+ setOrderCompleted
25
18
  } from '../redux/reducer';
26
19
  import { useMasterpassToken } from './useMasterpassToken';
27
20
  import { PaymentService } from '../services/payment';
@@ -31,9 +24,8 @@ import {
31
24
  getTransactionType
32
25
  } from '../utils/payment-utils';
33
26
  import { handleMasterpassResponse } from '../utils/response-handler';
34
- import type { Installment, RewardItem } from '../types/payment.types';
27
+ import type { Installment } from '../types/payment.types';
35
28
  import type { CardModel } from '../types/account.types';
36
- import { getCappedRewardAmounts } from '../utils/reward-utils';
37
29
 
38
30
  export type PaymentResult = {
39
31
  success: boolean;
@@ -43,14 +35,7 @@ export type PaymentResult = {
43
35
  message?: any;
44
36
  };
45
37
 
46
- export interface UseMasterpassPaymentOptions {
47
- enableRewards?: boolean;
48
- }
49
-
50
- export const useMasterpassPayment = (
51
- options: UseMasterpassPaymentOptions = {}
52
- ) => {
53
- const { enableRewards = false } = options;
38
+ export const useMasterpassPayment = () => {
54
39
  const dispatch = useDispatch();
55
40
  const {
56
41
  paymentState,
@@ -61,13 +46,6 @@ export const useMasterpassPayment = (
61
46
  tokenData
62
47
  } = useAppSelector((state) => state.masterpassRest);
63
48
 
64
- const payableAmount = useAppSelector(
65
- (state) =>
66
- state.checkout?.preOrder?.unpaid_amount ??
67
- state.checkout?.preOrder?.total_amount_with_interest ??
68
- null
69
- );
70
-
71
49
  const { refetch: refetchToken } = useMasterpassToken({
72
50
  useThreeD: paymentState.useThreeD
73
51
  });
@@ -84,12 +62,6 @@ export const useMasterpassPayment = (
84
62
  const [finalizeMasterpassOrder, { isLoading: isFinalizeLoading }] =
85
63
  useFinalizeMasterpassOrderMutation();
86
64
 
87
- const [queryMasterpassRewards, { isLoading: isRewardsQueryLoading }] =
88
- useQueryMasterpassRewardsMutation();
89
-
90
- const [selectMasterpassRewards, { isLoading: isRewardsSelectLoading }] =
91
- useSelectMasterpassRewardsMutation();
92
-
93
65
  const refreshTokenForPayment = useCallback(async () => {
94
66
  const result = await refetchToken({ skipReset: true });
95
67
  if (result?.data?.token) {
@@ -125,38 +97,12 @@ export const useMasterpassPayment = (
125
97
  [checkoutMasterpassInstallment, dispatch]
126
98
  );
127
99
 
128
- const fetchRewardsForCard = useCallback(
129
- async (card: CardModel) => {
130
- if (!card?.cardAlias) return;
131
-
132
- dispatch(setLoadingRewards(true));
133
-
134
- try {
135
- const result = await queryMasterpassRewards({
136
- card_alias: card.cardAlias
137
- }).unwrap();
138
-
139
- const rewards =
140
- result.context_list?.[0]?.page_context?.rewards || [];
141
- dispatch(setAvailableRewards(rewards));
142
- } catch (error) {
143
- dispatch(setAvailableRewards([]));
144
- } finally {
145
- dispatch(setLoadingRewards(false));
146
- }
147
- },
148
- [queryMasterpassRewards, dispatch]
149
- );
150
-
151
100
  const handleCardSelect = useCallback(
152
101
  async (card: CardModel) => {
153
102
  dispatch(setSelectedCard(card));
154
103
  dispatch(setInstallments([]));
155
104
  dispatch(setSelectedInstallment(null));
156
105
  dispatch(setCardType(null));
157
- if (enableRewards) {
158
- dispatch(clearRewards());
159
- }
160
106
 
161
107
  try {
162
108
  const result = await setMasterpassRestBinNumber({
@@ -173,53 +119,11 @@ export const useMasterpassPayment = (
173
119
  await handleInstallmentSelect(pageContext.installments[0]);
174
120
  }
175
121
  }
176
-
177
- if (enableRewards) {
178
- void fetchRewardsForCard(card);
179
- }
180
122
  } catch (error) {
181
123
  // Silently handle errors (e.g., mutation aborted due to rapid selection)
182
124
  }
183
125
  },
184
- [
185
- enableRewards,
186
- setMasterpassRestBinNumber,
187
- handleInstallmentSelect,
188
- fetchRewardsForCard,
189
- dispatch
190
- ]
191
- );
192
-
193
- const openRewardModal = useCallback(() => {
194
- dispatch(setShowRewardModal(true));
195
- }, [dispatch]);
196
-
197
- const closeRewardModal = useCallback(() => {
198
- dispatch(setShowRewardModal(false));
199
- }, [dispatch]);
200
-
201
- const confirmRewards = useCallback(
202
- async (selected: RewardItem[]) => {
203
- const capped = getCappedRewardAmounts(selected, payableAmount);
204
- const special = capped.special.toFixed(2);
205
- const general = capped.general.toFixed(2);
206
-
207
- try {
208
- await selectMasterpassRewards({ special, general }).unwrap();
209
- dispatch(setSelectedRewards(selected));
210
- dispatch(setShowRewardModal(false));
211
- return { success: true };
212
- } catch (error) {
213
- return {
214
- success: false,
215
- message:
216
- error instanceof Error
217
- ? error.message
218
- : 'Failed to apply rewards'
219
- };
220
- }
221
- },
222
- [selectMasterpassRewards, payableAmount, dispatch]
126
+ [setMasterpassRestBinNumber, handleInstallmentSelect, dispatch]
223
127
  );
224
128
 
225
129
  const processPayment = useCallback(async (): Promise<PaymentResult> => {
@@ -347,6 +251,10 @@ export const useMasterpassPayment = (
347
251
  const activeToken = freshResult?.token;
348
252
  const activeMerchantId = freshResult?.merchantId || tokenData?.MerchantId;
349
253
 
254
+ if (!activeTokenData?.AccountKey) {
255
+ return { success: false, message: 'Token data not available' };
256
+ }
257
+
350
258
  const prepareResult = await prepareMasterpassOrder({
351
259
  use_three_d: paymentState.useThreeD
352
260
  }).unwrap();
@@ -360,13 +268,13 @@ export const useMasterpassPayment = (
360
268
  cardHolderName: newCardFormData.cardholderName || '',
361
269
  cardAlias: newCardFormData.cardAlias || '',
362
270
  expiryDate: newCardFormData.expiryDate,
363
- accountKey: activeTokenData?.AccountKey || '',
271
+ accountKey: activeTokenData.AccountKey,
364
272
  amount: prepareResult.pre_order?.total_amount_with_interest,
365
273
  orderNo: prepareResult.context_list?.[0]?.page_context?.order_no,
366
274
  currencyCode: currency,
367
275
  installmentCount: selectedInstallment.installment_count,
368
- authenticationMethod: activeTokenData?.AuthenticationMethod,
369
- secure3DModel: activeTokenData?.Secure3dType,
276
+ authenticationMethod: activeTokenData.AuthenticationMethod,
277
+ secure3DModel: activeTokenData.Secure3dType,
370
278
  terminalGroupId,
371
279
  acquirerIcaNumber: bankIca,
372
280
  additionalFields:
@@ -438,18 +346,11 @@ export const useMasterpassPayment = (
438
346
  isInstallmentLoading,
439
347
  isPrepareLoading,
440
348
  isFinalizeLoading,
441
- isRewardsQueryLoading,
442
- isRewardsSelectLoading,
443
- payableAmount,
444
349
 
445
350
  updatePaymentState: updatePaymentStateAction,
446
351
  handleCardSelect,
447
352
  handleInstallmentSelect,
448
353
  processPayment,
449
- processDirectPayment,
450
- fetchRewardsForCard,
451
- openRewardModal,
452
- closeRewardModal,
453
- confirmRewards
354
+ processDirectPayment
454
355
  };
455
356
  };
package/src/index.ts CHANGED
@@ -4,7 +4,6 @@ export { default as MasterpassRestOption } from './views/masterpass-rest-option'
4
4
 
5
5
  export { default as CreditCardForm } from './components/credit-card-form';
6
6
  export { default as PaymentMethodSelector } from './components/payment-method-selector';
7
- export { default as RewardSelectionModal } from './components/reward-selection-modal';
8
7
 
9
8
  export { default as masterpassRestReducer } from './redux/reducer';
10
9
 
@@ -15,7 +14,6 @@ export { useMasterpassScript } from './hooks/useMasterpassScript';
15
14
 
16
15
  export * from './utils/payment-constants';
17
16
  export * from './utils/payment-utils';
18
- export * from './utils/reward-utils';
19
17
  export * from './utils/card-utils';
20
18
  export * from './utils/validation-schemas';
21
19
  export * from './utils/masterpass-sdk';
package/src/redux/api.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { api } from '@akinon/next/data/client/api';
2
2
  import { buildClientRequestUrl } from '@akinon/next/utils';
3
3
  import { setPaymentStepBusy } from '@akinon/next/redux/reducers/checkout';
4
- import type { RewardItem } from '../types/payment.types';
5
4
 
6
5
  export interface MasterpassRestTokenRequest {
7
6
  three_d?: boolean;
@@ -98,39 +97,6 @@ interface CardType {
98
97
  logo: string;
99
98
  }
100
99
 
101
- export interface QueryMasterpassRewardsRequest {
102
- card_alias: string;
103
- }
104
-
105
- export interface QueryMasterpassRewardsResponse {
106
- context_list: Array<{
107
- page_context: {
108
- rewards: RewardItem[];
109
- };
110
- page_name: string;
111
- page_slug: string;
112
- }>;
113
- template_name: string;
114
- errors: any;
115
- pre_order: any;
116
- }
117
-
118
- export interface SelectMasterpassRewardsRequest {
119
- special: string;
120
- general: string;
121
- }
122
-
123
- export interface SelectMasterpassRewardsResponse {
124
- context_list: Array<{
125
- page_context: any;
126
- page_name: string;
127
- page_slug: string;
128
- }>;
129
- template_name: string;
130
- errors: any;
131
- pre_order: any;
132
- }
133
-
134
100
  export interface SetMasterpassRestBinNumberResponse {
135
101
  context_list: Array<{
136
102
  page_context: {
@@ -236,51 +202,6 @@ export const masterpassRestApi = api.injectEndpoints({
236
202
  dispatch(setPaymentStepBusy(false));
237
203
  }
238
204
  }),
239
- queryMasterpassRewards: build.mutation<
240
- QueryMasterpassRewardsResponse,
241
- QueryMasterpassRewardsRequest
242
- >({
243
- query: (arg) => ({
244
- url: buildClientRequestUrl('/orders/checkout/', {
245
- useFormData: true
246
- }),
247
- method: 'POST',
248
- params: {
249
- page: 'MasterpassRestRewardListPage'
250
- },
251
- body: {
252
- card_alias: arg.card_alias
253
- }
254
- }),
255
- async onQueryStarted(_, { dispatch, queryFulfilled }) {
256
- dispatch(setPaymentStepBusy(true));
257
- await queryFulfilled;
258
- dispatch(setPaymentStepBusy(false));
259
- }
260
- }),
261
- selectMasterpassRewards: build.mutation<
262
- SelectMasterpassRewardsResponse,
263
- SelectMasterpassRewardsRequest
264
- >({
265
- query: (arg) => ({
266
- url: buildClientRequestUrl('/orders/checkout/', {
267
- useFormData: true
268
- }),
269
- method: 'POST',
270
- params: {
271
- page: 'MasterpassRestRewardSelectionPage'
272
- },
273
- body: {
274
- special: arg.special,
275
- general: arg.general
276
- }
277
- }),
278
- async onQueryStarted(_, { dispatch, queryFulfilled }) {
279
- dispatch(setPaymentStepBusy(true));
280
- await queryFulfilled;
281
- dispatch(setPaymentStepBusy(false));
282
- }
283
- }),
284
205
  finalizeMasterpassOrder: build.mutation<
285
206
  FinalizeMasterpassOrderResponse,
286
207
  FinalizeMasterpassOrderRequest
@@ -318,7 +239,5 @@ export const {
318
239
  useSetMasterpassRestBinNumberMutation,
319
240
  useCheckoutMasterpassInstallmentMutation,
320
241
  usePrepareMasterpassOrderMutation,
321
- useFinalizeMasterpassOrderMutation,
322
- useQueryMasterpassRewardsMutation,
323
- useSelectMasterpassRewardsMutation
242
+ useFinalizeMasterpassOrderMutation
324
243
  } = masterpassRestApi;
@@ -5,8 +5,7 @@ import {
5
5
  ModalState,
6
6
  Installment,
7
7
  CardType,
8
- OrderData,
9
- RewardItem
8
+ OrderData
10
9
  } from '../types/payment.types';
11
10
  import { CreditCardFormData } from '../utils/validation-schemas';
12
11
 
@@ -69,17 +68,13 @@ const initialState: MasterpassRestState = {
69
68
  orderData: null,
70
69
  orderCompleted: false,
71
70
  cvc: '',
72
- useThreeD: true,
73
- availableRewards: [],
74
- selectedRewards: [],
75
- isLoadingRewards: false
71
+ useThreeD: true
76
72
  },
77
73
  modalState: {
78
74
  showLinkModal: false,
79
75
  showOTPModal: false,
80
76
  show3DSecureModal: false,
81
77
  showInformationModal: false,
82
- showRewardModal: false,
83
78
  informationModalData: null,
84
79
  otpType: 'OTP',
85
80
  verificationData: null,
@@ -174,24 +169,6 @@ const masterpassRestSlice = createSlice({
174
169
  setOrderCompleted: (state, action: PayloadAction<boolean>) => {
175
170
  state.paymentState.orderCompleted = action.payload;
176
171
  },
177
- setAvailableRewards: (state, action: PayloadAction<RewardItem[]>) => {
178
- state.paymentState.availableRewards = action.payload;
179
- },
180
- setSelectedRewards: (state, action: PayloadAction<RewardItem[]>) => {
181
- state.paymentState.selectedRewards = action.payload;
182
- },
183
- setLoadingRewards: (state, action: PayloadAction<boolean>) => {
184
- state.paymentState.isLoadingRewards = action.payload;
185
- },
186
- setShowRewardModal: (state, action: PayloadAction<boolean>) => {
187
- state.modalState.showRewardModal = action.payload;
188
- },
189
- clearRewards: (state) => {
190
- state.paymentState.availableRewards = [];
191
- state.paymentState.selectedRewards = [];
192
- state.paymentState.isLoadingRewards = false;
193
- state.modalState.showRewardModal = false;
194
- },
195
172
  updateModalState: (state, action: PayloadAction<Partial<ModalState>>) => {
196
173
  state.modalState = { ...state.modalState, ...action.payload };
197
174
  },
@@ -257,17 +234,13 @@ const masterpassRestSlice = createSlice({
257
234
  orderData: null,
258
235
  orderCompleted: false,
259
236
  cvc: '',
260
- useThreeD: true,
261
- availableRewards: [],
262
- selectedRewards: [],
263
- isLoadingRewards: false
237
+ useThreeD: true
264
238
  };
265
239
  state.modalState = {
266
240
  showLinkModal: false,
267
241
  showOTPModal: false,
268
242
  show3DSecureModal: false,
269
243
  showInformationModal: false,
270
- showRewardModal: false,
271
244
  informationModalData: null,
272
245
  otpType: 'OTP',
273
246
  verificationData: null,
@@ -303,11 +276,6 @@ export const {
303
276
  setOrderData,
304
277
  setCvc,
305
278
  setOrderCompleted,
306
- setAvailableRewards,
307
- setSelectedRewards,
308
- setLoadingRewards,
309
- setShowRewardModal,
310
- clearRewards,
311
279
  updateModalState,
312
280
  setShowLinkModal,
313
281
  setShowOTPModal,