Description
This issue is automatically created based on existing pull request: #31010: Add VIES validation result object to the response.
Description
This commit adds result_object
to the method response. This allows doing some additional validation
logic in the plugin written for Magento\Customer\Model\Vat
model.
For some countries, this object returns additional fields:
traderName: "customer or company name"
traderCompanyType: "company type"
traderAddress: "
multiline address
associated with tax number
"
Manual testing scenarios
-
Apply the patch.
-
To test it you need a valid Netherland taxvat number.
-
Open vat validator model and add the following code right before the end of the method: https://github.com/magento/magento2/blob/HEAD/app/code/Magento/Customer/Model/Vat.php#L218
(new \Zend\Log\Logger()) ->addWriter(new \Zend\Log\Writer\Stream(BP . '/var/log/custom.log')) ->debug((array)$gatewayResponse->getResultObject());
-
Go to admin config Stores > Configuration > General > Store Information
-
Select a valid country for your tax number, fill the tax number field, and press the "Validate VAT Number" button.
-
Check the
magento_root/var/log/custom.log
. You should see the VIES result object:2020-11-23T09:25:57+00:00 DEBUG (7): array ( 'countryCode' => 'NL', 'vatNumber' => 'vatnumber', 'requestDate' => '2020-11-23+01:00', 'valid' => true, 'traderName' => 'companyname', 'traderCompanyType' => '---', 'traderAddress' => ' company address ', 'requestIdentifier' => '', )
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status