For example, ['UK'], for a US store registered in the UK to collect
EU VAT on digital services.
public getStoreRegistrations ( ) : array | ||
return | array | An array of country codes where the store is additionally registered to collect taxes. |
/** * @covers ::__construct * * @uses \CommerceGuys\Tax\Resolver\Context::getCustomerAddress * @uses \CommerceGuys\Tax\Resolver\Context::getStoreAddress * @uses \CommerceGuys\Tax\Resolver\Context::getCustomerTaxNumber * @uses \CommerceGuys\Tax\Resolver\Context::getStoreRegistrations * @uses \CommerceGuys\Tax\Resolver\Context::getDate */ public function testConstructor() { $customerAddress = $this->getMockBuilder('CommerceGuys\\Addressing\\Model\\Address')->getMock(); $storeAddress = $this->getMockBuilder('CommerceGuys\\Addressing\\Model\\Address')->getMock(); $date = new \DateTime('2014-10-10'); $context = new Context($customerAddress, $storeAddress, '0123', ['DE'], $date); $this->assertSame($customerAddress, $context->getCustomerAddress()); $this->assertSame($storeAddress, $context->getStoreAddress()); $this->assertEquals('0123', $context->getCustomerTaxNumber()); $this->assertEquals(['DE'], $context->getStoreRegistrations()); $this->assertSame($date, $context->getDate()); }
/** * Checks whether the store is registered to collect taxes in the given zone. * * @param ZoneInterface $zone The zone. * @param Context $context The context containing store information. * * @return bool True if the store is registered to collect taxes in the * given zone, false otherwise. */ protected function checkStoreRegistration(ZoneInterface $zone, Context $context) { $storeRegistrations = $context->getStoreRegistrations(); foreach ($storeRegistrations as $country) { if (!isset($this->emptyAddresses[$country])) { $this->emptyAddresses[$country] = new Address($country); } if ($zone->match($this->emptyAddresses[$country])) { return true; } } return false; }