AfterAddressSaveObserverTest.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Test\Unit\Observer;
  7. use Magento\Customer\Api\GroupManagementInterface;
  8. use Magento\Customer\Helper\Address as HelperAddress;
  9. use Magento\Customer\Model\Address\AbstractAddress;
  10. use Magento\Customer\Model\Vat;
  11. use Magento\Customer\Observer\AfterAddressSaveObserver;
  12. use Magento\Customer\Observer\BeforeAddressSaveObserver;
  13. use Magento\Framework\App\Area;
  14. use Magento\Framework\App\Config\ScopeConfigInterface;
  15. use Magento\Framework\App\State as AppState;
  16. use Magento\Framework\Escaper;
  17. use Magento\Framework\Message\ManagerInterface;
  18. use Magento\Framework\Registry;
  19. use Magento\Store\Model\ScopeInterface;
  20. /**
  21. * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  22. */
  23. class AfterAddressSaveObserverTest extends \PHPUnit\Framework\TestCase
  24. {
  25. /**
  26. * @var AfterAddressSaveObserver
  27. */
  28. protected $model;
  29. /**
  30. * @var Vat |\PHPUnit_Framework_MockObject_MockObject
  31. */
  32. protected $vat;
  33. /**
  34. * @var HelperAddress |\PHPUnit_Framework_MockObject_MockObject
  35. */
  36. protected $helperAddress;
  37. /**
  38. * @var Registry |\PHPUnit_Framework_MockObject_MockObject
  39. */
  40. protected $registry;
  41. /**
  42. * @var GroupManagementInterface |\PHPUnit_Framework_MockObject_MockObject
  43. */
  44. protected $groupManagement;
  45. /**
  46. * @var ScopeConfigInterface |\PHPUnit_Framework_MockObject_MockObject
  47. */
  48. protected $scopeConfig;
  49. /**
  50. * @var ManagerInterface |\PHPUnit_Framework_MockObject_MockObject
  51. */
  52. protected $messageManager;
  53. /**
  54. * @var Escaper |\PHPUnit_Framework_MockObject_MockObject
  55. */
  56. protected $escaper;
  57. /**
  58. * @var AppState |\PHPUnit_Framework_MockObject_MockObject
  59. */
  60. protected $appState;
  61. /**
  62. * @var \Magento\Customer\Model\Customer|\PHPUnit_Framework_MockObject_MockObject
  63. */
  64. protected $customerMock;
  65. /**
  66. * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject
  67. */
  68. protected $customerSessionMock;
  69. protected function setUp()
  70. {
  71. $this->vat = $this->getMockBuilder(\Magento\Customer\Model\Vat::class)
  72. ->disableOriginalConstructor()
  73. ->getMock();
  74. $this->helperAddress = $this->getMockBuilder(\Magento\Customer\Helper\Address::class)
  75. ->disableOriginalConstructor()
  76. ->getMock();
  77. $this->registry = $this->getMockBuilder(\Magento\Framework\Registry::class)
  78. ->disableOriginalConstructor()
  79. ->getMock();
  80. $this->group = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)
  81. ->setMethods(['getId'])
  82. ->getMockForAbstractClass();
  83. $this->group->expects($this->any())->method('getId')->willReturn(1);
  84. $this->groupManagement = $this->getMockBuilder(\Magento\Customer\Api\GroupManagementInterface::class)
  85. ->setMethods(['getDefaultGroup'])
  86. ->getMockForAbstractClass();
  87. $this->groupManagement->expects($this->any())->method('getDefaultGroup')->willReturn($this->group);
  88. $this->scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
  89. ->getMockForAbstractClass();
  90. $this->messageManager = $this->getMockBuilder(\Magento\Framework\Message\ManagerInterface::class)
  91. ->getMockForAbstractClass();
  92. $this->escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class)
  93. ->disableOriginalConstructor()
  94. ->getMock();
  95. $this->appState = $this->getMockBuilder(\Magento\Framework\App\State::class)
  96. ->disableOriginalConstructor()
  97. ->getMock();
  98. $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class)
  99. ->disableOriginalConstructor()
  100. ->getMock();
  101. $this->model = new AfterAddressSaveObserver(
  102. $this->vat,
  103. $this->helperAddress,
  104. $this->registry,
  105. $this->groupManagement,
  106. $this->scopeConfig,
  107. $this->messageManager,
  108. $this->escaper,
  109. $this->appState,
  110. $this->customerSessionMock
  111. );
  112. }
  113. /**
  114. * @param bool $isVatValidationEnabled
  115. * @param bool $processedFlag
  116. * @param bool $forceProcess
  117. * @param int $addressId
  118. * @param int $registeredAddressId
  119. * @param string $configAddressType
  120. * @dataProvider dataProviderAfterAddressSaveRestricted
  121. */
  122. public function testAfterAddressSaveRestricted(
  123. $isVatValidationEnabled,
  124. $processedFlag,
  125. $forceProcess,
  126. $addressId,
  127. $registeredAddressId,
  128. $configAddressType
  129. ) {
  130. $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
  131. ->disableOriginalConstructor()
  132. ->getMock();
  133. $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class)
  134. ->disableOriginalConstructor()
  135. ->setMethods(['getDefaultBilling', 'getStore', 'getDefaultShipping', 'getGroupId'])
  136. ->getMock();
  137. $customer->expects($this->any())
  138. ->method('getStore')
  139. ->willReturn($store);
  140. $customer->expects($this->any())
  141. ->method('getDefaultBilling')
  142. ->willReturn(null);
  143. $customer->expects($this->any())
  144. ->method('getDefaultShipping')
  145. ->willReturn(null);
  146. $customer->expects($this->any())
  147. ->method('getGroupID')
  148. ->willReturn(1);
  149. $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)
  150. ->disableOriginalConstructor()
  151. ->setMethods(
  152. [
  153. 'getId',
  154. 'getIsDefaultBilling',
  155. 'getIsDefaultShipping',
  156. 'setForceProcess',
  157. 'getIsPrimaryBilling',
  158. 'getIsPrimaryShipping',
  159. 'getCustomer',
  160. 'getForceProcess'
  161. ]
  162. )
  163. ->getMock();
  164. $address->expects($this->any())
  165. ->method('getId')
  166. ->willReturn($addressId);
  167. $address->expects($this->any())
  168. ->method('getCustomer')
  169. ->willReturn($customer);
  170. $address->expects($this->any())
  171. ->method('getForceProcess')
  172. ->willReturn($forceProcess);
  173. $address->expects($this->any())
  174. ->method('getIsPrimaryBilling')
  175. ->willReturn(null);
  176. $address->expects($this->any())
  177. ->method('getIsDefaultBilling')
  178. ->willReturn($addressId);
  179. $address->expects($this->any())
  180. ->method('getIsPrimaryShipping')
  181. ->willReturn(null);
  182. $address->expects($this->any())
  183. ->method('getIsDefaultShipping')
  184. ->willReturn($addressId);
  185. $observer = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
  186. ->disableOriginalConstructor()
  187. ->setMethods([
  188. 'getCustomerAddress',
  189. ])
  190. ->getMock();
  191. $observer->expects($this->once())
  192. ->method('getCustomerAddress')
  193. ->willReturn($address);
  194. $this->helperAddress->expects($this->once())
  195. ->method('isVatValidationEnabled')
  196. ->with($store)
  197. ->willReturn($isVatValidationEnabled);
  198. $this->registry->expects($this->any())
  199. ->method('registry')
  200. ->willReturnMap([
  201. [AfterAddressSaveObserver::VIV_PROCESSED_FLAG, $processedFlag],
  202. [BeforeAddressSaveObserver::VIV_CURRENTLY_SAVED_ADDRESS, $registeredAddressId],
  203. ]);
  204. $this->helperAddress->expects($this->any())
  205. ->method('getTaxCalculationAddressType')
  206. ->willReturn($configAddressType);
  207. $this->model->execute($observer);
  208. }
  209. /**
  210. * @return array
  211. */
  212. public function dataProviderAfterAddressSaveRestricted()
  213. {
  214. return [
  215. [false, false, false, 1, null, null],
  216. [true, true, false, 1, null, null],
  217. [true, false, false, 1, null, null],
  218. [true, false, false, 1, 1, AbstractAddress::TYPE_BILLING],
  219. [true, false, false, 1, 1, AbstractAddress::TYPE_SHIPPING],
  220. ];
  221. }
  222. public function testAfterAddressSaveException()
  223. {
  224. $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
  225. ->disableOriginalConstructor()
  226. ->getMock();
  227. $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class)
  228. ->disableOriginalConstructor()
  229. ->getMock();
  230. $customer->expects($this->any())
  231. ->method('getStore')
  232. ->willReturn($store);
  233. $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)
  234. ->disableOriginalConstructor()
  235. ->setMethods([
  236. 'getCustomer',
  237. 'getForceProcess',
  238. 'getVatId',
  239. ])
  240. ->getMock();
  241. $address->expects($this->any())
  242. ->method('getCustomer')
  243. ->willReturn($customer);
  244. $address->expects($this->once())
  245. ->method('getForceProcess')
  246. ->willReturn(true);
  247. $address->expects($this->any())
  248. ->method('getVatId')
  249. ->willThrowException(new \Exception('Exception'));
  250. $observer = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
  251. ->disableOriginalConstructor()
  252. ->setMethods([
  253. 'getCustomerAddress',
  254. ])
  255. ->getMock();
  256. $observer->expects($this->once())
  257. ->method('getCustomerAddress')
  258. ->willReturn($address);
  259. $this->helperAddress->expects($this->once())
  260. ->method('isVatValidationEnabled')
  261. ->with($store)
  262. ->willReturn(true);
  263. $this->registry->expects($this->any())
  264. ->method('registry')
  265. ->with(AfterAddressSaveObserver::VIV_PROCESSED_FLAG)
  266. ->willReturn(false);
  267. $this->registry->expects($this->any())
  268. ->method('register')
  269. ->willReturnMap([
  270. [AfterAddressSaveObserver::VIV_PROCESSED_FLAG, true, false, $this->registry],
  271. [AfterAddressSaveObserver::VIV_PROCESSED_FLAG, false, true, $this->registry],
  272. ]);
  273. $this->model->execute($observer);
  274. }
  275. /**
  276. * @param string $vatId
  277. * @param int $countryId
  278. * @param bool $isCountryInEU
  279. * @param int $defaultGroupId
  280. * @dataProvider dataProviderAfterAddressSaveDefaultGroup
  281. */
  282. public function testAfterAddressSaveDefaultGroup(
  283. $vatId,
  284. $countryId,
  285. $isCountryInEU,
  286. $defaultGroupId
  287. ) {
  288. $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
  289. ->disableOriginalConstructor()
  290. ->getMock();
  291. $dataGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)
  292. ->getMockForAbstractClass();
  293. $dataGroup->expects($this->any())
  294. ->method('getId')
  295. ->willReturn($defaultGroupId);
  296. $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class)
  297. ->disableOriginalConstructor()
  298. ->setMethods([
  299. 'getStore',
  300. 'getDisableAutoGroupChange',
  301. 'getGroupId',
  302. 'setGroupId',
  303. 'save',
  304. ])
  305. ->getMock();
  306. $customer->expects($this->exactly(2))
  307. ->method('getStore')
  308. ->willReturn($store);
  309. $customer->expects($this->once())
  310. ->method('getDisableAutoGroupChange')
  311. ->willReturn(false);
  312. $customer->expects($this->once())
  313. ->method('getGroupId')
  314. ->willReturn(null);
  315. $customer->expects($this->once())
  316. ->method('setGroupId')
  317. ->with($defaultGroupId)
  318. ->willReturnSelf();
  319. $customer->expects($this->once())
  320. ->method('save')
  321. ->willReturnSelf();
  322. $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)
  323. ->disableOriginalConstructor()
  324. ->setMethods([
  325. 'getCustomer',
  326. 'getForceProcess',
  327. 'getVatId',
  328. 'getCountry',
  329. ])
  330. ->getMock();
  331. $address->expects($this->once())
  332. ->method('getCustomer')
  333. ->willReturn($customer);
  334. $address->expects($this->once())
  335. ->method('getForceProcess')
  336. ->willReturn(true);
  337. $address->expects($this->once())
  338. ->method('getVatId')
  339. ->willReturn($vatId);
  340. $address->expects($this->any())
  341. ->method('getCountry')
  342. ->willReturn($countryId);
  343. $observer = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
  344. ->disableOriginalConstructor()
  345. ->setMethods([
  346. 'getCustomerAddress',
  347. ])
  348. ->getMock();
  349. $observer->expects($this->once())
  350. ->method('getCustomerAddress')
  351. ->willReturn($address);
  352. $this->helperAddress->expects($this->once())
  353. ->method('isVatValidationEnabled')
  354. ->with($store)
  355. ->willReturn(true);
  356. $this->vat->expects($this->any())
  357. ->method('isCountryInEU')
  358. ->with($countryId)
  359. ->willReturn($isCountryInEU);
  360. $this->groupManagement->expects($this->any())
  361. ->method('getDefaultGroup')
  362. ->with($store)
  363. ->willReturn($dataGroup);
  364. $this->model->execute($observer);
  365. }
  366. /**
  367. * @return array
  368. */
  369. public function dataProviderAfterAddressSaveDefaultGroup()
  370. {
  371. return [
  372. ['', 1, false, 1],
  373. [1, 1, false, 1],
  374. ];
  375. }
  376. /**
  377. * @param string $vatId
  378. * @param $vatClass
  379. * @param int $countryId
  380. * @param string $country
  381. * @param int $newGroupId
  382. * @param string $areaCode
  383. * @param bool $resultVatIsValid
  384. * @param bool $resultRequestSuccess
  385. * @param string $resultValidMessage
  386. * @param string $resultInvalidMessage
  387. * @param string $resultErrorMessage
  388. * @dataProvider dataProviderAfterAddressSaveNewGroup
  389. * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  390. * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  391. */
  392. public function testAfterAddressSaveNewGroup(
  393. $vatId,
  394. $vatClass,
  395. $countryId,
  396. $country,
  397. $newGroupId,
  398. $areaCode,
  399. $resultVatIsValid,
  400. $resultRequestSuccess,
  401. $resultValidMessage,
  402. $resultInvalidMessage,
  403. $resultErrorMessage
  404. ) {
  405. $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
  406. ->disableOriginalConstructor()
  407. ->getMock();
  408. $validationResult = $this->getMockBuilder(\Magento\Framework\DataObject::class)
  409. ->disableOriginalConstructor()
  410. ->setMethods([
  411. 'getIsValid',
  412. 'getRequestSuccess',
  413. ])
  414. ->getMock();
  415. $validationResult->expects($this->any())
  416. ->method('getIsValid')
  417. ->willReturn($resultVatIsValid);
  418. $validationResult->expects($this->any())
  419. ->method('getRequestSuccess')
  420. ->willReturn($resultRequestSuccess);
  421. $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class)
  422. ->disableOriginalConstructor()
  423. ->setMethods([
  424. 'getStore',
  425. 'getDisableAutoGroupChange',
  426. 'getGroupId',
  427. 'setGroupId',
  428. 'save',
  429. ])
  430. ->getMock();
  431. $customer->expects($this->exactly(2))
  432. ->method('getStore')
  433. ->willReturn($store);
  434. $customer->expects($this->any())
  435. ->method('getDisableAutoGroupChange')
  436. ->willReturn(false);
  437. $customer->expects($this->once())
  438. ->method('getGroupId')
  439. ->willReturn(null);
  440. $customer->expects($this->once())
  441. ->method('setGroupId')
  442. ->with($newGroupId)
  443. ->willReturnSelf();
  444. $customer->expects($this->once())
  445. ->method('save')
  446. ->willReturnSelf();
  447. $this->customerSessionMock->expects($this->once())
  448. ->method('setCustomerGroupId')
  449. ->with($newGroupId)
  450. ->willReturnSelf();
  451. $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)
  452. ->disableOriginalConstructor()
  453. ->setMethods([
  454. 'getCustomer',
  455. 'getForceProcess',
  456. 'getVatId',
  457. 'getCountryId',
  458. 'getCountry',
  459. 'setVatValidationResult',
  460. ])
  461. ->getMock();
  462. $address->expects($this->any())
  463. ->method('getCustomer')
  464. ->willReturn($customer);
  465. $address->expects($this->once())
  466. ->method('getForceProcess')
  467. ->willReturn(true);
  468. $address->expects($this->any())
  469. ->method('getVatId')
  470. ->willReturn($vatId);
  471. $address->expects($this->any())
  472. ->method('getCountryId')
  473. ->willReturn($countryId);
  474. $address->expects($this->once())
  475. ->method('getCountry')
  476. ->willReturn($country);
  477. $address->expects($this->once())
  478. ->method('setVatValidationResult')
  479. ->with($validationResult)
  480. ->willReturnSelf();
  481. $observer = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
  482. ->disableOriginalConstructor()
  483. ->setMethods([
  484. 'getCustomerAddress',
  485. ])
  486. ->getMock();
  487. $observer->expects($this->once())
  488. ->method('getCustomerAddress')
  489. ->willReturn($address);
  490. $this->helperAddress->expects($this->once())
  491. ->method('isVatValidationEnabled')
  492. ->with($store)
  493. ->willReturn(true);
  494. $this->vat->expects($this->any())
  495. ->method('isCountryInEU')
  496. ->with($country)
  497. ->willReturn(true);
  498. $this->vat->expects($this->once())
  499. ->method('checkVatNumber')
  500. ->with($countryId, $vatId)
  501. ->willReturn($validationResult);
  502. $this->vat->expects($this->once())
  503. ->method('getCustomerGroupIdBasedOnVatNumber')
  504. ->with($countryId, $validationResult, $store)
  505. ->willReturn($newGroupId);
  506. $this->vat->expects($this->any())
  507. ->method('getCustomerVatClass')
  508. ->with($countryId, $validationResult)
  509. ->willReturn($vatClass);
  510. $this->appState->expects($this->once())
  511. ->method('getAreaCode')
  512. ->willReturn($areaCode);
  513. $this->scopeConfig->expects($this->any())
  514. ->method('isSetFlag')
  515. ->with(HelperAddress::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT)
  516. ->willReturn(false);
  517. if ($resultValidMessage) {
  518. $this->messageManager->expects($this->once())
  519. ->method('addSuccess')
  520. ->with($resultValidMessage)
  521. ->willReturnSelf();
  522. }
  523. if ($resultInvalidMessage) {
  524. $this->escaper->expects($this->once())
  525. ->method('escapeHtml')
  526. ->with($vatId)
  527. ->willReturn($vatId);
  528. $this->messageManager->expects($this->once())
  529. ->method('addError')
  530. ->with($resultInvalidMessage)
  531. ->willReturnSelf();
  532. }
  533. if ($resultErrorMessage) {
  534. $this->scopeConfig->expects($this->once())
  535. ->method('getValue')
  536. ->with('trans_email/ident_support/email', ScopeInterface::SCOPE_STORE)
  537. ->willReturn('admin@example.com');
  538. $this->messageManager->expects($this->once())
  539. ->method('addError')
  540. ->with($resultErrorMessage)
  541. ->willReturnSelf();
  542. }
  543. $this->model->execute($observer);
  544. }
  545. /**
  546. * @return array
  547. */
  548. public function dataProviderAfterAddressSaveNewGroup()
  549. {
  550. return [
  551. [
  552. 'vat_id' => 1,
  553. 'vat_class' => null,
  554. 'country_id' => 1,
  555. 'country_code' => 'US',
  556. 'group_id' => 1,
  557. 'area_code' => Area::AREA_ADMINHTML,
  558. 'is_vat_valid' => false,
  559. 'request_sucess' => false,
  560. 'valid_message' => '',
  561. 'invalid_message' => '',
  562. 'error_message' => '',
  563. ],
  564. [
  565. 'vat_id' => 1,
  566. 'vat_class' => Vat::VAT_CLASS_DOMESTIC,
  567. 'country_id' => 1,
  568. 'country_code' => 'US',
  569. 'group_id' => 1,
  570. 'area_code' => Area::AREA_FRONTEND,
  571. 'is_vat_valid' => true,
  572. 'request_sucess' => false,
  573. 'valid_message' => 'Your VAT ID was successfully validated. You will be charged tax.',
  574. 'invalid_message' => '',
  575. 'error_message' => '',
  576. ],
  577. [
  578. 'vat_id' => 1,
  579. 'vat_class' => Vat::VAT_CLASS_INTRA_UNION,
  580. 'country_id' => 1,
  581. 'country_code' => 'US',
  582. 'group_id' => 1,
  583. 'area_code' => Area::AREA_FRONTEND,
  584. 'is_vat_valid' => true,
  585. 'request_sucess' => false,
  586. 'valid_message' => 'Your VAT ID was successfully validated. You will not be charged tax.',
  587. 'invalid_message' => '',
  588. 'error_message' => '',
  589. ],
  590. [
  591. 'vat_id' => 1,
  592. 'vat_class' => Vat::VAT_CLASS_INTRA_UNION,
  593. 'country_id' => 1,
  594. 'country_code' => 'US',
  595. 'group_id' => 1,
  596. 'area_code' => Area::AREA_FRONTEND,
  597. 'is_vat_valid' => false,
  598. 'request_sucess' => true,
  599. 'valid_message' => '',
  600. 'invalid_message' => 'The VAT ID entered (1) is not a valid VAT ID. You will be charged tax.',
  601. 'error_message' => '',
  602. ],
  603. [
  604. 'vat_id' => 1,
  605. 'vat_class' => Vat::VAT_CLASS_INTRA_UNION,
  606. 'country_id' => 1,
  607. 'country_code' => 'US',
  608. 'group_id' => 1,
  609. 'area_code' => Area::AREA_FRONTEND,
  610. 'is_vat_valid' => false,
  611. 'request_sucess' => false,
  612. 'valid_message' => '',
  613. 'invalid_message' => '',
  614. 'error_message' => 'Your Tax ID cannot be validated. You will be charged tax. '
  615. . 'If you believe this is an error, please contact us at admin@example.com',
  616. ],
  617. ];
  618. }
  619. }