SDK Order Update via API

Creation date: 15/12/2021 20:51    Updated: 15/12/2021 20:51   #orderupdate #updateviaapi
Question:

Date : 10-11-2021


Issue: Order update using  SDK API


Explanation:

Some time we have observed that SDK order update does not work via below API call.

API Request:


http://10.100.24.15:80:80/oms/webservice.php?app_key=1633357101&method=oms.SdkOrderBatchAdd&order=[

  {

    "shop_code": "CS298",

    "warehouse_code": null,

    "seller_nick": "JEDSHOP",

    "tid": "JED17522",

    "express_code": null,

    "email": amnaalshehhi_28@outlook.com,

    "area": "ABUDHBAI",

    "town": null,

    "zipcode": "MOMY",

    "consignee_doc_type": null,

    "consignee_doc_no": null,

    "seller_flag": null,

    "buyer_remark": "",

    "seller_remark": null,

    "order_price": "403.22",

    "pre_tax_price": "0",

    "tax_price": "0",

    "discount_price": "59.97",

    "cod_price": "91.82",

    "order_time": "2021-10-08 01:38:30",

    "invoice_type": null,

    "invoice_title": null,

    "invoice_content": null,

    "invoice_amount": null,

    "payment_type": "0",

    "distribution_status": "1",

    "plat_lastchanged": "2021-10-08 01:38:37",

    "distribution_mode": null,

    "distribution_name": null,

    "express_no": null,

    "payment_number": null,

    "detail": [

      {

        "title": "The Professional 3 in 1 Smoothing brush",

        "sku": "RBRUSH-V-001",

        "num": "2",

        "goods_price": "119.95",

        "avg_money": null,

        "return_status": null,

        "sku_properties": null

      }

    ],

    "payment_gateway_names": "PREPAID",

    "taxes_included": null,

    "status": "paid",

    "payment_way": "PREPAID",

    "payment_time": "2021-10-08 01:38:30",

    "consignee": "Amna Ali",

    "phone": "0503488444",

    "mobile": "0503488444",

    "address": "Albteen",

    "state": "AE",

    "city": "ABUDHBAI",

    "c_status": "1",

    "province": "UNITED ARAB EMIRATES",

    "currency": "AED",

    "postage": "0",

    "order_type": "",

    "user_nick": "Amna Ali"

  }

]&timestamp=1633924940&app_sign=A058316B527FDBE5A0D85BB87655F019


Answer:

Investigation:

In OMS logic, once the order is adapted, nothing can change the order details even using the method: oms.SdkOrderBatchAdd.


There are 2 instances on OMS each for different purpose – sdk and oms.

Sdk instance is used to store order/data come in OMS using API or using manual import, and for first processing stage such as shop checking, data field validation, address examination and so on.

Oms instance is used to second processing stage such as stock checking, whether any strategy implemented like getAWB and so on.


Once order added into OMS, within 1~2mins timer will initial and adapt the order if the order doesn’t have any out of logical data or validation error, will straight pass.

Therefore after this point, no changes to order details will take into consideration.


The things that IQF wants to update to the order details like quantity, sku, order price USING the above API will always cause system return “order batch save successfully” because

  1. System did really save the order batch, but the updated field are table inside sdk instance, and it already show the updated information on UI (Platform – Platform center – order download)
  2. The updated details will not be transfer to oms instance because order is already adapted. Therefore you will not see the updated info on UI (Customer Service – order processing)

In summary:

  1. API: oms.SdkOrderBatchAdd can only update order that haven’t adapted
  2. Currently OMS doesn’t support changing order details after adapted, it will cause data alignment issue in both system and business logic