@akinon/next 1.114.0 → 1.115.0-snapshot-ZERO-3855-20251209090338

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.115.0-snapshot-ZERO-3855-20251209090338
4
+
5
+ ### Minor Changes
6
+
7
+ - 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
8
+
3
9
  ## 1.114.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.114.0",
4
+ "version": "1.115.0-snapshot-ZERO-3855-20251209090338",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.114.0",
38
+ "@akinon/eslint-plugin-projectzero": "1.115.0-snapshot-ZERO-3855-20251209090338",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
@@ -204,15 +204,25 @@ export const contextListMiddleware: Middleware = ({
204
204
  (ctx) => ctx.page_name === 'DeliveryOptionSelectionPage'
205
205
  )
206
206
  ) {
207
+ const isCreditCardPayment =
208
+ preOrder?.payment_option?.payment_type === 'credit_card' ||
209
+ preOrder?.payment_option?.payment_type === 'masterpass';
210
+
207
211
  if (context.page_context.card_type) {
208
212
  dispatch(setCardType(context.page_context.card_type));
213
+ } else if (isCreditCardPayment) {
214
+ dispatch(setCardType(null));
209
215
  }
210
216
 
211
217
  if (
212
218
  context.page_context.installments &&
213
219
  preOrder?.payment_option?.payment_type !== 'masterpass_rest'
214
220
  ) {
215
- dispatch(setInstallmentOptions(context.page_context.installments));
221
+ if (!isCreditCardPayment || context.page_context.card_type) {
222
+ dispatch(
223
+ setInstallmentOptions(context.page_context.installments)
224
+ );
225
+ }
216
226
  }
217
227
  }
218
228
 
@@ -14,9 +14,17 @@ export const installmentOptionMiddleware: Middleware = ({
14
14
  return result;
15
15
  }
16
16
 
17
- const { installmentOptions } = getState().checkout;
17
+ const { installmentOptions, cardType } = getState().checkout;
18
18
  const { endpoints: apiEndpoints } = checkoutApi;
19
19
 
20
+ const isCreditCardPayment =
21
+ preOrder?.payment_option?.payment_type === 'credit_card' ||
22
+ preOrder?.payment_option?.payment_type === 'masterpass';
23
+
24
+ if (isCreditCardPayment && !cardType) {
25
+ return result;
26
+ }
27
+
20
28
  if (
21
29
  !preOrder?.installment &&
22
30
  preOrder?.payment_option?.payment_type !== 'saved_card' &&