Order validations
Full validation of orders has previously been ON by default. But since Engage does not store orders data, and just passes it on, some of the validations might be an unnecessary step, causing complications. So for new Engage customers, some validations for orders will be OFF by default and can be activated if needed.
Note
For customers starting their Engage journey after 1st December 2022, some validations on orders will be OFF by default. Consult your Voyado team if you are unsure about this.
There are some validations for orders that are always active.
discounts.value should always be negative
A return should have the item.type="return" and a quantity that is negative
A purchase should have the item.type="purchase" and a quantity that is positive
If taxes are specified, taxAmount must equal grossPaidPrice – grossPaidPrice / (1 + taxPercent / 100)
If taxes are specified, taxAmount multiplied by quantity must be negative for item.type="return"
Caution
Basic validations must always be passed by any data sent to the /orders endpoint.
Some other validations have been moved into individual toggles and can be activated if needed to add extra validations:
Toggle 1 - Enable validation of tax on orders (item level and total tax)
Turning this to ON adds the following validation requirement:
If totalTax is specified in your data, the taxAmount values given per item must sum to totalTax.
Toggle 2 - Enable validation - Sum of all grossPaidPrice and fees must match TotalGrossPrice
Turning this to ON adds the following validation requirement:
The totalGrossPrice must equal the sum of all grossPaidPrice plus any fees defined (such as freightFee, handlingFee).
Toggle 3 - Enable validation - Sum of all paymentMethods must match totalGrossPrice (if paymentMethods are specified)
Turning this to ON adds the following validation requirement:
If paymentMethods exists in your data, all paymentMethods values should sum to totalGrossPrice.
You can see examples of these payloads here.