Skip to content

Commit

Permalink
fix: enable Link as selectable saved payment source
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza authored and malessani committed May 14, 2024
1 parent fc06093 commit ed4ac0f
Show file tree
Hide file tree
Showing 10 changed files with 443 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ orbs:
jobs:
test: # this can be any name you choose
docker:
- image: mcr.microsoft.com/playwright:v1.43.1-focal
- image: mcr.microsoft.com/playwright:v1.44.0-focal
resource_class: medium+
parallelism: 10

Expand Down
2 changes: 0 additions & 2 deletions components/composite/StepPayment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ export const StepPayment: React.FC = () => {
const { isGuest, isPaymentRequired, setPayment, hasSubscriptions } = appCtx

const selectPayment = ({ payment, order }: PaymentMethodOnClickParams) => {
console.log(payment)
console.log(order)
if (
order?.payment_source &&
// @ts-expect-error available only on adyen
Expand Down
22 changes: 10 additions & 12 deletions components/data/AppProvider/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ export function calculateSettings(
...(isShipmentRequired
? calculateSelectedShipments(prepareShipments(order.shipments))
: {
hasShippingMethod: true,
shipments: [],
}),
hasShippingMethod: true,
shipments: [],
}),
...checkPaymentMethod(order),
returnUrl: order.return_url,
cartUrl: order.cart_url,
Expand All @@ -367,13 +367,11 @@ export function checkPaymentMethod(order: Order) {

const paymentSource: PaymentSourceType | undefined =
order.payment_source as PaymentSourceType

let hasPaymentMethod = Boolean(
paymentSource?.metadata?.card ||
paymentSource?.options?.card ||
paymentSource?.payment_response?.source
// @ts-expect-error no type for payment_method
paymentSource?.payment_method?.lenght > 0 ||
paymentSource?.payment_response?.source
)

const paymentRequired = isPaymentRequired(order)
if (!hasPaymentMethod && !paymentRequired) {
hasPaymentMethod = true
Expand Down Expand Up @@ -410,10 +408,10 @@ export function calculateSelectedShipments(
const shipmentsSelected = shipments?.map((shipment) => {
return shipment.shipmentId === payload?.shipmentId
? {
...shipment,
shippingMethodId: payload.shippingMethod.id,
shippingMethodName: payload.shippingMethod.name,
}
...shipment,
shippingMethodId: payload.shippingMethod.id,
shippingMethodName: payload.shippingMethod.name,
}
: shipment
})
const hasShippingMethod = hasShippingMethodSet(shipmentsSelected)
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@
"commercelayer"
],
"dependencies": {
"@commercelayer/js-auth": "^6.2.0",
"@commercelayer/js-auth": "^6.2.1",
"@commercelayer/organization-config": "^1.4.5",
"@commercelayer/react-components": "4.13.1-beta.4",
"@commercelayer/sdk": "^6.0.0-rc.2",
"@commercelayer/react-components": "^4.13.3",
"@commercelayer/sdk": "^6.0.2",
"@faker-js/faker": "^8.4.1",
"@headlessui/react": "^1.7.19",
"@next/bundle-analyzer": "^14.2.2",
"@next/eslint-plugin-next": "^14.2.2",
"@playwright/test": "1.43.1",
"@next/bundle-analyzer": "^14.2.3",
"@next/eslint-plugin-next": "^14.2.3",
"@playwright/test": "1.44.0",
"@tailwindcss/forms": "^0.5.7",
"@types/async-retry": "1.4.8",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/node": "^20.12.12",
"@types/react": "^18.3.2",
"@types/react-gtm-module": "^2.0.3",
"@types/styled-components": "^5.1.34",
"async-retry": "^1.3.3",
Expand All @@ -93,19 +93,19 @@
"babel-plugin-styled-components": "^2.1.4",
"classnames": "^2.5.1",
"cron-parser": "^4.9.0",
"cronstrue": "^2.49.0",
"cronstrue": "^2.50.0",
"dotenv": "^16.4.5",
"i18next": "^23.11.2",
"next": "^14.2.2",
"i18next": "^23.11.4",
"next": "^14.2.3",
"next-build-id": "^3.0.0",
"next-i18next": "^15.3.0",
"postcss": "^8.4.38",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-gtm-module": "^2.0.11",
"react-i18next": "^14.1.0",
"react-router-dom": "^6.22.3",
"styled-components": "^6.1.8",
"react-i18next": "^14.1.1",
"react-router-dom": "^6.23.1",
"styled-components": "^6.1.11",
"tailwindcss": "^3.4.3",
"twin.macro": "^3.4.1",
"typescript": "^5.4.5"
Expand All @@ -115,12 +115,12 @@
"@semantic-release/commit-analyzer": "^12.0.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.0.3",
"@semantic-release/npm": "^12.0.0",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^13.0.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.2",
"eslint-config-next": "^14.2.3",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -130,10 +130,10 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-tailwind": "^0.2.1",
"npm-check-updates": "^16.14.18",
"npm-check-updates": "^16.14.20",
"prettier": "^3.2.5",
"semantic-release": "^23.0.8",
"serve": "^14.2.2",
"semantic-release": "^23.1.1",
"serve": "^14.2.3",
"stylelint": "^16.3.1",
"stylelint-config-standard": "^36.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dotenv.config({ path: path.resolve(__dirname, "../../.env.local") })
// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
// Timeout per test
timeout: 1 * 60 * 1000,
timeout: 1 * 80 * 1000,
// Test directory
testDir: "specs/e2e",
// If a test fails, retry it additional 2 times
Expand Down
Loading

0 comments on commit ed4ac0f

Please sign in to comment.