@alipay/alipay-aipay 1.2.2 → 1.5.0
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 +5 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +13 -12
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +17 -9
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +5 -5
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts +5 -3
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +34 -12
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/file.d.ts +8 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +161 -9
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/jq.d.ts.map +1 -1
- package/dist/utils/jq.js +8 -0
- package/dist/utils/jq.js.map +1 -1
- package/package.json +9 -5
- package/skill/SKILL.md +15 -169
- package/skill/VERSION +1 -1
- package/skill/references/integration/flow.md +388 -291
- package/skill/references/integration/modules/alipay-sdk-reminder.md +5 -3
- package/skill/references/integration/modules/checklist.md +54 -32
- package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +199 -0
- package/skill/references/integration/modules/code-examples/csharp/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +8 -4
- package/skill/references/integration/modules/code-examples/csharp/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +6 -2
- package/skill/references/integration/modules/code-examples/csharp/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.cs +3 -1
- package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +184 -0
- package/skill/references/integration/modules/code-examples/java/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +4 -1
- package/skill/references/integration/modules/code-examples/java/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +5 -2
- package/skill/references/integration/modules/code-examples/java/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemoController.java +3 -1
- package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +135 -0
- package/skill/references/integration/modules/code-examples/nodejs/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +16 -10
- package/skill/references/integration/modules/code-examples/nodejs/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +10 -4
- package/skill/references/integration/modules/code-examples/nodejs/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.js +2 -1
- package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +157 -0
- package/skill/references/integration/modules/code-examples/php/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +4 -1
- package/skill/references/integration/modules/code-examples/php/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +5 -2
- package/skill/references/integration/modules/code-examples/php/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.php +2 -1
- package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//345/274/202/346/255/245/351/200/232/347/237/245/345/244/204/347/220/206/344/273/243/347/240/201/347/244/272/344/276/213.md +128 -0
- package/skill/references/integration/modules/code-examples/python/2-/347/275/221/347/253/231/346/224/257/344/273/230//347/273/237/344/270/200/346/224/266/345/215/225/344/270/213/345/215/225/345/271/266/346/224/257/344/273/230/351/241/265/351/235/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +4 -1
- package/skill/references/integration/modules/code-examples/python/3-APP/346/224/257/344/273/230/APP/346/224/257/344/273/230/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +5 -1
- package/skill/references/integration/modules/code-examples/python/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.py +4 -2
- package/skill/references/integration/modules/interface-contract/aipay-interface-contract.md +52 -0
- package/skill/references/integration/modules/interface-contract/apppay-interface-contract.md +45 -0
- package/skill/references/integration/modules/interface-contract/common-trade-contract.md +42 -0
- package/skill/references/integration/modules/interface-contract/notify-url-contract.md +68 -0
- package/skill/references/integration/modules/interface-contract/webpay-interface-contract.md +44 -0
- package/skill/references/integration/modules/interface-guide.md +38 -71
- package/skill/references/integration/modules/product-decision.md +18 -35
- package/skill/references/integration/modules/sandbox/a2m-sandbox-test.md +62 -94
- package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +43 -40
- package/skill/references/integration/modules/sandbox/sandbox-setup-guide.md +93 -114
- package/skill/references/integration/modules/scripts/local_402_sandbox_pay.py +358 -148
- package/skill/references/integration/modules/scripts/sandbox_config.sh +299 -0
- package/skill/references/integration/modules/troubleshooting-flow.md +28 -0
- package/skill/references/normal/alipay-cli-env.md +15 -5
- package/skill/references/normal/full-process-routing.md +82 -0
- package/skill/references/normal/json/customer-messages.json +942 -0
- package/skill/references/normal/json/policy-rules.json +179 -0
- package/skill/references/normal/rejection-guide.md +12 -7
- package/skill/references/normal/scripts/alipay_cli_env.mjs +33 -0
- package/skill/references/normal/scripts/alipay_cli_env.sh +55 -0
- package/skill/references/normal/scripts/common.sh +151 -0
- package/skill/references/normal/scripts/detect_dev_tool.sh +5 -1
- package/skill/references/normal/scripts/flow_loader.mjs +241 -0
- package/skill/references/normal/scripts/integration_context_runner.mjs +166 -0
- package/skill/references/normal/scripts/integration_message_runner.mjs +1023 -0
- package/skill/references/normal/scripts/interaction_reply.mjs +133 -0
- package/skill/references/normal/scripts/onboarding_discovery_runner.mjs +224 -0
- package/skill/references/normal/scripts/onboarding_message_runner.mjs +451 -0
- package/skill/references/normal/scripts/onboarding_recovery_runner.mjs +96 -0
- package/skill/references/normal/scripts/open_official_url.sh +82 -0
- package/skill/references/normal/scripts/platform_compat.mjs +39 -0
- package/skill/references/normal/scripts/project_route_inspector.sh +132 -0
- package/skill/references/normal/scripts/python_script_runner.mjs +56 -0
- package/skill/references/normal/scripts/render_customer_message.mjs +1288 -0
- package/skill/references/normal/scripts/self_update.mjs +160 -0
- package/skill/references/normal/scripts/telemetry.mjs +1327 -0
- package/skill/references/normal/self-update.md +18 -51
- package/skill/references/normal/telemetry.md +26 -0
- package/skill/references/onboarding/flow.md +421 -309
- package/skill/references/onboarding/modules/app-release.md +44 -438
- package/skill/references/onboarding/modules/authorization.md +25 -281
- package/skill/references/onboarding/modules/error-handling.md +31 -237
- package/skill/references/onboarding/modules/product-sign.md +25 -294
- package/skill/references/onboarding/modules/scripts/app.sh +445 -169
- package/skill/references/onboarding/modules/scripts/ar_sign_apply.sh +47 -28
- package/skill/references/onboarding/modules/scripts/auth.sh +484 -167
- package/skill/references/onboarding/modules/scripts/download_key_tool.sh +157 -0
- package/skill/references/onboarding/modules/scripts/error_handler.sh +101 -130
- package/skill/references/onboarding/modules/scripts/network_retry.sh +96 -0
- package/skill/references/onboarding/modules/scripts/query_sign_status.sh +20 -71
- package/skill/references/onboarding/modules/scripts/service.sh +154 -89
- package/skill/references/onboarding/modules/scripts/sign_status_parser.sh +58 -0
- package/skill/references/onboarding/modules/scripts/upload_screenshots.sh +34 -20
- package/skill/references/onboarding/modules/service-registration.md +20 -317
- package/skill/references/runtime-entry.md +63 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#=============================================================================
|
|
3
3
|
# 脚本名称: ar_sign_apply.sh
|
|
4
|
-
# 功能描述:
|
|
4
|
+
# 功能描述: 提交产品签约申请,支持AI 按量付费、AI 网页应用收款、AI 移动应用收款三种模式
|
|
5
5
|
# 调用位置: Step 5.1 产品签约
|
|
6
|
-
# 调用前置: 脚本通过 error_handler.sh 间接初始化 DEV_TOOL_NAME;需传入 --sales-code 和 --mcc-code,或兼容使用同名环境变量
|
|
6
|
+
# 调用前置: 脚本通过 error_handler.sh 间接初始化 DEV_TOOL_NAME/PLATFORM_ID;需传入 --sales-code 和 --mcc-code,或兼容使用同名环境变量
|
|
7
7
|
# 用法:
|
|
8
|
-
# 按量付费: bash ar_sign_apply.sh --product aipay --sales-code <code> --mcc-code <code>
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# AI 按量付费: bash ar_sign_apply.sh --product aipay --sales-code <code> --mcc-code <code>
|
|
9
|
+
# AI 网页应用收款: bash ar_sign_apply.sh --product webpay --sales-code <code> --mcc-code <code> --picurl1 <imageRef1> --picurl2 <imageRef2> --picurl3 <imageRef3>
|
|
10
|
+
# AI 移动应用收款: bash ar_sign_apply.sh --product apppay --sales-code <code> --mcc-code <code> --app-name <name> --picurl1 <imageRef1> --picurl2 <imageRef2> --picurl3 <imageRef3>
|
|
11
11
|
# 返回值:
|
|
12
12
|
# 成功: FLOW:AI_PAY_SIGN_CONTINUE | FLOW:PC_WEB_SIGN_CONTINUE | FLOW:APP_SIGN_CONTINUE
|
|
13
13
|
# 失败: exit 1(由 handle_error 输出详细错误信息)
|
|
@@ -22,9 +22,11 @@ else
|
|
|
22
22
|
echo "❌ 缺少错误处理脚本: ${SCRIPT_DIR}/error_handler.sh"
|
|
23
23
|
exit 1
|
|
24
24
|
fi
|
|
25
|
+
source "${SCRIPT_DIR}/network_retry.sh"
|
|
25
26
|
|
|
26
27
|
require_command jq || exit 1
|
|
27
28
|
require_command alipay-cli || exit 1
|
|
29
|
+
|
|
28
30
|
if ! command -v python3 >/dev/null 2>&1 && ! command -v uuidgen >/dev/null 2>&1; then
|
|
29
31
|
echo "❌ 缺少依赖命令: python3 或 uuidgen"
|
|
30
32
|
exit 1
|
|
@@ -101,6 +103,9 @@ if [ -n "$PRODUCT_TYPE" ] && [ "$PRODUCT_TYPE" != "$EXPECTED_PRODUCT_TYPE" ]; th
|
|
|
101
103
|
exit 1
|
|
102
104
|
fi
|
|
103
105
|
|
|
106
|
+
PRODUCT_TYPE="${PRODUCT_TYPE:-$EXPECTED_PRODUCT_TYPE}"
|
|
107
|
+
init_alipay_cli_product "$PRODUCT_TYPE" || exit 1
|
|
108
|
+
|
|
104
109
|
if [ -z "$BIZ_REQUEST_NO" ]; then
|
|
105
110
|
echo "❌ 无法生成 bizRequestNo"
|
|
106
111
|
exit 1
|
|
@@ -108,7 +113,7 @@ fi
|
|
|
108
113
|
|
|
109
114
|
# 场景判断(精确比较而非子串匹配)
|
|
110
115
|
if [ "$SALES_CODE" = "I1080300001000160457" ]; then
|
|
111
|
-
# ============ 按量付费签约 JSON(无截图) ============
|
|
116
|
+
# ============ AI 按量付费签约 JSON(无截图) ============
|
|
112
117
|
REQUEST_JSON=$(jq -n \
|
|
113
118
|
--arg bizRequestNo "$BIZ_REQUEST_NO" \
|
|
114
119
|
--arg mccCode "$MCC_CODE" \
|
|
@@ -128,13 +133,10 @@ if [ "$SALES_CODE" = "I1080300001000160457" ]; then
|
|
|
128
133
|
ctx: {}
|
|
129
134
|
}')
|
|
130
135
|
|
|
131
|
-
RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
|
|
132
|
-
-d "$REQUEST_JSON" --json 2>/dev/null)
|
|
133
|
-
|
|
134
136
|
elif [ "$SALES_CODE" = "I1080300001000041203" ]; then
|
|
135
|
-
# ============
|
|
137
|
+
# ============ AI 网页应用收款签约 JSON(有截图) ============
|
|
136
138
|
if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
|
|
137
|
-
echo "❌
|
|
139
|
+
echo "❌ AI 网页应用收款需要 3 个上传后的图片引用值"
|
|
138
140
|
exit 1
|
|
139
141
|
fi
|
|
140
142
|
|
|
@@ -166,17 +168,14 @@ elif [ "$SALES_CODE" = "I1080300001000041203" ]; then
|
|
|
166
168
|
ctx: {}
|
|
167
169
|
}')
|
|
168
170
|
|
|
169
|
-
RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
|
|
170
|
-
-d "$REQUEST_JSON" --json 2>/dev/null)
|
|
171
|
-
|
|
172
171
|
elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
|
|
173
|
-
# ============
|
|
172
|
+
# ============ AI 移动应用收款签约 JSON(有 APP 名称和截图) ============
|
|
174
173
|
if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
|
|
175
|
-
echo "❌
|
|
174
|
+
echo "❌ AI 移动应用收款需要 3 个上传后的图片引用值"
|
|
176
175
|
exit 1
|
|
177
176
|
fi
|
|
178
177
|
if [ -z "$APP_NAME" ]; then
|
|
179
|
-
echo "❌
|
|
178
|
+
echo "❌ AI 移动应用收款需要 --app-name"
|
|
180
179
|
exit 1
|
|
181
180
|
fi
|
|
182
181
|
|
|
@@ -209,14 +208,33 @@ elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
|
|
|
209
208
|
ctx: {}
|
|
210
209
|
}')
|
|
211
210
|
|
|
212
|
-
RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
|
|
213
|
-
-d "$REQUEST_JSON" --json 2>/dev/null)
|
|
214
|
-
|
|
215
211
|
else
|
|
216
212
|
echo "❌ 未知 SALES_CODE: $SALES_CODE"
|
|
217
213
|
exit 1
|
|
218
214
|
fi
|
|
219
215
|
|
|
216
|
+
export PLATFORM="${DEV_TOOL_NAME}" PLATFORM_ID="${PLATFORM_ID:-}"
|
|
217
|
+
run_network_retry RESULT write sign_apply -- alipay-cli mcp call ar-sign.apply \
|
|
218
|
+
-d "$REQUEST_JSON" --json
|
|
219
|
+
RETRY_RC=$?
|
|
220
|
+
if [ "$RETRY_RC" -eq 75 ]; then
|
|
221
|
+
RECONCILE_OUTPUT=$(bash "${SCRIPT_DIR}/query_sign_status.sh" --sales-code "$SALES_CODE" --product-type "$PRODUCT_TYPE" 2>&1 || true)
|
|
222
|
+
RECONCILED_STATUS=$(printf '%s\n' "$RECONCILE_OUTPUT" | sed -n 's/^ALIPAY_AIPAY_INTERNAL:SIGN_STATUS=//p' | tail -1)
|
|
223
|
+
if [ "$RECONCILED_STATUS" = "SIGN_SUBMITTED" ] || [ "$RECONCILED_STATUS" = "SIGNED_EFFECTIVE" ]; then
|
|
224
|
+
case "$PRODUCT_TYPE" in
|
|
225
|
+
aipay) emit_control "FLOW:AI_PAY_SIGN_CONTINUE" ;;
|
|
226
|
+
webpay) emit_control "FLOW:PC_WEB_SIGN_CONTINUE" ;;
|
|
227
|
+
apppay) emit_control "FLOW:APP_SIGN_CONTINUE" ;;
|
|
228
|
+
esac
|
|
229
|
+
exit 0
|
|
230
|
+
fi
|
|
231
|
+
echo "❌ 签约提交响应不明且现有查询无法排除传播延迟,结果标记为 UNKNOWN,禁止自动重复提交"
|
|
232
|
+
exit 1
|
|
233
|
+
elif [ "$RETRY_RC" -ne 0 ]; then
|
|
234
|
+
echo "❌ 签约提交因明确未发送的网络异常在自动重试两次后仍未恢复"
|
|
235
|
+
exit 1
|
|
236
|
+
fi
|
|
237
|
+
|
|
220
238
|
# 错误检测(先于业务解析,handle_error 内部会自动解包信封)
|
|
221
239
|
if ! handle_error "$RESULT"; then
|
|
222
240
|
exit 1
|
|
@@ -227,22 +245,23 @@ BUSINESS=$(unwrap_mcp "$RESULT")
|
|
|
227
245
|
SUCCESS=$(echo "$BUSINESS" | jq -r '.success // false')
|
|
228
246
|
|
|
229
247
|
if [ "$SUCCESS" = "true" ]; then
|
|
230
|
-
|
|
231
|
-
|
|
248
|
+
emit_control "✅ 签约提交成功"
|
|
249
|
+
emit_control "SIGN_APPLY_STATUS=SUBMITTED"
|
|
232
250
|
# 签约提交成功后无需等待审核,立即推进后续步骤
|
|
233
|
-
# 按量付费: 继续 5.2 服务注册 → 5.3 应用发布
|
|
234
|
-
#
|
|
251
|
+
# AI 按量付费: 继续 5.2 服务注册 → 5.3 应用发布
|
|
252
|
+
# AI 网页应用收款/AI 移动应用收款: 继续 5.3 应用发布
|
|
235
253
|
if [ "$SALES_CODE" = "I1080300001000160457" ]; then
|
|
236
|
-
|
|
254
|
+
emit_control "FLOW:AI_PAY_SIGN_CONTINUE"
|
|
237
255
|
elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
|
|
238
|
-
|
|
256
|
+
emit_control "FLOW:APP_SIGN_CONTINUE"
|
|
239
257
|
else
|
|
240
|
-
|
|
258
|
+
emit_control "FLOW:PC_WEB_SIGN_CONTINUE"
|
|
241
259
|
fi
|
|
242
260
|
else
|
|
243
261
|
# handle_error 已处理 ERROR/CLI_ERROR 路径并透出详细错误信息
|
|
244
|
-
# 此处为防御性兜底:handle_error 返回成功但 success
|
|
262
|
+
# 此处为防御性兜底:handle_error 返回成功但 success 非 true 的极端场景
|
|
245
263
|
ERROR_MSG=$(echo "$BUSINESS" | jq -r '.error.message // .errorMessage // "未知错误"')
|
|
264
|
+
ERROR_MSG=$(sanitize_customer_error_text "$ERROR_MSG")
|
|
246
265
|
echo "❌ 签约提交失败: $ERROR_MSG"
|
|
247
266
|
exit 1
|
|
248
267
|
fi
|