Tax Calculation
  • 12 Apr 2024
  • 1 Minute to read
  • Dark
    Light

Tax Calculation

  • Dark
    Light

Article summary

OrderCentral calculates VAT based upon the country of the shipment address and the corresponding VAT Rule. If this is not per your requirements there is the option to write you own logic to calculate VAT. This article describes how to do this.

All referenced class names are within the welisacommerce namespace

  1. Create a new Apex class and have it implement the ITaxCalculator interface
  2. Implement your logic and return an instance of TaxCalculationResponse (all properties are required
  3. Register your class within the OrderCentral plugin registrations
    1. Setup -> Custom Metadata Types -> Plugin Registrations -> New
    2. In the Plugin field select pluging with name ITaxCalculator
    3. Save

TaxCalculationRequest

Property NameType
accountDetailAccountDetail
shippingDetailShippingDetail
orderProductsList<OrderProductDetail>

TaxCalculationResponse

Property NameType
totalTaxAmountDecimal
shippingTaxAmountDecimal
productTaxDetailsList<ProductTaxDetail>

AccountDetail

Property NameType
accountIdId
billingAddressAddressDetail

ShippingDetail

Property NameType
addressAddressDetail
customFieldsCustomFields
deliveryMethodDeliveryMethod

OrderProductDetail

Property NameType
productCodeString
quantityDecimal
totalAmountDecimal

AddressDetail

Property NameType
cityString
countryString
postalCodeString
stateString
streetString

DeliveryMethod

Property NameType
nameString
priceDouble

CustomFields

| Method Name | Argument | Return Value |
| --- | --- |
| getValue | fieldApiName (String) | object |

ProductTaxDetail

Property NameType
productCodeString
taxAmountDecimal

What's Next