@alipay/alipay-aipay 1.2.2 → 1.4.9

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.
Files changed (98) hide show
  1. package/README.md +5 -0
  2. package/dist/commands/install.d.ts.map +1 -1
  3. package/dist/commands/install.js +13 -12
  4. package/dist/commands/install.js.map +1 -1
  5. package/dist/commands/uninstall.d.ts.map +1 -1
  6. package/dist/commands/uninstall.js +17 -9
  7. package/dist/commands/uninstall.js.map +1 -1
  8. package/dist/commands/update.d.ts.map +1 -1
  9. package/dist/commands/update.js +5 -5
  10. package/dist/commands/update.js.map +1 -1
  11. package/dist/index.js +4 -4
  12. package/dist/index.js.map +1 -1
  13. package/dist/utils/config.d.ts +5 -3
  14. package/dist/utils/config.d.ts.map +1 -1
  15. package/dist/utils/config.js +34 -12
  16. package/dist/utils/config.js.map +1 -1
  17. package/dist/utils/file.d.ts +8 -0
  18. package/dist/utils/file.d.ts.map +1 -1
  19. package/dist/utils/file.js +161 -9
  20. package/dist/utils/file.js.map +1 -1
  21. package/dist/utils/jq.d.ts.map +1 -1
  22. package/dist/utils/jq.js +8 -0
  23. package/dist/utils/jq.js.map +1 -1
  24. package/package.json +6 -5
  25. package/skill/SKILL.md +15 -169
  26. package/skill/VERSION +1 -1
  27. package/skill/references/integration/flow.md +321 -292
  28. package/skill/references/integration/modules/alipay-sdk-reminder.md +5 -3
  29. package/skill/references/integration/modules/checklist.md +41 -27
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. package/skill/references/integration/modules/interface-contract/aipay-interface-contract.md +53 -0
  51. package/skill/references/integration/modules/interface-contract/apppay-interface-contract.md +45 -0
  52. package/skill/references/integration/modules/interface-contract/common-trade-contract.md +42 -0
  53. package/skill/references/integration/modules/interface-contract/notify-url-contract.md +68 -0
  54. package/skill/references/integration/modules/interface-contract/webpay-interface-contract.md +44 -0
  55. package/skill/references/integration/modules/interface-guide.md +37 -72
  56. package/skill/references/integration/modules/product-decision.md +10 -27
  57. package/skill/references/integration/modules/sandbox/a2m-sandbox-test.md +62 -94
  58. package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +43 -40
  59. package/skill/references/integration/modules/sandbox/sandbox-setup-guide.md +93 -114
  60. package/skill/references/integration/modules/scripts/local_402_sandbox_pay.py +357 -147
  61. package/skill/references/integration/modules/scripts/sandbox_config.sh +299 -0
  62. package/skill/references/integration/modules/troubleshooting-flow.md +28 -0
  63. package/skill/references/normal/alipay-cli-env.md +15 -5
  64. package/skill/references/normal/full-process-routing.md +80 -0
  65. package/skill/references/normal/json/customer-messages.json +937 -0
  66. package/skill/references/normal/json/policy-rules.json +179 -0
  67. package/skill/references/normal/rejection-guide.md +11 -6
  68. package/skill/references/normal/scripts/alipay_cli_env.mjs +29 -0
  69. package/skill/references/normal/scripts/alipay_cli_env.sh +21 -0
  70. package/skill/references/normal/scripts/common.sh +87 -0
  71. package/skill/references/normal/scripts/detect_dev_tool.sh +5 -1
  72. package/skill/references/normal/scripts/integration_message_runner.mjs +801 -0
  73. package/skill/references/normal/scripts/onboarding_message_runner.mjs +436 -0
  74. package/skill/references/normal/scripts/open_official_url.sh +82 -0
  75. package/skill/references/normal/scripts/platform_compat.mjs +39 -0
  76. package/skill/references/normal/scripts/project_route_inspector.sh +132 -0
  77. package/skill/references/normal/scripts/python_script_runner.mjs +56 -0
  78. package/skill/references/normal/scripts/render_customer_message.mjs +1263 -0
  79. package/skill/references/normal/scripts/self_update.mjs +160 -0
  80. package/skill/references/normal/scripts/telemetry.mjs +1278 -0
  81. package/skill/references/normal/self-update.md +18 -51
  82. package/skill/references/onboarding/flow.md +381 -283
  83. package/skill/references/onboarding/modules/app-release.md +132 -179
  84. package/skill/references/onboarding/modules/authorization.md +53 -64
  85. package/skill/references/onboarding/modules/error-handling.md +31 -34
  86. package/skill/references/onboarding/modules/product-sign.md +62 -66
  87. package/skill/references/onboarding/modules/scripts/app.sh +397 -158
  88. package/skill/references/onboarding/modules/scripts/ar_sign_apply.sh +38 -22
  89. package/skill/references/onboarding/modules/scripts/auth.sh +479 -167
  90. package/skill/references/onboarding/modules/scripts/download_key_tool.sh +157 -0
  91. package/skill/references/onboarding/modules/scripts/error_handler.sh +100 -130
  92. package/skill/references/onboarding/modules/scripts/network_retry.sh +96 -0
  93. package/skill/references/onboarding/modules/scripts/query_sign_status.sh +17 -70
  94. package/skill/references/onboarding/modules/scripts/service.sh +153 -89
  95. package/skill/references/onboarding/modules/scripts/sign_status_parser.sh +58 -0
  96. package/skill/references/onboarding/modules/scripts/upload_screenshots.sh +16 -14
  97. package/skill/references/onboarding/modules/service-registration.md +67 -72
  98. package/skill/references/runtime-entry.md +62 -0
