@tbox.cn/app-module-ai-payment 0.1.5 → 0.1.7

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 CHANGED
@@ -10,7 +10,7 @@ createPaymentOrder 只准备待支付卡与已有买家身份,不发起真实
10
10
 
11
11
  ## 服务端配置
12
12
 
13
- 统一读取应用根目录下 config/kya.json 的非空字符串 kyaid;文件不可读取、JSON 无效或字段无效时使用默认 agentId `2026000116664809`,不区分环境。买家身份不区分环境:优先使用已有非匿名身份中的有效 `2088` 数字 ID,否则兜底为测试账号 `2088052281674865`。AI_PAY_AGENT_PID 为收款商家 PID,优先使用环境变量的非空值,未配置或为空白时使用体验商家 `2088051636299393`,与卡片已有的买家身份分开。真实场景请在平台环境变量中配置 AI_PAY_AGENT_PID,默认 PID 仅供体验。
13
+ 统一读取应用根目录下 config/kya.json 的非空字符串 kyaid;文件不可读取、JSON 无效或字段无效时使用默认 agentId `2026000117688364`,不区分环境。买家身份不区分环境:优先使用已有非匿名身份中的有效 `2088` 数字 ID,否则兜底为测试账号 `2088052281674865`。AI_PAY_AGENT_PID 为收款商家 PID,优先使用环境变量的非空值,未配置或为空白时使用体验商家 `2088051636299393`,与卡片已有的买家身份分开。真实场景请在平台环境变量中配置 AI_PAY_AGENT_PID,默认 PID 仅供体验。
14
14
 
15
15
  配置在工具执行期读取,从当前工作目录沿 .tbox/app.json 标记定位生成应用根目录(兼容 apps/server 启动)。商家 PID 缺失时 Web 仍可模拟,端内支付明确拒绝。
16
16
 
@@ -24,7 +24,7 @@ var meta = {
24
24
  subject: "\u6D4B\u8BD5\u8D2D\u4E70\u5546\u54C1",
25
25
  totalAmountText: "0.01",
26
26
  payState: "created",
27
- bizContext: '{"cashierScene":"agentPay","agentPid":"2088051636299393","agentId":"2026000116664809"}'
27
+ bizContext: '{"cashierScene":"agentPay","agentPid":"2088051636299393","agentId":"2026000117688364"}'
28
28
  },
29
29
  schemaVersion: 1
30
30
  };
@@ -52,7 +52,7 @@ async function paymentAppRoot(start = process.cwd()) {
52
52
  }
53
53
  async function loadPaymentConfig(options = {}) {
54
54
  const env = options.env ?? process.env;
55
- let agentId = "2026000116664809";
55
+ let agentId = "2026000117688364";
56
56
  try {
57
57
  const config = JSON.parse(await readFile(resolve(options.appDir ?? await paymentAppRoot(), "config", "kya.json"), "utf8"));
58
58
  const id = config?.kyaid;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createAiPaymentTools,
5
5
  resolvePaymentPort,
6
6
  serverModule
7
- } from "./chunk-3NXYT4XA.js";
7
+ } from "./chunk-A4TSDEEZ.js";
8
8
  export {
9
9
  PaymentNotConfiguredError,
10
10
  createAiPaymentActions,
@@ -5,7 +5,7 @@ import {
5
5
  resolvePaymentPort,
6
6
  serverModule,
7
7
  server_default
8
- } from "../chunk-3NXYT4XA.js";
8
+ } from "../chunk-A4TSDEEZ.js";
9
9
  export {
10
10
  PaymentNotConfiguredError,
11
11
  createAiPaymentActions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-ai-payment",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "AI 支付体验:Web 模拟收银台与端内云容器创单",
6
6
  "exports": {
@@ -19,10 +19,10 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "@tbox.cn/app-agent-sdk-client": "0.2.0",
23
- "@tbox.cn/app-agent-sdk-server": "0.3.0",
24
- "@tbox.cn/app-contracts": "0.13.1",
25
- "@tbox.cn/app-contracts-mall": "0.13.1"
22
+ "@tbox.cn/app-agent-sdk-client": "0.2.1",
23
+ "@tbox.cn/app-agent-sdk-server": "0.3.3",
24
+ "@tbox.cn/app-contracts": "0.13.3",
25
+ "@tbox.cn/app-contracts-mall": "0.14.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "zod": "3.25.76",
@@ -10,7 +10,7 @@ const meta: CardMeta<typeof paymentOrderCardDataSchema> = {
10
10
  subject: '测试购买商品',
11
11
  totalAmountText: '0.01',
12
12
  payState: 'created',
13
- bizContext: '{"cashierScene":"agentPay","agentPid":"2088051636299393","agentId":"2026000116664809"}',
13
+ bizContext: '{"cashierScene":"agentPay","agentPid":"2088051636299393","agentId":"2026000117688364"}',
14
14
  },
15
15
  schemaVersion: 1,
16
16
  };
@@ -15,7 +15,7 @@ export async function paymentAppRoot(start = process.cwd()): Promise<string> {
15
15
  export async function loadPaymentConfig(options: { env?: NodeJS.ProcessEnv; appDir?: string } = {}) {
16
16
  const env = options.env ?? process.env;
17
17
  // TODO:这是临时体验的智能体 ID,使用时请在平台申请真实 ID,并写入 config/kya.json 的 kyaid。
18
- let agentId = '2026000116664809';
18
+ let agentId = '2026000117688364';
19
19
  try {
20
20
  const config: unknown = JSON.parse(await readFile(resolve(options.appDir ?? await paymentAppRoot(), 'config', 'kya.json'), 'utf8'));
21
21
  const id = (config as { kyaid?: unknown } | null)?.kyaid;
@@ -0,0 +1,8 @@
1
+ {
2
+ "slots": ["payment.main"],
3
+ "meta": {
4
+ "payment.main": {
5
+ "name": "AI支付"
6
+ }
7
+ }
8
+ }
@@ -50,7 +50,7 @@ describe('体验商品准备', () => {
50
50
  expect(JSON.parse(out.bizContext!)).toEqual({
51
51
  cashierScene: 'agentPay',
52
52
  agentPid: value?.trim() || '2088051636299393',
53
- agentId: '2026000116664809',
53
+ agentId: '2026000117688364',
54
54
  });
55
55
  }
56
56
  } finally { await rm(appDir, { recursive: true }); }
@@ -59,11 +59,11 @@ describe('体验商品准备', () => {
59
59
  const appDir = await mkdtemp(join(tmpdir(), 'payment-fallback-'));
60
60
  try {
61
61
  const readId = async () => JSON.parse((await loadPaymentConfig({ appDir, env: { AI_PAY_AGENT_PID: 'merchant' } })).bizContext!).agentId;
62
- expect(await readId()).toBe('2026000116664809');
62
+ expect(await readId()).toBe('2026000117688364');
63
63
  await mkdir(join(appDir, 'config'));
64
64
  for (const content of ['{', '{}', 'null', '{"kyaid":123}', '{"kyaid":" "}']) {
65
65
  await writeFile(join(appDir, 'config/kya.json'), content);
66
- expect(await readId()).toBe('2026000116664809');
66
+ expect(await readId()).toBe('2026000117688364');
67
67
  }
68
68
  } finally { await rm(appDir, { recursive: true }); }
69
69
  });