"OrderLines": [
{
"Id": "OL327043",
"ProductId": "SGK089",
"ProductVariantId": "SP1239.SP1240.SP1298",
"ProductLanguageId": "LANG1",
"ProductName": "SANDEEL 12.5CM 23G SINKING BLUE/SILVER 2+1PCS",
"ProductNumber": "42203",
"ProductVariantName": "12.5CM - SINKING / 23G - BLUE/SILVER",
"ProductImage": "/Files/Images/missing_image.jpg",
"PrimaryOrDefaultGroup": {
"Id": "SPSHOP12-77",
"Name": "Jigs"
},
"Quantity": 1.0,
"UnitName": "",
"OrderLineFields": {},
"Price": {
"Price": 9.49,
"PriceFormatted": "kr. 9,49",
"PriceWithoutVat": 9.49,
"PriceWithoutVatFormatted": "kr. 9,49",
"PriceWithVat": 11.6727,
"PriceWithVatFormatted": "kr. 11,67",
"Vat": 2.1827,
"VatFormatted": "kr. 2,18",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"UnitPrice": {
"Price": 9.49,
"PriceFormatted": "kr. 9,49",
"PriceWithoutVat": 9.49,
"PriceWithoutVatFormatted": "kr. 9,49",
"PriceWithVat": 11.6727,
"PriceWithVatFormatted": "kr. 11,67",
"Vat": 2.1827,
"VatFormatted": "kr. 2,18",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"UnitPriceBeforeDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"TotalDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
}
},
{
"Id": "OL327044",
"ProductId": "",
"ProductVariantId": "",
"ProductLanguageId": "",
"ProductName": "",
"ProductNumber": "",
"ProductVariantName": "12.5CM - SINKING / 23G - BLUE/SILVER",
"ProductImage": "/Files/Images/missing_image.jpg",
"PrimaryOrDefaultGroup": {},
"Quantity": 1.0,
"UnitName": "",
"OrderLineFields": {},
"Price": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPrice": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPriceBeforeDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"TotalDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
}
},
{
"Id": "OL327045",
"ProductId": "SGK089",
"ProductVariantId": "SP1239.SP1240.TEST",
"ProductLanguageId": "LANG1",
"ProductName": "SANDEEL",
"ProductNumber": "SGK089",
"ProductVariantName": "12.5CM - SINKING / 23G - ",
"ProductImage": "/Files/Images/missing_image.jpg",
"PrimaryOrDefaultGroup": {
"Id": "SPSHOP12-77",
"Name": "Jigs"
},
"Quantity": 1.0,
"UnitName": "",
"OrderLineFields": {},
"Price": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPrice": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPriceBeforeDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"TotalDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
}
},
{
"Id": "OL327046",
"ProductId": "",
"ProductVariantId": "",
"ProductLanguageId": "",
"ProductName": "",
"ProductNumber": "",
"ProductImage": "/Files/Images/missing_image.jpg",
"PrimaryOrDefaultGroup": {},
"Quantity": 1.0,
"UnitName": "",
"OrderLineFields": {},
"Price": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPrice": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
},
"UnitPriceBeforeDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercent": 23.0,
"VATPercentFormatted": "23%",
"CurrencyCode": "EUR"
},
"TotalDiscount": {
"PriceFormatted": "kr. 0,00",
"PriceWithoutVatFormatted": "kr. 0,00",
"PriceWithVatFormatted": "kr. 0,00",
"VatFormatted": "kr. 0,00",
"VATPercentFormatted": "0%",
"CurrencyCode": "EUR"
}
}
]
We're thinking maybe there should be some sort of validation like:
ProductId is required, since it can't handle it not being there. (atleast with our data)
If a ProductVariantId is given, it should check if there's a product with that ProductId and ProductVariantId so it doesn't return "half" true data.
And maybe some changes to the return Code so it's not always 200 Ok
Ofc you can check first if the product exist via some of the other endpoints, and using that returned data as input for adding a product.
But we still think it could be usefull with some form of validation when adding a product, to prevent a scenario where you're using cached data or something similar
Hope this can be useful for the further development for the dwapi :)
EDIT:
After rereading my post and looking closer at the endpoint, i can see why you wouldn't always want the validation,
since it's /items and not /products, so you should be allowed to add "anything".
So instead of forcing the validation we requested, maybe it could be added as a property on the OrderlineViewModel that's being used for the body of the request,
to force it to validate that it's a existing product, maybe with a validitateExistingProduct boolean or something similar. Or even a specific endpoint for it
Best regards,
Mikkel Hammer