@@ -1,13 +1,13 @@
1
1
  #!/bin/bash
2
2
  #=============================================================================
3
3
  # 脚本名称: ar_sign_apply.sh
4
- # 功能描述: 提交产品签约申请,支持按量付费、网站支付、APP支付三种模式
4
+ # 功能描述: 提交产品签约申请,支持按量付费、网站支付、APP 支付三种模式
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
8
  # 按量付费: bash ar_sign_apply.sh --product aipay --sales-code <code> --mcc-code <code>
9
9
  # 网站支付: bash ar_sign_apply.sh --product webpay --sales-code <code> --mcc-code <code> --picurl1 <imageRef1> --picurl2 <imageRef2> --picurl3 <imageRef3>
10
- # APP支付: bash ar_sign_apply.sh --product apppay --sales-code <code> --mcc-code <code> --app-name <name> --picurl1 <imageRef1> --picurl2 <imageRef2> --picurl3 <imageRef3>
10
+ # APP 支付: 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
@@ -128,9 +130,6 @@ if [ "$SALES_CODE" = "I1080300001000160457" ]; then
128
130
  ctx: {}
129
131
  }')
130
132
 
131
- RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
132
- -d "$REQUEST_JSON" --json 2>/dev/null)
133
-
134
133
  elif [ "$SALES_CODE" = "I1080300001000041203" ]; then
135
134
  # ============ 网站支付签约 JSON(有截图) ============
136
135
  if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
@@ -166,17 +165,14 @@ elif [ "$SALES_CODE" = "I1080300001000041203" ]; then
166
165
  ctx: {}
167
166
  }')
168
167
 
169
- RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
170
- -d "$REQUEST_JSON" --json 2>/dev/null)
171
-
172
168
  elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
173
- # ============ APP支付签约 JSON(有 APP 名称和截图) ============
169
+ # ============ APP 支付签约 JSON(有 APP 名称和截图) ============
174
170
  if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
175
- echo "❌ APP支付需要 3 个上传后的图片引用值"
171
+ echo "❌ APP 支付需要 3 个上传后的图片引用值"
176
172
  exit 1
177
173
  fi
178
174
  if [ -z "$APP_NAME" ]; then
179
- echo "❌ APP支付需要 --app-name"
175
+ echo "❌ APP 支付需要 --app-name"
180
176
  exit 1
181
177
  fi
182
178
 
@@ -209,14 +205,33 @@ elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
209
205
  ctx: {}
210
206
  }')
211
207
 
212
- RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
213
- -d "$REQUEST_JSON" --json 2>/dev/null)
214
-
215
208
  else
216
209
  echo "❌ 未知 SALES_CODE: $SALES_CODE"
