Skip to content

Commit 3eec2bc

Browse files
ENGCOM-4635: Fixed assignment of the guest customer to the guest group when 'Automatic Assignment by VAT ID' is enabled #22091
- Merge Pull Request #22091 from vovayatsyuk/magento2:fix-customer-group-assignment-for-empty-vat - Merged commits: 1. b00402d 2. b4c6158
2 parents 341bb5b + b4c6158 commit 3eec2bc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/code/Magento/Quote/Observer/Frontend/Quote/Address/CollectTotalsObserver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Handle customer VAT number on collect_totals_before event of quote address.
12+
*
13+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
14+
*/
1015
class CollectTotalsObserver implements ObserverInterface
1116
{
1217
/**

app/code/Magento/Quote/Test/Unit/Observer/Frontend/Quote/Address/CollectTotalsObserverTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGrou
199199
->method('getNotLoggedInGroup')
200200
->will($this->returnValue($this->groupInterfaceMock));
201201
$this->groupInterfaceMock->expects($this->once())
202-
->method('getId')->will($this->returnValue(0));
202+
->method('getId')->will($this->returnValue(null));
203203
$this->vatValidatorMock->expects($this->once())
204204
->method('isEnabled')
205205
->with($this->quoteAddressMock, $this->storeId)
@@ -220,9 +220,6 @@ public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGrou
220220
$this->returnValue(false)
221221
);
222222

223-
$groupMock = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)
224-
->disableOriginalConstructor()
225-
->getMock();
226223
$this->customerMock->expects($this->once())->method('getId')->will($this->returnValue(null));
227224

228225
/** Assertions */

0 commit comments

Comments
 (0)