Logic for Inventory cron
Sending feed:
- Collect all items which have update_quantity = 'pending' OR end_item = 1
- Send them to Tesco AND update all of them with update_quantity = 'sent'
- Save data in marketplace_feed
- In marketplace_feed_object one row for each item
- for those with end_item = 1 => set end_item = 1 (in marketplace_feed_object)
- for the others set end_item = 0 (in marketplace_feed_object)
For errors during checks for the items (before adding them to the feed) :
a. Save them in ending_error if item_account.end_item = 1 + set end_item = 0
b. Save them in update_quantity_error if item_account.end_item = 0 + set update_quantity = error
Reading the response:
Errors:
- If marketplace_feed_object.end_item = 1 AND if update_quantity = 'sent'
- Save the error in ia.ending_error
- Set ia.end_item = 0
- ia.update_quantity = normal
- If marketplace_feed_object.end_item = 0 AND if update_quantity = 'sent'
- Save the error in ia.update_quantity_error
- Set ia.update_quantity = 'error'
Successes:
- If marketplace_feed_object.end_item = 1
- set ia.update_quantity = 'normal'
- set ia.end_item = 0
- set iat.deactivate_item = 1
- If marketplace_feed_object.end_item = 0 AND if update_quantity = 'sent'
- set update_quantity = 'normal'
- if qty >0 => listingStatus = 'active'
- if qty = 0 set iat.deactivate_item = 1