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

PP-12853 Validate Apple Pay passing HttpsProxyAgent to Axios post #3885

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

marcotranchino
Copy link
Contributor

With this change, we are making a new attempt at using Axios with HttpsProxyAgent to operate an Apple Pay Merchant validation when there is a proxy, which is the configuration in place for all of our environments on AWS.

The Apple Pay validation with Axios is switched on only on the Test environment, not on production, therefore this change is safe to deploy because it does not change the validation with request retry which is used for production.

This new version passes the HttpsProxyAgent within the post method, in the third parameter, together with headers.

Further information in the Axios documentation[1], which unfortunately does not have examples with HttpsProxyAgent, and in the Jira ticket[2].

[1]
https://axios-http.com/docs/post_example

[2]
https://payments-platform.atlassian.net/browse/PP-12853

With this change, we are making a new attempt at using Axios with
HttpsProxyAgent to operate an Apple Pay Merchant validation when there is a
proxy, which is the configuration in place for all of our environments on
AWS.

The Apple Pay validation with Axios is switched on only on the Test
environment, not on production, therefore this change is safe to deploy
because it does not change the validation with `request retry` which is used
for production.

This new version passes the HttpsProxyAgent within the post method, in the
third parameter, together with headers.

Further information in the Axios documentation[1], which unfortunately does
not have examples with HttpsProxyAgent, and in the Jira ticket[2].

[1]
https://axios-http.com/docs/post_example

[2]
https://payments-platform.atlassian.net/browse/PP-12853
}

} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that there is no change to the implementation using request retry which is used in production.

Copy link
Contributor

@SandorArpa SandorArpa left a comment

Choose a reason for hiding this comment

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

LOKTM

@marcotranchino marcotranchino merged commit ee386b6 into master Aug 2, 2024
11 checks passed
@marcotranchino marcotranchino deleted the pp-12853-new-way-axios-proxy-agent branch August 2, 2024 10:15
marcotranchino added a commit that referenced this pull request Aug 2, 2024
With the previous PR[1], we have made some progress in communicating with
Apple Pay via Axios and HttpsProxyAgent and we have tested that the
validation is initiated correctly but then fails with the following message
from Apple: `Apple Pay Merchant ID not valid`.

See screenshot in the new PR[2].

With this change, we are now adding the charset to the Content-Type header in
the post request, in case that is what is expected by Apple Pay, and we are
also adding the status to the error log, to have a little bit more
information back.

Further information in JIRA[3].

[1]
#3885

[2]
#3886

[3]
https://payments-platform.atlassian.net/browse/PP-12853
marcotranchino added a commit that referenced this pull request Aug 2, 2024
With the previous PR[1], we have made some progress in communicating with
Apple Pay via Axios and HttpsProxyAgent and we have tested that the
validation is initiated correctly but then fails with the following message
from Apple: `Apple Pay Merchant ID not valid`.

See screenshot in the new PR[2].

With this change, we are now adding the charset to the Content-Type header in
the post request, in case that is what is expected by Apple Pay, and we are
also adding the status to the error log, to have a little bit more
information back.

Further information in JIRA[3].

[1]
#3885

[2]
#3886

[3]
https://payments-platform.atlassian.net/browse/PP-12853
marcotranchino added a commit that referenced this pull request Aug 2, 2024
With the previous PRs[1][2], we have made some progress in communicating with
Apple Pay via Axios and HttpsProxyAgent and we have tested that the
validation is initiated correctly but then fails with the following message
from Apple: `Apple Pay Merchant ID not valid`.

See screenshot in the second PR[2].

With this change, we are now passing the certificate and key to the Proxy
Agent via additional options.

Further information in JIRA[3].

[1]
#3885

[2]
#3886

[3]
https://payments-platform.atlassian.net/browse/PP-12853
marcotranchino added a commit that referenced this pull request Aug 5, 2024
…axios

With the previous PRs[1][2][3], we have made some progress in communicating
with Apple Pay via Axios and HttpsProxyAgent and we have tested that the
validation is initiated correctly but then fails with the following message:
`Apple Pay Merchant ID not valid`.

See screenshot in the second PR[2].

With this change, we are now creating the HttpsProxyAgent with just the proxy
URL as an argument for its constructor, passing it together with the
certificate and key to the HttpsAgent, as arguments for its constructor, and
then creating an `axios` instance, passing the HttpsAgent to it.

Further information in JIRA[3].

[1]
#3885

[2]
#3886

[3]
#3887

[4]
https://payments-platform.atlassian.net/browse/PP-12853
marcotranchino added a commit that referenced this pull request Aug 5, 2024
…axios

With the previous PRs[1][2][3], we have made some progress in communicating
with Apple Pay via Axios and HttpsProxyAgent and we have tested that the
validation is initiated correctly but then fails with the following message:
`Apple Pay Merchant ID not valid`.

See screenshot in the second PR[2].

With this change, we are now creating the HttpsProxyAgent with just the proxy
URL as an argument for its constructor, passing it together with the
certificate and key to the HttpsAgent, as arguments for its constructor, and
then creating an `axios` instance, passing the HttpsAgent to it.

Further information in JIRA[3].

[1]
#3885

[2]
#3886

[3]
#3887

[4]
https://payments-platform.atlassian.net/browse/PP-12853
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

Successfully merging this pull request may close these issues.

2 participants