Skip to content

[Issue] Add VIES validation result object to the response. #38511

Open
@m2-assistant

Description

@m2-assistant

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

  1. Apply the patch.

  2. To test it you need a valid Netherland taxvat number.

  3. 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());
  4. Go to admin config Stores > Configuration > General > Store Information

  5. Select a valid country for your tax number, fill the tax number field, and press the "Validate VAT Number" button.

  6. 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

Labels

Component: CustomerPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: PR in progressSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itfeature request

Type

No type

Projects

Status

Pull Request in Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions