---
# System prepended metadata

title: Java Web service API

---

# Java Web service API

## 超商代收

### 更新條碼代收狀態

- 在收到超商代收通知條碼已經被刷讀後，發送請求給 foodomo 修改訂單狀態
- 預計規格
    ```
    [POST] /v3/OrderApi/cod-complete
    
    request body : 
    
        {
            "barcode1": "1109067W7",
            "barcode2": "1VHJFOODOMO012Y",
            "barcode3": "A42359010000220",
            "pos_scan_at": "2022-09-05 00:00:00"
        }
    
    response body: 
    
        200:
        {
            "status": 1,
            "code": 200,
            "message": "Success.",
        }

        400:
        {
            "status": 0,
            "code": 400,
            "message": "Order is not exist.",
        }
    ```
    
### Table 

``` MySql
CREATE TABLE `tb_order_cod_barcode` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL COMMENT '訂單編號',
  `OL_Code_2` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '銷帳編號',
  `OL_Amount` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '代收金額',
  `trace_id` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '交易編號',
  `barcode1` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT 'barcode1',
  `barcode2` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT 'barcode2',
  `barcode3` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT 'barcode3',
  `bar_type` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '條碼類型 2: 純條碼 3: 純條碼 + base64 image',
  `barcode_image` text COLLATE utf8mb4_bin NOT NULL COMMENT '條碼 base64 image',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立時間',
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新時間',
  `pos_scan_at` timestamp NULL DEFAULT NULL COMMENT 'POS掃描時間',
  `checkout_at` timestamp NULL DEFAULT NULL COMMENT '訂單結算時間',
  PRIMARY KEY (`id`),
  KEY `order_cod_barcode_order_id_index` (`order_id`),
  KEY `order_cod_barcode_ol_code_2_index` (`OL_Code_2`),
  KEY `order_cod_barcode_trace_id_index` (`trace_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
