Skip to content

Commit c3f96fd

Browse files
committed
ACP2E-4072: VAT Validation fails because of VAT API rate limiter - triggers false positive customer group change
1 parent 98d584a commit c3f96fd

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

app/code/Magento/Customer/Model/Vat.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,14 @@ public function getCustomerGroupIdBasedOnVatNumber($customerCountryCode, $vatVal
139139
];
140140

141141
if (isset($vatClassToGroupXmlPathMap[$vatClass])) {
142-
$groupId = (int)$this->scopeConfig->getValue(
142+
$groupId = $this->scopeConfig->getValue(
143143
$vatClassToGroupXmlPathMap[$vatClass],
144144
ScopeInterface::SCOPE_STORE,
145145
$store
146146
);
147-
148-
if (!$groupId) {
149-
$groupId = (int)$this->scopeConfig->getValue(
150-
GroupManagement::XML_PATH_DEFAULT_ID,
151-
ScopeInterface::SCOPE_STORE,
152-
$store
153-
);
154-
}
155147
}
156148

157-
return $groupId;
149+
return $groupId ? (int)$groupId : null;
158150
}
159151

160152
/**

app/code/Magento/Customer/Observer/AfterAddressSaveObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ public function execute(Observer $observer)
159159
$customer->getStore()
160160
);
161161

162-
if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $newGroupId) {
162+
if (!$customer->getDisableAutoGroupChange() &&
163+
$newGroupId !== null &&
164+
$customer->getGroupId() != $newGroupId
165+
) {
163166
$customer->setGroupId($newGroupId);
164167
$customer->save();
165168
$this->customerSession->setCustomerGroupId($newGroupId);

0 commit comments

Comments
 (0)