Skip to content

Commit ed4ac0f

Browse files
acasazzamalessani
authored andcommitted
fix: enable Link as selectable saved payment source
1 parent fc06093 commit ed4ac0f

10 files changed

Lines changed: 443 additions & 310 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ orbs:
77
jobs:
88
test: # this can be any name you choose
99
docker:
10-
- image: mcr.microsoft.com/playwright:v1.43.1-focal
10+
- image: mcr.microsoft.com/playwright:v1.44.0-focal
1111
resource_class: medium+
1212
parallelism: 10
1313

components/composite/StepPayment/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ export const StepPayment: React.FC = () => {
108108
const { isGuest, isPaymentRequired, setPayment, hasSubscriptions } = appCtx
109109

110110
const selectPayment = ({ payment, order }: PaymentMethodOnClickParams) => {
111-
console.log(payment)
112-
console.log(order)
113111
if (
114112
order?.payment_source &&
115113
// @ts-expect-error available only on adyen

components/data/AppProvider/utils.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ export function calculateSettings(
350350
...(isShipmentRequired
351351
? calculateSelectedShipments(prepareShipments(order.shipments))
352352
: {
353-
hasShippingMethod: true,
354-
shipments: [],
355-
}),
353+
hasShippingMethod: true,
354+
shipments: [],
355+
}),
356356
...checkPaymentMethod(order),
357357
returnUrl: order.return_url,
358358
cartUrl: order.cart_url,
@@ -367,13 +367,11 @@ export function checkPaymentMethod(order: Order) {
367367

368368
const paymentSource: PaymentSourceType | undefined =
369369
order.payment_source as PaymentSourceType
370-
371370
let hasPaymentMethod = Boolean(
372-
paymentSource?.metadata?.card ||
373-
paymentSource?.options?.card ||
374-
paymentSource?.payment_response?.source
371+
// @ts-expect-error no type for payment_method
372+
paymentSource?.payment_method?.lenght > 0 ||
373+
paymentSource?.payment_response?.source
375374
)
376-
377375
const paymentRequired = isPaymentRequired(order)
378376
if (!hasPaymentMethod && !paymentRequired) {
379377
hasPaymentMethod = true
@@ -410,10 +408,10 @@ export function calculateSelectedShipments(
410408
const shipmentsSelected = shipments?.map((shipment) => {
411409
return shipment.shipmentId === payload?.shipmentId
412410
? {
413-
...shipment,
414-
shippingMethodId: payload.shippingMethod.id,
415-
shippingMethodName: payload.shippingMethod.name,
416-
}
411+
...shipment,
412+
shippingMethodId: payload.shippingMethod.id,
413+
shippingMethodName: payload.shippingMethod.name,
414+
}
417415
: shipment
418416
})
419417
const hasShippingMethod = hasShippingMethodSet(shipmentsSelected)

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@
7272
"commercelayer"
7373
],
7474
"dependencies": {
75-
"@commercelayer/js-auth": "^6.2.0",
75+
"@commercelayer/js-auth": "^6.2.1",
7676
"@commercelayer/organization-config": "^1.4.5",
77-
"@commercelayer/react-components": "4.13.1-beta.4",
78-
"@commercelayer/sdk": "^6.0.0-rc.2",
77+
"@commercelayer/react-components": "^4.13.3",
78+
"@commercelayer/sdk": "^6.0.2",
7979
"@faker-js/faker": "^8.4.1",
8080
"@headlessui/react": "^1.7.19",
81-
"@next/bundle-analyzer": "^14.2.2",
82-
"@next/eslint-plugin-next": "^14.2.2",
83-
"@playwright/test": "1.43.1",
81+
"@next/bundle-analyzer": "^14.2.3",
82+
"@next/eslint-plugin-next": "^14.2.3",
83+
"@playwright/test": "1.44.0",
8484
"@tailwindcss/forms": "^0.5.7",
8585
"@types/async-retry": "1.4.8",
86-
"@types/node": "^20.12.7",
87-
"@types/react": "^18.2.79",
86+
"@types/node": "^20.12.12",
87+
"@types/react": "^18.3.2",
8888
"@types/react-gtm-module": "^2.0.3",
8989
"@types/styled-components": "^5.1.34",
9090
"async-retry": "^1.3.3",
@@ -93,19 +93,19 @@
9393
"babel-plugin-styled-components": "^2.1.4",
9494
"classnames": "^2.5.1",
9595
"cron-parser": "^4.9.0",
96-
"cronstrue": "^2.49.0",
96+
"cronstrue": "^2.50.0",
9797
"dotenv": "^16.4.5",
98-
"i18next": "^23.11.2",
99-
"next": "^14.2.2",
98+
"i18next": "^23.11.4",
99+
"next": "^14.2.3",
100100
"next-build-id": "^3.0.0",
101101
"next-i18next": "^15.3.0",
102102
"postcss": "^8.4.38",
103-
"react": "^18.2.0",
104-
"react-dom": "^18.2.0",
103+
"react": "^18.3.1",
104+
"react-dom": "^18.3.1",
105105
"react-gtm-module": "^2.0.11",
106-
"react-i18next": "^14.1.0",
107-
"react-router-dom": "^6.22.3",
108-
"styled-components": "^6.1.8",
106+
"react-i18next": "^14.1.1",
107+
"react-router-dom": "^6.23.1",
108+
"styled-components": "^6.1.11",
109109
"tailwindcss": "^3.4.3",
110110
"twin.macro": "^3.4.1",
111111
"typescript": "^5.4.5"
@@ -115,12 +115,12 @@
115115
"@semantic-release/commit-analyzer": "^12.0.0",
116116
"@semantic-release/git": "^10.0.1",
117117
"@semantic-release/github": "^10.0.3",
118-
"@semantic-release/npm": "^12.0.0",
118+
"@semantic-release/npm": "^12.0.1",
119119
"@semantic-release/release-notes-generator": "^13.0.0",
120120
"@typescript-eslint/eslint-plugin": "^7.7.0",
121121
"@typescript-eslint/parser": "^7.7.0",
122122
"eslint": "^8.57.0",
123-
"eslint-config-next": "^14.2.2",
123+
"eslint-config-next": "^14.2.3",
124124
"eslint-config-prettier": "^9.1.0",
125125
"eslint-config-standard": "^17.1.0",
126126
"eslint-plugin-import": "^2.29.1",
@@ -130,10 +130,10 @@
130130
"eslint-plugin-promise": "^6.1.1",
131131
"eslint-plugin-react": "^7.34.1",
132132
"eslint-plugin-tailwind": "^0.2.1",
133-
"npm-check-updates": "^16.14.18",
133+
"npm-check-updates": "^16.14.20",
134134
"prettier": "^3.2.5",
135-
"semantic-release": "^23.0.8",
136-
"serve": "^14.2.2",
135+
"semantic-release": "^23.1.1",
136+
"serve": "^14.2.3",
137137
"stylelint": "^16.3.1",
138138
"stylelint-config-standard": "^36.0.0"
139139
},

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dotenv.config({ path: path.resolve(__dirname, "../../.env.local") })
88
// Reference: https://playwright.dev/docs/test-configuration
99
const config: PlaywrightTestConfig = {
1010
// Timeout per test
11-
timeout: 1 * 60 * 1000,
11+
timeout: 1 * 80 * 1000,
1212
// Test directory
1313
testDir: "specs/e2e",
1414
// If a test fails, retry it additional 2 times

0 commit comments

Comments
 (0)