commerceguys / tax

A PHP 5.5+ tax library.
MIT License
276 stars 39 forks source link

VAT in Norway #97

Open mmihalev opened 1 month ago

mmihalev commented 1 month ago

Hello, The code bellow produces empty results var_dump($amounts) when store and customer addresses are in Norway. Am I doing something wrong here?

$taxTypeRepository = new TaxTypeRepository();
$chainTaxTypeResolver = new ChainTaxTypeResolver();
$chainTaxTypeResolver->addResolver(new CanadaTaxTypeResolver($taxTypeRepository));
$chainTaxTypeResolver->addResolver(new EuTaxTypeResolver($taxTypeRepository));
$chainTaxTypeResolver->addResolver(new DefaultTaxTypeResolver($taxTypeRepository));
$chainTaxRateResolver = new ChainTaxRateResolver();
$chainTaxRateResolver->addResolver(new DefaultTaxRateResolver());
$resolver = new TaxResolver($chainTaxTypeResolver, $chainTaxRateResolver);

$customerAddress = new Address();
$storeAddress = new Address();

$storeAddress = $storeAddress->withCountryCode('NO');
$customerAddress = $customerAddress->withCountryCode('NO');

$context = new Context($customerAddress, $storeAddress);
$taxable = new MyTaxable();

$amounts = $resolver->resolveAmounts($taxable, $context);