cbs-4px-merchant-cli 0.0.6 → 0.0.8

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 (69) hide show
  1. package/README.4px.md +38 -5
  2. package/README.cainiao.md +38 -5
  3. package/README.md +38 -5
  4. package/dist/cli.js +242 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/address.js +6 -26
  7. package/dist/commands/address.js.map +1 -1
  8. package/dist/commands/claim.js +14 -34
  9. package/dist/commands/claim.js.map +1 -1
  10. package/dist/commands/config.js +222 -0
  11. package/dist/commands/config.js.map +1 -1
  12. package/dist/commands/country.js +6 -26
  13. package/dist/commands/country.js.map +1 -1
  14. package/dist/commands/customs.js +17 -65
  15. package/dist/commands/customs.js.map +1 -1
  16. package/dist/commands/finance.js +56 -204
  17. package/dist/commands/finance.js.map +1 -1
  18. package/dist/commands/label.js +6 -26
  19. package/dist/commands/label.js.map +1 -1
  20. package/dist/commands/notice.js +22 -86
  21. package/dist/commands/notice.js.map +1 -1
  22. package/dist/commands/onboarding.d.ts +79 -0
  23. package/dist/commands/onboarding.js +384 -0
  24. package/dist/commands/onboarding.js.map +1 -0
  25. package/dist/commands/order.d.ts +26 -0
  26. package/dist/commands/order.js +254 -58
  27. package/dist/commands/order.js.map +1 -1
  28. package/dist/commands/pickup.js +29 -97
  29. package/dist/commands/pickup.js.map +1 -1
  30. package/dist/commands/platform.d.ts +26 -0
  31. package/dist/commands/platform.js +254 -0
  32. package/dist/commands/platform.js.map +1 -0
  33. package/dist/commands/problem.js +56 -170
  34. package/dist/commands/problem.js.map +1 -1
  35. package/dist/commands/product.js +52 -155
  36. package/dist/commands/product.js.map +1 -1
  37. package/dist/commands/service.js +64 -186
  38. package/dist/commands/service.js.map +1 -1
  39. package/dist/commands/skill.d.ts +1 -1
  40. package/dist/commands/skill.js +68 -2
  41. package/dist/commands/skill.js.map +1 -1
  42. package/dist/commands/track.js +20 -74
  43. package/dist/commands/track.js.map +1 -1
  44. package/dist/commands/update.js +1 -1
  45. package/dist/digital-employee-skills/cbs-4px-merchant-cli-order-fulfillment.zip +0 -0
  46. package/dist/digital-employee-skills/cbs-cainiao-merchant-cli-order-fulfillment.zip +0 -0
  47. package/dist/index.js +0 -0
  48. package/dist/services/api-client.d.ts +38 -1
  49. package/dist/services/api-client.js +275 -9
  50. package/dist/services/api-client.js.map +1 -1
  51. package/dist/services/completion-installer.d.ts +51 -0
  52. package/dist/services/completion-installer.js +134 -0
  53. package/dist/services/completion-installer.js.map +1 -0
  54. package/dist/types/index.d.ts +294 -0
  55. package/dist/utils/confirm.d.ts +18 -0
  56. package/dist/utils/confirm.js +50 -0
  57. package/dist/utils/confirm.js.map +1 -0
  58. package/dist/utils/run-command.d.ts +24 -0
  59. package/dist/utils/run-command.js +58 -0
  60. package/dist/utils/run-command.js.map +1 -0
  61. package/package.json +2 -1
  62. package/scripts/postinstall.js +1 -1
  63. package/skill/SKILL.md +112 -4
  64. package/skill/package.json +3 -1
  65. package/skill/reference/index.md +30 -3
  66. package/skill/reference/onboarding.md +573 -0
  67. package/skill/reference/order.md +194 -0
  68. package/skill/reference/platform.md +317 -0
  69. package/skill/reference/update.md +1 -1
@@ -1,31 +1,11 @@
1
- import { ConfigManager } from '../services/config-manager.js';
2
- import { ApiClient } from '../services/api-client.js';
3
- import { createSpinner } from '../utils/logger.js';
4
- import { handleError } from './error-handler.js';
1
+ import { runCommand } from '../utils/run-command.js';
5
2
  import chalk from 'chalk';