```



## OP 兌點

### 取得用戶目前剩餘 OP 點數

- 用戶使用 OP 折抵前，先取得用戶目前剩餘的 OP 點數
- 精準度到小數點後兩位
- 預計規格
    ```
    foodomo 端
    [GET] /v3/OrderApi/open-point/{user_gid}
    
    termino 規則 ： 交易日期(8碼)+店號(6碼)+POS機號(2碼)+交易流水號(6碼)+交易時間(4碼)
    
    request: 
    {
        "termino": "12344550696996",
        "T0000": "20", //固定
        "T0100": "0210", //固定 一般交易:0200/0210
        "T0200": "GID6635542", //GID 會員條碼
        "T0205": "040C", // GID 會員條碼:040C
        "T0300": "200000", //查詢餘額點數(200000) 
        "T1100": "000001", //每日流水號
        "T1200": "His", //終端機交易時間
        "T1300": "Ymd", //終端機交易日期
        "T3700": "GID6635542", //交易序號 
        "T4100": "GID6635542", // 終端機唯一代號
        "T4200": "GID6635542", // 通路廠商代號
        "T5502": "GID6635542" // 門市代號
    }
    
    Web service 端
    未定
    
    response : 
        200:
        {
            "status": 1,
            "gid": "GID6635542",
            "points": 328
        }
        
        400:
        {
            "status": 0,
            "message": "用戶不存在"
            
        }
    ```
    
    ```
    查詢成功 OP reponse
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221020</ns0:DATE><ns0:TIME>105713</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID25019421296852</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0300>200000</ns0:T0300><ns0:T1100>000005</ns0:T1100><ns0:T1200>105713</ns0:T1200><ns0:T1300>20221020</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521020000005</ns0:T3700><ns0:T3800>Nwmy9T</ns0:T3800><ns0:T3900>00</ns0:T3900><ns0:T3901>處理成功</ns0:T3901><ns0:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>1</ns0:T4300><ns0:T4400>2</ns0:T4400><ns0:T5502>800002</ns0:T5502><ns507/><ns0:T5532><ns0:T553201>20000002</ns0:T553201><ns0:T553204>2.66</ns0:T553204><ns0:T553205>20221231</ns0:T553205><ns0:T553206>OP點</ns0:T553206></ns0:T5532><ns0:T5533><ns0:T553301>20000002</ns0:T553301><ns0:T553302>2021010100000</ns0:T553302><ns0:T553303>20221231235959</ns0:T553303><ns0:T553306>2.66</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5533><ns0:T553301>20000002</ns0:T553301><ns0:T553302>20220101000000</ns0:T553302><ns0:T553303>2021231235959</ns0:T553303><ns0:T553306>0.00</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533></ns0:AP></ns0:OLTP><ns0:T553305>1.00</ns0:T553305><ns0:T553306>1.66</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5533><n0:T553301>20000002</ns0:T553301><ns0:T553302>20220101000000</ns0:T553302><ns0:T553303>20231231235959</ns0:T553303><ns0:T553305>0.00</ns0:T553305><ns0:T553306>0.00</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5575>00/ns0:T5575><ns0:T5591/></ns0:AP></ns0:OLTP>
    
    查詢失敗 OP response
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221020</ns0:DATE><ns0:TIME>105511</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID75019511296853</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0300>200000</ns0:T0300><ns0:T1100>000004</ns0:T1100><ns0:T1200>105510</ns0:T1200><ns0:T1300>20221020</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521020000004</ns0:T3700><ns0:T3800>9PJ5fb</ns0:T3800><ns0:T3900>57</ns0:T3900><ns0:T3901>交易失敗，請與 OP 客服人員聯繫</ns0:T3901><ns0:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>0</ns0:T4300><ns0:T4400>2</ns0:T4400><ns0:T5502T5502><ns0:T5507/><ns0:T5532><ns0:T553201>0</ns0:T553201><ns0:T553202>0</ns0:T553202><ns0:T553204>0</ns0:T553204><ns0:T553205>0</ns0:T553205></ns0:T5532><ns0:T5533><ns0:T553301>0</ns0:T553301><ns0:T553302>0</ns0:T553302><ns0:T553303>0</ns0:T553303><ns0:T553304>0</ns0:T553304><ns0:T553306>0</ns0:T553306></ns0:T5533></ns0:AP></ns0:OLTP>
    ```

### 兌換用戶指定 OP 點數
- 用戶選擇 OP 預期扣除點數後，扣除用戶選擇要扣除的 OP 點數
- 扣點為整數
- 加點可支援小數點後兩位小數
- 根據 points 的正負來決定加點數或是扣點數
- 預計規格
    ```
    foodomo 端
    [POST] /v3/OrderApi/open-point
    
    Web service 端
    未定
    
    request body: 
    {
        "termino": "12344550696996",
        "order_number": "1002-0001" //foodomo 的訂單編號
        "T0000": "20", //固定
        "T0100": "0210", //固定
        "T0200": "GID6635542", //GID 會員條碼
        "T0205": "040C", //GID 會員條碼:040C
        "T0221": "", //給空值
        "T0300": "607000", //兌點(607000) 
        "T0400": "30", //交易金額 
        "T1100": "000001", //每日流水號
        "T1200": "His", //終端機交易時間
        "T1300": "Ymd", //終端機交易日期
        "T3700": "GID6635542", //交易序號
        "T4100": "GID6635542", // 終端機唯一代號
        "T4200": "GID6635542", // 通路廠商代號
        "T5502": "GID6635542", // 門市店號
        "T5532": "T5507", //點數資料 
        "T553201": "20000002", //點數ID  OP 點:20000002
        "T553203": "30", //扣點明細 
        "T5575": "00" //交易原因 00 : 折抵現金 
    }
    
    response : 
        200:
        {
            "status": 1,
            "gid": "GID6635542",
            "message":"扣點成功",
            "T4100": "GID6635542", // T4100
            "T3700":"04489585" //T3700
            "order_number": "1002-0001" //foodomo 的訂單編號
        }
        
        400:
        
        {
            "status": 0,
            "message": "ERROR Message from OP (ns0:T3901)"
            
        }
    ```
    
    ```
    兌點成功 OP reponse
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221020</ns0:DATE><ns0:TIME>172108</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID25019421296852</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0221/><ns0:T0300>607000</ns0:T0300><ns0:T0400>0</ns0:T0400><ns0:T1100>000014</ns0:T1100><ns0:T1200>172108</ns0:T1200><ns0:T1300>20221020</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521020000014</ns0:T3700><ns0:T3800>AeNMZv</ns0:T3800><ns0:T3900>00</ns0:T3900><ns0:T3901>處理成功</ns0:T3901><ns0:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>1</ns0:T4300><ns0:T4400>2</ns0:T44000:T5501>001</ns0:T5501><ns0:T5502>800002</ns0:T5502><ns0:T5503/><ns0:T5532><ns0:T553201>20000002</ns0:T553201><ns0:T553204>1.66</ns0:T553204><ns0:T553205>20221231</ns0:T553205><ns0:T553206>OP點</ns0:T553206></ns0:T5532><ns0:T5533><n0:T553301>20000002</ns0:T553301><ns0:T553302>20210101000000</ns0:T553302><ns0:T553303>20221231235959</ns0:T553303><ns0:T553305>1.00</ns0:T553305><ns0:T553306>1.66</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5533><n0:T553301>20000002</ns0:T553301><ns0:T553302>20220101000000</ns0:T553302><ns0:T553303>20231231235959</ns0:T553303><ns0:T553305>0.00</ns0:T553305><ns0:T553306>0.00</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5575>00/ns0:T5575><ns0:T5591/></ns0:AP></ns0:OLTP>
    
    兌點失敗 OP response
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221020</ns0:DATE><ns0:TIME>132400</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID25019421296852</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0221/><ns0:T0300>607000</ns0:T0300><ns0:T0400>0</ns0:T0400><ns0:T1100>000013</ns0:T1100><ns0:T1200>132400</ns0:T1200><ns0:T1300>20221020</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521020000013</ns0:T3700><ns0:T3800>MsEcXO</ns0:T3800><ns0:T3900>12</ns0:T3900><ns0:T3901>交易異常，請與 OP 客服人員聯繫</ns0:T3901><ns0:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>0</ns0:T4300><ns0:T4400><ns0:T5501>001</ns0:T5501><ns0:T5502>800002</ns0:T5502><ns0:T5503/><ns0:T5532><ns0:T553201>0</ns0:T553201><ns0:T553202>0</ns0:T553202><ns0:T553204>0</ns0:T553204><ns0:T553205>0</ns0:T553205></ns0:T5532><ns0:T5533><ns0:T553301>0</ns0:T553301><ns0:T553302>0</ns0:T553302><ns0:T553303>0</ns0:T553303><ns0:T553304>0</ns0:T553304><ns0:T553306>0</ns0:T553306></ns0:T5533><ns0:T5575>00</ns0:T5575><ns0:T5591/></ns0:AP></ns0:OLTP>
    ```

### 兌退用戶指定 OP 點數
- 用戶選擇 OP 預期扣除點數後，退還用戶選擇要扣除的 OP 點數
- 扣點為整數
- 加點可支援小數點後兩位小數
- 根據 points 的正負來決定加點數或是扣點數
- 預計規格
    ```
    foodomo 端
    [POST] /v3/OrderApi/open-point
    
    Web service 端
    未定
    
    request body: 
    {
        "termino": "12344550696996",
        "order_number": "1002-0001" //foodomo 的訂單編號
        "T0000": "20", //固定
        "T0100": "0210", //固定
        "T0200": "GID6635542", //卡號 GID 會員條碼
        "T0205": "040C", //GID 會員條碼:040C
        "T0300": "610070", //兌點取消(610070)
        "T0400": "30", //交易金額 
        "T1100": "000001", //每日流水號
        "T1200": "His", //終端機交易時間
        "T1300": "Ymd", //終端機交易日期
        "T3700": "GID6635542", //交易序號
        "T4100": "GID6635542", // 終端機唯一代號
        "T4200": "GID6635542", // 通路廠商代號
        "T5502": "GID6635542", // 門市店號
        "T5533": "T5507", //有效點數明細資料 
        "T553301": "20000002", //點數ID OP 點:20000002,或效期點點 別 ID (8 碼)
        "T553304": "30", //加點明細 交易金額 
        "T5575": "00", //交易原因(原活動代號) 00 : 折抵現金
        "T5581": "T5507", // 原始交易終端機唯一代號 原 T4100
        "T5582": "T5507", //原始交易序號 原 T3700
    }
    
    response : 
        200:
        {
            "status": 1,
            "gid": "",
            "message":"扣點成功",
            "T4100": "GID6635542", // T4100
            "T3700":"04489585" //T3700
            "T5581": "T5507", // T5581
            "T5582": "T5507", //T5582
            "order_number": "1002-0001" //foodomo 的訂單編號
        }
        
        400:    
        {
            "status": 0,
            "message": "ERROR Message from OP (ns0:T3901)"
            
        }
    ```
    
    ```
    兌退成功 OP reponse
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221021</ns0:DATE><ns0:TIME>142837</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID25019421296852</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0221/><ns0:T0300>610070</ns0:T0300><ns0:T0400>0</ns0:T0400><ns0:T1100>000023</ns0:T1100><ns0:T1200>142836</ns0:T1200><ns0:T1300>20221021</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521021000023</ns0:T3700><ns0:T3800>6sH5eK</ns0:T3800><ns0:T3900>00</ns0:T3900><ns0:T3901>處理成功</ns0:T3901><ns0:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>1</ns0:T4300><ns0:T4400>2</ns0:T44000:T5501>001</ns0:T5501><ns0:T5502>800002</ns0:T5502><ns0:T5503/><ns0:T5532><ns0:T553201>20000002</ns0:T553201><ns0:T553204>2.66</ns0:T553204><ns0:T553205>20221231</ns0:T553205></ns0:T5532><ns0:T5533><ns0:T553301>20000002</ns0:T553301><ns0:T553302>20210101000000</ns0:T553302><ns0:T553303>20221231235959</ns0:T553303><ns0:T553304>1.00</ns0:T553304><ns0:T553306>2.66</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5533><ns0:T553301>20000002</ns0:T55331><ns0:T553302>20220101000000</ns0:T553302><ns0:T553303>20231231235959</ns0:T553303><ns0:T553304>0.00</ns0:T553304><ns0:T553306>0.00</ns0:T553306><ns0:T553307>OP點</ns0:T553307></ns0:T5533><ns0:T5575>00</ns0:T5575><ns0:T5581>8000020</ns0:T5581><ns0:T5582>32521020000014</ns0:T5582></ns0:AP></ns0:OLTP>
    
    兌退失敗 OP response
    
    <?xml version="1.0" encoding="UTF-8"?><ns0:OLTP xmlns:ns0="http://7-11.com.tw/online"><ns0:HEADER><ns0:VER>01.01</ns0:VER><ns0:FROM>CP00100601</ns0:FROM><ns0:TERMINO>20150505846420020854930001</ns0:TERMINO><ns0:TO>CS00100001</ns0:TO><ns0:BUSINESS>0010102</ns0:BUSINESS><ns0:DATE>20221021</ns0:DATE><ns0:TIME>104023</ns0:TIME><ns0:STATCODE>0000</ns0:STATCODE><ns0:STATDESC/></ns0:HEADER><ns0:AP><ns0:T0000>20</ns0:T0000><ns0:T0100>0210</ns0:T0100><ns0:T0200>GID25019421296852</ns0:T0200><ns0:T0205>040C</ns0:T0205><ns0:T0221/><ns0:T0300>610070</ns0:T0300><ns0:T0400>0</ns0:T0400><ns0:T1100>000022</ns0:T1100><ns0:T1200>104023</ns0:T1200><ns0:T1300>20221021</ns0:T1300><ns0:T1400>999912</ns0:T1400><ns0:T3700>32521021000022</ns0:T3700><ns0:T3800>4jXOuj</ns0:T3800><ns0:T3900>12</ns0:T3900><ns0:T3901>交易異常，請與 OP 客服人員聯繫</n:T4100>80000201</ns0:T4100><ns0:T4200>foodomo8</ns0:T4200><ns0:T4300>0</ns0:T4300><ns0:T4400>2</ns0:T4400><ns0:T5501>001</ns0:T5501><ns0:T5502>800002</ns0:T5502><ns0:T5503/><ns0:T5532><ns0:T553201>0</ns0:T553201><ns0:T553202>0</ns0:T553202><ns0:T553204>0</ns0:T553204><ns0:T553205>0</ns0:T553205></ns0:T5532><ns0:T5533><ns0:T553301>0</ns0:T553301><ns0:T553302>0</ns0:T553302><ns0:T553303>0</ns0:T553303><ns0:T553304>0</ns0:T553304><ns0:T553306>0</ns0:T553306></ns0:T5533><ns0:T5575>00</ns0:T5575><ns0:T5581>800002</ns0:T5581><ns0:T5582>32521020000014</ns0:T5582></ns0:AP></ns0:OLTP>
    ```
### 設定相關

```
.env

#OLTP API
OLTP_GET_OPEN_POINT_EXCHANGE=http://34.80.111.9:8080/foodomo/v3/OrderApi/open-point/deduction
OLTP_GET_REVERT_OPEN_POINT_EXCHANGE=http://34.80.111.9:8080/foodomo/v3/OrderApi/open-point/cancelDeduction
OLTP_GET_OPEN_POINT=http://34.80.111.9:8080/foodomo/v3/OrderApi/open-point/query/11
OLTP_TERMINAL_CODE=800002
OLTP_VENDOR_CODE=foodomo8
OLTP_OP_STATIC_CODE=3
OLTP_OP_STORE_SIMPLE_CODE=25
```