Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Commit

Permalink
AVS-421_88 - Fix Submit VAT Number
Browse files Browse the repository at this point in the history
- Refactor VAT ID code to match the behavior described in the config
  comment
  • Loading branch information
Richard Sisco committed Jun 13, 2018
1 parent df4cb21 commit 983a7e2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Framework/Interaction/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,19 @@ protected function retrieveGetTaxRequestFields(StoreInterface $store, $address,
*/
protected function getBusinessIdentificationNumber($store, $address, $customer)
{
if ($customer && $customer->getTaxvat()) {
return $customer->getTaxvat();
if (!$this->config->getUseBusinessIdentificationNumber($store)) {
// 'Include VAT Tax' setting is disabled
return null;
}
if ($this->config->getUseBusinessIdentificationNumber($store)) {
if ($address->getVatId()) {
// Using the VAT ID has been assigned to the address
return $address->getVatId();
}
if ($customer && $customer->getTaxvat()) {
// Using the VAT ID assigned to the customer account
return $customer->getTaxvat();
}
// No VAT ID available to use
return null;
}

Expand Down

0 comments on commit 983a7e2

Please sign in to comment.