Closed dphilipps closed 2 years ago
Hi @dphilipps. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
@magento give me 2.4-develop instance
Hi @dphilipps. Thank you for your request. I'm working on Magento instance for you.
Hi @dphilipps, here is your Magento Instance: https://2e0e748fe9adb6f5da4bafbe39d78c0c-2-4-develop.instances.magento-community.engineering Admin access: https://2e0e748fe9adb6f5da4bafbe39d78c0c-2-4-develop.instances.magento-community.engineering/admin_dbfb Login: 8f213e7d Password: c6d8bb5f8e82
Hi @engcom-November How do i get an instance deployed with Braintree included in the build? Even with country set in payment methods config, it does not appear.
Many thanks Dave
I have verified these steps on a fresh composer install of M2.4.3
What do I need to add to this ticket to get it to be triaged @magento/engcom-team-members? This is a serious checkout issue in the latest version of Magento using a mainstream payment gateway?
Is there any update on this, we are also experiencing the same issue. This is a critical bug and needs addressing, happy to assist with a fix if required.
@dphilipps did you happen to find a workaround? Disabling 3DS is a no-go for legal reasons, yet making the state field required is a UX problem.
@dphilipps For all those who come across this issue, I have created a patch file, attached.
ISSUE-34204__PayPal-Braintree-Validation.patch.zip
diff --git a/view/frontend/web/js/view/payment/3d-secure.js b/view/frontend/web/js/view/payment/3d-secure.js
index 864d5e53..ef832923 100644
--- a/view/frontend/web/js/view/payment/3d-secure.js
+++ b/view/frontend/web/js/view/payment/3d-secure.js
@@ -55,7 +55,7 @@ define([
totalAmount = parseFloat(quote.totals()['base_grand_total']).toFixed(2),
billingAddress = quote.billingAddress();
- if (billingAddress.regionCode !== undefined && billingAddress.regionCode.length > 2) {
+ if (billingAddress.regionCode != null && billingAddress.regionCode.length > 2) {
billingAddress.regionCode = undefined;
}
This patch file updates the validation to check for null, which naturally covers both 'undefined and null', thus bypassing the 'cannot read properties of null' error when reading the length in the case a region is not set.
I have created a PR on the Braintree repo, is this the correct place for it? If I need to raise a PR on a different repo please may somebody assign the issue to me and point me in the right direction.
https://github.com/genecommerce/module-braintree-magento2/pull/182
I would question the original code as it seems a bit of a hack having to set regionCode to undefined, a possible workaround for a bug in the system at Braintree's end?
Hi @nicholasscottfish Agree this is a nasty one - checkout just freezes. In the end I contacted Gene directly through their Braintree Magento support channel. They got back to me with a patch yesterday but I haven't had a chance to test it yet. I'll post it here. Thanks for your patch BTW.
Patch supplied by Gene support directly in response to this issue, however I have not tested it yet.
Hi @dphilipps, the patch I posted has been tested and fixes the issue, however, looking at the patch they supplied it is fixing the same lines of code but is slightly different in that they still set regionCode as undefined if it was null, possibly what needs to happen.
I will get in touch to find out why that is necessary.
Thanks for sharing!
worth noting that while this seems to only occur using saved addresses for logged in users with a blank region, freshly entered ones work fine. (it was mentioned to save the address in the reproduction steps, but not explicitly anywhere else in the body)
also someone should include the JS error in this issue as text somewhere so it's not so hard for anyone else with the same issue to find. screenshots aren't searchable
hosted-fields.min.js:1 Error in callback function
hosted-fields.min.js:1 TypeError: Cannot read properties of null (reading 'length')
at Object.validate (3d-secure.js:1)
at validator-handler.js:1
at Function.map (jquery.js:2)
at Object.validate (validator-handler.js:1)
at UiClass.handleNonce (cc-form.js:1)
at UiClass.onPaymentMethodReceived (cc-form.js:1)
at Object.<anonymous> (adapter.js:1)
at hosted-fields.min.js:1
you're welcome, frantic googlers
anyway, thanks to @dphilipps for logging this, and @nicholasscottfish for the fix, this has been a particularly nasty one to root out.
Patch supplied by Gene support directly in response to this issue, however I have not tested it yet.
I have updated my patch as it had a strict type check on null when it needed to be !=, to be safe I would use the official patch provided by @dphilipps as I have tested and this fixes the bug.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @dphilipps,
Thank you for reporting the issue.
We followed your steps and were able to reproduce it on Magento 2.4-develop/2.4.3/2.4.3-p1. Hence confirming the issue.
Thank you
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1830 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Hello @dphilipps,
Fix for the issue is added to the 2.4.4-release of Braintree package.
With 'paypal/module-braintree' version 4.3.0 issue will be fixed.
Below is the patch which is added to 4.3.0 of 'paypal/module-braintree'
if (billingAddress.regionCode == null)
{ billingAddress.regionCode = undefined; }
We are closing this issue.
Thanks
Thank you @engcom-Hotel
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Note: If 3DS is disabled, then the same address (above) will complete OK. Likewise, if a state/region is set it will too.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
3DS is vital for processing credit card payments as is a regulatory requirement in some jurisdictions and some processors do not approve payments without, therefore disabling it is not a work around. UK addresses which typically do not have state or region set will not be able to place orders with 3DS enabled.