From 93d2d8ce2ed5cb313f38dee13a81ceacdb8e229b Mon Sep 17 00:00:00 2001 From: Graham Wharton Date: Sat, 18 Jan 2025 10:30:36 +0000 Subject: [PATCH] Removed EU Online Validation. VIES not available. Updated Interface between main module and country modules. --- Model/TaxScheme.php | 8 ++++---- Test/Integration/TaxSchemeTest.php | 4 +--- Test/Unit/TaxSchemeTest.php | 14 +------------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Model/TaxScheme.php b/Model/TaxScheme.php index 18fb0c9..e1ca7cf 100644 --- a/Model/TaxScheme.php +++ b/Model/TaxScheme.php @@ -109,9 +109,9 @@ public function getOrderValue(Quote $quote): float /** * Get customer group based on Validation Result and Country of customer * @param string $customerCountryCode - * @param string|null $customerPostCode * @param bool $taxIdValidated * @param float $orderValue + * @param string|null $customerPostCode * @param int|null $storeId * @return int|null * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -120,9 +120,9 @@ public function getOrderValue(Quote $quote): float */ public function getCustomerGroup( string $customerCountryCode, - ?string $customerPostCode, bool $taxIdValidated, float $orderValue, + ?string $customerPostCode, ?int $storeId ): ?int { $merchantCountry = $this->scopeConfig->getValue( @@ -197,13 +197,13 @@ public function getCustomerGroup( * Peform validation of the ABN, returning a gatewayResponse object * * @param string $countryCode - * @param string|null $taxId + * @param string $taxId * @return TaxIdCheckResponseInterface * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function checkTaxId( string $countryCode, - ?string $taxId + string $taxId ): TaxIdCheckResponseInterface { $taxIdCheckResponse = $this->ticrFactory->create(); diff --git a/Test/Integration/TaxSchemeTest.php b/Test/Integration/TaxSchemeTest.php index fc905ad..c75fa52 100644 --- a/Test/Integration/TaxSchemeTest.php +++ b/Test/Integration/TaxSchemeTest.php @@ -184,9 +184,9 @@ public function testGetCustomerGroup( ); $result = $this->taxScheme->getCustomerGroup( $customerCountryCode, - $customerPostCode, $taxIdValidated, $orderValue, + $customerPostCode, $storeId ); $this->assertEquals($expectedGroup, $result); @@ -252,7 +252,6 @@ public function checkTaxIdDataProviderOnline(): array //IsValid return [ ['AU', '', false], - ['AU', null, false], ['AU', '72 629 951 766', true], // Correct format, valid ABN, valid GST ['AU', '50 110 219 460', false], // Correct format, valid ABN, no GST ['AU', '9429032097351', false], @@ -293,7 +292,6 @@ public function checkTaxIdDataProviderOfline(): array //IsValid return [ ['AU', '', false], - ['AU', null, false], ['AU', '72 629 951 766', true], // Correct format ['AU', '50 110 219 460', true], // Correct format ['AU', '9429032097351', false], diff --git a/Test/Unit/TaxSchemeTest.php b/Test/Unit/TaxSchemeTest.php index 4e744d4..a3d90b9 100644 --- a/Test/Unit/TaxSchemeTest.php +++ b/Test/Unit/TaxSchemeTest.php @@ -2,8 +2,6 @@ namespace Gw\AutoCustomerGroupAustralia\Test\Unit; -use GuzzleHttp\ClientFactory; -use Gw\AutoCustomerGroup\Model\TaxSchemeHelper; use Gw\AutoCustomerGroupAustralia\Model\TaxScheme; use Gw\AutoCustomerGroup\Api\Data\TaxIdCheckResponseInterfaceFactory; use Magento\Directory\Model\CurrencyFactory; @@ -51,11 +49,6 @@ class TaxSchemeTest extends TestCase */ private $dateTimeMock; - /** - * @var TaxSchemeHelper|MockObject - */ - private $helperMock; - protected function setUp(): void { $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) @@ -82,18 +75,13 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); - $this->helperMock = $this->getMockBuilder(TaxSchemeHelper::class) - ->disableOriginalConstructor() - ->getMock(); - $this->model = new TaxScheme( $this->scopeConfigMock, $this->loggerMock, $this->storeManagerMock, $this->currencyFactoryMock, $this->taxIdCheckResponseInterfaceFactoryMock, - $this->dateTimeMock, - $this->helperMock + $this->dateTimeMock ); }