---
# System prepended metadata

title: 方案訂購

---

[TOC]

# 方案訂購

## 方案訂購列表

```url=
POST /order/list
```

Request

|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| query | json | | | 篩選(casePatInfoId, planName, startDate, endDate) |
| pagination | json | | | 分頁 |
| - current | int | | 1 | 當前頁數 |
| - pageSize | int | | -2 | 每頁結果數量，-1 為顯示所有|
| sorter | json |  | | 排序欄位, 預設是用更新時間降序排列 |
| - field | string | | update_time(目前已 planName 為預設) | 排序欄位 |
| - order | string | | desc | 生序或降序


```json
{
    "query": {
        "casePatInfoId": "1552fc8b-055e-49d0-a7f8-8329389b8c84",
        "planName": "",
        "startDate": 1614528000000,
        "endDate": 1617206399999
    },
    "pagination": {
        "pageSize": 10,
        "total": 10,
        "current": 1
    },
    "sorter": {}
}
```

Response

|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| orderNo | String | 訂單編號 |
| orderTime | timestamp | 訂購日期 |
| serviceKind | json | 訂購方案及服務 |
| totalMoney | int |  訂單金額 |
| paymentKind | String | A: 超商代碼, B: 超商條碼 |
| paymentKindName | String | 
| orderStatus | int | 後端處理綠界訂單狀態: 訂單建立(0)/訂單成立(1)/付款成功(2)/取消(3)/應收金額錯誤(4)/付款失敗(5)
| payStatus | int | 繳費狀態: 未設定(0) 逾期未繳(1) 尚未繳款(2) 已繳款(3)
| useStatus | int | 是否啟訂單狀態: 未完成(0) 已取消(1) 未開始(2) 使用中(3) 已過期(4)


```json
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "1e10b534-762a-40e8-a0e3-96a092b98b01",
                "orderNo": "LOCALTT2103040003",
                "orderTime": 1614823557413,
                "serviceKind": "[{\"planName\" : \"孝親\", \"periodTime\" : 6, \"unit\" : 1, \"chargePlanType\" : \"G\", \"planMonths\" : 6}]",
                "totalMoney": 1000,
                "paymentKind": "A",
                "paymentKindName": "超商代碼",
                "paymentTypeChargeFee": 0,
                "orderStatus": "0",
                "payStatus": 0,
                "useStatus": 0,
                "total": 2,
                "paid": false
            },
            {
                "id": "c1943eb6-97b2-4ff9-b167-ce1e72e2972d",
                "orderNo": "LOCALTT2103040002",
                "orderTime": 1614823209934,
                "serviceKind": "[{\"planName\" : \"孝親\", \"periodTime\" : 6, \"unit\" : 1, \"chargePlanType\" : \"G\", \"planMonths\" : 6}]",
                "totalMoney": 1000,
                "paymentKind": "A",
                "paymentKindName": "超商代碼",
                "paymentTypeChargeFee": 0,
                "orderStatus": "0",
                "payStatus": 0,
                "useStatus": 0,
                "total": 2,
                "paid": false
            }
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 2
        },
        "sorter": {}
    }
}
```

## 查詢未過期方案

```url=
POST /order/nonExpired
```

Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| casePatInfoId | String | * |  | 個案Id |


```json
{
    "casePatInfoId":"1552fc8b-055e-49d0-a7f8-8329389b8c84"
}
```

Response
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| orderTime | timestamp | 訂購日期 |
| periodTime | int | 方案期間 |
| unit | int |  方案期間單位 次(0) 月(1) 年(2) |
| planName | String | 方案名稱 |
| chargePlanType | string | G(一般方案) A(加值方案) |
| chargePlanTypeName | string | |
| startTime | timestamp |方案開始日期|
| endTime | timestamp |方案結束日期|

```json
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "orderTime": 1614828292135,
                "periodTime": 6,
                "unit": 1,
                "planName": "孝親",
                "chargePlanType": "G",
                "chargePlanTypeName": "一般方案",
                "startTime": 1614828325060,
                "endTime": 1630725925060,
                "paid": false
            }
        ]
    }
}
```
## 透過訂單ID取得付款資訊

```url=
POST /order/ecpay/goPay
```

Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| id | string | Y | | 訂單ID |

```javascript
{
    "id": "1552fc8b-055e-49d0-a7f8-8329389b8c84"
}
```

