Tax

using DirectScale.Disco.Extension.Hooks.Taxes;

CommitTax

Hook into the CommitTax() function. This function is used to commit the tax to the third-party tax provider.

public class CommitTax : IHook<CommitTaxHookRequest, CommitTaxHookResponse>
{
  public CommitTax() { }
  
  public CommitTaxHookResponse Invoke(CommitTaxHookRequest request, Func<CommitTaxHookRequest, CommitTaxHookResponse> func)
  {
    return func(request);
  }
}
 services.AddTransient<IHook<CommitTaxHookRequest, CommitTaxHookResponse>, CommitTax>();
{
  "OrderInfo": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  }
}
{}


GetTax

Override the Tax Provider settings. For example, If you wanted a different tax provider by country or Order Type. The default is to use the Corporate Admin > Advanced Settings > Tax Providers page.

public class GetTax : IHook<GetTaxHookRequest, GetTaxHookResponse>
{
  public GetTax() { }

  public GetTaxHookResponse Invoke(GetTaxHookRequest request, Func<GetTaxHookRequest, GetTaxHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<GetTaxHookRequest, GetTaxHookResponse>, GetTax>();
{
  "Items": [
    {
      "ItemId": 0,
      "Weight": 0.0,
      "Length": 0.0,
      "Width": 0.0,
      "Height": 0.0,
      "Amount": 0.0,
      "Quantity": 0.0,
      "TaxCode": "string",
      "GrossAmount": 0.0,
      "SKU": "string",
      "Description": "string"
    }
  ],
  "Shipping": 0.0,
  "WarehouseId": 0,
  "Address": {
    "Id": 0,
    "AddressLine1": "string",
    "AddressLine2": "string",
    "AddressLine3": "string",
    "City": "string",
    "State": "string",
    "PostalCode": "string",
    "CountryCode": "string"
  },
  "AssociateId": 0,
  "SaleDate": "0001-01-01T00:00:00",
  "CurrencyCode": "string"
}
{
  "TaxResult": {
    "TransactionId": "string",
    "RefundTransactionId": "string",
    "TaxProvider": 0,
    "LineItems": [
      {
        "Detail": [],
        "ItemId": 0,
        "TaxRate": 0.0,
        "TaxAmount": 0.0,
        "Street": null,
        "City": null,
        "County": null,
        "State": null,
        "Country": null,
        "Zip": null,
        "WarehouseAddressId": 0
      }
    ],
    "TaxAmount": 0.0,
    "TaxRate": 0.0,
    "ShippingAmount": 0.0
  }
}