Skip to content

Commit 5890bab

Browse files
marsenclaude
andcommitted
新增 Pickup Service Mock API 資料
包含完整的測試回應資料,支援各種狀態和異常情況測試。 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 44229dc commit 5890bab

File tree

9 files changed

+310
-0
lines changed

9 files changed

+310
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Pickup Service Mock API
2+
3+
這個資料夾包含了 Pickup Service 的模擬 API 回應資料,用於測試和開發目的。
4+
5+
## 資料夾結構
6+
7+
```
8+
pickup-service/
9+
├── README.md # 說明文件 (本文件)
10+
└── api/ # API 回應檔案
11+
├── done.json # 完成狀態回應
12+
├── shipping.json # 運送中狀態回應
13+
├── fail.json # 失敗狀態回應
14+
├── expiry.json # 過期狀態回應
15+
├── arrived.json # 已到達狀態回應
16+
├── error.json # 錯誤結果回應
17+
├── content-error.json # 內容錯誤回應
18+
└── exception.txt # 異常回應 (純文本)
19+
```
20+
21+
## API 端點說明
22+
23+
### 正常狀態回應
24+
25+
| 檔案 | 狀態 | 說明 | 對應測試案例 |
26+
|------|------|------|-------------|
27+
| `done.json` | DONE | 配送完成 | Case1_Query_Done_waybillNo |
28+
| `shipping.json` | Shipping | 運送中 | Case2_Query_Shipping_waybillNo |
29+
| `fail.json` | FAIL | 配送失敗 | Case3_Query_FAIL_waybillNo |
30+
| `expiry.json` | Expiry | 運單過期 | Case4_Query_Expiry_waybillNo |
31+
| `arrived.json` | Arrived | 已到達取貨點 | Case5_Query_Arrived_waybillNo |
32+
33+
### 異常狀態回應
34+
35+
| 檔案 | 說明 | 對應測試案例 |
36+
|------|------|-------------|
37+
| `error.json` | 結果錯誤 (result: "error") | Case6_Query_Error_Result |
38+
| `content-error.json` | 內容為空 (content: []) | Case7_Query_Error_Content |
39+
| `exception.txt` | 系統異常 (純文本回應) | Case8_Query_Exception |
40+
41+
## 使用方式
42+
43+
### 在 Hexo 中使用
44+
45+
1. 將此 `pickup-service` 資料夾放置於 Hexo 專案的 `source` 目錄下
46+
2. Hexo 會自動將 `api/` 目錄下的檔案作為靜態資源提供服務
47+
3. 可透過以下 URL 存取各種測試回應:
48+
49+
```
50+
http://your-domain.com/pickup-service/api/done.json
51+
http://your-domain.com/pickup-service/api/shipping.json
52+
http://your-domain.com/pickup-service/api/fail.json
53+
http://your-domain.com/pickup-service/api/expiry.json
54+
http://your-domain.com/pickup-service/api/arrived.json
55+
http://your-domain.com/pickup-service/api/error.json
56+
http://your-domain.com/pickup-service/api/content-error.json
57+
http://your-domain.com/pickup-service/api/exception.txt
58+
```
59+
60+
### 在測試中使用
61+
62+
可以直接將這些 URL 用作 mock 服務端點,對應到原本的測試案例:
63+
64+
```csharp
65+
// 原本的測試常數
66+
private const string MockDone = "http://your-domain.com/pickup-service/api/done.json";
67+
private const string MockShipping = "http://your-domain.com/pickup-service/api/shipping.json";
68+
private const string MockFail = "http://your-domain.com/pickup-service/api/fail.json";
69+
private const string MockExpiry = "http://your-domain.com/pickup-service/api/expiry.json";
70+
private const string MockArrived = "http://your-domain.com/pickup-service/api/arrived.json";
71+
private const string MockResultError = "http://your-domain.com/pickup-service/api/error.json";
72+
private const string MockContentError = "http://your-domain.com/pickup-service/api/content-error.json";
73+
private const string MockException = "http://your-domain.com/pickup-service/api/exception.txt";
74+
```
75+
76+
## JSON 回應格式
77+
78+
### 成功回應格式
79+
80+
```json
81+
{
82+
"result": "success",
83+
"content": [
84+
{
85+
"merchantId": "123",
86+
"merchantRef": "ABC123",
87+
"waybillNo": "W123456",
88+
"locationId": "456",
89+
"pudoRef": "PUDO789",
90+
"pudoVerifyCode": "1234",
91+
"senderId": "Sender123",
92+
"consigneeId": "Consignee456",
93+
"customerName": "John Doe",
94+
"customerAddress1": "123 Main St",
95+
"customerAddress2": "Apt 456",
96+
"customerAddress3": "Suburb",
97+
"customerAddress4": "City",
98+
"feedbackURL": "https://example.com/feedback",
99+
"eta": "2023-01-01",
100+
"codAmt": "50.00",
101+
"sizeCode": "L",
102+
"lastStatusId": "DONE", // 根據不同檔案會有不同的狀態值
103+
"lastStatusDescription": "Delivered to Customer",
104+
"lastStatusDate": "2023-01-01",
105+
"lastStatusTime": "12:34:56",
106+
"customerMobile": "1234567890",
107+
"customerEmail": "[email protected]",
108+
"errorCode": null
109+
}
110+
]
111+
}
112+
```
113+
114+
### 錯誤回應格式
115+
116+
```json
117+
{
118+
"result": "error",
119+
"content": []
120+
}
121+
```
122+
123+
## 狀態值對應表
124+
125+
| lastStatusId | 對應 C# enum | 說明 |
126+
|-------------|-------------|------|
127+
| DONE | Status.Finish | 配送完成 |
128+
| Shipping | Status.Processing | 處理中/運送中 |
129+
| FAIL | Status.Abnormal | 異常狀態 |
130+
| Expiry | Status.Abnormal | 異常狀態 |
131+
| Arrived | Status.Arrived | 已到達 |
132+
133+
## 注意事項
134+
135+
- 所有 JSON 檔案都使用 UTF-8 編碼
136+
- `exception.txt` 是純文本檔案,模擬系統異常時的非 JSON 回應
137+
- 測試資料中的個人資料都是範例資料,非真實資料
138+
- 時間格式採用 ISO 日期格式 (YYYY-MM-DD) 和 24 小時制時間格式 (HH:mm:ss)
139+
140+
## 維護說明
141+
142+
如需修改測試資料,請直接編輯對應的 JSON 檔案。修改後重新部署 Hexo 即可生效。
143+
144+
---
145+
146+
*此資料夾是基於 Marsen.NetCore.Dojo 專案中的 PickupService 測試案例建立*
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"result": "success",
3+
"content": [
4+
{
5+
"merchantId": "123",
6+
"merchantRef": "ABC123",
7+
"waybillNo": "W123456",
8+
"locationId": "456",
9+
"pudoRef": "PUDO789",
10+
"pudoVerifyCode": "1234",
11+
"senderId": "Sender123",
12+
"consigneeId": "Consignee456",
13+
"customerName": "John Doe",
14+
"customerAddress1": "123 Main St",
15+
"customerAddress2": "Apt 456",
16+
"customerAddress3": "Suburb",
17+
"customerAddress4": "City",
18+
"feedbackURL": "https://example.com/feedback",
19+
"eta": "2023-01-01",
20+
"codAmt": "50.00",
21+
"sizeCode": "L",
22+
"lastStatusId": "Arrived",
23+
"lastStatusDescription": "Delivered to Customer",
24+
"lastStatusDate": "2023-01-01",
25+
"lastStatusTime": "12:34:56",
26+
"customerMobile": "1234567890",
27+
"customerEmail": "[email protected]",
28+
"errorCode": null
29+
}
30+
]
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"result": "success",
3+
"content": []
4+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"result": "success",
3+
"content": [
4+
{
5+
"merchantId": "123",
6+
"merchantRef": "ABC123",
7+
"waybillNo": "W123456",
8+
"locationId": "456",
9+
"pudoRef": "PUDO789",
10+
"pudoVerifyCode": "1234",
11+
"senderId": "Sender123",
12+
"consigneeId": "Consignee456",
13+
"customerName": "John Doe",
14+
"customerAddress1": "123 Main St",
15+
"customerAddress2": "Apt 456",
16+
"customerAddress3": "Suburb",
17+
"customerAddress4": "City",
18+
"feedbackURL": "https://example.com/feedback",
19+
"eta": "2023-01-01",
20+
"codAmt": "50.00",
21+
"sizeCode": "L",
22+
"lastStatusId": "DONE",
23+
"lastStatusDescription": "Delivered to Customer",
24+
"lastStatusDate": "2023-01-01",
25+
"lastStatusTime": "12:34:56",
26+
"customerMobile": "1234567890",
27+
"customerEmail": "[email protected]",
28+
"errorCode": null
29+
}
30+
]
31+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"result": "error",
3+
"content": []
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Something Wrong
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"result": "success",
3+
"content": [
4+
{
5+
"merchantId": "123",
6+
"merchantRef": "ABC123",
7+
"waybillNo": "W123456",
8+
"locationId": "456",
9+
"pudoRef": "PUDO789",
10+
"pudoVerifyCode": "1234",
11+
"senderId": "Sender123",
12+
"consigneeId": "Consignee456",
13+
"customerName": "John Doe",
14+
"customerAddress1": "123 Main St",
15+
"customerAddress2": "Apt 456",
16+
"customerAddress3": "Suburb",
17+
"customerAddress4": "City",
18+
"feedbackURL": "https://example.com/feedback",
19+
"eta": "2023-01-01",
20+
"codAmt": "50.00",
21+
"sizeCode": "L",
22+
"lastStatusId": "Expiry",
23+
"lastStatusDescription": "Delivered to Customer",
24+
"lastStatusDate": "2023-01-01",
25+
"lastStatusTime": "12:34:56",
26+
"customerMobile": "1234567890",
27+
"customerEmail": "[email protected]",
28+
"errorCode": null
29+
}
30+
]
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"result": "success",
3+
"content": [
4+
{
5+
"merchantId": "123",
6+
"merchantRef": "ABC123",
7+
"waybillNo": "W123456",
8+
"locationId": "456",
9+
"pudoRef": "PUDO789",
10+
"pudoVerifyCode": "1234",
11+
"senderId": "Sender123",
12+
"consigneeId": "Consignee456",
13+
"customerName": "John Doe",
14+
"customerAddress1": "123 Main St",
15+
"customerAddress2": "Apt 456",
16+
"customerAddress3": "Suburb",
17+
"customerAddress4": "City",
18+
"feedbackURL": "https://example.com/feedback",
19+
"eta": "2023-01-01",
20+
"codAmt": "50.00",
21+
"sizeCode": "L",
22+
"lastStatusId": "FAIL",
23+
"lastStatusDescription": "Delivered to Customer",
24+
"lastStatusDate": "2023-01-01",
25+
"lastStatusTime": "12:34:56",
26+
"customerMobile": "1234567890",
27+
"customerEmail": "[email protected]",
28+
"errorCode": null
29+
}
30+
]
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"result": "success",
3+
"content": [
4+
{
5+
"merchantId": "123",
6+
"merchantRef": "ABC123",
7+
"waybillNo": "W123456",
8+
"locationId": "456",
9+
"pudoRef": "PUDO789",
10+
"pudoVerifyCode": "1234",
11+
"senderId": "Sender123",
12+
"consigneeId": "Consignee456",
13+
"customerName": "John Doe",
14+
"customerAddress1": "123 Main St",
15+
"customerAddress2": "Apt 456",
16+
"customerAddress3": "Suburb",
17+
"customerAddress4": "City",
18+
"feedbackURL": "https://example.com/feedback",
19+
"eta": "2023-01-01",
20+
"codAmt": "50.00",
21+
"sizeCode": "L",
22+
"lastStatusId": "Shipping",
23+
"lastStatusDescription": "Delivered to Customer",
24+
"lastStatusDate": "2023-01-01",
25+
"lastStatusTime": "12:34:56",
26+
"customerMobile": "1234567890",
27+
"customerEmail": "[email protected]",
28+
"errorCode": null
29+
}
30+
]
31+
}

0 commit comments

Comments
 (0)