hitmeister / api-sdk-php

Kaufland.de Onlineshop (former real.de and Hitmeister) API SDK for PHP
https://www.real.de/api/v1/
MIT License
23 stars 28 forks source link

id_unit should be exposed by the order unit model #108

Open sirajea opened 3 years ago

sirajea commented 3 years ago

The order unit model does not expose the unit ID. We do not use the offer ID property. The reference for a unit in our system is simply the unit ID. This means that we have to do an extra API call to the units endpoint to retrieve the unit ID, by searching for a unit with a certain item ID and unit condition. It would make more sense to expose the unit ID in the order unit model (like the condition, delivery time etc. of the unit are already exposed). Is this possible?

Edit: It would also make more sense to expose the unit as a sub-model of the order unit model (like the item), but that would be a breaking change.

abdul-jabbar01 commented 3 years ago

Hey @sirajea . Thank you for bringing it here.

unit ID refers to unit (inventory). And order unit is copy of inventory unit that refers to specific order.

The inventory unit might not exist any longer, or have been modified in any of its parameters (e.g. price, shipping), while the order_unit is a snapshot of when the inventory unit when the order was placed.

It would make more sense to expose the unit ID in the order unit model (like the condition, delivery time etc. of the unit are already exposed)

unit_condition and delivery time exposed with order_unit is specifically related to that order. Even though if something is changed in unit, these values remain same. It reflects the unit_condition and delivery time when this order was placed.

So, we should keep unit and order_unit separately.

Does it make sense to you?

mansurs commented 3 years ago

@sirajea Additionally: If we would return a unit ID or embedded unit in the order unit request and the unit does not exist anymore, you will get a problem later. If you could use the offer id field, you can match it easier with your own system.