-
Notifications
You must be signed in to change notification settings - Fork 3
Description
We had a customer where initiating a payment sometimes took up to 2 minutes. It was difficult to find out what caused this, but it turned out to be the VIES service. In this case, empty VAT numbers were also validated in combination with Gravity Forms. Validating an empty VAT number does not make sense, but the entire validation is not yet used. That is why I think it would be better to completely remove the entire VAT number validation from core. There are also special EU VAT number validation plugins available for WooCommerce and possibly other plugins. If we want to keep VAT number validation, it might be better to do this via the WordPress HTTP requests API instead of the SoapClient PHP library. It was now very difficult to determine the cause of the 2 minute delay.
wp-pay-core/src/CustomerHelper.php
Lines 63 to 79 in 5d9bed0
| // VAT Number validity. | |
| $vat_number = $customer->get_vat_number(); | |
| if ( null !== $vat_number ) { | |
| $vat_number_validity = $vat_number->get_validity(); | |
| if ( null === $vat_number_validity ) { | |
| try { | |
| $vat_number_validity = VatNumberViesValidator::validate( $vat_number ); | |
| } catch ( \Exception $e ) { | |
| // On exceptions we have no VAT number validity info, no problem. | |
| $vat_number_validity = null; | |
| } | |
| $vat_number->set_validity( $vat_number_validity ); | |
| } | |
| } |
CC @rvdsteege
Internal HelpScout ticket: https://secure.helpscout.net/conversation/2615779403/27300?viewId=1425715#thread-7916353505
Metadata
Metadata
Assignees
Labels
Type
Projects
Status