@alipay/alipay-aipay 1.0.0 → 1.0.2

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 (117) hide show
  1. package/bin/alipay-aipay.js +6 -0
  2. package/dist/commands/install.d.ts +11 -0
  3. package/dist/commands/install.d.ts.map +1 -0
  4. package/dist/commands/install.js +182 -0
  5. package/dist/commands/install.js.map +1 -0
  6. package/dist/commands/prepare-tools.d.ts +5 -0
  7. package/dist/commands/prepare-tools.d.ts.map +1 -0
  8. package/dist/commands/prepare-tools.js +29 -0
  9. package/dist/commands/prepare-tools.js.map +1 -0
  10. package/dist/commands/uninstall.d.ts +10 -0
  11. package/dist/commands/uninstall.d.ts.map +1 -0
  12. package/dist/commands/uninstall.js +82 -0
  13. package/dist/commands/uninstall.js.map +1 -0
  14. package/dist/commands/update.d.ts +10 -0
  15. package/dist/commands/update.d.ts.map +1 -0
  16. package/dist/commands/update.js +155 -0
  17. package/dist/commands/update.js.map +1 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +65 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/types.d.ts +43 -0
  23. package/dist/types.d.ts.map +1 -0
  24. package/dist/types.js +2 -0
  25. package/dist/types.js.map +1 -0
  26. package/dist/utils/alipay-cli.d.ts +15 -0
  27. package/dist/utils/alipay-cli.d.ts.map +1 -0
  28. package/dist/utils/alipay-cli.js +221 -0
  29. package/dist/utils/alipay-cli.js.map +1 -0
  30. package/dist/utils/config.d.ts +48 -0
  31. package/dist/utils/config.d.ts.map +1 -0
  32. package/dist/utils/config.js +207 -0
  33. package/dist/utils/config.js.map +1 -0
  34. package/dist/utils/file.d.ts +55 -0
  35. package/dist/utils/file.d.ts.map +1 -0
  36. package/dist/utils/file.js +154 -0
  37. package/dist/utils/file.js.map +1 -0
  38. package/dist/utils/gpg.d.ts +14 -0
  39. package/dist/utils/gpg.d.ts.map +1 -0
  40. package/dist/utils/gpg.js +247 -0
  41. package/dist/utils/gpg.js.map +1 -0
  42. package/dist/utils/jq.d.ts +14 -0
  43. package/dist/utils/jq.d.ts.map +1 -0
  44. package/dist/utils/jq.js +221 -0
  45. package/dist/utils/jq.js.map +1 -0
  46. package/dist/utils/npm.d.ts +17 -0
  47. package/dist/utils/npm.d.ts.map +1 -0
  48. package/dist/utils/npm.js +42 -0
  49. package/dist/utils/npm.js.map +1 -0
  50. package/dist/utils/shell.d.ts +11 -0
  51. package/dist/utils/shell.d.ts.map +1 -0
  52. package/dist/utils/shell.js +54 -0
  53. package/dist/utils/shell.js.map +1 -0
  54. package/package.json +48 -7
  55. package/skill/SKILL.md +118 -0
  56. package/skill/references/integration/flow.md +487 -0
  57. package/skill/references/integration/modules/alipay-sdk-reminder.md +256 -0
  58. package/skill/references/integration/modules/checklist.md +122 -0
  59. package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +68 -0
  60. package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
  61. package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +74 -0
  62. package/skill/references/integration/modules/code-examples/csharp/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +73 -0
  63. 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 +58 -0
  64. 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 +128 -0
  65. package/skill/references/integration/modules/code-examples/csharp/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.cs +500 -0
  66. package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +72 -0
  67. package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +80 -0
  68. package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +78 -0
  69. package/skill/references/integration/modules/code-examples/java/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +77 -0
  70. 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 +66 -0
  71. 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 +135 -0
  72. package/skill/references/integration/modules/code-examples/java/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemoController.java +610 -0
  73. package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +51 -0
  74. package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
  75. package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +55 -0
  76. package/skill/references/integration/modules/code-examples/nodejs/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +54 -0
  77. 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 +77 -0
  78. 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 +65 -0
  79. package/skill/references/integration/modules/code-examples/nodejs/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.js +461 -0
  80. package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +59 -0
  81. package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +67 -0
  82. package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +66 -0
  83. package/skill/references/integration/modules/code-examples/php/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
  84. 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 +56 -0
  85. 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 +107 -0
  86. package/skill/references/integration/modules/code-examples/php/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.php +444 -0
  87. package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/345/205/263/351/227/255/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +57 -0
  88. package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +65 -0
  89. package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +63 -0
  90. package/skill/references/integration/modules/code-examples/python/1-/351/200/232/347/224/250/346/216/245/345/217/243//347/273/237/344/270/200/346/224/266/345/215/225/344/272/244/346/230/223/351/200/200/346/254/276/346/237/245/350/257/242/346/216/245/345/217/243/344/273/243/347/240/201/347/244/272/344/276/213.md +62 -0
  91. 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 +48 -0
  92. 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 +43 -0
  93. package/skill/references/integration/modules/code-examples/python/4-/346/214/211/351/207/217/344/273/230/350/264/271/A2MPaymentDemo.py +465 -0
  94. package/skill/references/integration/modules/interface-guide.md +90 -0
  95. package/skill/references/integration/modules/product-decision.md +90 -0
  96. package/skill/references/integration/modules/sandbox/a2m-sandbox-test.md +270 -0
  97. package/skill/references/integration/modules/sandbox/alipay-sandbox-tool.md +133 -0
  98. package/skill/references/integration/modules/sandbox/sandbox-setup-guide.md +218 -0
  99. package/skill/references/integration/modules/scripts/local_402_sandbox_pay.py +659 -0
  100. package/skill/references/normal/alipay-cli-env.md +214 -0
  101. package/skill/references/normal/rejection-guide.md +37 -0
  102. package/skill/references/normal/scripts/common.sh +32 -0
  103. package/skill/references/normal/scripts/detect_dev_tool.sh +46 -0
  104. package/skill/references/onboarding/flow.md +573 -0
  105. package/skill/references/onboarding/modules/app-release.md +415 -0
  106. package/skill/references/onboarding/modules/authorization.md +269 -0
  107. package/skill/references/onboarding/modules/error-handling.md +251 -0
  108. package/skill/references/onboarding/modules/mcc-reference.md +209 -0
  109. package/skill/references/onboarding/modules/product-sign.md +304 -0
  110. package/skill/references/onboarding/modules/scripts/app.sh +705 -0
  111. package/skill/references/onboarding/modules/scripts/ar_sign_apply.sh +248 -0
  112. package/skill/references/onboarding/modules/scripts/auth.sh +505 -0
  113. package/skill/references/onboarding/modules/scripts/error_handler.sh +452 -0
  114. package/skill/references/onboarding/modules/scripts/query_sign_status.sh +146 -0
  115. package/skill/references/onboarding/modules/scripts/service.sh +267 -0
  116. package/skill/references/onboarding/modules/scripts/upload_screenshots.sh +152 -0
  117. package/skill/references/onboarding/modules/service-registration.md +294 -0