Response
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| formContent | String | 訂單Form 網頁呼叫綠界API用
| jsonContent | string | 訂單內容json sdk呼叫綠界API用 |
| id | string | 訂單ID

```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "a81ec59c-a89f-40f5-b6c3-72edace9debc",
            "formContent": "&lt;form id=\"allPayAPIForm\" action=\"https://payment-stage.ecPay.com.tw/Cashier/AioCheckOut/V5\" method=\"post\"&gt;<input type=\"hidden\" name=\"ChooseSubPayment\" value=\"\"/><input type=\"hidden\" name=\"Redeem\" value=\"N\"/><input type=\"hidden\" name=\"MerchantID\" value=\"2000132\"/><input type=\"hidden\" name=\"ClientBackURL\" value=\"http://10.31.104.23/#/order/ecpay/gopay/a81ec59c-a89f-40f5-b6c3-72edace9debc/999\"/><input type=\"hidden\" name=\"CustomField4\" value=\"\"/><input type=\"hidden\" name=\"CustomField3\" value=\"\"/><input type=\"hidden\" name=\"CustomField2\" value=\"\"/><input type=\"hidden\" name=\"MerchantMemberID\" value=\"\"/><input type=\"hidden\" name=\"TotalAmount\" value=\"300\"/><input type=\"hidden\" name=\"OrderResultURL\" value=\"\"/><input type=\"hidden\" name=\"CustomField1\" value=\"a81ec59c-a89f-40f5-b6c3-72edace9debc\"/><input type=\"hidden\" name=\"UnionPay\" value=\"\"/><input type=\"hidden\" name=\"InvoiceMark\" value=\"N\"/><input type=\"hidden\" name=\"IgnorePayment\" value=\"\"/><input type=\"hidden\" name=\"PaymentType\" value=\"aio\"/><input type=\"hidden\" name=\"CheckMacValue\" value=\"1E7050B7CF17B6E8CB9B8125DFB3C311A06F553F67D314E465E2C6C8DC78677B\"/><input type=\"hidden\" name=\"NeedExtraPaidInfo\" value=\"N\"/><input type=\"hidden\" name=\"ItemURL\" value=\"\"/><input type=\"hidden\" name=\"BidingCard\" value=\"\"/><input type=\"hidden\" name=\"DeviceSource\" value=\"\"/><input type=\"hidden\" name=\"EncryptType\" value=\"1\"/><input type=\"hidden\" name=\"TradeDesc\" value=\"銀卡會員\"/><input type=\"hidden\" name=\"ChoosePayment\" value=\"Credit\"/><input type=\"hidden\" name=\"StoreID\" value=\"\"/><input type=\"hidden\" name=\"Remark\" value=\"\"/><input type=\"hidden\" name=\"Language\" value=\"\"/><input type=\"hidden\" name=\"PlatformID\" value=\"\"/><input type=\"hidden\" name=\"ReturnURL\" value=\"http://10.31.104.23/api/order/ecpay/paidResult\"/><input type=\"hidden\" name=\"ItemName\" value=\"銀卡會員\"/><input type=\"hidden\" name=\"MerchantTradeNo\" value=\"ML230116000148234B7S\"/><input type=\"hidden\" name=\"MerchantTradeDate\" value=\"2023/01/16 21:46:06\"/>&lt;script language=\"JavaScript\"&gt;allPayAPIForm.submit()&lt;/script&gt;&lt;/form&gt;",
            "jsonContent": "{\"MerchantID\":\"2000132\",\"MerchantTradeNo\":\"ML230116000148234B7S\",\"MerchantTradeDate\":\"2023/01/16 21:46:06\",\"PaymentType\":\"aio\",\"TotalAmount\":\"300\",\"TradeDesc\":\"銀卡會員\",\"ItemName\":\"銀卡會員\",\"ReturnURL\":\"http://10.31.104.23/api/order/ecpay/paidResult\",\"ChoosePayment\":\"Credit\",\"ClientBackURL\":\"http://10.31.104.23/#/order/ecpay/gopay/a81ec59c-a89f-40f5-b6c3-72edace9debc/999\",\"ItemURL\":\"\",\"Remark\":\"\",\"ChooseSubPayment\":\"\",\"OrderResultURL\":\"\",\"NeedExtraPaidInfo\":\"N\",\"DeviceSource\":\"\",\"IgnorePayment\":\"\",\"PlatformID\":\"\",\"InvoiceMark\":\"N\",\"EncryptType\":\"1\",\"Redeem\":\"N\",\"UnionPay\":\"\",\"Language\":\"\",\"StoreID\":\"\",\"CustomField1\":\"a81ec59c-a89f-40f5-b6c3-72edace9debc\",\"CustomField2\":\"\",\"CustomField3\":\"\",\"CustomField4\":\"\",\"BidingCard\":\"\",\"MerchantMemberID\":\"\"}"
        }
    }
}
```

