Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applepay domain verification Failure for SFCC #995

Closed
nishad-ashraf opened this issue Oct 26, 2023 · 2 comments
Closed

Applepay domain verification Failure for SFCC #995

nishad-ashraf opened this issue Oct 26, 2023 · 2 comments

Comments

@nishad-ashraf
Copy link

nishad-ashraf commented Oct 26, 2023

In Adyen SFRA v23.2.1 cartridge, for applepay domain verification, the applepay domain association file content has to be stored in site peference - Adyen_ApplePay_DomainAssociation
The applepay domain association file provided in the Adyen documentation (https://docs.adyen.com/plugins/salesforce-commerce-cloud/set-up-payment-methods/?tab=use_adyen_s_apple_pay_certificate_1#step-5-go-live-with-apple-pay) has a line ending with blank space/blank line

As per OOB Adyen cartridge code - print() function is used to render this domain association file content is sfcc and print() removes / trim the ending line ending. So the domain verification fails.
On changing print() to println() the line endings are retained and executing cksum and xxd commands for website URL and comparing with https://eu.adyen.link/.well-known/apple-developer-merchantid-domain-association returns same cksum and xxd value

Changes-

  1. Replace print() with println()
  2. Add code to set response header text/plain . This is mentioned in doc - https://eu.adyen.link/.well-known/apple-developer-merchantid-domain-association

var server = require('server'); var URLRedirectMgr = require('dw/web/URLRedirectMgr'); var AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs'); var constants = require('../client/default/js/constants'); server.extend(module.superModule); server.prepend('Start', function (req, res, next) { var origin = URLRedirectMgr.redirectOrigin; // Intercept the incoming path request if (origin.match(constants.APPLE_DOMAIN_URL)) { var applePayDomainAssociation = AdyenConfigs.getApplePayDomainAssociation(); response.getWriter().print(applePayDomainAssociation); return null; } return next(); }); module.exports = server.exports();

Changed code -
var server = require('server'); var URLRedirectMgr = require('dw/web/URLRedirectMgr'); var AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs'); var constants = require('../client/default/js/constants'); server.extend(module.superModule); server.prepend('Start', function (req, res, next) { var origin = URLRedirectMgr.redirectOrigin; // Intercept the incoming path request if (origin.match(constants.APPLE_DOMAIN_URL)) { var applePayDomainAssociation = AdyenConfigs.getApplePayDomainAssociation(); res.setHttpHeader(dw.system.Response.CONTENT_TYPE, 'text/plain'); response.getWriter().println(applePayDomainAssociation); return null; } return next(); }); module.exports = server.exports();

image

File path: int_adyen_SFRA/cartridge/controllers/RedirectURL.js

Is it possible to fix this and provide a patch?

@zenit2001
Copy link
Contributor

Hi @nishad-ashraf ,

We will set up an investigation internally regarding this and will keep you updated.

With kind regards,
Zenit
Adyen

@zenit2001
Copy link
Contributor

Hi @nishad-ashraf ,

We have fixed the issue in this PR and included it in release v23.3.1.
Thank you for reporting.

With kind regards,
Zenit
Adyen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants