Skip to content

Create Shop Order

Description

建立店長APP訂單。

Resource

POST /v1/shop_order

Authorization

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

Request Body Parameters

Name Type Description
id string 訂單編號,第一次進購物車不用帶,
例如:STORE2005010001
(optional)
order_date string 交易日期
EXAMPLE "2020-01-01 12:00:00"
machine_id string 機號
type string 類型
ALLOWED VALUES:
  • OIL
  • PRODUCT
store Info 門市資訊
operator Info 操作人員
charges Charges 費用
cart Cart 購物車資訊
(optional)

Request Body Parameters - Info

Name Type Description
id string 代碼
name string 名稱

Request Body Parameters - Charges

Name Type Description
product_amount integer 商品加油金額
discount_amount integer 折扣金額
total_amount integer 總金額

Request Body Parameters - Cart

Name Type Description
items Item[] 品項資料

Request Body Parameters - Item

Name Type Description
id string 商品編號
title string 商品名稱
quantity integer 數量
price ItemPrice 售價
ticket_no_list list 票卷號碼列表
(optional)

Request Body Parameters - ItemPrice

Name Type Description
unit_price integer 單價
discount integer 折價
total_price integer 合計售價

Request Body Parameters - Ticket

Name Type Description
number string 票劵號碼

Request Example

{
  "id": "00003021080300966",
  "order_date": "2021-08-24 14:18:30",
  "machine_id": "02",
  "type": "PRODUCT",
  "store": {
    "id": "A01",
    "name": "台南店"
  },
  "operator": {
    "id": "1234",
    "name": "李小鐵"
  },
  "charges": {
    "product_amount": 1000,
    "discount_amount": 0,
    "total_amount": 1000
  },
  "cart": {
    "items": [
      {
        "id": "Z10002",
        "title": "雨刷16吋",
        "quantity": 1,
        "price": {
          "unit_price": 600,
          "discount": 0,
          "total_price": 600
        },
        "ticket_no_list": []
      },
      {
        "id": "ZMJ0001",
        "title": "折價券",
        "quantity": 100,
        "price": {
          "unit_price": -1,
          "discount": 0,
          "total_price": -100
        },
        "ticket_no_list": [
          "AA0001",
          "AA0002"
        ]
      }
    ]
  }
}

Response Body Parameters

Name Type Description
id string 訂單編號
current_state string
(enum)
訂單狀態
ALLOWED VALUES:
  • CREATED
  • COMPLETED
  • CANCELED
create_at string 建立時間
EXAMPLE "2020-01-01 12:00:00"

Response Success Example

{
  "id": "STORE2005010001",
  "current_state": "CREATED",
  "create_at": "2021-08-24 14:18:30"
}

Response Fail Example

{
  "code": "1116",
  "message": "此票券不是折價券",
  "ticket_list": [
    {
      "ticket_no": "A01000011",
      "amount": 0.0
    }
  ]
}

Response Error Code

code message
1001 參數錯誤
1002 查無此訂單
1003 發生未知的錯誤
1101 將訂單資訊寫入資料庫時失敗
1102 訂單狀態錯誤,無法再次建立訂單
1103 查無票券
1104 票券已被使用
1105 票券不適用於此商品
1106 訂單總金額錯誤
1107 訂單商品總金額錯誤
1108 訂單商品總折扣金額錯誤
1109 商品金額錯誤
1110 折價金額超過消費金額
1111 票券折扣金額與商品折扣金額不相同
1112 票券重複
1113 商品券數量大於商品數量
1114 無法辨識商品券類型
1115 商品提貨券兌換失敗,商品編號不符
1116 此票券不是折價券
1117 查無商品類別
1118 商品查詢失敗
1119 商品金額不符
1120 查無公司名稱
1121 查無門市名稱