# What is the tax accountant service?

The Tax Account is the service responsible for determining the tax multiplier that should be applied to a product price.

It uses the store's tax configuration together with the current customer's tax information and location to determine which tax rules and rates apply. The service can then use those multipliers to convert prices between tax-exclusive and tax-inclusive values.

## Converting prices

### Ex =&gt; Inc

The `priceInc` method can be used to convert an ex price to an inc price, we use it when handling prices for products:

```php
app('aero.accountant')->priceInc($value, $this->product_tax_group_id);
```

### Inc =&gt; Ex

The `priceEx` method can be used to convert an inc price to an ex price, we use it when handling prices for products:

```php
app('aero.accountant')->priceEx($value, $this->product_tax_group_id);
```

## Resolvers

### Tax Group Resolver

The Tax Account uses a tax group resolver to resolve a customer's tax group id.

A resolver is set by the `Aero\Store\Http\Middleware\SetTaxResolver` middleware:

```php
$this->accountant->setTaxGroupResolver(static function (?\Aero\Account\Models\Customer $customer) {
    if ($customer && ($group = $customer->getAttribute('customer_tax_group_id'))) {
        return $group;
    }

    if ($customer && $customer->customer_group_id && ($group = $customer->group->getAttribute('customer_tax_group_id'))) {
        return $group;
    }

    return null;
});
```

<p class="callout info">If no customer tax group id is resolved, the store's default will be used.</p>

### Country Resolver

The Tax Account uses a country resolver to resolve the country it should use.

A resolver is set by the `Aero\Store\Http\Middleware\SetTaxResolver` middleware:

```php
$this->accountant->setCountryResolver(static function (?\Aero\Account\Models\Customer $customer) {
    if ($cartLocale = \Aero\Cart\Facades\Cart::instance(PaymentDriver::MOTO)->locale()) {
        return $cartLocale->countryCode;
    }
    
    return null;
});
```

<p class="callout info">If no country code is resolved, the store's default will be used.</p>

### Zone Resolver

The Tax Account uses a country resolver to resolve the country it should use.

A resolver is set by the `Aero\Store\Http\Middleware\SetTaxResolver` middleware:

```php
$this->accountant->setZoneResolver(static function (?\Aero\Account\Models\Customer $customer) {
    if ($cartLocale = \Aero\Cart\Facades\Cart::instance(PaymentDriver::MOTO)->locale()) {
        return $cartLocale->zoneId;
    }
    
    return null;
});
```

<p class="callout info">If no zone id is resolved, then no zone id will be used.</p>

### Postcode Resolver

The Tax Account uses a country resolver to resolve the country it should use.

A resolver is set by the `Aero\Store\Http\Middleware\SetTaxResolver` middleware:

```php
$this->accountant->setPostcodeResolver(static function (?\Aero\Account\Models\Customer $customer) {
    if ($cartLocale = \Aero\Cart\Facades\Cart::instance(PaymentDriver::MOTO)->locale()) {
        return $cartLocale->postcode;
    }
    
    return null;
});
```

<p class="callout info">If no postcode is resolved, then no postcode will be used.</p>