GX-Task #70799
geschlossenSperre bei der EU durch überdurchschnittliche Nutzung der VAT-API / Optimize usage of the VAT ID check API
100%
USt-IdNr-Prüfung optimiert: Wesentliche Reduktion der Anfragen an VIES-API
Beschreibung
Description :
Using the EU's VAT ID Check API, the VAT identification number can be checked.
The EU blocks the IP address of the shop if the API is misused. It is possible to misuse the API via the shop.
How to reproduce
If the live check of the VAT ID is activated in the shop, a request is always sent to the EU during creation of a customer account, even if only a "1" is entered as the VAT ID.
- Register and enter something to the Vat ID field
- Repeat 10.000 times in a short period of time. (i.e. with a bot that spams registrations)
What should we do now?
- Refactor VAT ID check to avoid redundancy. There are currently two different mechanisms in use for checking the VAT ID: One legacy class used for registration, one service used for updating existing customers VAT ID from the admin interface.
- The shop should already check the format of the VAT ID.(Two letters followd by a bunch of numbers) If this is not valid, there shouldn't be a request to the API. Show an error message.
- Cache the result of the API for one hour. So if the same number is requested several times in a row only one request per hour to the API is made.
- implement a limit (max 3 vatid-live-check-calls per IPadress per minute) to avoid too many requests to the VAT ID Check API.
How can I test this?
Registration - invalid VAT-ID:
- Install Shop
- Create a new account using an invalid VAT-ID.
Expected result:
The registration fails displaying an error informing the user about the VAT-ID being invalid.
Registration - valid VAT-ID:
- Install Shop
- Create a new account using a valid VAT-ID.
Expected result:
The registration completes without issues.
Changing VAT-ID of existing account - invalid VAT-ID.
- Install Shop
- Login as admin.
- Go to Customers, open the existing customer's account.
- Under "BUSINESS INFORMATION" edit the VAT-ID and change it to an invalid one.
Expected result:
The VAT-ID gets saved but the symbol for "VAT ID not verified" is displayed under the customer's name on the same screen.
Changing VAT-ID of existing account - valid VAT-ID.
- Install Shop
- Login as admin.
- Go to Customers, open the existing customer's account.
- Under "BUSINESS INFORMATION" edit the VAT-ID and change it to a valid one.
Expected result:
The VAT-ID gets saved and the symbol for "VAT ID verified" is displayed under the customer's name on the same screen.
Untergeordnete Tickets