## 訂單明細

```url=
POST /order/detail
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| casePatChargePlanInfoId | String | * | | 方案訂購Id |
| casePatInfoId | String | * | | 個案Id |


```javascript
{
    "casePatChargePlanInfoId": "1e10b534-762a-40e8-a0e3-96a092b98b01",
    "casePatInfoId": "1552fc8b-055e-49d0-a7f8-8329389b8c84"
}
```

Response
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| orderNo | String | 訂單編號 |
| orderTime | timestamp | 訂購日期 |
| chargePlanInfoId | string | 方案管理Id |
| periodTime | int | 方案期間 |
| unit | int |  方案期間單位 次(0) 月(1) 年(2) |
| planName | string | 方案名稱
| planMonths | int | fun(periodTime, unit) => planMonths(月)
| patName | string | 個案姓名
| patIdNo | string | 身份證字號
| planMoney | string | 方案價錢
| expireDate | timestamp | 繳款到期日
| paymentTime | timestamp | 繳款日期
| totalMoney | int | 總額
| paymentKind | String | A: 超商代碼, B: 超商條碼 |
| paymentKindName | String | 
| orderStatus | int | 後端處理綠界訂單狀態: 訂單建立(0)/訂單成立(1)/付款成功(2)/取消(3)/應收金額錯誤(4)/付款失敗(5)
| payStatus | int | 繳費狀態: 未設定(0) 逾期未繳(1) 尚未繳款(2) 已繳款(3)
| useStatus | int | 是否啟訂單狀態: 未完成(0) 已取消(1) 未開始(2) 使用中(3) 已過期(4)
| startTime | timestamp | 方案起始日
| endTime | timestamp | 方案到期日


```json
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "1e10b534-762a-40e8-a0e3-96a092b98b01",
                "orderNo": "2103040005",
                "orderTime": 1614828292135,
                "chargePlanInfoId": "c8505874-1570-4dea-9457-b01fc5527964",
                "periodTime": 6,
                "unit": 1,
                "planName": "孝親",
                "planMonths": 6,
                "patName": "測試員",
                "patIdNo": "N177039593",
                "planMoney": 1000,
                "expireDate": 1615564795000,
                "paymentTime": 1614828324000,
                "totalMoney": 1000,
                "paymentKind": "A",
                "paymentKindName": "超商代碼",
                "chargePlanType": "G",
                "startTime": 1614828325060,
                "endTime": 1630725925060,
                "paymentNo": "LLL21063335921",
                "paymentTypeChargeFee": 30,
                "orderStatus": "2",
                "areaCode": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc",
                "payStatus": 3,
                "useStatus": 3,
                "paid": false
            }
        ]
    }
}
```

## 刪除訂單

```url=
POST /order/delete
```

Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| casePatChargePlanInfoId | string | * | | 訂單Id |

```javascript
{
    "casePatChargePlanInfoId": "67855f9f-ff55-4812-abbb-8bd260c141fd"
}
```

Response
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| casePatChargePlanId | String | 訂單Id 

```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "casePatChargePlanId": "67855f9f-ff55-4812-abbb-8bd260c141fd"
        }
    }
}
```

## 繳款通知
```url=
POST /order/notification
```

Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| casePatChargePlanInfoId | string | * | | 訂單Id |

```javascript
{
    "casePatChargePlanInfoId": "67855f9f-ff55-4812-abbb-8bd260c141fd"
}
```

Response
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| casePatChargePlanId | String | 訂單Id 
| isSuccess | bool | 是否成功

```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "casePatChargePlanId": "c1943eb6-97b2-4ff9-b167-ce1e72e2972d",
            "isSuccess": "true"
        }
    }
}
```

# 綠界呼叫API

請參考 ==綠界科技全方位金流非信用卡介接技術文件 v5.2.5== 文件

/order/ecpay/orderResult
/order/ecpay/paidResult

