Skip to content

Commit 0556f94

Browse files
authored
@W-20508471: Implement PWA Adyen integration for Express (#3640)
Support processing adyen payments and handle 409 errors for failure use-cases
1 parent 92d7b24 commit 0556f94

File tree

13 files changed

+430
-93
lines changed

13 files changed

+430
-93
lines changed

packages/commerce-sdk-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"version": "node ./scripts/version.js"
4141
},
4242
"dependencies": {
43-
"commerce-sdk-isomorphic": "^4.0.0",
43+
"commerce-sdk-isomorphic": "5.0.0-unstable-20260124080731",
4444
"js-cookie": "^3.0.1",
4545
"jwt-decode": "^4.0.0"
4646
},

packages/commerce-sdk-react/src/auth/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ const DATA_MAP: AuthDataMap = {
174174
storageType: 'local',
175175
key: 'idp_access_token'
176176
},
177+
idp_refresh_token: {
178+
storageType: 'local',
179+
key: 'idp_refresh_token'
180+
},
181+
dnt: {
182+
storageType: 'local',
183+
key: 'dnt'
184+
},
177185
token_type: {
178186
storageType: 'local',
179187
key: 'token_type'

packages/commerce-sdk-react/src/hooks/ShopperCustomers/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ describe('Shopper Customers hooks', () => {
1818
// or add it to the `expected` array with a comment explaining "TODO" or "never" (and why).
1919
expect(unimplemented).toEqual([
2020
'getExternalProfile', // TODO: Implement when the endpoint exits closed beta
21-
'registerExternalProfile' // TODO: Implement when the endpoint exits closed beta
21+
'getPublicProductListItems', // TODO: Implement when the endpoint exits closed beta
22+
'registerExternalProfile', // TODO: Implement when the endpoint exits closed beta
23+
'updateCustomerPaymentInstrument', // TODO: Implement when needed
2224
])
2325
})
2426
test('all mutations have cache update logic', () => {

packages/commerce-sdk-react/src/hooks/ShopperExperience/index.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ import * as queries from './query'
1111
describe('Shopper Experience hooks', () => {
1212
test('all endpoints have hooks', () => {
1313
const unimplemtented = getUnimplementedEndpoints(ShopperExperience, queries)
14-
expect(unimplemtented).toEqual([])
14+
expect(unimplemtented).toEqual([
15+
// TODO: Implement content hooks when needed
16+
'getContent',
17+
'getContentFolder',
18+
'getContentFolders',
19+
'getMultipleContent',
20+
'searchContent',
21+
])
1522
})
1623
})

packages/commerce-sdk-react/src/hooks/ShopperLogin/index.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ describe('Shopper Login hooks', () => {
2020
// These endpoints all return data in the response headers, rather than body, so they
2121
// don't work well with the current implementation of mutation hooks.
2222
'authenticateCustomer',
23-
'getTrustedAgentAuthorizationToken'
23+
// TODO: Implement WebAuthn hooks when needed (new endpoints in 5.0.0)
24+
'authorizeWebauthnRegistration',
25+
// TODO: Implement WebAuthn hooks when needed (new endpoints in 5.0.0)
26+
'finishWebauthnAuthentication',
27+
'finishWebauthnUserRegistration',
28+
'getTrustedAgentAuthorizationToken',
29+
'startWebauthnAuthentication',
30+
'startWebauthnUserRegistration',
2431
])
2532
})
2633
test('all mutations have cache update logic', () => {

packages/commerce-sdk-react/src/hooks/ShopperPayments/queryKeyHelpers.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import {ShopperPayments} from 'commerce-sdk-isomorphic'
88
import {Argument, ExcludeTail} from '../types'
9-
import {pickValidParams} from '../utils'
9+
import {pickValidParams, omitNullable} from '../utils'
1010

1111
// We must use a client with no parameters in order to have required/optional match the API spec
1212
type Client = ShopperPayments<{shortCode: string}>
@@ -41,7 +41,10 @@ export const getPaymentConfiguration: QueryKeyHelper<'getPaymentConfiguration'>
4141
queryKey: (params: Params<'getPaymentConfiguration'>) => {
4242
return [
4343
...getPaymentConfiguration.path(params),
44-
pickValidParams(params || {}, ShopperPayments.paramKeys.getPaymentConfiguration)
44+
// pickValidParams returns the filtered parameters, TypeScript sees that zoneId
45+
// could be string | null, and complains because null isn't allowed in the query key.
46+
// omitNullable removes null values from the parameters (zoneId is optional but NOT nullable)
47+
omitNullable(pickValidParams(params || {}, ShopperPayments.paramKeys.getPaymentConfiguration))
4548
]
4649
}
4750
}

0 commit comments

Comments
 (0)