Tax Calculation

Prev Next

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 Name Type
accountDetail AccountDetail
shippingDetail ShippingDetail
orderProducts List<OrderProductDetail>

TaxCalculationResponse

Property Name Type
totalTaxAmount Decimal
shippingTaxAmount Decimal
productTaxDetails List<ProductTaxDetail>

AccountDetail

Property Name Type
accountId Id
billingAddress AddressDetail

ShippingDetail

Property Name Type
address AddressDetail
customFields CustomFields
deliveryMethod DeliveryMethod

OrderProductDetail

Property Name Type
productCode String
quantity Decimal
totalAmount Decimal

AddressDetail

Property Name Type
city String
country String
postalCode String
state String
street String

DeliveryMethod

Property Name Type
name String
price Double

CustomFields

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

ProductTaxDetail

Property Name Type
productCode String
taxAmount Decimal