Hi,
We’re using Connect ERP (endpoint /api/connect/erp/orders/) to read orders for an ERP integration. In the ERP we want to store the price of each product after any discounts rather than saving product discounts as separate rows.
The data from Connect ERP looks something like this:
{
"id": "LS10049",
"rows": [
{
"id": "1",
"type": "product",
"articleNumber": "302212",
"descriptions": "Dot knopp mässing",
"unitPriceIncludingVat": 102,
"unitPriceExcludingVat": 81.6,
"quantity": 1,
"unitOfMeasurement": "st",
"vatRate": 0.25,
"totalIncludingVat": 102,
"totalExcludingVat": 81.6,
"totalVat": 20.4,
"additionalInfo": {}
},
{
"id": "2",
"type": "product",
"articleNumber": "1349965",
"descriptions": "Bottenventil pop up svart med stort lock med bräddavlopp",
"unitPriceIncludingVat": 620,
"unitPriceExcludingVat": 496,
"quantity": 1,
"unitOfMeasurement": "st",
"vatRate": 0.25,
"totalIncludingVat": 620,
"totalExcludingVat": 496,
"totalVat": 124,
"additionalInfo": {}
},
{
"id": "3",
"type": "promotion",
"articleNumber": "302212",
"descriptions": "sales.discounttypes.productcampaignprice.title",
"unitPriceIncludingVat": 42,
"unitPriceExcludingVat": 33.6,
"quantity": 1,
"unitOfMeasurement": "",
"vatRate": 0.25,
"totalIncludingVat": 42,
"totalExcludingVat": 33.6,
"totalVat": 8.4,
"additionalInfo": {}
}
],
"promotions": [
{
"id": null,
"description": null,
"type": "product",
"discountType": "DiscountedProductPrice",
"additionalInfo": {},
"sourceOrderRowIds": [
"82821240-961c-4dd2-9156-43660de902c7"
],
"resultOrderRowId": "45961bff-c1a2-444b-814f-e2711ba77255"
}
]
}
What’s the best way to map the promotion data to the corresponding products to calculate the final price? Should we map based on articleNumber
or use the promotions
property for this? promotions
seem to contain the mapping between product
rows and promotion
rows, but uses systemids which is not available under rows
.
Litium version: 8.15.0