use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\Tax\Aggregate\TaxRule\TaxRuleEntity;
#[Package('checkout')]
class ZipCodeRangeRuleTypeFilter extends AbstractTaxRuleTypeFilter
{ final public const TECHNICAL_NAME = 'zip_code_range';
public function match(TaxRuleEntity
$taxRuleEntity, ?CustomerEntity
$customer, ShippingLocation
$shippingLocation): bool
{ if ($taxRuleEntity->
getType()->
getTechnicalName() !== self::TECHNICAL_NAME
|| !
$this->
metPreconditions($taxRuleEntity,
$shippingLocation) ) { return false;
} $zipCode =
$this->
getZipCode($shippingLocation);
$toZipCode =
$taxRuleEntity->
getData()['toZipCode'
];
$fromZipCode =
$taxRuleEntity->
getData()['fromZipCode'
];
if ($fromZipCode === null ||
$toZipCode === null ||
$zipCode <
$fromZipCode ||
$zipCode >
$toZipCode) { return false;
}