Skip to content

Order Return

Description

訂單退貨。

Resource

PATCH /v1/order/return

Authorization

採用 OAuth 2.0 Bearer Token,詳細使用流程請參考 Auth Login

Request Body Parameters

Name Type Description
id string 訂單編號
store_id string 門市編號
external_data string 訂單外部資訊
(optional)

Response

Status-Code: 204 No Content

Order Return API Workflow

sequenceDiagram %%{init: {'securityLevel': 'loose', 'theme': 'base'}}%% autonumber participant C as Client participant OP as OmniPlatform participant R as repository C ->> OP: Request [PATCH] /v1/order/return OP ->> OP: Call self.check_params_process(params) alt 請求參數缺少必填欄位 OP ->> C: Return(400, f"{column} 不可為空") end OP ->> OP: auth_data = get_auth_info(bearer) OP ->> OP: company_id = get_company_id(auth_data) OP ->> OP: order00_df = self.get_order00() OP ->> OP: allow_order_status = ['2', '4', '7', 'D'] alt order00_df['status'] not in allow_order_status OP ->> C: Return Response(400, {'message': '訂單狀態錯誤,無法進行退貨'}) end Note over OP: 更新全通路 order00 的 status = 9、external_data(如果前端有傳值) OP ->> R: Call update_order00(params, order00_df) Note over OP: 呼叫接單程式API通知POS進行退貨 OP ->> OP: status_code, response_data = sync_order_refund(order00_df) alt status_code != 200 and response_data.get('code', '') != '0' loop retry 3 次,每次間隔 3 秒 OP ->> OP: status_code, response_data = sync_order_refund(order00_df) end end OP ->> C: Return Response(204)