Skip to content

@W-19014904 – Adyen Apple Pay PDP#2787

Merged
mmccullom-sf merged 26 commits intoSalesforceCommerceCloud:adyenExpressPaymentsDreamForcefrom
mmccullom-sf:adyenApplePayPDP
Jul 30, 2025
Merged

@W-19014904 – Adyen Apple Pay PDP#2787
mmccullom-sf merged 26 commits intoSalesforceCommerceCloud:adyenExpressPaymentsDreamForcefrom
mmccullom-sf:adyenApplePayPDP

Conversation

@mmccullom-sf
Copy link
Collaborator

@mmccullom-sf mmccullom-sf commented Jul 11, 2025

Description

Adding Apple Pay to the PDP page of the agent.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@salesforce-cla
Copy link

Thanks for the contribution! Unfortunately we can't verify the commit author(s): mmccullom <m***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request.

@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jul 11, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@mmccullom-sf mmccullom-sf changed the title Adyen Apple Pay PDP @W-19014904 – Adyen Apple Pay PDP Jul 24, 2025
@mmccullom-sf mmccullom-sf marked this pull request as ready for review July 24, 2025 14:20
@mmccullom-sf mmccullom-sf requested a review from a team as a code owner July 24, 2025 14:20
*/
export default async function handler(req, res) {
if (req.method !== 'GET') {
return res.status(405).json({error: 'Method not allowed'})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't shopper facing error messages right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're API error messages, so if for whatever reason someone tried to hit this API with postman or something and had an invalid method they would see these errors.

mmccullom and others added 2 commits July 24, 2025 12:48
Signed-off-by: mmccullom-sf <mmccullom+@salesforce.com>
regularAdyenData.adyenEnvironment

const adyenPaymentMethods = usingStandalone ? standalonePaymentMethods : regularAdyenData.adyenPaymentMethods
const basket = regularAdyenData.basket
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an area for more testing like you mentioned, but do you know if this is going to return the right basket every time?

I believe regularAdyenData.basket is coming from the useCurrentBasket() hook. This gets all customer baskets and returns the first if no basketId was specified:

const currentBasket = basketsData?.baskets?.find((basket) => basket?.basketId === id) || basketsData?.baskets?.[0]

cleanupTemporaryBasket() should take care of this though is the thought?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right actually good catch, I think this could depend on a race condition where the API response timing could decide which basket gets chosen, I'll fix it to guarantee we're getting the temporary basket if it's PDP.


applePayAmount = currentBasket.orderTotal || currentBasket.productTotal || 0

// CRITICAL: Force final order calculation before payment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update the tests to cover these scenarios.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this in a follow up PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can.

getToken()
}, [])

// PostMessage listener for SKU updates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the MIAW side changes are going into the develop branch, when will those be merged into main?

Since we're not releasing ApplePay on PDP for the July 31st release, I'm wondering if this should be in a separate branch and merge it into adyenApplePayBranch3 when the MIAW side changes are also merged into its main branch.

Also, are we defaulting isPdpMode=false and do we have sufficient null checks in place for ApplePay in Checkout to work without the MIAW changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've solved the prior issues, but to focus on your second question, yes, even without MIAW changes checkout will still function as per usual.

navigate={navigate}
>
<ApplePayExpress />
<ApplePayExpress sku={currentSku} quantity={currentQuantity} isPdpMode={isPdpMode} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce the number of params, we could wrap them in an object like pdpData.

@mmccullom-sf mmccullom-sf changed the base branch from adyenExpressPayments to adyenExpressPaymentsDreamForce July 25, 2025 15:01
mmccullom and others added 3 commits July 30, 2025 14:40
@mmccullom-sf mmccullom-sf merged commit 2b7eebf into SalesforceCommerceCloud:adyenExpressPaymentsDreamForce Jul 30, 2025
8 of 9 checks passed
@mmccullom-sf mmccullom-sf deleted the adyenApplePayPDP branch July 30, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants