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 Use axios or request retry for Apple Pay Merchant validation depending on configuration #3877

Merged

Conversation

marcotranchino
Copy link
Contributor

@marcotranchino marcotranchino commented Jul 26, 2024

With this change, we are introducing a new environment variable to check
whether the pay-frontend application should use axios for the Apple Pay
Merchant Validation.

By default the new variable will not exist on any environment, therefore
pay-frontend will keep using request retry to operate the Apple Pay Merchant
Validation.

When the new variable is created and set to true, then pay-frontend will use
axios, with or without the use of HttpsProxyAgent, in order to operate the
Apple Pay Merchant Validation.

This will allow us to safely deploy this change to all environments including
production, and crucially it will allow us to test the Apple Pay Merchant
Validation using axios on the Test environment only, by creating the new
environment variable there and setting it to 'true'.

Further work will be needed to remove the old code and the use of request
retry once the validation will be successfully operated with axios in all
environments.

Note that for simplicity the old tests for the Apple Pay Merchant Validation
using request retry have been saved in a new file called
old-merchant-validation.controller.test.js, so that it will be easy to simply
delete this file once the current way using request retry will be fully
discontinued.

Further information in Jira.

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

screenshots of logs when request retry is used (default)

with request retry

screenshots of logs when axios is used (to be enabled on test environment)

with axios

@marcotranchino marcotranchino changed the title Revert "Pp 12853 apple pay merchant validation revert changes" Execute Apple Pay Merchant Validation normally or with axios depending on the environment Jul 26, 2024
@marcotranchino marcotranchino force-pushed the pp-12853-apple-pay-merchant-validation-two-ways branch 2 times, most recently from 4195579 to 62d9d70 Compare July 26, 2024 16:43
marcotranchino and others added 2 commits July 29, 2024 12:05
With this change, we are updating the controller in charge of operating the
Apple Pay Merchant Validation so that it uses axios instead of request retry,
and also so that it uses HttpsProxyAgent if a proxy URL is defined in the
environment.

This is needed because we have realised that the test environment uses a
proxy, while the local environment does not, thus requiring us to use axios
in two different ways depending on the presence or absence of a proxy.

Further information in Jira.

https://payments-platform.atlassian.net/browse/PP-12853
With this change, we are introducing a new environment variable to check
whether the pay-frontend application should use axios for the Apple Pay
Merchant Validation.

By default the new variable will not exist on any environment, therefore
pay-frontend will keep using request retry to operate the Apple Pay Merchant
Validation.

When the new variable is created and set to true, then pay-frontend will use
Axios, with or without the use of HttpsProxyAgent, in order to operate the
Apple Pay Merchant Validation.

This will allow us to safely deploy this change to all environments including
production, and crucially it will allow us to test the Apple Pay Merchant
Validation using axios on the Test environment only by creating the new
environment variable there and setting it to 'true'.

Further work will be needed to remove the old code and the use of request
retry once the validation will be successfully operated with axios in all
environments.

Note that for simplicity the old tests for the Apple Pay Merchant Validation
using request retry have been saved in a new file called
old-merchant-validation.controller.test.js, so that it will be easy to simply
delete this file once the current way using request retry will be fully
discontinued.

Further information in Jira.

https://payments-platform.atlassian.net/browse/PP-12853
@marcotranchino marcotranchino force-pushed the pp-12853-apple-pay-merchant-validation-two-ways branch from 62d9d70 to 3dfbcbe Compare July 29, 2024 11:07
@marcotranchino marcotranchino changed the title Execute Apple Pay Merchant Validation normally or with axios depending on the environment Use axios or request retry for Apple Pay Merchant validation depending on configuration Jul 29, 2024
@marcotranchino marcotranchino changed the title Use axios or request retry for Apple Pay Merchant validation depending on configuration PP-12853 Use axios or request retry for Apple Pay Merchant validation depending on configuration Jul 29, 2024
@marcotranchino marcotranchino marked this pull request as ready for review July 29, 2024 11:20
With this change, we are passing the merchant certificate and key to Axios
using HttpsProxyAgent, including them in the options.

Further information in JIRA.

https://payments-platform.atlassian.net/browse/PP-12853
Copy link
Contributor

@hjvoid hjvoid left a comment

Choose a reason for hiding this comment

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

Looks great - nice one 💪

@marcotranchino marcotranchino merged commit 3628810 into master Jul 29, 2024
11 checks passed
@marcotranchino marcotranchino deleted the pp-12853-apple-pay-merchant-validation-two-ways branch July 29, 2024 15:18
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