217
210
  exit 1
218
211
  fi
219
212
 
213
+ export PLATFORM="${DEV_TOOL_NAME}" PLATFORM_ID="${PLATFORM_ID:-}"
214
+ run_network_retry RESULT write sign_apply -- alipay-cli mcp call ar-sign.apply \
215
+ -d "$REQUEST_JSON" --json
216
+ RETRY_RC=$?
217
+ if [ "$RETRY_RC" -eq 75 ]; then
218
+ RECONCILE_OUTPUT=$(bash "${SCRIPT_DIR}/query_sign_status.sh" --sales-code "$SALES_CODE" --product-type "$PRODUCT_TYPE" 2>&1 || true)
219
+ RECONCILED_STATUS=$(printf '%s\n' "$RECONCILE_OUTPUT" | sed -n 's/^ALIPAY_AIPAY_INTERNAL:SIGN_STATUS=//p' | tail -1)
220
+ if [ "$RECONCILED_STATUS" = "SIGN_SUBMITTED" ] || [ "$RECONCILED_STATUS" = "SIGNED_EFFECTIVE" ]; then
221
+ case "$PRODUCT_TYPE" in
222
+ aipay) emit_control "FLOW:AI_PAY_SIGN_CONTINUE" ;;
223
+ webpay) emit_control "FLOW:PC_WEB_SIGN_CONTINUE" ;;
224
+ apppay) emit_control "FLOW:APP_SIGN_CONTINUE" ;;
225
+ esac
226
+ exit 0
227
+ fi
228
+ echo "❌ 签约提交响应不明且现有查询无法排除传播延迟,结果标记为 UNKNOWN,禁止自动重复提交"
229
+ exit 1
230
+ elif [ "$RETRY_RC" -ne 0 ]; then
231
+ echo "❌ 签约提交因明确未发送的网络异常在自动重试两次后仍未恢复"
232
+ exit 1
233
+ fi
234
+
220
235
  # 错误检测(先于业务解析,handle_error 内部会自动解包信封)
221
236
  if ! handle_error "$RESULT"; then
222
237
  exit 1
@@ -227,22 +242,23 @@ BUSINESS=$(unwrap_mcp "$RESULT")
227
242
  SUCCESS=$(echo "$BUSINESS" | jq -r '.success // false')
228
243
 
229
244
  if [ "$SUCCESS" = "true" ]; then
230
- echo "✅ 签约提交成功"
231
- echo "$BUSINESS" | jq '.resultObj // .data // {}'
245
+ emit_control "✅ 签约提交成功"
246
+ emit_control "SIGN_APPLY_STATUS=SUBMITTED"
232
247
  # 签约提交成功后无需等待审核,立即推进后续步骤
233
248
  # 按量付费: 继续 5.2 服务注册 → 5.3 应用发布
234
- # 网站支付/APP支付: 继续 5.3 应用发布
249
+ # 网站支付/APP 支付: 继续 5.3 应用发布
235
250
  if [ "$SALES_CODE" = "I1080300001000160457" ]; then
236
- echo "FLOW:AI_PAY_SIGN_CONTINUE"
251
+ emit_control "FLOW:AI_PAY_SIGN_CONTINUE"
237
252
  elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
238
- echo "FLOW:APP_SIGN_CONTINUE"
253
+ emit_control "FLOW:APP_SIGN_CONTINUE"
239
254
  else
240
- echo "FLOW:PC_WEB_SIGN_CONTINUE"
255
+ emit_control "FLOW:PC_WEB_SIGN_CONTINUE"
241
256
  fi
242
257
  else
243
258
  # handle_error 已处理 ERROR/CLI_ERROR 路径并透出详细错误信息
244
- # 此处为防御性兜底:handle_error 返回成功但 success=false 的极端场景
259
+ # 此处为防御性兜底:handle_error 返回成功但 success 非 true 的极端场景
245
260
  ERROR_MSG=$(echo "$BUSINESS" | jq -r '.error.message // .errorMessage // "未知错误"')
261
+ ERROR_MSG=$(sanitize_customer_error_text "$ERROR_MSG")
246
262
  echo "❌ 签约提交失败: $ERROR_MSG"
247
263
  exit 1
248
264
  fi