@@ -0,0 +1,248 @@
1
+ #!/bin/bash
2
+ #=============================================================================
3
+ # 脚本名称: ar_sign_apply.sh
4
+ # 功能描述: 提交产品签约申请,支持按量付费、网站支付、APP支付三种模式
5
+ # 调用位置: Step 5.1 产品签约
6
+ # 调用前置: 脚本通过 error_handler.sh 间接初始化 DEV_TOOL_NAME;需传入 --sales-code 和 --mcc-code,或兼容使用同名环境变量
7
+ # 用法:
8
+ # 按量付费: bash ar_sign_apply.sh --product aipay --sales-code <code> --mcc-code <code>
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>
11
+ # 返回值:
12
+ # 成功: FLOW:AI_PAY_SIGN_CONTINUE | FLOW:PC_WEB_SIGN_CONTINUE | FLOW:APP_SIGN_CONTINUE
13
+ # 失败: exit 1(由 handle_error 输出详细错误信息)
14
+ #=============================================================================
15
+
16
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
+
18
+ # 一次性 source error_handler(含 unwrap_mcp)
19
+ if [ -f "${SCRIPT_DIR}/error_handler.sh" ]; then
20
+ source "${SCRIPT_DIR}/error_handler.sh"
21
+ else
22
+ echo "❌ 缺少错误处理脚本: ${SCRIPT_DIR}/error_handler.sh"
23
+ exit 1
24
+ fi
25
+
26
+ require_command jq || exit 1
27
+ require_command alipay-cli || exit 1
28
+ if ! command -v python3 >/dev/null 2>&1 && ! command -v uuidgen >/dev/null 2>&1; then
29
+ echo "❌ 缺少依赖命令: python3 或 uuidgen"
30
+ exit 1
31
+ fi
32
+
33
+ # 生成 UUID 作为 bizRequestNo
34
+ BIZ_REQUEST_NO=$(python3 -c "import uuid; print(uuid.uuid4())" 2>/dev/null || uuidgen | tr '[:upper:]' '[:lower:]')
35
+
36
+ # 优先使用 --product 参数,未传时从环境变量继承
37
+ PRODUCT_TYPE="${PRODUCT_TYPE:-}"
38
+ PICURL1=""
39
+ PICURL2=""
40
+ PICURL3=""
41
+ APP_NAME=""
42
+
43
+ # 解析参数
44
+ while [[ $# -gt 0 ]]; do
45
+ case $1 in
46
+ --product)
47
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
48
+ PRODUCT_TYPE="$2"; shift 2 ;;
49
+ --sales-code)
50
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
51
+ SALES_CODE="$2"; shift 2 ;;
52
+ --mcc-code)
53
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
54
+ MCC_CODE="$2"; shift 2 ;;
55
+ --picurl1)
56
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
57
+ PICURL1="$2"; shift 2 ;;
58
+ --picurl2)
59
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
60
+ PICURL2="$2"; shift 2 ;;
61
+ --picurl3)
62
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
63
+ PICURL3="$2"; shift 2 ;;
64
+ --app-name)
65
+ [ $# -ge 2 ] || { echo "❌ 缺少参数值: $1"; exit 1; }
66
+ APP_NAME="$2"; shift 2 ;;
67
+ *)
68
+ echo "❌ 未知参数: $1"; exit 1 ;;
69
+ esac
70
+ done
71
+
72
+ if [ -z "$SALES_CODE" ] || [ -z "$MCC_CODE" ]; then
73
+ echo "❌ 缺少必需参数(请传入 --sales-code 和 --mcc-code,或设置 SALES_CODE/MCC_CODE 环境变量)"
74
+ exit 1
75
+ fi
76
+
77
+ if [ -n "$PRODUCT_TYPE" ] && [ "$PRODUCT_TYPE" != "aipay" ] && [ "$PRODUCT_TYPE" != "webpay" ] && [ "$PRODUCT_TYPE" != "apppay" ]; then
78
+ echo "❌ --product 参数值无效: ${PRODUCT_TYPE}(仅支持 aipay|webpay|apppay)"
79
+ exit 1
80
+ fi
81
+
82
+ case "$SALES_CODE" in
83
+ "I1080300001000160457")
84
+ EXPECTED_PRODUCT_TYPE="aipay"
85
+ ;;
86
+ "I1080300001000041203")
87
+ EXPECTED_PRODUCT_TYPE="webpay"
88
+ ;;
89
+ "I1080300001000041313")
90
+ EXPECTED_PRODUCT_TYPE="apppay"
91
+ ;;
92
+ *)
93
+ echo "❌ 未知 SALES_CODE: $SALES_CODE"
94
+ exit 1
95
+ ;;
96
+ esac
97
+
98
+ if [ -n "$PRODUCT_TYPE" ] && [ "$PRODUCT_TYPE" != "$EXPECTED_PRODUCT_TYPE" ]; then
99
+ echo "❌ --product 与 SALES_CODE 不匹配:--product=${PRODUCT_TYPE}, SALES_CODE=${SALES_CODE}"
100
+ echo "📋 期望 --product=${EXPECTED_PRODUCT_TYPE}"
101
+ exit 1
102
+ fi
103
+
104
+ if [ -z "$BIZ_REQUEST_NO" ]; then
105
+ echo "❌ 无法生成 bizRequestNo"
106
+ exit 1
107
+ fi
108
+
109
+ # 场景判断(精确比较而非子串匹配)
110
+ if [ "$SALES_CODE" = "I1080300001000160457" ]; then
111
+ # ============ 按量付费签约 JSON(无截图) ============
112
+ REQUEST_JSON=$(jq -n \
113
+ --arg bizRequestNo "$BIZ_REQUEST_NO" \
114
+ --arg mccCode "$MCC_CODE" \
115
+ --arg salesCode "$SALES_CODE" \
116
+ '{
117
+ request: {
118
+ bizFeatures: {},
119
+ bizRequestNo: $bizRequestNo,
120
+ businessProperty: {
121
+ mccCode: $mccCode
122
+ },
123
+ channelCode: "B_SK_SH_RPC",
124
+ extension: {},
125
+ orderType: "NEW_SIGN",
126
+ salesProductCodes: [$salesCode]
127
+ },
128
+ ctx: {}
129
+ }')
130
+
131
+ RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
132
+ -d "$REQUEST_JSON" --json 2>/dev/null)
133
+
134
+ elif [ "$SALES_CODE" = "I1080300001000041203" ]; then
135
+ # ============ 网站支付签约 JSON(有截图) ============
136
+ if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
137
+ echo "❌ 网站支付需要 3 个上传后的图片引用值"
138
+ exit 1
139
+ fi
140
+
141
+ REQUEST_JSON=$(jq -n \
142
+ --arg bizRequestNo "$BIZ_REQUEST_NO" \
143
+ --arg mccCode "$MCC_CODE" \
144
+ --arg salesCode "$SALES_CODE" \
145
+ --arg picUrl1 "$PICURL1" \
146
+ --arg picUrl2 "$PICURL2" \
147
+ --arg picUrl3 "$PICURL3" \
148
+ '{
149
+ request: {
150
+ bizFeatures: {},
151
+ bizRequestNo: $bizRequestNo,
152
+ businessProperty: {
153
+ mccCode: $mccCode,
154
+ webAppDTO: {
155
+ placeType: "ONLINE_WEBAPP",
156
+ appType: "PC_WEB",
157
+ appStatus: "OFFLINE",
158
+ screenshot: [$picUrl1, $picUrl2, $picUrl3]
159
+ }
160
+ },
161
+ channelCode: "B_SK_SH_RPC",
162
+ extension: {},
163
+ orderType: "NEW_SIGN",
164
+ salesProductCodes: [$salesCode]
165
+ },
166
+ ctx: {}
167
+ }')
168
+
169
+ RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
170
+ -d "$REQUEST_JSON" --json 2>/dev/null)
171
+
172
+ elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
173
+ # ============ APP支付签约 JSON(有 APP 名称和截图) ============
174
+ if [ -z "$PICURL1" ] || [ -z "$PICURL2" ] || [ -z "$PICURL3" ]; then
175
+ echo "❌ APP支付需要 3 个上传后的图片引用值"
176
+ exit 1
177
+ fi
178
+ if [ -z "$APP_NAME" ]; then
179
+ echo "❌ APP支付需要 --app-name"
180
+ exit 1
181
+ fi
182
+
183
+ REQUEST_JSON=$(jq -n \
184
+ --arg bizRequestNo "$BIZ_REQUEST_NO" \
185
+ --arg mccCode "$MCC_CODE" \
186
+ --arg salesCode "$SALES_CODE" \
187
+ --arg appName "$APP_NAME" \
188
+ --arg picUrl1 "$PICURL1" \
189
+ --arg picUrl2 "$PICURL2" \
190
+ --arg picUrl3 "$PICURL3" \
191
+ '{
192
+ request: {
193
+ bizFeatures: {},
194
+ bizRequestNo: $bizRequestNo,
195
+ businessProperty: {
196
+ mccCode: $mccCode,
197
+ nativeAppDTO: {
198
+ placeType: "ONLINE_NATIVEYAPP",
199
+ name: $appName,
200
+ appStatus: "OFFLINE",
201
+ screenshot: [$picUrl1, $picUrl2, $picUrl3]
202
+ }
203
+ },
204
+ channelCode: "B_SK_SH_RPC",
205
+ extension: {},
206
+ orderType: "NEW_SIGN",
207
+ salesProductCodes: [$salesCode]
208
+ },
209
+ ctx: {}
210
+ }')
211
+
212
+ RESULT=$(export PLATFORM=${DEV_TOOL_NAME} && alipay-cli mcp call ar-sign.apply \
213
+ -d "$REQUEST_JSON" --json 2>/dev/null)
214
+
215
+ else
216
+ echo "❌ 未知 SALES_CODE: $SALES_CODE"
217
+ exit 1
218
+ fi
219
+
220
+ # 错误检测(先于业务解析,handle_error 内部会自动解包信封)
221
+ if ! handle_error "$RESULT"; then
222
+ exit 1
223
+ fi
224
+
225
+ # 解包 MCP 信封后解析业务字段
226
+ BUSINESS=$(unwrap_mcp "$RESULT")
227
+ SUCCESS=$(echo "$BUSINESS" | jq -r '.success // false')
228
+
229
+ if [ "$SUCCESS" = "true" ]; then
230
+ echo "✅ 签约提交成功"
231
+ echo "$BUSINESS" | jq '.resultObj // .data // {}'
232
+ # 签约提交成功后无需等待审核,立即推进后续步骤
233
+ # 按量付费: 继续 5.2 服务注册 → 5.3 应用发布
234
+ # 网站支付/APP支付: 继续 5.3 应用发布
235
+ if [ "$SALES_CODE" = "I1080300001000160457" ]; then
236
+ echo "FLOW:AI_PAY_SIGN_CONTINUE"
237
+ elif [ "$SALES_CODE" = "I1080300001000041313" ]; then
238
+ echo "FLOW:APP_SIGN_CONTINUE"
239
+ else
240
+ echo "FLOW:PC_WEB_SIGN_CONTINUE"
241
+ fi
242
+ else
243
+ # handle_error 已处理 ERROR/CLI_ERROR 路径并透出详细错误信息
244
+ # 此处为防御性兜底:handle_error 返回成功但 success=false 的极端场景
245
+ ERROR_MSG=$(echo "$BUSINESS" | jq -r '.error.message // .errorMessage // "未知错误"')
246
+ echo "❌ 签约提交失败: $ERROR_MSG"
247
+ exit 1
248
+ fi