magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Billingaddress gets renewed on every set-payment-information call. Thus Vat Validation on Billing address gets called multiple times #28946

Open stkrelax opened 4 years ago

stkrelax commented 4 years ago

Summary (*)

I came accross this when i was searching why our VatValidation Service is blocking calls from our side. i figured out that there is an explicit deleting of quote billing addresses at

https://github.com/magento/magento2/blob/ba25897c151b4f33505a8fe91aa1942bb6e71330/app/code/Magento/Checkout/Model/PaymentInformationManagement.php#L124

this method is called up to 4 times in our checkout (classic OneStepCheckout plus iways/magento2-paypal-plus module) the Reasons therefor are

Note that there was no change in billingAddress, but the billingaddress is still posted due to the false in

https://github.com/magento/magento2/blob/ba25897c151b4f33505a8fe91aa1942bb6e71330/app/code/Magento/Checkout/view/frontend/web/js/action/set-payment-information.js#L17

this false tells the script to not skip billing. Thus billing data is provided and in management a new billing address is created and the old one deleted.

All together almost okay, despite the fact that i sometimes had 2 billingaddresses and 1 shippingaddress set to my quote at one time... This does not seem to affect checkout or order place in any kind, so it is working.

But it affects the Vat Validation.

You may know a certain amount of calls/same calls lead to a block (around 1 minute) on the VIES or the german https://evatr.bff-online.de/eVatR/xmlrpc/ which actually uses the same endpoints.

There were some tickets that tried to prevent this behaviour. One good approach was that not everytime there must be a validation when nothing has changed. In this Feature the request data for validation ist stored in the quote address. A check is only made, when a change in the request data appears.

Examples (*)

And there is the problem:

Having set Vat Validation based on billing address and having a billingaddress that renews itself on every call causes multiple Validation call to VIES. Sometimes to much so that VIES or other will block your ip for a while.

Proposed solution

  1. Instead of deleting the billing_address you could clean(of course not the viv requested data) the data and add the new data to the quote address.

OR

  1. Store the validation result in the quote and not in the address or in a completely seperate space.
m2-assistant[bot] commented 4 years ago

Hi @stkrelax. 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


johnyoy commented 4 years ago

having same issue in my siteVAT CALCULATOR

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1006 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 years ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.