@itpay/cli 2.1.22 → 2.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/client/backend.js +4 -1
- package/dist/src/client/http.js +2 -0
- package/dist/src/commands/buy.js +6 -4
- package/dist/src/commands/cart.js +15 -15
- package/dist/src/commands/catalog.js +10 -8
- package/dist/src/commands/checkout.js +9 -11
- package/dist/src/commands/checkout_handoff.js +7 -4
- package/dist/src/commands/docs.js +3 -14
- package/dist/src/commands/guidance.js +43 -25
- package/dist/src/commands/install.js +2 -2
- package/dist/src/commands/order.js +4 -3
- package/dist/src/commands/orders.js +4 -9
- package/dist/src/commands/pay.js +1 -1
- package/dist/src/commands/refund.js +5 -5
- package/dist/src/commands/services.js +628 -390
- package/dist/src/commands/vault.js +27 -20
- package/dist/src/main.js +35 -24
- package/dist/src/render/qr.js +1 -1
- package/dist/src/state/account_auth.js +9 -6
- package/dist/src/state/config.js +4 -4
- package/dist/src/state/device_authority.js +2 -2
- package/docs/agent/buyer/cart-checkout.json +1 -1
- package/docs/agent/buyer/catalog-list.json +1 -1
- package/docs/agent/buyer/identity-and-sessions.json +3 -7
- package/docs/agent/buyer/orders-refunds.json +8 -1
- package/docs/agent/buyer/payment-flow.json +1 -0
- package/docs/agent/buyer/purchased-content.json +1 -1
- package/docs/agent/buyer/quickstart.json +6 -5
- package/docs/agent/buyer/rail-booking.json +96 -51
- package/docs/agent/buyer/rail-fast-checkout.json +6 -3
- package/docs/agent/buyer/render-hosts.json +1 -1
- package/docs/cli-reference/commands/device.md +4 -5
- package/docs/cli-reference/commands/services/invoke.md +2 -2
- package/docs/cli-reference/commands/services/read-result.md +12 -5
- package/docs/cli-reference/commands/services/run.md +2 -0
- package/package.json +5 -1
- package/skills/itpay/SKILL.md +25 -16
|
@@ -12,11 +12,11 @@ export async function runRefund(backend, config, options) {
|
|
|
12
12
|
plainResult: Object.entries(envelope.result).map(([key, value]) => `${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function refundStateEnvelope(refund, status) {
|
|
15
|
+
export function refundStateEnvelope(refund, status) {
|
|
16
16
|
const terminal = ["succeeded", "failed", "cancelled", "rejected"].includes(refund.status);
|
|
17
17
|
let instruction = refund.decision_mode === "manual"
|
|
18
18
|
? "先告诉用户退款已进入人工审核,原交付保持冻结;人工审核不等于拒绝,等待服务器决定,不要重复申请或承诺结果。"
|
|
19
|
-
: "先告诉用户退款申请已经记录,原交付已冻结;自动路径表示系统会继续处理,但只有最终 succeeded
|
|
19
|
+
: "先告诉用户退款申请已经记录,原交付已冻结;自动路径表示系统会继续处理,但只有最终 succeeded 才能确认退款成功。然后只跟踪同一退款,不读取交付、不创建授权或重复申请。";
|
|
20
20
|
if (!refund.access_locked)
|
|
21
21
|
instruction = "先告诉用户退款当前没有锁定交付;按服务器事实解释当前状态,不要自行推断退款结果、到账时间或交付资格。";
|
|
22
22
|
if (refund.status === "succeeded")
|
|
@@ -73,7 +73,7 @@ export async function runListRefunds(backend, options) {
|
|
|
73
73
|
: "该订单没有退款记录;确认用户确实要求退款后再创建。",
|
|
74
74
|
next: selected
|
|
75
75
|
? { command: `itpay refund get ${selected.refund_request_id} --json`, reason: active ? "读取活跃退款" : "读取最新退款" }
|
|
76
|
-
:
|
|
76
|
+
: null,
|
|
77
77
|
recovery: [],
|
|
78
78
|
};
|
|
79
79
|
writeCommandEnvelope(envelope, {
|
|
@@ -96,13 +96,13 @@ export async function runGetRefund(backend, refundID, options = {}) {
|
|
|
96
96
|
export async function runCancelRefund(backend, refundID, reason, options = {}) {
|
|
97
97
|
const refund = await backend.cancelRefund(refundID, reason?.trim() || "buyer_cancelled");
|
|
98
98
|
const envelope = {
|
|
99
|
-
status:
|
|
99
|
+
status: refund.status,
|
|
100
100
|
result: {
|
|
101
101
|
refund_request_id: refund.refund_request_id,
|
|
102
102
|
order_id: refund.order_id,
|
|
103
103
|
access_locked: refund.access_locked,
|
|
104
104
|
},
|
|
105
|
-
instruction: "
|
|
105
|
+
instruction: refund.status === "cancelled" ? "Backend确认退款已取消;如需交付,重新进入原订单核对当前权限,旧grant不自动复活;后端要求时取得新的授权。" : "Backend未确认取消;按返回的退款权威状态核对原订单,不重复提交取消。",
|
|
106
106
|
next: { command: `itpay order ${refund.order_id} --json`, reason: "确认订单访问状态" },
|
|
107
107
|
recovery: [],
|
|
108
108
|
};
|