6
3
  export async function trackCommand(orderNo, opts) {
7
- const spinner = createSpinner('正在查询物流轨迹...');
8
- try {
9
- spinner.start();
10
- const client = new ApiClient(new ConfigManager(), opts);
11
- const data = await client.getTrackDetail(orderNo);
12
- spinner.stop();
13
- if (opts.output === 'json') {
14
- console.log(JSON.stringify(data ?? null, null, 2));
15
- return;
16
- }
17
- if (!data) {
18
- console.log('');
19
- console.log(chalk.yellow(' 暂无数据'));
20
- console.log('');
21
- return;
22
- }
23
- printTrackDetail(data);
24
- }
25
- catch (e) {
26
- spinner.stop();
27
- handleError(e);
28
- }
4
+ await runCommand(opts, {
5
+ spinner: '正在查询物流轨迹...',
6
+ exec: (client) => client.getTrackDetail(orderNo),
7
+ render: printTrackDetail,
8
+ });
29
9
  }
30
10
  function printTrackDetail(data) {
31
11
  console.log('');
@@ -58,56 +38,22 @@ function printTrackItem(t) {
58
38
  console.log(` ${chalk.yellow(t.tkDate)} ${t.tkLocation ?? ''} ${t.tkDesc}`);
59
39
  }
60
40
  export async function trackSubscriptionOrderCommand(opts) {
61
- const spinner = createSpinner('正在查询轨迹订阅...');
62
- try {
63
- spinner.start();
64
- const client = new ApiClient(new ConfigManager(), opts);
65
- const pageNum = opts.page ? parseInt(opts.page, 10) : undefined;
66
- const pageSize = opts.size ? parseInt(opts.size, 10) : undefined;
67
- const data = await client.listTrackSubscriptionByOrder(opts.trackNos, pageNum, pageSize);
68
- spinner.stop();
69
- if (opts.output === 'json') {
70
- console.log(JSON.stringify(data ?? null, null, 2));
71
- return;
72
- }
73
- if (!data) {
74
- console.log('');
75
- console.log(chalk.yellow(' 暂无数据'));
76
- console.log('');
77
- return;
78
- }
79
- printTrackSubscriptionList(data);
80
- }
81
- catch (e) {
82
- spinner.stop();
83
- handleError(e);
84
- }
41
+ const pageNum = opts.page ? parseInt(opts.page, 10) : undefined;
42
+ const pageSize = opts.size ? parseInt(opts.size, 10) : undefined;
43
+ await runCommand(opts, {
44
+ spinner: '正在查询轨迹订阅...',
45
+ exec: (client) => client.listTrackSubscriptionByOrder(opts.trackNos, pageNum, pageSize),
46
+ render: printTrackSubscriptionList,
47
+ });
85
48
  }
86
49
  export async function trackSubscriptionProductCommand(opts) {
87
- const spinner = createSpinner('正在查询轨迹订阅...');
88
- try {
89
- spinner.start();
90
- const client = new ApiClient(new ConfigManager(), opts);
91
- const pageNum = opts.page ? parseInt(opts.page, 10) : undefined;
92
- const pageSize = opts.size ? parseInt(opts.size, 10) : undefined;
93
- const data = await client.listTrackSubscriptionByProduct(opts.productCode, opts.countryCode, pageNum, pageSize);
94
- spinner.stop();
95
- if (opts.output === 'json') {
96
- console.log(JSON.stringify(data ?? null, null, 2));
97
- return;
98
- }
99
- if (!data) {
100
- console.log('');
101
- console.log(chalk.yellow(' 暂无数据'));
102
- console.log('');
103
- return;
104
- }
105
- printTrackSubscriptionList(data);
106
- }
107
- catch (e) {
108
- spinner.stop();
109
- handleError(e);
110
- }
50
+ const pageNum = opts.page ? parseInt(opts.page, 10) : undefined;
51
+ const pageSize = opts.size ? parseInt(opts.size, 10) : undefined;
52
+ await runCommand(opts, {
53
+ spinner: '正在查询轨迹订阅...',
54
+ exec: (client) => client.listTrackSubscriptionByProduct(opts.productCode, opts.countryCode, pageNum, pageSize),
55
+ render: printTrackSubscriptionList,
56
+ });
111
57
  }
112
58
  function printTrackSubscriptionList(data) {
113
59
  console.log('');
@@ -1 +1 @@
1
- {"version":3,"file":"track.js","sourceRoot":"","sources":["../../src/commands/track.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,IAAmB;IACrE,MAAM,OAAO,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,IAAI,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AAM,GAAG,CAAC,EAAE,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -197,7 +197,7 @@ async function runUpdate(opts, globals) {
197
197
  }
198
198
  // 8. Sync the skill with the version we just installed.
199
199
  //
200
- // npm 11 blocks dependency install scripts by default (and still exits 0),
200
+ // npm 12 blocks dependency install scripts by default (and still exits 0),
201
201
  // so the upgraded package's postinstall may never have run. Re-running
202
202
  // `skill install` explicitly is the only reliable path — and it must be a
203
203
  // *subprocess*: this process still holds the pre-upgrade code and paths, so
package/dist/index.js CHANGED
File without changes
@@ -1,5 +1,5 @@
1
1
  import { ConfigManager } from './config-manager.js';
2
- import type { GlobalOptions, TrackDetailDTO, LabelPrintDTO, OrderDetailResp, ProductRecommendDTO, ProductRecommendRequest, ClaimListResp, ClaimListRequest, OrderListRequest, OrderListResp, OrderAddressResp, CountrySearchResp, ProductSearchResp, TrackSubscriptionResp, ProductListResp, ProductDetailResp, FreightTrialResp, ProblemListRequest, ProblemListResp, AbnormalSuggestRequest, BatchAbnormalSuggestResponse, NotifyProblemListResp, ArrearOrderListResp, ServiceRepairOrderListRequest, RepairOrderListResp, ServiceOrderListRequest, ServiceOrderListResp, ServiceDetailResp, HandleRecordListResp, DssClaimDetailResp, ClaimReasonListResp, AccountBalanceResp, BillListResp, DailyFeeListResp, UnbilledDetailResp, UnbilledListResp, RechargeRecordListResp, TransferRecordListResp, FeeDetailResp, MaterialApplyListResp, MaterialDetailResp, MaterialQuotaResp, CollectAddressListResp, NoticeListResp, NoticeDetailResp, MessageListResp, MessageDetailResp, UnreadMessageCountResp, CargoKindListResp, CommodityListResp, HsCodeListResp, CustomerDeclareResp, FrozenRecordListResp, NotifyTypeListResp } from '../types/index.js';
2
+ import type { GlobalOptions, TrackDetailDTO, LabelPrintDTO, OrderDetailResp, ProductRecommendDTO, ProductRecommendRequest, ClaimListResp, ClaimListRequest, OrderListRequest, OrderListResp, OrderAddressResp, CountrySearchResp, ProductSearchResp, TrackSubscriptionResp, ProductListResp, ProductDetailResp, FreightTrialResp, ProblemListRequest, ProblemListResp, AbnormalSuggestRequest, BatchAbnormalSuggestResponse, NotifyProblemListResp, ArrearOrderListResp, ServiceRepairOrderListRequest, RepairOrderListResp, ServiceOrderListRequest, ServiceOrderListResp, ServiceDetailResp, HandleRecordListResp, DssClaimDetailResp, ClaimReasonListResp, AccountBalanceResp, BillListResp, DailyFeeListResp, UnbilledDetailResp, UnbilledListResp, RechargeRecordListResp, TransferRecordListResp, FeeDetailResp, MaterialApplyListResp, MaterialDetailResp, MaterialQuotaResp, CollectAddressListResp, NoticeListResp, NoticeDetailResp, MessageListResp, MessageDetailResp, UnreadMessageCountResp, CargoKindListResp, CommodityListResp, HsCodeListResp, CustomerDeclareResp, FrozenRecordListResp, NotifyTypeListResp, SellerAccountListResp, PlatformOrderSyncResp, SyncOrderRecordListResp, PlatformOrderListResp, PlatformOrderDetailResp, IndivAuthRequest, CheckAuthCodeRequest, OrganAuthRequest, OpenBrandRequest, GATAuthRequest, OnboardingProgressResp, AuthScheduleResp, CustomerTypeItem, BrandAndAuthItem, ContractListResp, CreateOrderRequest, CreateOrderResp, EditOrderRequest, EditOrderResp, ForecastOrderResp, CancelOrderResp, InterceptOrderResp } from '../types/index.js';
3
3
  export declare class ApiClient {
4
4
  private readonly config;
5
5
  private readonly verbose;
@@ -8,6 +8,16 @@ export declare class ApiClient {
8
8
  private createHttp;
9
9
  private get;
10
10
  private post;
11
+ /**
12
+ * 发送 JSON body 的 POST。
13
+ *
14
+ * 仅用于后端以 `@Body` 绑定的接口(当前为 `order create` 和
15
+ * `order edit`)。其他接口必须继续调用 `post()`,因为 Solon 的
16
+ * `@Param` 从表单取值,发送 JSON body 会返回 400。
17
+ */
18
+ private postJson;
19
+ /** 生成 JSON body 请求的 dry-run 预览,不发送网络请求。 */
20
+ dryRunJsonInfo(path: string, body: unknown, withAuth: boolean): Promise<Record<string, unknown>>;
11
21
  /** Build a dry-run summary object for a GET request (no network call). */
12
22
  dryRunInfo(path: string, params: Record<string, string>, withAuth: boolean): Promise<Record<string, unknown>>;
13
23
  /** Build a dry-run summary object for a POST request (no network call). */
@@ -20,6 +30,13 @@ export declare class ApiClient {
20
30
  listOrders(request: OrderListRequest): Promise<OrderListResp>;
21
31
  listAddressBook(): Promise<OrderAddressResp>;
22
32
  searchDestinationCountry(key: string, productCode?: string): Promise<CountrySearchResp>;
33
+ /** JSON body,`status: 'D'` 表示保存草稿而不预报。 */
34
+ createOrder(request: CreateOrderRequest): Promise<CreateOrderResp>;
35
+ /** JSON body;仅草稿和已取消订单可编辑。 */
36
+ editOrder(request: EditOrderRequest): Promise<EditOrderResp>;
37
+ forecastOrder(orderIds: string): Promise<ForecastOrderResp>;
38
+ cancelOrder(orderIds: string, cancelReason: string): Promise<CancelOrderResp>;
39
+ interceptOrder(orderIds: string): Promise<InterceptOrderResp>;
23
40
  searchProduct(key: string, countryCode?: string): Promise<ProductSearchResp>;
24
41
  getProductRecommend(request: ProductRecommendRequest): Promise<ProductRecommendDTO>;
25
42
  listAvailableProducts(country: string, startCity?: string): Promise<ProductListResp>;
@@ -64,4 +81,24 @@ export declare class ApiClient {
64
81
  getRegistrationInfo(): Promise<CustomerDeclareResp>;
65
82
  listFrozenRecord(businessSystem?: string, currency?: string, businessNo?: string, pageNum?: number, pageSize?: number): Promise<FrozenRecordListResp>;
66
83
  listProblemNotifyType(): Promise<NotifyTypeListResp>;
84
+ listSellerAccounts(pageNum?: number, pageSize?: number): Promise<SellerAccountListResp>;
85
+ syncPlatformOrders(sellerAccountId: string, timeFrom: string, timeTo: string): Promise<PlatformOrderSyncResp>;
86
+ listPlatformSyncRecords(pageNum?: number, pageSize?: number): Promise<SyncOrderRecordListResp>;
87
+ listPlatformOrders(status?: number, keyword?: string, pageNum?: number, pageSize?: number): Promise<PlatformOrderListResp>;
88
+ pushPlatformOrders(ids: string): Promise<unknown>;
89
+ getPlatformOrderDetail(id: string): Promise<PlatformOrderDetailResp>;
90
+ /** Returns the flowId that `checkAuthCode` needs. */
91
+ startIndivRealNameAuth(request: IndivAuthRequest): Promise<string>;
92
+ checkAuthCode(request: CheckAuthCodeRequest): Promise<string>;
93
+ startOrganRealNameAuth(request: OrganAuthRequest): Promise<string>;
94
+ openBrandAndApplyContract(request: OpenBrandRequest): Promise<string>;
95
+ authSaveGAT(request: GATAuthRequest): Promise<string>;
96
+ /** amount is in cents — the backend rejects yuan. */
97
+ checkRemitAmount(flowId: string, amount: number): Promise<string>;
98
+ queryOnboardingProgress(): Promise<OnboardingProgressResp>;
99
+ queryAuthSchedule(): Promise<AuthScheduleResp>;
100
+ queryCustomerType(): Promise<CustomerTypeItem[]>;
101
+ queryBrandAndAuth(customerType?: string): Promise<BrandAndAuthItem[]>;
102
+ getContractList(pageNum?: number, pageSize?: number): Promise<ContractListResp>;
103
+ getContractSignUrl(contractCode: string): Promise<string>;
67
104
  }
@@ -1,6 +1,49 @@
1
1
  import axios from 'axios';
2
2
  import { ApiError, DryRunSignal } from '../errors.js';
3
3
  const API_PREFIX = '/api/merchant/tools';
4
+ /**
5
+ * Params whose values must never be echoed back to the terminal.
6
+ *
7
+ * `--verbose` and `--dry-run` print the outgoing request, which is harmless
8
+ * for order numbers. The onboarding auth commands send identity documents,
9
+ * bank cards and SMS codes; those would land in scrollback and shell
10
+ * transcripts. Masking applies to the printed copy only — the request itself
11
+ * still carries the real value.
12
+ */
13
+ const SENSITIVE_PARAMS = new Set(['certNumber', 'bankCard', 'authCode', 'mobile']);
14
+ /**
15
+ * 嵌套 JSON body 同样需要递归遮蔽敏感字段,否则订单的
16
+ * `receiver.mobile`、`sender.phone` 会被 `--dry-run` / `--verbose`
17
+ * 原样写入终端回滚区和平台日志。
18
+ */
19
+ const SENSITIVE_BODY_KEYS = new Set(['certNumber', 'bankCard', 'authCode', 'mobile', 'phone']);
20
+ function maskSensitive(params) {
21
+ const out = {};
22
+ for (const [k, v] of Object.entries(params)) {
23
+ out[k] = SENSITIVE_PARAMS.has(k) && v != null ? '****' : v;
24
+ }
25
+ return out;
26
+ }
27
+ /** 将敏感字段遮蔽规则递归应用到嵌套对象与数组。 */
28
+ function maskSensitiveDeep(value) {
29
+ if (Array.isArray(value))
30
+ return value.map(maskSensitiveDeep);
31
+ if (value === null || typeof value !== 'object')
32
+ return value;
33
+ const out = {};
34
+ for (const [k, v] of Object.entries(value)) {
35
+ out[k] = SENSITIVE_BODY_KEYS.has(k) && v != null ? '****' : maskSensitiveDeep(v);
36
+ }
37
+ return out;
38
+ }
39
+ function toForm(params) {
40
+ const form = new URLSearchParams();
41
+ for (const [k, v] of Object.entries(params)) {
42
+ if (v != null)
43
+ form.append(k, String(v));
44
+ }
45
+ return form;
46
+ }
4
47
  export class ApiClient {
5
48
  config;
6
49
  verbose;
@@ -31,7 +74,7 @@ export class ApiClient {
31
74
  const http = await this.createHttp(withAuth);
32
75
  const baseURL = await this.config.resolveBaseUrl();
33
76
  if (this.verbose) {
34
- const queryString = new URLSearchParams(params).toString();
77
+ const queryString = new URLSearchParams(maskSensitive(params)).toString();
35
78
  const fullUrl = `${baseURL}${path}?${queryString}`;
36
79
  process.stderr.write(`> GET ${fullUrl}\n`);
37
80
  const authHeader = withAuth ? 'Bearer ****' : '(none)';
@@ -56,15 +99,11 @@ export class ApiClient {
56
99
  const http = await this.createHttp(withAuth);
57
100
  const baseURL = await this.config.resolveBaseUrl();
58
101
  // Solon @Param reads from query string / form params, not JSON body
59
- const formParams = new URLSearchParams();
60
- for (const [k, v] of Object.entries(params)) {
61
- if (v != null)
62
- formParams.append(k, String(v));
63
- }
102
+ const formParams = toForm(params);
64
103
  if (this.verbose) {
65
104
  const fullUrl = `${baseURL}${path}`;
66
105
  process.stderr.write(`> POST ${fullUrl}\n`);
67
- process.stderr.write(`> Params: ${formParams.toString()}\n`);
106
+ process.stderr.write(`> Params: ${toForm(maskSensitive(params)).toString()}\n`);
68
107
  const authHeader = withAuth ? 'Bearer ****' : '(none)';
69
108
  process.stderr.write(`> Authorization: ${authHeader}\n`);
70
109
  }
@@ -80,13 +119,58 @@ export class ApiClient {
80
119
  }
81
120
  return resp.data;
82
121
  }
122
+ /**
123
+ * 发送 JSON body 的 POST。
124
+ *
125
+ * 仅用于后端以 `@Body` 绑定的接口(当前为 `order create` 和
126
+ * `order edit`)。其他接口必须继续调用 `post()`,因为 Solon 的
127
+ * `@Param` 从表单取值,发送 JSON body 会返回 400。
128
+ */
129
+ async postJson(path, body, withAuth) {
130
+ if (this.dryRun) {
131
+ const info = await this.dryRunJsonInfo(path, body, withAuth);
132
+ console.log(JSON.stringify(info, null, 2));
133
+ throw new DryRunSignal();
134
+ }
135
+ const http = await this.createHttp(withAuth);
136
+ const baseURL = await this.config.resolveBaseUrl();
137
+ if (this.verbose) {
138
+ process.stderr.write(`> POST ${baseURL}${path}\n`);
139
+ process.stderr.write(`> Content-Type: application/json\n`);
140
+ process.stderr.write(`> Body: ${JSON.stringify(maskSensitiveDeep(body))}\n`);
141
+ const authHeader = withAuth ? 'Bearer ****' : '(none)';
142
+ process.stderr.write(`> Authorization: ${authHeader}\n`);
143
+ }
144
+ const res = await http.post(path, body, {
145
+ headers: { 'Content-Type': 'application/json' },
146
+ });
147
+ if (this.verbose) {
148
+ process.stderr.write(`< ${res.status} ${res.statusText}\n`);
149
+ }
150
+ const resp = res.data;
151
+ if (!resp.success) {
152
+ throw new ApiError(resp.errCode, resp.errMsg, '请检查订单字段是否完整、产品与目的国是否匹配,或稍后重试');
153
+ }
154
+ return resp.data;
155
+ }
156
+ /** 生成 JSON body 请求的 dry-run 预览,不发送网络请求。 */
157
+ async dryRunJsonInfo(path, body, withAuth) {
158
+ const baseURL = await this.config.resolveBaseUrl();
159
+ return {
160
+ method: 'POST',
161
+ url: `${baseURL}${path}`,
162
+ contentType: 'application/json',
163
+ body: maskSensitiveDeep(body),
164
+ auth: withAuth ? 'Bearer ****' : 'none',
165
+ };
166
+ }
83
167
  /** Build a dry-run summary object for a GET request (no network call). */
84
168
  async dryRunInfo(path, params, withAuth) {
85
169
  const baseURL = await this.config.resolveBaseUrl();
86
170
  return {
87
171
  method: 'GET',
88
172
  url: `${baseURL}${path}`,
89
- params,
173
+ params: maskSensitive(params),
90
174
  auth: withAuth ? 'Bearer ****' : 'none',
91
175
  };
92
176
  }
@@ -96,7 +180,7 @@ export class ApiClient {
96
180
  return {
97
181
  method: 'POST',
98
182
  url: `${baseURL}${path}`,
99
- body,
183
+ body: maskSensitive(body),
100
184
  auth: withAuth ? 'Bearer ****' : 'none',
101
185
  };
102
186
  }
@@ -163,6 +247,24 @@ export class ApiClient {
163
247
  body.productCode = productCode;
164
248
  return this.post(`${API_PREFIX}/destination-country/search`, body, true);
165
249
  }
250
+ // ==================== 订单写操作 ====================
251
+ /** JSON body,`status: 'D'` 表示保存草稿而不预报。 */
252
+ async createOrder(request) {
253
+ return this.postJson(`${API_PREFIX}/order/create`, request, true);
254
+ }
255
+ /** JSON body;仅草稿和已取消订单可编辑。 */
256
+ async editOrder(request) {
257
+ return this.postJson(`${API_PREFIX}/order/edit`, request, true);
258
+ }
259
+ async forecastOrder(orderIds) {
260
+ return this.post(`${API_PREFIX}/order/forecast`, { orderIds }, true);
261
+ }
262
+ async cancelOrder(orderIds, cancelReason) {
263
+ return this.post(`${API_PREFIX}/order/cancel`, { orderIds, cancelReason }, true);
264
+ }
265
+ async interceptOrder(orderIds) {
266
+ return this.post(`${API_PREFIX}/order/intercept`, { orderIds }, true);
267
+ }
166
268
  async searchProduct(key, countryCode) {
167
269
  const body = { key };
168
270
  if (countryCode)
@@ -595,5 +697,169 @@ export class ApiClient {
595
697
  async listProblemNotifyType() {
596
698
  return this.get(`${API_PREFIX}/problem/notify-type/list`, {}, true);
597
699
  }
700
+ // ==================== Platform Order (平台拉单) ====================
701
+ async listSellerAccounts(pageNum, pageSize) {
702
+ const body = {};
703
+ if (pageNum != null)
704
+ body.pageNum = pageNum;
705
+ if (pageSize != null)
706
+ body.pageSize = pageSize;
707
+ return this.post(`${API_PREFIX}/platformOrder/account/list`, body, true);
708
+ }
709
+ async syncPlatformOrders(sellerAccountId, timeFrom, timeTo) {
710
+ return this.post(`${API_PREFIX}/platformOrder/sync`, { sellerAccountId, timeFrom, timeTo }, true);
711
+ }
712
+ async listPlatformSyncRecords(pageNum, pageSize) {
713
+ const body = {};
714
+ if (pageNum != null)
715
+ body.pageNum = pageNum;
716
+ if (pageSize != null)
717
+ body.pageSize = pageSize;
718
+ return this.post(`${API_PREFIX}/platformOrder/syncRecord/list`, body, true);
719
+ }
720
+ async listPlatformOrders(status, keyword, pageNum, pageSize) {
721
+ const body = {};
722
+ if (status != null)
723
+ body.status = status;
724
+ if (keyword)
725
+ body.keyword = keyword;
726
+ if (pageNum != null)
727
+ body.pageNum = pageNum;
728
+ if (pageSize != null)
729
+ body.pageSize = pageSize;
730
+ return this.post(`${API_PREFIX}/platformOrder/order/list`, body, true);
731
+ }
732
+ async pushPlatformOrders(ids) {
733
+ return this.post(`${API_PREFIX}/platformOrder/order/push`, { ids }, true);
734
+ }
735
+ async getPlatformOrderDetail(id) {
736
+ return this.get(`${API_PREFIX}/platformOrder/order/detail`, { id }, true);
737
+ }
738
+ // ==================== Onboarding (入驻) ====================
739
+ /** Returns the flowId that `checkAuthCode` needs. */
740
+ async startIndivRealNameAuth(request) {
741
+ const body = {
742
+ name: request.name,
743
+ certNumber: request.certNumber,
744
+ mobile: request.mobile,
745
+ authType: request.authType,
746
+ };
747
+ if (request.bankCard)
748
+ body.bankCard = request.bankCard;
749
+ if (request.isAgent != null)
750
+ body.isAgent = request.isAgent;
751
+ return this.post(`${API_PREFIX}/onboarding/indiv-auth`, body, true);
752
+ }
753
+ async checkAuthCode(request) {
754
+ const body = {
755
+ authCode: request.authCode,
756
+ flowId: request.flowId,
757
+ };
758
+ if (request.authType)
759
+ body.authType = request.authType;
760
+ if (request.isAgent != null)
761
+ body.isAgent = request.isAgent;
762
+ return this.post(`${API_PREFIX}/onboarding/check-auth-code`, body, true);
763
+ }
764
+ async startOrganRealNameAuth(request) {
765
+ const body = {
766
+ name: request.name,
767
+ certNumber: request.certNumber,
768
+ };
769
+ if (request.certType != null)
770
+ body.certType = request.certType;
771
+ if (request.agentAccountId)
772
+ body.agentAccountId = request.agentAccountId;
773
+ return this.post(`${API_PREFIX}/onboarding/organ-auth`, body, true);
774
+ }
775
+ async openBrandAndApplyContract(request) {
776
+ const body = {
777
+ serviceCode: request.serviceCode,
778
+ country: request.country,
779
+ address: request.address,
780
+ customerName: request.customerName,
781
+ contactName: request.contactName,
782
+ mobile: request.mobile,
783
+ email: request.email,
784
+ };
785
+ if (request.customerType != null)
786
+ body.customerType = request.customerType;
787
+ if (request.state)
788
+ body.state = request.state;
789
+ if (request.city)
790
+ body.city = request.city;
791
+ if (request.county)
792
+ body.county = request.county;
793
+ if (request.cLegalName)
794
+ body.cLegalName = request.cLegalName;
795
+ return this.post(`${API_PREFIX}/onboarding/open-brand`, body, true);
796
+ }
797
+ async authSaveGAT(request) {
798
+ const body = {
799
+ customerProfile: request.customerProfile,
800
+ // Backend spells it `enitity`; keeping the typo is what makes it bind.
801
+ enitity: request.enitity,
802
+ name: request.name,
803
+ mobile: request.mobile,
804
+ email: request.email,
805
+ };
806
+ if (request.contactName)
807
+ body.contactName = request.contactName;
808
+ if (request.legalPerson)
809
+ body.legalPerson = request.legalPerson;
810
+ if (request.certNumber)
811
+ body.certNumber = request.certNumber;
812
+ if (request.country)
813
+ body.country = request.country;
814
+ if (request.countryCode)
815
+ body.countryCode = request.countryCode;
816
+ if (request.alpha2Code)
817
+ body.alpha2Code = request.alpha2Code;
818
+ if (request.state)
819
+ body.state = request.state;
820
+ if (request.stateCode)
821
+ body.stateCode = request.stateCode;
822
+ if (request.city)
823
+ body.city = request.city;
824
+ if (request.cityCode)
825
+ body.cityCode = request.cityCode;
826
+ if (request.county)
827
+ body.county = request.county;
828
+ if (request.countyCode)
829
+ body.countyCode = request.countyCode;
830
+ if (request.address)
831
+ body.address = request.address;
832
+ return this.post(`${API_PREFIX}/onboarding/gat-auth`, body, true);
833
+ }
834
+ /** amount is in cents — the backend rejects yuan. */
835
+ async checkRemitAmount(flowId, amount) {
836
+ return this.post(`${API_PREFIX}/onboarding/check-remit`, { flowId, amount }, true);
837
+ }
838
+ async queryOnboardingProgress() {
839
+ return this.get(`${API_PREFIX}/onboarding/progress`, {}, true);
840
+ }
841
+ async queryAuthSchedule() {
842
+ return this.get(`${API_PREFIX}/onboarding/auth-schedule`, {}, true);
843
+ }
844
+ async queryCustomerType() {
845
+ return this.get(`${API_PREFIX}/onboarding/customer-type`, {}, true);
846
+ }
847
+ async queryBrandAndAuth(customerType) {
848
+ const body = {};
849
+ if (customerType)
850
+ body.customerType = customerType;
851
+ return this.post(`${API_PREFIX}/onboarding/brand-auth-options`, body, true);
852
+ }
853
+ async getContractList(pageNum, pageSize) {
854
+ const body = {};
855
+ if (pageNum != null)
856
+ body.pageNum = pageNum;
857
+ if (pageSize != null)
858
+ body.pageSize = pageSize;
859
+ return this.post(`${API_PREFIX}/onboarding/contracts`, body, true);
860
+ }
861
+ async getContractSignUrl(contractCode) {
862
+ return this.post(`${API_PREFIX}/onboarding/contract-sign-url`, { contractCode }, true);
863
+ }
598
864
  }
599
865
  //# sourceMappingURL=api-client.js.map