wxpay-nodejs-sdk 0.2.4 → 0.2.6

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/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import crypto from 'node:crypto';
2
+
1
3
  /** 微信支付 API V3 通用响应结构 */
2
4
  interface WxPayResponse<T = unknown> {
3
5
  /** HTTP 状态码 */
@@ -61,6 +63,8 @@ interface WxPayOptions {
61
63
  enableResponseVerification?: boolean;
62
64
  /** 是否启用跨城容灾(主备域名自动切换),默认 true */
63
65
  enableFailover?: boolean;
66
+ /** 自定义 fetch 实现,用于注入代理、自定义超时等场景 */
67
+ customFetch?: typeof fetch;
64
68
  }
65
69
  /** 请求参数基础类型 */
66
70
  type RequestParams = Record<string, string | number | boolean | undefined>;
@@ -607,6 +611,54 @@ interface FundFlowBillResponse {
607
611
  /** 下载地址 */
608
612
  download_url: string;
609
613
  }
614
+ /** 申请单个子商户资金账单请求参数 */
615
+ interface SubMerchantFundFlowBillParams {
616
+ /** 子商户号 */
617
+ sub_mchid: string;
618
+ /** 账单日期,格式 YYYY-MM-DD */
619
+ bill_date: string;
620
+ /** 资金账户类型 */
621
+ account_type?: 'BASIC' | 'OPERATION' | 'ALL';
622
+ /** 账单文件加密算法 */
623
+ algorithm?: 'AEAD_AES_256_GCM';
624
+ /** 压缩方式 */
625
+ tar_type?: 'GZIP';
626
+ [key: string]: unknown;
627
+ }
628
+ /** 加密账单文件信息 */
629
+ interface EncryptBillEntity {
630
+ /** 账单文件序号 */
631
+ bill_sequence: number;
632
+ /** 哈希类型 */
633
+ hash_type: string;
634
+ /** 哈希值 */
635
+ hash_value: string;
636
+ /** 下载地址(5分钟内有效) */
637
+ download_url: string;
638
+ /** 加密密钥(已用商户证书公钥加密) */
639
+ encrypt_key: string;
640
+ /** 随机字符串 */
641
+ nonce: string;
642
+ }
643
+ /** 加密账单响应 */
644
+ interface EncryptBillResponse {
645
+ /** 下载信息总数 */
646
+ download_bill_count: number;
647
+ /** 下载信息明细 */
648
+ download_bill_list: EncryptBillEntity[];
649
+ }
650
+ /** 申请二级商户资金账单请求参数 */
651
+ interface EcommerceFundFlowBillParams {
652
+ /** 账单日期,格式 YYYY-MM-DD */
653
+ bill_date: string;
654
+ /** 资金账户类型(本接口只支持填 ALL) */
655
+ account_type?: 'ALL';
656
+ /** 压缩方式 */
657
+ tar_type?: 'GZIP';
658
+ /** 账单文件加密算法 */
659
+ algorithm?: 'AEAD_AES_256_GCM';
660
+ [key: string]: unknown;
661
+ }
610
662
  /** 回调通知资源 */
611
663
  interface CallbackResource {
612
664
  /** 原始回调类型 */
@@ -4576,6 +4628,125 @@ interface MedInsJsapiBridgeConfig {
4576
4628
  /** 签名 */
4577
4629
  sign: string;
4578
4630
  }
4631
+ interface PartnerJsapiPayer {
4632
+ sp_openid?: string;
4633
+ sub_openid?: string;
4634
+ }
4635
+ interface CreatePartnerJsapiOrderRequest {
4636
+ sp_appid: string;
4637
+ sp_mchid: string;
4638
+ sub_appid?: string;
4639
+ sub_mchid: string;
4640
+ description: string;
4641
+ out_trade_no: string;
4642
+ time_expire?: string;
4643
+ attach?: string;
4644
+ notify_url: string;
4645
+ goods_tag?: string;
4646
+ support_fapiao?: boolean;
4647
+ amount: OrderAmount;
4648
+ payer: PartnerJsapiPayer;
4649
+ detail?: OrderDetail;
4650
+ scene_info?: SceneInfo;
4651
+ settle_info?: SettleInfo;
4652
+ }
4653
+ interface CreatePartnerJsapiOrderResponse {
4654
+ prepay_id: string;
4655
+ }
4656
+ interface CreatePartnerAppOrderRequest {
4657
+ sp_appid: string;
4658
+ sp_mchid: string;
4659
+ sub_appid?: string;
4660
+ sub_mchid: string;
4661
+ description: string;
4662
+ out_trade_no: string;
4663
+ time_expire?: string;
4664
+ attach?: string;
4665
+ notify_url: string;
4666
+ goods_tag?: string;
4667
+ support_fapiao?: boolean;
4668
+ amount: OrderAmount;
4669
+ detail?: OrderDetail;
4670
+ scene_info?: SceneInfo;
4671
+ settle_info?: SettleInfo;
4672
+ }
4673
+ interface CreatePartnerAppOrderResponse {
4674
+ prepay_id: string;
4675
+ }
4676
+ interface PartnerH5SceneInfo {
4677
+ payer_client_ip: string;
4678
+ device_id?: string;
4679
+ store_info?: StoreInfo;
4680
+ h5_info: H5Info;
4681
+ }
4682
+ interface CreatePartnerH5OrderRequest {
4683
+ sp_appid: string;
4684
+ sp_mchid: string;
4685
+ sub_appid?: string;
4686
+ sub_mchid: string;
4687
+ description: string;
4688
+ out_trade_no: string;
4689
+ time_expire?: string;
4690
+ attach?: string;
4691
+ notify_url: string;
4692
+ goods_tag?: string;
4693
+ support_fapiao?: boolean;
4694
+ amount: OrderAmount;
4695
+ detail?: OrderDetail;
4696
+ scene_info: PartnerH5SceneInfo;
4697
+ settle_info?: SettleInfo;
4698
+ }
4699
+ interface CreatePartnerH5OrderResponse {
4700
+ h5_url: string;
4701
+ }
4702
+ interface CreatePartnerNativeOrderRequest {
4703
+ sp_appid: string;
4704
+ sp_mchid: string;
4705
+ sub_appid?: string;
4706
+ sub_mchid: string;
4707
+ description: string;
4708
+ out_trade_no: string;
4709
+ time_expire?: string;
4710
+ attach?: string;
4711
+ notify_url: string;
4712
+ goods_tag?: string;
4713
+ support_fapiao?: boolean;
4714
+ amount: OrderAmount;
4715
+ detail?: OrderDetail;
4716
+ scene_info?: SceneInfo;
4717
+ settle_info?: SettleInfo;
4718
+ }
4719
+ interface CreatePartnerNativeOrderResponse {
4720
+ code_url: string;
4721
+ }
4722
+ interface PartnerQueryOrderParams {
4723
+ out_trade_no?: string;
4724
+ transaction_id?: string;
4725
+ sp_mchid: string;
4726
+ sub_mchid: string;
4727
+ }
4728
+ interface PartnerQueryOrderResponse {
4729
+ sp_appid: string;
4730
+ sp_mchid: string;
4731
+ sub_appid?: string;
4732
+ sub_mchid: string;
4733
+ out_trade_no: string;
4734
+ transaction_id?: string;
4735
+ trade_type?: string;
4736
+ trade_state: string;
4737
+ trade_state_desc: string;
4738
+ bank_type?: string;
4739
+ attach?: string;
4740
+ success_time?: string;
4741
+ payer: PartnerJsapiPayer;
4742
+ amount: OrderAmountResponse;
4743
+ scene_info?: SceneInfoResponse;
4744
+ promotion_detail?: PromotionDetail[];
4745
+ }
4746
+ interface PartnerCloseOrderRequest {
4747
+ sp_mchid: string;
4748
+ sub_mchid: string;
4749
+ }
4579
4750
 
4580
4751
  /**
4581
4752
  * 自动更新配置选项
@@ -4633,11 +4804,21 @@ declare class CertificateManager {
4633
4804
  * 获取用于验签的公钥
4634
4805
  *
4635
4806
  * 优先返回微信支付公钥(公钥模式),否则根据证书序列号查找平台证书。
4807
+ * 在组合模式下,如果证书未找到,会回退到微信支付公钥。
4636
4808
  *
4637
4809
  * @param serialNo - 证书序列号或公钥ID
4638
4810
  * @returns PEM 格式的公钥,不存在则返回 null
4639
4811
  */
4640
4812
  getPublicKey(serialNo: string): string | null;
4813
+ /**
4814
+ * 判断当前是否为组合验签模式
4815
+ *
4816
+ * 当同时配置了微信支付公钥和平台证书时,返回 true。
4817
+ * 组合模式用于平台证书→微信支付公钥的灰度迁移期间。
4818
+ *
4819
+ * @returns 是否为组合模式
4820
+ */
4821
+ isCombinedMode(): boolean;
4641
4822
  /**
4642
4823
  * 更新平台证书
4643
4824
  */
@@ -4703,8 +4884,6 @@ declare class WxPayClient {
4703
4884
  private static readonly PRODUCTION_BACKUP;
4704
4885
  /** 沙箱环境 API 地址 */
4705
4886
  private static readonly SANDBOX_BASE;
4706
- /** SDK 版本号 */
4707
- private static readonly SDK_VERSION;
4708
4887
  /** 动态 User-Agent 字符串 */
4709
4888
  private static readonly USER_AGENT;
4710
4889
  /** 商户号 */
@@ -4716,6 +4895,7 @@ declare class WxPayClient {
4716
4895
  private readonly baseUrl;
4717
4896
  private readonly backupUrl;
4718
4897
  private readonly enableResponseVerification;
4898
+ private readonly customFetch;
4719
4899
  /** 平台证书管理器 */
4720
4900
  readonly certificates: CertificateManager;
4721
4901
  constructor(options: WxPayOptions);
@@ -4996,104 +5176,109 @@ declare class CertificateService {
4996
5176
  }
4997
5177
 
4998
5178
  /**
4999
- * JSAPI 支付 / 小程序支付 服务
5179
+ * 基础支付服务抽象类
5000
5180
  *
5001
- * 提供 JSAPI 支付全流程相关的 API 封装,包括:
5002
- * - JSAPI/小程序下单
5003
- * - 查询订单
5004
- * - 关闭订单
5005
- * - 申请退款
5006
- * - 查询退款
5007
- * - 申请异常退款
5008
- * - 申请交易账单
5009
- * - 申请资金账单
5010
- * - 下载账单
5181
+ * 提供所有支付渠道通用的查询、退款、账单等方法,避免代码重复。
5182
+ * 子类只需实现 createOrder 方法即可获得完整的支付服务能力。
5011
5183
  */
5012
- declare class JsapiService {
5013
- private readonly client;
5184
+ declare abstract class BasePaymentService {
5185
+ protected readonly client: WxPayClient;
5014
5186
  constructor(client: WxPayClient);
5015
5187
  /**
5016
- * JSAPI/小程序下单
5017
- *
5018
- * 商户通过此接口生成预付单并获取 prepay_id。
5019
- * prepay_id 有效期为 2 小时,超过 2 小时需重新请求。
5020
- *
5021
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791856
5022
- */
5023
- createOrder(request: CreateJsapiOrderRequest): Promise<WxPayResponse<CreateJsapiOrderResponse>>;
5024
- /**
5025
- * 查询 JSAPI 支付订单
5188
+ * 查询订单
5026
5189
  *
5027
5190
  * 支持通过微信支付订单号或商户订单号查询订单状态。
5028
- *
5029
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791858 (微信支付订单号查询订单)
5030
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791859 (商户订单号查询订单)
5031
5191
  */
5032
5192
  queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5193
+ /**
5194
+ * 通过商户订单号查询订单
5195
+ */
5196
+ queryOrderByOutTradeNo(outTradeNo: string): Promise<WxPayResponse<QueryOrderResponse>>;
5197
+ /**
5198
+ * 通过微信支付订单号查询订单
5199
+ */
5200
+ queryOrderByTransactionId(transactionId: string): Promise<WxPayResponse<QueryOrderResponse>>;
5033
5201
  /**
5034
5202
  * 关闭订单
5035
5203
  *
5036
5204
  * 对于未支付的订单,商户可通过此接口关闭订单。
5037
- * 关单后,订单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5038
- *
5039
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791860
5040
5205
  */
5041
5206
  closeOrder(outTradeNo: string, request: CloseOrderRequest): Promise<WxPayResponse>;
5042
5207
  /**
5043
5208
  * 申请退款
5044
5209
  *
5045
5210
  * 当订单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5046
- * 仅支持支付成功后 1 年内的订单。
5047
- *
5048
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791862
5049
5211
  */
5050
5212
  createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5051
5213
  /**
5052
5214
  * 查询退款单
5053
5215
  *
5054
5216
  * 通过商户退款单号查询退款状态。
5055
- *
5056
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791863
5057
5217
  */
5058
5218
  queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5219
+ /**
5220
+ * 申请异常退款
5221
+ *
5222
+ * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5223
+ */
5224
+ applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5059
5225
  /**
5060
5226
  * 申请交易账单
5061
5227
  *
5062
5228
  * 商户可通过此接口获取交易账单的下载链接。
5063
- *
5064
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791866
5065
5229
  */
5066
5230
  tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5067
5231
  /**
5068
5232
  * 申请资金账单
5069
5233
  *
5070
5234
  * 商户可通过此接口获取资金账单的下载链接。
5071
- *
5072
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791867
5073
5235
  */
5074
5236
  fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5075
5237
  /**
5076
- * 申请异常退款
5238
+ * 下载账单
5077
5239
  *
5078
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5079
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5240
+ * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5241
+ */
5242
+ downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5243
+ }
5244
+
5245
+ /**
5246
+ * JSAPI 支付 / 小程序支付 服务
5247
+ *
5248
+ * 提供 JSAPI 支付全流程相关的 API 封装,包括:
5249
+ * - JSAPI/小程序下单
5250
+ * - 查询订单
5251
+ * - 关闭订单
5252
+ * - 申请退款
5253
+ * - 查询退款
5254
+ * - 申请异常退款
5255
+ * - 申请交易账单
5256
+ * - 申请资金账单
5257
+ * - 下载账单
5258
+ */
5259
+ declare class JsapiService extends BasePaymentService {
5260
+ /**
5261
+ * JSAPI/小程序下单
5080
5262
  *
5081
- * @param refundId - 微信支付退款单号
5082
- * @param request - 异常退款请求参数
5083
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791864
5263
+ * 商户通过此接口生成预付单并获取 prepay_id。
5264
+ * prepay_id 有效期为 2 小时,超过 2 小时需重新请求。
5265
+ *
5266
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791856
5084
5267
  */
5085
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5268
+ createOrder(request: CreateJsapiOrderRequest): Promise<WxPayResponse<CreateJsapiOrderResponse>>;
5086
5269
  /**
5087
- * 下载账单
5270
+ * JSAPI 下单并生成调起支付参数
5088
5271
  *
5089
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5090
- * 下载地址 5 分钟内有效,请及时下载。
5091
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5272
+ * 封装了下单和调起支付参数生成两个步骤,一次调用即可获得
5273
+ * prepay_id 和前端 WeixinJSBridge.invoke() 所需的全部参数。
5092
5274
  *
5093
- * @param downloadUrl - 申请账单返回的 download_url
5094
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791868
5275
+ * @param request - 下单请求参数(需包含 appid)
5276
+ * @param privateKey - 商户私钥
5277
+ * @returns 下单响应 + 调起支付参数
5095
5278
  */
5096
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5279
+ prepayWithRequestPayment(request: CreateJsapiOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreateJsapiOrderResponse> & {
5280
+ bridgeConfig: JsapiBridgeConfig;
5281
+ }>;
5097
5282
  }
5098
5283
 
5099
5284
  /**
@@ -5112,9 +5297,7 @@ declare class JsapiService {
5112
5297
  *
5113
5298
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791834
5114
5299
  */
5115
- declare class H5Service {
5116
- private readonly client;
5117
- constructor(client: WxPayClient);
5300
+ declare class H5Service extends BasePaymentService {
5118
5301
  /**
5119
5302
  * H5 支付下单
5120
5303
  *
@@ -5124,79 +5307,6 @@ declare class H5Service {
5124
5307
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791834
5125
5308
  */
5126
5309
  createOrder(request: CreateH5OrderRequest): Promise<WxPayResponse<CreateH5OrderResponse>>;
5127
- /**
5128
- * 查询订单
5129
- *
5130
- * 支持通过微信支付订单号或商户订单号查询订单状态。
5131
- *
5132
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791837 (微信支付订单号查询订单)
5133
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791838 (商户订单号查询订单)
5134
- */
5135
- queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5136
- /**
5137
- * 关闭订单
5138
- *
5139
- * 对于未支付的订单,商户可通过此接口关闭订单。
5140
- * 关单后,订单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5141
- *
5142
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791839
5143
- */
5144
- closeOrder(outTradeNo: string, request: CloseOrderRequest): Promise<WxPayResponse>;
5145
- /**
5146
- * 申请退款
5147
- *
5148
- * 当订单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5149
- * 仅支持支付成功后 1 年内的订单。
5150
- *
5151
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810597
5152
- */
5153
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5154
- /**
5155
- * 查询退款单
5156
- *
5157
- * 通过商户退款单号查询退款状态。
5158
- *
5159
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810601
5160
- */
5161
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5162
- /**
5163
- * 申请异常退款
5164
- *
5165
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5166
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5167
- *
5168
- * @param refundId - 微信支付退款单号
5169
- * @param request - 异常退款请求参数
5170
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810603
5171
- */
5172
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5173
- /**
5174
- * 申请交易账单
5175
- *
5176
- * 商户可通过此接口获取交易账单的下载链接。
5177
- *
5178
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810606
5179
- */
5180
- tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5181
- /**
5182
- * 申请资金账单
5183
- *
5184
- * 商户可通过此接口获取资金账单的下载链接。
5185
- *
5186
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810609
5187
- */
5188
- fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5189
- /**
5190
- * 下载账单
5191
- *
5192
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5193
- * 下载地址 5 分钟内有效,请及时下载。
5194
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5195
- *
5196
- * @param downloadUrl - 申请账单返回的 download_url
5197
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012810615
5198
- */
5199
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5200
5310
  }
5201
5311
 
5202
5312
  /**
@@ -5215,9 +5325,7 @@ declare class H5Service {
5215
5325
  *
5216
5326
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070347
5217
5327
  */
5218
- declare class AppService {
5219
- private readonly client;
5220
- constructor(client: WxPayClient);
5328
+ declare class AppService extends BasePaymentService {
5221
5329
  /**
5222
5330
  * APP 支付下单
5223
5331
  *
@@ -5228,78 +5336,18 @@ declare class AppService {
5228
5336
  */
5229
5337
  createOrder(request: CreateAppOrderRequest): Promise<WxPayResponse<CreateAppOrderResponse>>;
5230
5338
  /**
5231
- * 查询订单
5339
+ * APP 下单并生成调起支付参数
5232
5340
  *
5233
- * 支持通过微信支付订单号或商户订单号查询订单状态。
5341
+ * 封装了下单和调起支付参数生成两个步骤,一次调用即可获得
5342
+ * prepay_id 和 APP 端调起支付所需的全部参数。
5234
5343
  *
5235
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070354 (微信支付订单号查询订单)
5236
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070356 (商户订单号查询订单)
5344
+ * @param request - 下单请求参数(需包含 appid)
5345
+ * @param privateKey - 商户私钥
5346
+ * @returns 下单响应 + 调起支付参数
5237
5347
  */
5238
- queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5239
- /**
5240
- * 关闭订单
5241
- *
5242
- * 对于未支付的订单,商户可通过此接口关闭订单。
5243
- * 关单后,订单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5244
- *
5245
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070360
5246
- */
5247
- closeOrder(outTradeNo: string, request: CloseOrderRequest): Promise<WxPayResponse>;
5248
- /**
5249
- * 申请退款
5250
- *
5251
- * 当订单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5252
- * 仅支持支付成功后 1 年内的订单。
5253
- *
5254
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070371
5255
- */
5256
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5257
- /**
5258
- * 查询退款单
5259
- *
5260
- * 通过商户退款单号查询退款状态。
5261
- *
5262
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070374
5263
- */
5264
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5265
- /**
5266
- * 申请异常退款
5267
- *
5268
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5269
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5270
- *
5271
- * @param refundId - 微信支付退款单号
5272
- * @param request - 异常退款请求参数
5273
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070379
5274
- */
5275
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5276
- /**
5277
- * 申请交易账单
5278
- *
5279
- * 商户可通过此接口获取交易账单的下载链接。
5280
- *
5281
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070395
5282
- */
5283
- tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5284
- /**
5285
- * 申请资金账单
5286
- *
5287
- * 商户可通过此接口获取资金账单的下载链接。
5288
- *
5289
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070400
5290
- */
5291
- fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5292
- /**
5293
- * 下载账单
5294
- *
5295
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5296
- * 下载地址 5 分钟内有效,请及时下载。
5297
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5298
- *
5299
- * @param downloadUrl - 申请账单返回的 download_url
5300
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070401
5301
- */
5302
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5348
+ prepayWithRequestPayment(request: CreateAppOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreateAppOrderResponse> & {
5349
+ bridgeConfig: AppBridgeConfig;
5350
+ }>;
5303
5351
  }
5304
5352
 
5305
5353
  /**
@@ -5318,9 +5366,7 @@ declare class AppService {
5318
5366
  *
5319
5367
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791877
5320
5368
  */
5321
- declare class NativeService {
5322
- private readonly client;
5323
- constructor(client: WxPayClient);
5369
+ declare class NativeService extends BasePaymentService {
5324
5370
  /**
5325
5371
  * Native 支付下单
5326
5372
  *
@@ -5333,77 +5379,63 @@ declare class NativeService {
5333
5379
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791877
5334
5380
  */
5335
5381
  createOrder(request: CreateNativeOrderRequest): Promise<WxPayResponse<CreateNativeOrderResponse>>;
5382
+ }
5383
+
5384
+ /**
5385
+ * 合单支付服务抽象类
5386
+ *
5387
+ * 提供所有合单支付渠道通用的查询、关闭、退款、账单等方法,避免代码重复。
5388
+ * 子类只需实现 createOrder 方法即可获得完整的合单支付服务能力。
5389
+ */
5390
+ declare abstract class BaseCombineService {
5391
+ protected readonly client: WxPayClient;
5392
+ constructor(client: WxPayClient);
5336
5393
  /**
5337
- * 查询订单
5338
- *
5339
- * 支持通过微信支付订单号或商户订单号查询订单状态。
5394
+ * 查询合单订单
5340
5395
  *
5341
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791879 (微信支付订单号查询订单)
5342
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791880 (商户订单号查询订单)
5396
+ * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
5343
5397
  */
5344
- queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5398
+ queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
5345
5399
  /**
5346
- * 关闭订单
5347
- *
5348
- * 对于未支付的订单,商户可通过此接口关闭订单。
5349
- * 关单后,订单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5400
+ * 关闭合单订单
5350
5401
  *
5351
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791881
5402
+ * 对于未支付的合单订单,商户可通过此接口关闭订单。
5352
5403
  */
5353
- closeOrder(outTradeNo: string, request: CloseOrderRequest): Promise<WxPayResponse>;
5404
+ closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
5354
5405
  /**
5355
5406
  * 申请退款
5356
5407
  *
5357
- * 当订单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5358
- * 仅支持支付成功后 1 年内的订单。
5359
- *
5360
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791883
5408
+ * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口对子单申请退款。
5361
5409
  */
5362
5410
  createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5363
5411
  /**
5364
5412
  * 查询退款单
5365
5413
  *
5366
5414
  * 通过商户退款单号查询退款状态。
5367
- *
5368
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791884
5369
5415
  */
5370
5416
  queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5371
5417
  /**
5372
5418
  * 申请异常退款
5373
5419
  *
5374
5420
  * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5375
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5376
- *
5377
- * @param refundId - 微信支付退款单号
5378
- * @param request - 异常退款请求参数
5379
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791885
5380
5421
  */
5381
5422
  applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5382
5423
  /**
5383
5424
  * 申请交易账单
5384
5425
  *
5385
5426
  * 商户可通过此接口获取交易账单的下载链接。
5386
- *
5387
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791887
5388
5427
  */
5389
5428
  tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5390
5429
  /**
5391
5430
  * 申请资金账单
5392
5431
  *
5393
5432
  * 商户可通过此接口获取资金账单的下载链接。
5394
- *
5395
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791888
5396
5433
  */
5397
5434
  fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5398
5435
  /**
5399
5436
  * 下载账单
5400
5437
  *
5401
5438
  * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5402
- * 下载地址 5 分钟内有效,请及时下载。
5403
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5404
- *
5405
- * @param downloadUrl - 申请账单返回的 download_url
5406
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791889
5407
5439
  */
5408
5440
  downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5409
5441
  }
@@ -5418,6 +5450,9 @@ declare class NativeService {
5418
5450
  * - 申请退款
5419
5451
  * - 查询退款
5420
5452
  * - 申请异常退款
5453
+ * - 申请交易账单
5454
+ * - 申请资金账单
5455
+ * - 下载账单
5421
5456
  *
5422
5457
  * 合单支付允许一笔支付中包含 2-10 个子单,适用于多商户场景。
5423
5458
  * 各子单商户号需与合单发起方 APPID 绑定。
@@ -5429,9 +5464,7 @@ declare class NativeService {
5429
5464
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421222 (查询合单订单)
5430
5465
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421225 (关闭合单订单)
5431
5466
  */
5432
- declare class CombineService {
5433
- private readonly client;
5434
- constructor(client: WxPayClient);
5467
+ declare class CombineService extends BaseCombineService {
5435
5468
  /**
5436
5469
  * JSAPI 合单下单
5437
5470
  *
@@ -5448,66 +5481,6 @@ declare class CombineService {
5448
5481
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556926
5449
5482
  */
5450
5483
  createOrder(request: CreateCombineOrderRequest): Promise<WxPayResponse<CreateCombineOrderResponse>>;
5451
- /**
5452
- * 查询合单订单
5453
- *
5454
- * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
5455
- *
5456
- * 订单状态(sub_orders[].trade_state):
5457
- * - SUCCESS:支付成功(终态)
5458
- * - NOTPAY:未支付
5459
- * - CLOSED:已关闭(终态)
5460
- *
5461
- * 注意:请勿使用非合单支付的查单接口查询合单订单。
5462
- *
5463
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421222
5464
- */
5465
- queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
5466
- /**
5467
- * 关闭合单订单
5468
- *
5469
- * 对于未支付的合单订单,商户可通过此接口关闭订单。
5470
- * 关单后,所有子单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5471
- *
5472
- * 关键约束:
5473
- * - 只能整单关闭,不支持关闭部分子单
5474
- * - combine_appid、sub_orders 中的 mchid 和 out_trade_no 必须与下单时完全一致
5475
- * - 仅支持未支付状态的订单
5476
- *
5477
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421225
5478
- */
5479
- closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
5480
- /**
5481
- * 申请退款
5482
- *
5483
- * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口对子单申请退款。
5484
- * 仅支持支付成功后 1 年内的订单。
5485
- *
5486
- * 注意:合单支付的订单无法通过合单总单号 combine_out_trade_no 退款,
5487
- * 需要传入子单的 transaction_id 或 out_trade_no。
5488
- *
5489
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421249
5490
- */
5491
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5492
- /**
5493
- * 查询退款单
5494
- *
5495
- * 通过商户退款单号查询退款状态。
5496
- *
5497
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421261
5498
- */
5499
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5500
- /**
5501
- * 申请异常退款
5502
- *
5503
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5504
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5505
- *
5506
- * @param refundId - 微信支付退款单号
5507
- * @param request - 异常退款请求参数
5508
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421269
5509
- */
5510
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5511
5484
  }
5512
5485
 
5513
5486
  /**
@@ -5520,6 +5493,9 @@ declare class CombineService {
5520
5493
  * - 申请退款(基于子单)
5521
5494
  * - 查询退款单
5522
5495
  * - 申请异常退款
5496
+ * - 申请交易账单
5497
+ * - 申请资金账单
5498
+ * - 下载账单
5523
5499
  *
5524
5500
  * 合单支付允许一笔支付中包含 2-10 个子单,适用于多商户场景。
5525
5501
  * 各子单商户号需与合单发起方 APPID 绑定。
@@ -5536,9 +5512,7 @@ declare class CombineService {
5536
5512
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421148 (合单退款)
5537
5513
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421156 (查询退款单)
5538
5514
  */
5539
- declare class CombineH5Service {
5540
- private readonly client;
5541
- constructor(client: WxPayClient);
5515
+ declare class CombineH5Service extends BaseCombineService {
5542
5516
  /**
5543
5517
  * H5 合单下单
5544
5518
  *
@@ -5558,83 +5532,6 @@ declare class CombineH5Service {
5558
5532
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556961
5559
5533
  */
5560
5534
  createOrder(request: CreateH5CombineOrderRequest): Promise<WxPayResponse<CreateH5CombineOrderResponse>>;
5561
- /**
5562
- * 查询合单订单
5563
- *
5564
- * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
5565
- * 合单支付订单需使用合单查单接口,不可使用非合单支付的查单接口。
5566
- *
5567
- * 订单状态(sub_orders[].trade_state):
5568
- * - SUCCESS:支付成功(终态)
5569
- * - NOTPAY:未支付
5570
- * - CLOSED:已关闭(终态)
5571
- *
5572
- * 典型使用场景:
5573
- * - 用户支付后从收银台返回商户页面时,确认订单支付状态
5574
- * - 未收到支付成功回调通知时,主动查询确认订单状态
5575
- * - 关单前确认订单仍为未支付状态
5576
- *
5577
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421126
5578
- */
5579
- queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
5580
- /**
5581
- * 关闭合单订单
5582
- *
5583
- * 对于未支付的合单订单,商户可通过此接口关闭订单。
5584
- * 关单后,所有子单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5585
- *
5586
- * 关键约束:
5587
- * - 只能整单关闭,不支持关闭部分子单
5588
- * - combine_appid、sub_orders 中的 mchid 和 out_trade_no 必须与下单时完全一致
5589
- * - 仅支持未支付状态的订单
5590
- * - 关单后订单为失败终态
5591
- *
5592
- * 典型使用场景:
5593
- * - 用户超过商户系统内部规定的支付时间
5594
- * - 超过下单时设置的 time_expire 时间
5595
- * - 因特殊原因需在可支付时间范围内关闭订单
5596
- *
5597
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421130
5598
- */
5599
- closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
5600
- /**
5601
- * 申请退款(基于子单)
5602
- *
5603
- * 合单支付的订单退款,无法通过合单商户订单号(combine_out_trade_no)退款,
5604
- * 只能根据单个子单进行退款。传入子单的 out_trade_no 或 transaction_id。
5605
- *
5606
- * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5607
- * 仅支持支付成功后 1 年内的订单。
5608
- *
5609
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421148
5610
- */
5611
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5612
- /**
5613
- * 查询退款单
5614
- *
5615
- * 通过商户退款单号查询退款状态。
5616
- * 退款申请成功后,可通过此接口确认退款是否到账。
5617
- *
5618
- * 退款状态:
5619
- * - SUCCESS:退款成功
5620
- * - CLOSED:退款关闭
5621
- * - PROCESSING:退款处理中
5622
- * - ABNORMAL:退款异常
5623
- *
5624
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421156
5625
- */
5626
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5627
- /**
5628
- * 申请异常退款
5629
- *
5630
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5631
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5632
- *
5633
- * @param refundId - 微信支付退款单号
5634
- * @param request - 异常退款请求参数
5635
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421164
5636
- */
5637
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5638
5535
  }
5639
5536
 
5640
5537
  /**
@@ -5667,9 +5564,7 @@ declare class CombineH5Service {
5667
5564
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556587 (查询退款单)
5668
5565
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556692 (下载交易账单)
5669
5566
  */
5670
- declare class CombineAppService {
5671
- private readonly client;
5672
- constructor(client: WxPayClient);
5567
+ declare class CombineAppService extends BaseCombineService {
5673
5568
  /**
5674
5569
  * APP 合单下单
5675
5570
  *
@@ -5690,118 +5585,6 @@ declare class CombineAppService {
5690
5585
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556944
5691
5586
  */
5692
5587
  createOrder(request: CreateAppCombineOrderRequest): Promise<WxPayResponse<CreateAppCombineOrderResponse>>;
5693
- /**
5694
- * 查询合单订单
5695
- *
5696
- * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
5697
- * 合单支付订单需使用合单查单接口,不可使用非合单支付的查单接口。
5698
- *
5699
- * 订单状态(sub_orders[].trade_state):
5700
- * - SUCCESS:支付成功(终态)
5701
- * - NOTPAY:未支付
5702
- * - CLOSED:已关闭(终态)
5703
- *
5704
- * 典型使用场景:
5705
- * - 用户支付后从微信收银台返回商户 APP 时,OpenSDK 回调 onResp 后确认订单支付状态
5706
- * - 未收到支付成功回调通知时,主动查询确认订单状态
5707
- * - 关单前确认订单仍为未支付状态
5708
- *
5709
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012557006
5710
- */
5711
- queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
5712
- /**
5713
- * 关闭合单订单
5714
- *
5715
- * 对于未支付的合单订单,商户可通过此接口关闭订单。
5716
- * 关单后,所有子单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5717
- *
5718
- * 关键约束:
5719
- * - 只能整单关闭,不支持关闭部分子单
5720
- * - combine_appid、sub_orders 中的 mchid 和 out_trade_no 必须与下单时完全一致
5721
- * - 仅支持未支付状态的订单
5722
- * - 关单后订单为失败终态
5723
- *
5724
- * 典型使用场景:
5725
- * - 用户超过商户系统内部规定的支付时间
5726
- * - 超过下单时设置的 time_expire 时间
5727
- * - 因特殊原因需在可支付时间范围内关闭订单
5728
- *
5729
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012577452
5730
- */
5731
- closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
5732
- /**
5733
- * 申请退款(基于子单)
5734
- *
5735
- * 合单支付的订单退款,无法通过合单商户订单号(combine_out_trade_no)退款,
5736
- * 只能根据单个子单进行退款。传入子单的 out_trade_no 或 transaction_id。
5737
- *
5738
- * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5739
- * 仅支持支付成功后 1 年内的订单。
5740
- *
5741
- * 注意:
5742
- * - 一笔订单最多支持 50 次部分退款,间隔至少 1 分钟
5743
- * - 重试时必须使用原商户退款单号,避免重复退款
5744
- * - 接口返回成功仅表示受理成功,最终结果以回调通知和查询接口为准
5745
- *
5746
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556524
5747
- */
5748
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5749
- /**
5750
- * 查询退款单
5751
- *
5752
- * 通过商户退款单号查询退款状态。
5753
- * 退款申请成功后,可通过此接口确认退款是否到账。
5754
- *
5755
- * 退款状态:
5756
- * - SUCCESS:退款成功
5757
- * - CLOSED:退款关闭
5758
- * - PROCESSING:退款处理中
5759
- * - ABNORMAL:退款异常
5760
- *
5761
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556587
5762
- */
5763
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5764
- /**
5765
- * 申请异常退款
5766
- *
5767
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5768
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5769
- *
5770
- * @param refundId - 微信支付退款单号
5771
- * @param request - 异常退款请求参数
5772
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013420988
5773
- */
5774
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5775
- /**
5776
- * 申请交易账单
5777
- *
5778
- * 合单支付的订单账单是以子单为维度,每笔子单都会记录在各个子单商户账单内,
5779
- * 需要各个子单商户自己进行下载。
5780
- *
5781
- * 商户可通过此接口获取交易账单的下载链接,下载地址 5 分钟内有效。
5782
- *
5783
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556692
5784
- */
5785
- tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5786
- /**
5787
- * 申请资金账单
5788
- *
5789
- * 商户可通过此接口获取资金账单的下载链接,下载地址 5 分钟内有效。
5790
- *
5791
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556748
5792
- */
5793
- fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5794
- /**
5795
- * 下载账单
5796
- *
5797
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5798
- * 下载地址 5 分钟内有效,请及时下载。
5799
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5800
- *
5801
- * @param downloadUrl - 申请账单返回的 download_url
5802
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012085923
5803
- */
5804
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5805
5588
  }
5806
5589
 
5807
5590
  /**
@@ -5834,9 +5617,7 @@ declare class CombineAppService {
5834
5617
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421421 (查询退款单)
5835
5618
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421450 (下载交易账单)
5836
5619
  */
5837
- declare class CombineMiniProgramService {
5838
- private readonly client;
5839
- constructor(client: WxPayClient);
5620
+ declare class CombineMiniProgramService extends BaseCombineService {
5840
5621
  /**
5841
5622
  * 小程序合单下单
5842
5623
  *
@@ -5858,118 +5639,6 @@ declare class CombineMiniProgramService {
5858
5639
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556931
5859
5640
  */
5860
5641
  createOrder(request: CreateMiniProgramCombineOrderRequest): Promise<WxPayResponse<CreateMiniProgramCombineOrderResponse>>;
5861
- /**
5862
- * 查询合单订单
5863
- *
5864
- * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
5865
- * 合单支付订单需使用合单查单接口,不可使用非合单支付的查单接口。
5866
- *
5867
- * 订单状态(sub_orders[].trade_state):
5868
- * - SUCCESS:支付成功(终态)
5869
- * - NOTPAY:未支付
5870
- * - CLOSED:已关闭(终态)
5871
- *
5872
- * 典型使用场景:
5873
- * - 用户支付后从收银台返回小程序页面时,requestPayment 回调后确认订单支付状态
5874
- * - 未收到支付成功回调通知时,主动查询确认订单状态
5875
- * - 关单前确认订单仍为未支付状态
5876
- *
5877
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421401
5878
- */
5879
- queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
5880
- /**
5881
- * 关闭合单订单
5882
- *
5883
- * 对于未支付的合单订单,商户可通过此接口关闭订单。
5884
- * 关单后,所有子单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
5885
- *
5886
- * 关键约束:
5887
- * - 只能整单关闭,不支持关闭部分子单
5888
- * - combine_appid、sub_orders 中的 mchid 和 out_trade_no 必须与下单时完全一致
5889
- * - 仅支持未支付状态的订单
5890
- * - 关单后订单为失败终态
5891
- *
5892
- * 典型使用场景:
5893
- * - 用户超过商户系统内部规定的支付时间
5894
- * - 超过下单时设置的 time_expire 时间
5895
- * - 因特殊原因需在可支付时间范围内关闭订单
5896
- *
5897
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421404
5898
- */
5899
- closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
5900
- /**
5901
- * 申请退款(基于子单)
5902
- *
5903
- * 合单支付的订单退款,无法通过合单商户订单号(combine_out_trade_no)退款,
5904
- * 只能根据单个子单进行退款。传入子单的 out_trade_no 或 transaction_id。
5905
- *
5906
- * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
5907
- * 仅支持支付成功后 1 年内的订单。
5908
- *
5909
- * 注意:
5910
- * - 一笔订单最多支持 50 次部分退款,间隔至少 1 分钟
5911
- * - 重试时必须使用原商户退款单号,避免重复退款
5912
- * - 接口返回成功仅表示受理成功,最终结果以回调通知和查询接口为准
5913
- *
5914
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421410
5915
- */
5916
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
5917
- /**
5918
- * 查询退款单
5919
- *
5920
- * 通过商户退款单号查询退款状态。
5921
- * 退款申请成功后,可通过此接口确认退款是否到账。
5922
- *
5923
- * 退款状态:
5924
- * - SUCCESS:退款成功
5925
- * - CLOSED:退款关闭
5926
- * - PROCESSING:退款处理中
5927
- * - ABNORMAL:退款异常
5928
- *
5929
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421421
5930
- */
5931
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
5932
- /**
5933
- * 申请异常退款
5934
- *
5935
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
5936
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
5937
- *
5938
- * @param refundId - 微信支付退款单号
5939
- * @param request - 异常退款请求参数
5940
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421429
5941
- */
5942
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
5943
- /**
5944
- * 申请交易账单
5945
- *
5946
- * 合单支付的订单账单是以子单为维度,每笔子单都会记录在各个子单商户账单内,
5947
- * 需要各个子单商户自己进行下载。
5948
- *
5949
- * 商户可通过此接口获取交易账单的下载链接,下载地址 5 分钟内有效。
5950
- *
5951
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421450
5952
- */
5953
- tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
5954
- /**
5955
- * 申请资金账单
5956
- *
5957
- * 商户可通过此接口获取资金账单的下载链接,下载地址 5 分钟内有效。
5958
- *
5959
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421456
5960
- */
5961
- fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
5962
- /**
5963
- * 下载账单
5964
- *
5965
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
5966
- * 下载地址 5 分钟内有效,请及时下载。
5967
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
5968
- *
5969
- * @param downloadUrl - 申请账单返回的 download_url
5970
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421461
5971
- */
5972
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
5973
5642
  }
5974
5643
 
5975
5644
  /**
@@ -6003,9 +5672,7 @@ declare class CombineMiniProgramService {
6003
5672
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421346 (查询退款单)
6004
5673
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421361 (下载交易账单)
6005
5674
  */
6006
- declare class CombineNativeService {
6007
- private readonly client;
6008
- constructor(client: WxPayClient);
5675
+ declare class CombineNativeService extends BaseCombineService {
6009
5676
  /**
6010
5677
  * Native 合单下单
6011
5678
  *
@@ -6027,118 +5694,6 @@ declare class CombineNativeService {
6027
5694
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012556982
6028
5695
  */
6029
5696
  createOrder(request: CreateNativeCombineOrderRequest): Promise<WxPayResponse<CreateNativeCombineOrderResponse>>;
6030
- /**
6031
- * 查询合单订单
6032
- *
6033
- * 通过合单商户订单号查询合单订单的支付状态及各子单详情。
6034
- * 合单支付订单需使用合单查单接口,不可使用非合单支付的查单接口。
6035
- *
6036
- * 订单状态(sub_orders[].trade_state):
6037
- * - SUCCESS:支付成功(终态)
6038
- * - NOTPAY:未支付
6039
- * - CLOSED:已关闭(终态)
6040
- *
6041
- * 典型使用场景:
6042
- * - 用户扫码支付后,轮询确认订单支付状态
6043
- * - 未收到支付成功回调通知时,主动查询确认订单状态
6044
- * - 关单前确认订单仍为未支付状态
6045
- *
6046
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421316
6047
- */
6048
- queryOrderById(params: QueryCombineOrderParams): Promise<WxPayResponse<QueryCombineOrderResponse>>;
6049
- /**
6050
- * 关闭合单订单
6051
- *
6052
- * 对于未支付的合单订单,商户可通过此接口关闭订单。
6053
- * 关单后,所有子单状态从未支付(NOTPAY)流转为已关闭(CLOSED)。
6054
- *
6055
- * 关键约束:
6056
- * - 只能整单关闭,不支持关闭部分子单
6057
- * - combine_appid、sub_orders 中的 mchid 和 out_trade_no 必须与下单时完全一致
6058
- * - 仅支持未支付状态的订单
6059
- * - 关单后订单为失败终态
6060
- *
6061
- * 典型使用场景:
6062
- * - 用户超过商户系统内部规定的支付时间
6063
- * - 超过下单时设置的 time_expire 时间
6064
- * - 因特殊原因需在可支付时间范围内关闭订单
6065
- *
6066
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421330
6067
- */
6068
- closeOrder(params: CloseCombineOrderParams, request: CloseCombineOrderRequest): Promise<WxPayResponse>;
6069
- /**
6070
- * 申请退款(基于子单)
6071
- *
6072
- * 合单支付的订单退款,无法通过合单商户订单号(combine_out_trade_no)退款,
6073
- * 只能根据单个子单进行退款。传入子单的 out_trade_no 或 transaction_id。
6074
- *
6075
- * 当子单状态为支付成功(SUCCESS)时,商户可通过此接口申请退款。
6076
- * 仅支持支付成功后 1 年内的订单。
6077
- *
6078
- * 注意:
6079
- * - 一笔订单最多支持 50 次部分退款,间隔至少 1 分钟
6080
- * - 重试时必须使用原商户退款单号,避免重复退款
6081
- * - 接口返回成功仅表示受理成功,最终结果以回调通知和查询接口为准
6082
- *
6083
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421340
6084
- */
6085
- createRefund(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
6086
- /**
6087
- * 查询退款单
6088
- *
6089
- * 通过商户退款单号查询退款状态。
6090
- * 退款申请成功后,可通过此接口确认退款是否到账。
6091
- *
6092
- * 退款状态:
6093
- * - SUCCESS:退款成功
6094
- * - CLOSED:退款关闭
6095
- * - PROCESSING:退款处理中
6096
- * - ABNORMAL:退款异常
6097
- *
6098
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421346
6099
- */
6100
- queryRefund(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
6101
- /**
6102
- * 申请异常退款
6103
- *
6104
- * 当退款状态为 ABNORMAL 时,可通过此接口发起异常退款处理。
6105
- * 支持退款至用户银行卡或退款至交易商户银行账户两种方式。
6106
- *
6107
- * @param refundId - 微信支付退款单号
6108
- * @param request - 异常退款请求参数
6109
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421352
6110
- */
6111
- applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
6112
- /**
6113
- * 申请交易账单
6114
- *
6115
- * 合单支付的订单账单是以子单为维度,每笔子单都会记录在各个子单商户账单内,
6116
- * 需要各个子单商户自己进行下载。
6117
- *
6118
- * 商户可通过此接口获取交易账单的下载链接,下载地址 5 分钟内有效。
6119
- *
6120
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421361
6121
- */
6122
- tradeBill(params: TradeBillParams): Promise<WxPayResponse<TradeBillResponse>>;
6123
- /**
6124
- * 申请资金账单
6125
- *
6126
- * 商户可通过此接口获取资金账单的下载链接,下载地址 5 分钟内有效。
6127
- *
6128
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421365
6129
- */
6130
- fundFlowBill(params: FundFlowBillParams): Promise<WxPayResponse<FundFlowBillResponse>>;
6131
- /**
6132
- * 下载账单
6133
- *
6134
- * 通过申请账单接口返回的 download_url,以 GET 方式下载账单原始文件。
6135
- * 下载地址 5 分钟内有效,请及时下载。
6136
- * 返回的 data 为 Buffer,可能为 GZIP 压缩格式,需要自行解压。
6137
- *
6138
- * @param downloadUrl - 申请账单返回的 download_url
6139
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013421368
6140
- */
6141
- downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
6142
5697
  }
6143
5698
 
6144
5699
  /**
@@ -6567,6 +6122,30 @@ declare class BillService {
6567
6122
  * ```
6568
6123
  */
6569
6124
  applyProfitSharingBill(params: ProfitSharingBillParams): Promise<WxPayResponse<ProfitSharingBillResponse>>;
6125
+ /**
6126
+ * 申请单个子商户资金账单
6127
+ *
6128
+ * 服务商调用该接口获取单个子商户资金账单的下载链接。
6129
+ * 返回的账单文件使用 AES-256-GCM 加密,需用子商户的 API 证书私钥解密。
6130
+ *
6131
+ * @param params - 账单请求参数
6132
+ * @returns 加密账单下载信息
6133
+ *
6134
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071235
6135
+ */
6136
+ applySubMerchantFundFlowBill(params: SubMerchantFundFlowBillParams): Promise<WxPayResponse<EncryptBillResponse>>;
6137
+ /**
6138
+ * 申请二级商户资金账单
6139
+ *
6140
+ * 电商平台调用该接口获取二级商户资金账单的下载链接。
6141
+ * 返回的账单文件使用 AES-256-GCM 加密,需用平台的 API 证书私钥解密。
6142
+ *
6143
+ * @param params - 账单请求参数
6144
+ * @returns 加密账单下载信息
6145
+ *
6146
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071235
6147
+ */
6148
+ applyEcommerceFundFlowBill(params: EcommerceFundFlowBillParams): Promise<WxPayResponse<EncryptBillResponse>>;
6570
6149
  /**
6571
6150
  * 下载账单文件
6572
6151
  *
@@ -6602,6 +6181,28 @@ declare class BillService {
6602
6181
  * ```
6603
6182
  */
6604
6183
  downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
6184
+ /**
6185
+ * 下载账单文件并自动解压、校验摘要
6186
+ *
6187
+ * 封装了完整的账单下载流程:
6188
+ * 1. 下载原始文件
6189
+ * 2. 自动检测并解压 GZIP 格式
6190
+ * 3. 可选:与申请账单返回的 hash_value 进行 SHA-1 摘要校验
6191
+ *
6192
+ * @param downloadUrl - 申请账单接口返回的 download_url
6193
+ * @param expectedDigest - 期望的 SHA-1 摘要值(来自申请账单接口返回的 hash_value)
6194
+ * @returns 包含解压后账单文件 Buffer 的响应
6195
+ * @throws 如果摘要校验失败
6196
+ *
6197
+ * @example
6198
+ * ```ts
6199
+ * const result = await billService.downloadAndVerifyBill(
6200
+ * applyResult.data.download_url,
6201
+ * applyResult.data.hash_value,
6202
+ * );
6203
+ * ```
6204
+ */
6205
+ downloadAndVerifyBill(downloadUrl: string, expectedDigest?: string): Promise<WxPayResponse<Buffer>>;
6605
6206
  }
6606
6207
 
6607
6208
  /**
@@ -7890,192 +7491,1825 @@ declare class ScanAndRideService {
7890
7491
  sub_mchid: string;
7891
7492
  }): Promise<WxPayResponse<Record<string, unknown>>>;
7892
7493
  }
7893
-
7494
+
7495
+ /**
7496
+ * 零售门店服务
7497
+ *
7498
+ * 提供微信支付零售门店相关 API 封装,包括:
7499
+ * - 门店活动管理
7500
+ * - 门店资质管理
7501
+ * - 零售门店活动操作
7502
+ *
7503
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
7504
+ */
7505
+ declare class RetailStoreService {
7506
+ private readonly client;
7507
+ constructor(client: WxPayClient);
7508
+ /**
7509
+ * 创建门店活动
7510
+ *
7511
+ * @param request - 活动创建请求参数
7512
+ * @returns 创建结果
7513
+ */
7514
+ createActivity(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7515
+ /**
7516
+ * 查询门店活动详情
7517
+ *
7518
+ * @param activityId - 活动ID
7519
+ * @returns 活动详情
7520
+ */
7521
+ queryActivity(activityId: string): Promise<WxPayResponse<Record<string, unknown>>>;
7522
+ /**
7523
+ * 更新门店活动
7524
+ *
7525
+ * @param activityId - 活动ID
7526
+ * @param request - 更新请求参数
7527
+ * @returns 更新结果
7528
+ */
7529
+ updateActivity(activityId: string, request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7530
+ /**
7531
+ * 创建门店资质
7532
+ *
7533
+ * @param request - 资质创建请求参数
7534
+ * @returns 创建结果
7535
+ */
7536
+ createQualification(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7537
+ /**
7538
+ * 查询门店资质
7539
+ *
7540
+ * @param qualificationId - 资质ID
7541
+ * @returns 资质详情
7542
+ */
7543
+ queryQualification(qualificationId: string): Promise<WxPayResponse<Record<string, unknown>>>;
7544
+ }
7545
+
7546
+ /**
7547
+ * 商家零钱服务
7548
+ *
7549
+ * 提供微信支付商家零钱(金盘计划)相关 API 封装,包括:
7550
+ * - 查询商户零钱余额
7551
+ * - 查询商户零钱流水
7552
+ * - 商家零钱状态管理
7553
+ *
7554
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
7555
+ */
7556
+ declare class GoldPlanService {
7557
+ private readonly client;
7558
+ constructor(client: WxPayClient);
7559
+ /**
7560
+ * 查询商户零钱余额
7561
+ *
7562
+ * @param mchid - 商户号
7563
+ * @returns 零钱余额信息
7564
+ */
7565
+ queryBalance(mchid: string): Promise<WxPayResponse<Record<string, unknown>>>;
7566
+ /**
7567
+ * 查询商户零钱流水
7568
+ *
7569
+ * @param mchid - 商户号
7570
+ * @param params - 查询参数
7571
+ * @returns 零钱流水列表
7572
+ */
7573
+ queryFlow(mchid: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7574
+ /**
7575
+ * 查询商家零钱状态
7576
+ *
7577
+ * @param mchid - 商户号
7578
+ * @returns 零钱状态信息
7579
+ */
7580
+ queryStatus(mchid: string): Promise<WxPayResponse<Record<string, unknown>>>;
7581
+ }
7582
+
7583
+ /**
7584
+ * 爱心餐服务
7585
+ *
7586
+ * 提供微信支付爱心餐相关 API 封装,包括:
7587
+ * - 品牌管理
7588
+ * - 订单管理
7589
+ *
7590
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
7591
+ */
7592
+ declare class LoveFeastService {
7593
+ private readonly client;
7594
+ constructor(client: WxPayClient);
7595
+ /**
7596
+ * 创建爱心餐品牌
7597
+ *
7598
+ * @param request - 品牌创建请求参数
7599
+ * @returns 创建结果
7600
+ */
7601
+ createBrand(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7602
+ /**
7603
+ * 查询爱心餐品牌
7604
+ *
7605
+ * @param brandId - 品牌ID
7606
+ * @returns 品牌详情
7607
+ */
7608
+ queryBrand(brandId: string): Promise<WxPayResponse<Record<string, unknown>>>;
7609
+ /**
7610
+ * 创建爱心餐订单
7611
+ *
7612
+ * @param request - 订单创建请求参数
7613
+ * @returns 订单创建结果
7614
+ */
7615
+ createOrder(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7616
+ /**
7617
+ * 查询爱心餐订单
7618
+ *
7619
+ * @param outTradeNo - 商户订单号
7620
+ * @param params - 查询参数
7621
+ * @returns 订单详情
7622
+ */
7623
+ queryOrder(outTradeNo: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7624
+ }
7625
+
7626
+ /**
7627
+ * 商户专属优惠券服务
7628
+ *
7629
+ * 提供微信支付商户专属优惠券相关 API 封装,包括:
7630
+ * - 优惠券批次管理
7631
+ * - 优惠券发放
7632
+ * - 优惠券查询
7633
+ *
7634
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012084079
7635
+ */
7636
+ declare class MerchantExclusiveCouponService {
7637
+ private readonly client;
7638
+ constructor(client: WxPayClient);
7639
+ /**
7640
+ * 创建优惠券批次
7641
+ *
7642
+ * @param request - 批次创建请求参数
7643
+ * @returns 创建结果
7644
+ */
7645
+ createCouponStock(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7646
+ /**
7647
+ * 查询优惠券批次详情
7648
+ *
7649
+ * @param stockId - 批次ID
7650
+ * @returns 批次详情
7651
+ */
7652
+ queryCouponStock(stockId: string): Promise<WxPayResponse<Record<string, unknown>>>;
7653
+ /**
7654
+ * 发放优惠券
7655
+ *
7656
+ * @param request - 发放请求参数
7657
+ * @returns 发放结果
7658
+ */
7659
+ sendCoupon(request: {
7660
+ stock_id: string;
7661
+ out_request_no: string;
7662
+ openid: string;
7663
+ }): Promise<WxPayResponse<Record<string, unknown>>>;
7664
+ /**
7665
+ * 查询用户优惠券
7666
+ *
7667
+ * @param openid - 用户标识
7668
+ * @param params - 查询参数
7669
+ * @returns 用户优惠券列表
7670
+ */
7671
+ queryUserCoupons(openid: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7672
+ /**
7673
+ * 查询优惠券详情
7674
+ *
7675
+ * @param couponId - 优惠券ID
7676
+ * @param params - 查询参数
7677
+ * @returns 优惠券详情
7678
+ */
7679
+ queryCoupon(couponId: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
7680
+ }
7681
+
7682
+ /**
7683
+ * 境内退款服务
7684
+ *
7685
+ * 提供独立的退款 API 封装,不绑定特定支付方式。
7686
+ * 适用于所有支付方式(JSAPI/APP/H5/Native)的退款场景。
7687
+ *
7688
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071001 (产品介绍)
7689
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071036 (申请退款)
7690
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071041 (查询单笔退款)
7691
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071193 (发起异常退款)
7692
+ */
7693
+ declare class RefundService {
7694
+ private readonly client;
7695
+ constructor(client: WxPayClient);
7696
+ /**
7697
+ * 申请退款
7698
+ *
7699
+ * 当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,
7700
+ * 卖家可以通过退款接口将支付款退还给买家。
7701
+ * 支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。
7702
+ * 一笔退款失败后重新提交,要采用原来的退款单号。
7703
+ *
7704
+ * @param request - 退款请求参数,包含商户订单号、退款单号、退款金额等信息
7705
+ * @returns 退款申请结果,包含微信退款单号、退款状态等
7706
+ *
7707
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071036
7708
+ */
7709
+ create(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
7710
+ /**
7711
+ * 查询单笔退款(通过商户退款单号)
7712
+ *
7713
+ * 提交退款申请后,通过调用该接口查询退款状态。
7714
+ * 退款有一定延时,建议在提交退款申请后1分钟再查询退款状态。
7715
+ *
7716
+ * @param params - 查询参数,需包含 outRefundNo(商户退款单号)
7717
+ * @returns 退款单详情,包含退款状态、退款金额、退款渠道等
7718
+ *
7719
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071041
7720
+ */
7721
+ queryByOutRefundNo(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
7722
+ /**
7723
+ * 发起异常退款
7724
+ *
7725
+ * 当退款因为用户账户异常而无法原路退回时,可使用此接口将退款资金
7726
+ * 退到用户的其他银行卡或商户的银行账户。
7727
+ *
7728
+ * @param refundId - 微信支付退款单号
7729
+ * @param request - 异常退款请求参数,包含退款方式、收款账户信息等
7730
+ * @returns 异常退款处理结果
7731
+ *
7732
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071193
7733
+ */
7734
+ applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
7735
+ }
7736
+
7737
+ /**
7738
+ * 服务商 JSAPI 支付服务
7739
+ *
7740
+ * 服务商模式下,服务商代替特约商户发起 JSAPI 支付请求。
7741
+ * 与直连商户模式的区别在于请求中包含 sp_appid、sp_mchid、sub_mchid 等字段。
7742
+ *
7743
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738519 (JSAPI/小程序下单)
7744
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738964 (微信支付订单号查询)
7745
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739008 (商户订单号查询)
7746
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739019 (关闭订单)
7747
+ */
7748
+ declare class PartnerJsapiService {
7749
+ private readonly client;
7750
+ constructor(client: WxPayClient);
7751
+ /**
7752
+ * 服务商 JSAPI/小程序下单
7753
+ *
7754
+ * 服务商通过此接口代特约商户发起 JSAPI 支付下单,获取 prepay_id。
7755
+ *
7756
+ * @param request - 下单请求参数,需包含 sp_appid、sp_mchid、sub_mchid 等
7757
+ * @returns 下单结果,包含 prepay_id
7758
+ *
7759
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738519
7760
+ */
7761
+ createOrder(request: CreatePartnerJsapiOrderRequest): Promise<WxPayResponse<CreatePartnerJsapiOrderResponse>>;
7762
+ /**
7763
+ * 通过商户订单号查询订单
7764
+ *
7765
+ * @param params - 查询参数,需包含 out_trade_no、sp_mchid、sub_mchid
7766
+ * @returns 订单详情
7767
+ *
7768
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739008
7769
+ */
7770
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7771
+ /**
7772
+ * 通过微信支付订单号查询订单
7773
+ *
7774
+ * @param params - 查询参数,需包含 transaction_id、sp_mchid、sub_mchid
7775
+ * @returns 订单详情
7776
+ *
7777
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738964
7778
+ */
7779
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7780
+ /**
7781
+ * 关闭订单
7782
+ *
7783
+ * 对于未支付的订单,服务商可通过此接口代特约商户关闭订单。
7784
+ *
7785
+ * @param outTradeNo - 商户订单号
7786
+ * @param request - 关单请求参数,需包含 sp_mchid、sub_mchid
7787
+ *
7788
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739019
7789
+ */
7790
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
7791
+ /**
7792
+ * 服务商 JSAPI 下单并生成调起支付参数
7793
+ *
7794
+ * 封装了下单和调起支付参数生成两个步骤,一次调用即可获得
7795
+ * prepay_id 和前端 WeixinJSBridge.invoke() 所需的全部参数。
7796
+ *
7797
+ * @param request - 下单请求参数
7798
+ * @param privateKey - 商户私钥,用于生成调起支付签名
7799
+ * @returns 下单响应 + 调起支付参数
7800
+ */
7801
+ prepayWithRequestPayment(request: CreatePartnerJsapiOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreatePartnerJsapiOrderResponse> & {
7802
+ bridgeConfig: JsapiBridgeConfig;
7803
+ }>;
7804
+ }
7805
+
7806
+ /**
7807
+ * 服务商 APP 支付服务
7808
+ *
7809
+ * 服务商模式下,服务商代替特约商户发起 APP 支付请求。
7810
+ *
7811
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080231 (APP下单)
7812
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080234 (微信支付订单号查询)
7813
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080235 (商户订单号查询)
7814
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080236 (关闭订单)
7815
+ */
7816
+ declare class PartnerAppService {
7817
+ private readonly client;
7818
+ constructor(client: WxPayClient);
7819
+ /**
7820
+ * 服务商 APP 下单
7821
+ *
7822
+ * @param request - 下单请求参数
7823
+ * @returns 下单结果,包含 prepay_id
7824
+ *
7825
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080231
7826
+ */
7827
+ createOrder(request: CreatePartnerAppOrderRequest): Promise<WxPayResponse<CreatePartnerAppOrderResponse>>;
7828
+ /**
7829
+ * 通过商户订单号查询订单
7830
+ *
7831
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080235
7832
+ */
7833
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7834
+ /**
7835
+ * 通过微信支付订单号查询订单
7836
+ *
7837
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080234
7838
+ */
7839
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7840
+ /**
7841
+ * 关闭订单
7842
+ *
7843
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080236
7844
+ */
7845
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
7846
+ /**
7847
+ * 服务商 APP 下单并生成调起支付参数
7848
+ *
7849
+ * @param request - 下单请求参数
7850
+ * @param privateKey - 商户私钥
7851
+ * @returns 下单响应 + 调起支付参数
7852
+ */
7853
+ prepayWithRequestPayment(request: CreatePartnerAppOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreatePartnerAppOrderResponse> & {
7854
+ bridgeConfig: AppBridgeConfig;
7855
+ }>;
7856
+ }
7857
+
7858
+ /**
7859
+ * 服务商 H5 支付服务
7860
+ *
7861
+ * 服务商模式下,服务商代替特约商户发起 H5 支付请求。
7862
+ *
7863
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738604 (H5下单)
7864
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738969 (微信支付订单号查询)
7865
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759661 (商户订单号查询)
7866
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759669 (关闭订单)
7867
+ */
7868
+ declare class PartnerH5Service {
7869
+ private readonly client;
7870
+ constructor(client: WxPayClient);
7871
+ /**
7872
+ * 服务商 H5 下单
7873
+ *
7874
+ * @param request - 下单请求参数,需包含 scene_info.h5_info
7875
+ * @returns 下单结果,包含 h5_url
7876
+ *
7877
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738604
7878
+ */
7879
+ createOrder(request: CreatePartnerH5OrderRequest): Promise<WxPayResponse<CreatePartnerH5OrderResponse>>;
7880
+ /**
7881
+ * 通过商户订单号查询订单
7882
+ *
7883
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759661
7884
+ */
7885
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7886
+ /**
7887
+ * 通过微信支付订单号查询订单
7888
+ *
7889
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738969
7890
+ */
7891
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7892
+ /**
7893
+ * 关闭订单
7894
+ *
7895
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759669
7896
+ */
7897
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
7898
+ }
7899
+
7900
+ /**
7901
+ * 服务商 Native 支付服务
7902
+ *
7903
+ * 服务商模式下,服务商代替特约商户发起 Native 支付请求。
7904
+ *
7905
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738659 (Native下单)
7906
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738971 (微信支付订单号查询)
7907
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759714 (商户订单号查询)
7908
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759725 (关闭订单)
7909
+ */
7910
+ declare class PartnerNativeService {
7911
+ private readonly client;
7912
+ constructor(client: WxPayClient);
7913
+ /**
7914
+ * 服务商 Native 下单
7915
+ *
7916
+ * @param request - 下单请求参数
7917
+ * @returns 下单结果,包含 code_url
7918
+ *
7919
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738659
7920
+ */
7921
+ createOrder(request: CreatePartnerNativeOrderRequest): Promise<WxPayResponse<CreatePartnerNativeOrderResponse>>;
7922
+ /**
7923
+ * 通过商户订单号查询订单
7924
+ *
7925
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759714
7926
+ */
7927
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7928
+ /**
7929
+ * 通过微信支付订单号查询订单
7930
+ *
7931
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738971
7932
+ */
7933
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
7934
+ /**
7935
+ * 关闭订单
7936
+ *
7937
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759725
7938
+ */
7939
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
7940
+ }
7941
+
7942
+ /** 服务商商家转账请求参数 */
7943
+ interface PartnerTransferRequest {
7944
+ /** 特约商户号 */
7945
+ sub_mchid: string;
7946
+ /** 特约商户 AppID */
7947
+ sub_appid?: string;
7948
+ /** 免确认收款授权单号 */
7949
+ authorization_id?: string;
7950
+ /** 商户转账单号 */
7951
+ out_bill_no: string;
7952
+ /** 转账场景ID */
7953
+ transfer_scene_id: string;
7954
+ /** 用户 OpenID */
7955
+ openid: string;
7956
+ /** 收款用户姓名 */
7957
+ user_name?: string;
7958
+ /** 转账金额(分) */
7959
+ transfer_amount: number;
7960
+ /** 转账备注 */
7961
+ transfer_remark: string;
7962
+ /** 回调通知地址 */
7963
+ notify_url?: string;
7964
+ /** 用户收款感知 */
7965
+ user_recv_perception?: string;
7966
+ /** 转账场景报备信息 */
7967
+ transfer_scene_report_infos: {
7968
+ info_type: string;
7969
+ info_content: string;
7970
+ }[];
7971
+ }
7972
+ /** 服务商商家转账响应 */
7973
+ interface PartnerTransferResponse {
7974
+ /** 商户转账单号 */
7975
+ out_bill_no: string;
7976
+ /** 微信转账单号 */
7977
+ transfer_bill_no: string;
7978
+ /** 创建时间 */
7979
+ create_time: string;
7980
+ /** 转账状态 */
7981
+ state: string;
7982
+ /** 跳转领取页面的 package 信息 */
7983
+ package_info?: string;
7984
+ }
7985
+ /** 服务商商家转账查询响应 */
7986
+ interface PartnerTransferQueryResponse {
7987
+ /** 服务商户号 */
7988
+ sp_mchid: string;
7989
+ /** 特约商户号 */
7990
+ sub_mchid: string;
7991
+ /** 商户转账单号 */
7992
+ out_bill_no: string;
7993
+ /** 微信转账单号 */
7994
+ transfer_bill_no: string;
7995
+ /** 创建时间 */
7996
+ create_time: string;
7997
+ /** 转账状态 */
7998
+ state: string;
7999
+ /** 转账金额(分) */
8000
+ transfer_amount: number;
8001
+ /** 转账备注 */
8002
+ transfer_remark: string;
8003
+ /** 失败原因 */
8004
+ fail_reason?: string;
8005
+ /** 用户 OpenID */
8006
+ openid: string;
8007
+ /** 收款用户姓名 */
8008
+ user_name?: string;
8009
+ /** 更新时间 */
8010
+ update_time?: string;
8011
+ }
8012
+ /** 服务商申请电子回单请求(商户单号) */
8013
+ interface ApplyPartnerTransferElecSignByOutBillNoRequest {
8014
+ /** 特约商户号 */
8015
+ sub_mchid: string;
8016
+ /** 商户单号 */
8017
+ out_bill_no: string;
8018
+ }
8019
+ /** 服务商申请电子回单请求(微信单号) */
8020
+ interface ApplyPartnerTransferElecSignByTransferBillNoRequest {
8021
+ /** 特约商户号 */
8022
+ sub_mchid: string;
8023
+ /** 微信转账单号 */
8024
+ transfer_bill_no: string;
8025
+ }
8026
+ /** 服务商发起免确认收款授权请求 */
8027
+ interface CreatePartnerTransferAuthorizationRequest {
8028
+ /** 特约商户号 */
8029
+ sub_mchid: string;
8030
+ /** 商户侧授权单号 */
8031
+ out_authorization_no: string;
8032
+ /** 商户应用唯一标识 */
8033
+ appid: string;
8034
+ /** 收款用户在商户appid下的唯一标识 */
8035
+ openid: string;
8036
+ /** 转账场景ID */
8037
+ transfer_scene_id: string;
8038
+ /** 用户展示名称 */
8039
+ user_display_name: string;
8040
+ /** 用户收款时感知到的收款原因 */
8041
+ user_recv_perception?: string;
8042
+ /** 授权结果异步通知回调地址 */
8043
+ authorization_notify_url: string;
8044
+ /** 用户端场景信息 */
8045
+ scene_info?: {
8046
+ /** 用户终端IP */
8047
+ client_ip?: string;
8048
+ /** 用户设备ID */
8049
+ device_id?: string;
8050
+ /** 设备类型 */
8051
+ device_type?: 'IOS' | 'ANDROID' | 'HARMONY' | 'OTHER';
8052
+ };
8053
+ }
8054
+ /** 服务商查询授权结果请求 */
8055
+ interface QueryPartnerTransferAuthorizationRequest {
8056
+ /** 特约商户号 */
8057
+ sub_mchid: string;
8058
+ /** 商户侧授权单号 */
8059
+ out_authorization_no: string;
8060
+ /** 是否显示授权信息 */
8061
+ is_display_authorization?: boolean;
8062
+ }
8063
+ /** 服务商用户授权后转账请求 */
8064
+ interface CreatePartnerTransferAfterAuthorizationRequest {
8065
+ /** 特约商户号 */
8066
+ sub_mchid: string;
8067
+ /** 商户AppID */
8068
+ appid: string;
8069
+ /** 商户单号 */
8070
+ out_bill_no: string;
8071
+ /** 转账场景ID */
8072
+ transfer_scene_id: string;
8073
+ /** 收款用户姓名(需加密) */
8074
+ user_name?: string;
8075
+ /** 转账金额,单位为分 */
8076
+ transfer_amount: number;
8077
+ /** 转账备注 */
8078
+ transfer_remark: string;
8079
+ /** 用户收款感知 */
8080
+ user_recv_perception?: string;
8081
+ /** 转账场景报备信息 */
8082
+ transfer_scene_report_infos?: {
8083
+ info_type: string;
8084
+ info_content: string;
8085
+ }[];
8086
+ /** 微信免确认收款授权单号(与out_authorization_no二选一) */
8087
+ authorization_id?: string;
8088
+ /** 商户侧授权单号(与authorization_id二选一) */
8089
+ out_authorization_no?: string;
8090
+ }
8091
+ /** 服务商解除免确认收款授权请求 */
8092
+ interface ClosePartnerTransferAuthorizationRequest {
8093
+ /** 特约商户号 */
8094
+ sub_mchid: string;
8095
+ /** 商户侧授权单号 */
8096
+ out_authorization_no: string;
8097
+ }
8098
+ /**
8099
+ * 服务商商家转账服务
8100
+ *
8101
+ * 服务商模式下,服务商代替特约商户发起商家转账。
8102
+ *
8103
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434 (商家转账)
8104
+ */
8105
+ declare class PartnerTransferService {
8106
+ private readonly client;
8107
+ constructor(client: WxPayClient);
8108
+ /**
8109
+ * 服务商发起商家转账
8110
+ *
8111
+ * @param request - 转账请求参数
8112
+ * @returns 转账结果
8113
+ *
8114
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434
8115
+ */
8116
+ createTransfer(request: PartnerTransferRequest): Promise<WxPayResponse<PartnerTransferResponse>>;
8117
+ /**
8118
+ * 通过商户单号查询转账单
8119
+ *
8120
+ * @param outBillNo - 商户转账单号
8121
+ * @param subMchid - 特约商户号
8122
+ * @returns 转账单详情
8123
+ */
8124
+ queryTransferByOutBillNo(outBillNo: string, subMchid: string): Promise<WxPayResponse<PartnerTransferQueryResponse>>;
8125
+ /**
8126
+ * 通过微信单号查询转账单
8127
+ *
8128
+ * @param transferBillNo - 微信转账单号
8129
+ * @param subMchid - 特约商户号
8130
+ * @returns 转账单详情
8131
+ */
8132
+ queryTransferByTransferBillNo(transferBillNo: string, subMchid: string): Promise<WxPayResponse<PartnerTransferQueryResponse>>;
8133
+ /**
8134
+ * 撤销转账
8135
+ *
8136
+ * @param outBillNo - 商户转账单号
8137
+ * @param subMchid - 特约商户号
8138
+ */
8139
+ cancelTransfer(outBillNo: string, subMchid: string): Promise<WxPayResponse>;
8140
+ /**
8141
+ * 商户单号申请电子回单
8142
+ *
8143
+ * 申请条件:
8144
+ * - 转账单据状态为 SUCCESS
8145
+ * - 传入了收款用户姓名
8146
+ * - 六个月内的转账单据
8147
+ *
8148
+ * 回单有效期为90天,过期需重新申请。
8149
+ *
8150
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716452
8151
+ */
8152
+ applyElecSignByOutBillNo(request: ApplyPartnerTransferElecSignByOutBillNoRequest): Promise<WxPayResponse<ApplyMerchantTransferElecSignResponse>>;
8153
+ /**
8154
+ * 商户单号查询电子回单
8155
+ *
8156
+ * 当申请单状态为 FINISHED 时,返回回单文件的下载地址和摘要信息。
8157
+ * 下载地址有效期为10分钟,过期后需重新调用此接口获取。
8158
+ *
8159
+ * @param outBillNo - 商户单号
8160
+ * @param subMchid - 特约商户号
8161
+ *
8162
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716436
8163
+ */
8164
+ queryElecSignByOutBillNo(outBillNo: string, subMchid: string): Promise<WxPayResponse<QueryMerchantTransferElecSignResponse>>;
8165
+ /**
8166
+ * 微信单号申请电子回单
8167
+ *
8168
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716456
8169
+ */
8170
+ applyElecSignByTransferBillNo(request: ApplyPartnerTransferElecSignByTransferBillNoRequest): Promise<WxPayResponse<ApplyMerchantTransferElecSignResponse>>;
8171
+ /**
8172
+ * 微信单号查询电子回单
8173
+ *
8174
+ * @param transferBillNo - 微信转账单号
8175
+ * @param subMchid - 特约商户号
8176
+ *
8177
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716455
8178
+ */
8179
+ queryElecSignByTransferBillNo(transferBillNo: string, subMchid: string): Promise<WxPayResponse<QueryMerchantTransferElecSignResponse>>;
8180
+ /**
8181
+ * 下载电子回单
8182
+ *
8183
+ * 通过申请电子回单接口返回的 download_url,以 GET 方式下载回单原始文件。
8184
+ * 下载地址有效期为 10 分钟,过期后需重新调用查询接口获取。
8185
+ * 返回的 data 为 PDF 文件的 Buffer。
8186
+ *
8187
+ * @param downloadUrl - 查询电子回单返回的 download_url
8188
+ * @returns 电子回单文件 Buffer
8189
+ *
8190
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013866774
8191
+ */
8192
+ downloadElecSign(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
8193
+ /**
8194
+ * 发起转账并完成免确认收款授权
8195
+ *
8196
+ * 在发起转账的同时申请免确认收款授权,用户确认收款时可同时完成授权。
8197
+ * 授权成功后,后续转账无需用户逐笔确认。
8198
+ *
8199
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4014399293
8200
+ */
8201
+ createTransferWithAuthorization(request: CreateTransferWithAuthorizationRequest & {
8202
+ sub_mchid: string;
8203
+ }): Promise<WxPayResponse<CreateTransferWithAuthorizationResponse>>;
8204
+ /**
8205
+ * 发起免确认收款授权
8206
+ *
8207
+ * 直接申请免确认收款授权,不发起转账。
8208
+ * 用户需在24小时内完成授权,未确认记录保留30天。
8209
+ * 同一微信号在同商户下待确认+已授权状态的授权单最多5个。
8210
+ *
8211
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4015901167
8212
+ */
8213
+ createAuthorization(request: CreatePartnerTransferAuthorizationRequest): Promise<WxPayResponse<CreateMerchantTransferAuthorizationResponse>>;
8214
+ /**
8215
+ * 商户单号查询授权结果
8216
+ *
8217
+ * @param request - 查询请求参数
8218
+ *
8219
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4014399423
8220
+ */
8221
+ queryAuthorizationByOutAuthorizationNo(request: QueryPartnerTransferAuthorizationRequest): Promise<WxPayResponse<QueryMerchantTransferAuthorizationResponse>>;
8222
+ /**
8223
+ * 用户授权后转账
8224
+ *
8225
+ * 用户完成授权后,商户可直接发起转账,无需用户逐笔确认收款。
8226
+ * 需要提供 authorization_id 或 out_authorization_no(二选一)。
8227
+ *
8228
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4014399371
8229
+ */
8230
+ createTransferAfterAuthorization(request: CreatePartnerTransferAfterAuthorizationRequest): Promise<WxPayResponse<CreateTransferAfterAuthorizationResponse>>;
8231
+ /**
8232
+ * 解除免确认收款授权
8233
+ *
8234
+ * 商户可调用此接口帮助用户发起解除授权。
8235
+ * 用户也可通过微信支付入账消息的收款设置操作关闭授权。
8236
+ *
8237
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4015653811
8238
+ */
8239
+ closeAuthorization(request: ClosePartnerTransferAuthorizationRequest): Promise<WxPayResponse<CloseMerchantTransferAuthorizationResponse>>;
8240
+ }
8241
+
8242
+ /** 批量转账明细输入 */
8243
+ interface TransferDetailInput {
8244
+ /** 商家明细单号 */
8245
+ out_detail_no: string;
8246
+ /** 转账金额(分) */
8247
+ transfer_amount: number;
8248
+ /** 转账备注(UTF8编码,最多32字符) */
8249
+ transfer_remark: string;
8250
+ /** 收款用户openid */
8251
+ openid: string;
8252
+ /** 收款用户姓名(加密,转账金额>=2000元时必填) */
8253
+ user_name?: string;
8254
+ }
8255
+ /** 发起批量转账请求 */
8256
+ interface InitiateBatchTransferRequest {
8257
+ /** 商户appid */
8258
+ appid: string;
8259
+ /** 商家批次单号 */
8260
+ out_batch_no: string;
8261
+ /** 批次名称 */
8262
+ batch_name: string;
8263
+ /** 批次备注(UTF8编码,最多32字符) */
8264
+ batch_remark: string;
8265
+ /** 转账总金额(分),必须与明细金额之和一致 */
8266
+ total_amount: number;
8267
+ /** 转账总笔数,最多1000笔,必须与明细数一致 */
8268
+ total_num: number;
8269
+ /** 转账明细列表 */
8270
+ transfer_detail_list: TransferDetailInput[];
8271
+ /** 转账场景ID(如 1001-现金营销) */
8272
+ transfer_scene_id?: string;
8273
+ /** 异步通知回调地址 */
8274
+ notify_url?: string;
8275
+ }
8276
+ /** 发起批量转账响应 */
8277
+ interface InitiateBatchTransferResponse {
8278
+ /** 商家批次单号 */
8279
+ out_batch_no: string;
8280
+ /** 微信批次单号 */
8281
+ batch_id: string;
8282
+ /** 批次创建时间(RFC3339) */
8283
+ create_time: string;
8284
+ /** 批次状态:ACCEPTED / PROCESSING / FINISHED / CLOSED */
8285
+ batch_status: string;
8286
+ }
8287
+ /** 批次单信息 */
8288
+ interface TransferBatchGet {
8289
+ /** 商户号 */
8290
+ mchid: string;
8291
+ /** 商家批次单号 */
8292
+ out_batch_no: string;
8293
+ /** 微信批次单号 */
8294
+ batch_id: string;
8295
+ /** 商户appid */
8296
+ appid: string;
8297
+ /** 批次状态 */
8298
+ batch_status: string;
8299
+ /** 批次类型 */
8300
+ batch_type?: string;
8301
+ /** 批次名称 */
8302
+ batch_name: string;
8303
+ /** 批次备注 */
8304
+ batch_remark: string;
8305
+ /** 转账总金额(分) */
8306
+ total_amount: number;
8307
+ /** 转账总笔数 */
8308
+ total_num: number;
8309
+ /** 转账成功金额(分) */
8310
+ success_amount?: number;
8311
+ /** 转账成功笔数 */
8312
+ success_num?: number;
8313
+ /** 转账失败金额(分) */
8314
+ fail_amount?: number;
8315
+ /** 转账失败笔数 */
8316
+ fail_num?: number;
8317
+ /** 批次关闭原因 */
8318
+ close_reason?: string;
8319
+ /** 批次创建时间 */
8320
+ create_time?: string;
8321
+ /** 批次更新时间 */
8322
+ update_time?: string;
8323
+ }
8324
+ /** 转账明细简要信息 */
8325
+ interface TransferDetailCompact {
8326
+ /** 微信明细单号 */
8327
+ detail_id: string;
8328
+ /** 商家明细单号 */
8329
+ out_detail_no: string;
8330
+ /** 明细状态 */
8331
+ detail_status: string;
8332
+ }
8333
+ /** 查询批次单响应 */
8334
+ interface TransferBatchEntity {
8335
+ /** 转账批次单基本信息 */
8336
+ transfer_batch: TransferBatchGet;
8337
+ /** 转账明细单列表(批次完成时返回) */
8338
+ transfer_detail_list?: TransferDetailCompact[];
8339
+ }
8340
+ /** 转账明细单详情 */
8341
+ interface TransferDetailEntity {
8342
+ /** 商户号 */
8343
+ mchid: string;
8344
+ /** 商家批次单号 */
8345
+ out_batch_no: string;
8346
+ /** 微信批次单号 */
8347
+ batch_id: string;
8348
+ /** 商户appid */
8349
+ appid: string;
8350
+ /** 商家明细单号 */
8351
+ out_detail_no: string;
8352
+ /** 微信明细单号 */
8353
+ detail_id: string;
8354
+ /** 明细状态:INIT / WAIT_PAY / PROCESSING / SUCCESS / FAIL */
8355
+ detail_status: string;
8356
+ /** 转账金额(分) */
8357
+ transfer_amount: number;
8358
+ /** 转账备注 */
8359
+ transfer_remark: string;
8360
+ /** 明细失败原因 */
8361
+ fail_reason?: string;
8362
+ /** 收款用户openid */
8363
+ openid: string;
8364
+ /** 收款用户姓名(加密) */
8365
+ user_name?: string;
8366
+ /** 转账发起时间 */
8367
+ initiate_time?: string;
8368
+ /** 明细更新时间 */
8369
+ update_time?: string;
8370
+ }
8371
+ /** 查询批次单参数 */
8372
+ interface GetTransferBatchParams {
8373
+ /** 是否查询明细单(默认 false) */
8374
+ need_query_detail?: boolean;
8375
+ /** 请求资源起始位置(默认 0) */
8376
+ offset?: number;
8377
+ /** 最大资源条数(20~100,默认 20) */
8378
+ limit?: number;
8379
+ /** 明细状态筛选:WAIT_PAY / ALL / SUCCESS / FAIL */
8380
+ detail_status?: string;
8381
+ }
8382
+ /**
8383
+ * 批量转账服务
8384
+ *
8385
+ * 商户可通过该产品实现同时向多个用户微信零钱进行转账的操作。
8386
+ *
8387
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012716434 (商家转账)
8388
+ */
8389
+ declare class TransferBatchService {
8390
+ private readonly client;
8391
+ constructor(client: WxPayClient);
8392
+ /**
8393
+ * 发起批量转账
8394
+ *
8395
+ * @param request - 批量转账请求参数
8396
+ * @returns 批量转账结果
8397
+ */
8398
+ initiateBatchTransfer(request: InitiateBatchTransferRequest): Promise<WxPayResponse<InitiateBatchTransferResponse>>;
8399
+ /**
8400
+ * 通过微信批次单号查询批次单
8401
+ *
8402
+ * @param batchId - 微信批次单号
8403
+ * @param params - 可选查询参数
8404
+ * @returns 批次单详情
8405
+ */
8406
+ getTransferBatchByNo(batchId: string, params?: GetTransferBatchParams): Promise<WxPayResponse<TransferBatchEntity>>;
8407
+ /**
8408
+ * 通过商家批次单号查询批次单
8409
+ *
8410
+ * @param outBatchNo - 商家批次单号
8411
+ * @param params - 可选查询参数
8412
+ * @returns 批次单详情
8413
+ */
8414
+ getTransferBatchByOutNo(outBatchNo: string, params?: GetTransferBatchParams): Promise<WxPayResponse<TransferBatchEntity>>;
8415
+ /**
8416
+ * 通过微信明细单号查询明细单
8417
+ *
8418
+ * @param batchId - 微信批次单号
8419
+ * @param detailId - 微信明细单号
8420
+ * @returns 明细单详情
8421
+ */
8422
+ getTransferDetailByNo(batchId: string, detailId: string): Promise<WxPayResponse<TransferDetailEntity>>;
8423
+ /**
8424
+ * 通过商家明细单号查询明细单
8425
+ *
8426
+ * @param outBatchNo - 商家批次单号
8427
+ * @param outDetailNo - 商家明细单号
8428
+ * @returns 明细单详情
8429
+ */
8430
+ getTransferDetailByOutNo(outBatchNo: string, outDetailNo: string): Promise<WxPayResponse<TransferDetailEntity>>;
8431
+ }
8432
+
8433
+ /** 服务商批量转账明细输入 */
8434
+ interface PartnerTransferDetailInput {
8435
+ /** 商家明细单号 */
8436
+ out_detail_no: string;
8437
+ /** 转账金额(分) */
8438
+ transfer_amount: number;
8439
+ /** 转账备注(UTF8编码,最多32字符) */
8440
+ transfer_remark: string;
8441
+ /** 收款用户openid */
8442
+ openid: string;
8443
+ /** 收款用户姓名(加密) */
8444
+ user_name?: string;
8445
+ }
8446
+ /** 发起服务商批量转账请求 */
8447
+ interface InitiatePartnerBatchTransferRequest {
8448
+ /** 商户appid */
8449
+ appid: string;
8450
+ /** 商家批次单号 */
8451
+ out_batch_no: string;
8452
+ /** 批次名称 */
8453
+ batch_name: string;
8454
+ /** 批次备注(UTF8编码,最多32字符) */
8455
+ batch_remark: string;
8456
+ /** 转账总金额(分),必须与明细金额之和一致 */
8457
+ total_amount: number;
8458
+ /** 转账总笔数,最多1000笔,必须与明细数一致 */
8459
+ total_num: number;
8460
+ /** 转账明细列表 */
8461
+ transfer_detail_list: PartnerTransferDetailInput[];
8462
+ /** 转账场景ID */
8463
+ transfer_scene_id?: string;
8464
+ /** 异步通知回调地址 */
8465
+ notify_url?: string;
8466
+ }
8467
+ /** 发起服务商批量转账响应 */
8468
+ interface InitiatePartnerBatchTransferResponse {
8469
+ /** 商家批次单号 */
8470
+ out_batch_no: string;
8471
+ /** 微信批次单号 */
8472
+ batch_id: string;
8473
+ /** 批次创建时间(RFC3339) */
8474
+ create_time: string;
8475
+ /** 批次状态:ACCEPTED / PROCESSING / FINISHED / CLOSED */
8476
+ batch_status: string;
8477
+ }
8478
+ /** 服务商批次单信息 */
8479
+ interface PartnerTransferBatchGet {
8480
+ /** 商户号 */
8481
+ mchid: string;
8482
+ /** 商家批次单号 */
8483
+ out_batch_no: string;
8484
+ /** 微信批次单号 */
8485
+ batch_id: string;
8486
+ /** 商户appid */
8487
+ appid: string;
8488
+ /** 批次状态 */
8489
+ batch_status: string;
8490
+ /** 批次类型 */
8491
+ batch_type?: string;
8492
+ /** 批次名称 */
8493
+ batch_name: string;
8494
+ /** 批次备注 */
8495
+ batch_remark: string;
8496
+ /** 转账总金额(分) */
8497
+ total_amount: number;
8498
+ /** 转账总笔数 */
8499
+ total_num: number;
8500
+ /** 转账成功金额(分) */
8501
+ success_amount?: number;
8502
+ /** 转账成功笔数 */
8503
+ success_num?: number;
8504
+ /** 转账失败金额(分) */
8505
+ fail_amount?: number;
8506
+ /** 转账失败笔数 */
8507
+ fail_num?: number;
8508
+ /** 批次关闭原因 */
8509
+ close_reason?: string;
8510
+ /** 批次创建时间 */
8511
+ create_time?: string;
8512
+ /** 批次更新时间 */
8513
+ update_time?: string;
8514
+ }
8515
+ /** 服务商转账明细简要信息 */
8516
+ interface PartnerTransferDetailCompact {
8517
+ /** 微信明细单号 */
8518
+ detail_id: string;
8519
+ /** 商家明细单号 */
8520
+ out_detail_no: string;
8521
+ /** 明细状态 */
8522
+ detail_status: string;
8523
+ }
8524
+ /** 查询服务商批次单响应 */
8525
+ interface PartnerTransferBatchEntity {
8526
+ /** 转账批次单基本信息 */
8527
+ transfer_batch: PartnerTransferBatchGet;
8528
+ /** 转账明细单列表(批次完成时返回) */
8529
+ transfer_detail_list?: PartnerTransferDetailCompact[];
8530
+ }
8531
+ /** 服务商转账明细单详情 */
8532
+ interface PartnerTransferDetailEntity {
8533
+ /** 商户号 */
8534
+ mchid: string;
8535
+ /** 商家批次单号 */
8536
+ out_batch_no: string;
8537
+ /** 微信批次单号 */
8538
+ batch_id: string;
8539
+ /** 商户appid */
8540
+ appid: string;
8541
+ /** 商家明细单号 */
8542
+ out_detail_no: string;
8543
+ /** 微信明细单号 */
8544
+ detail_id: string;
8545
+ /** 明细状态:INIT / WAIT_PAY / PROCESSING / SUCCESS / FAIL */
8546
+ detail_status: string;
8547
+ /** 转账金额(分) */
8548
+ transfer_amount: number;
8549
+ /** 转账备注 */
8550
+ transfer_remark: string;
8551
+ /** 明细失败原因 */
8552
+ fail_reason?: string;
8553
+ /** 收款用户openid */
8554
+ openid: string;
8555
+ /** 收款用户姓名(加密) */
8556
+ user_name?: string;
8557
+ /** 转账发起时间 */
8558
+ initiate_time?: string;
8559
+ /** 明细更新时间 */
8560
+ update_time?: string;
8561
+ }
8562
+ /** 查询服务商批次单参数 */
8563
+ interface GetPartnerTransferBatchParams {
8564
+ /** 是否查询明细单(默认 false) */
8565
+ need_query_detail?: boolean;
8566
+ /** 请求资源起始位置(默认 0) */
8567
+ offset?: number;
8568
+ /** 最大资源条数(20~100,默认 20) */
8569
+ limit?: number;
8570
+ /** 明细状态筛选:WAIT_PAY / ALL / SUCCESS / FAIL */
8571
+ detail_status?: string;
8572
+ }
8573
+ /**
8574
+ * 服务商批量转账服务
8575
+ *
8576
+ * 服务商模式下,实现同时向多个用户微信零钱进行转账的操作。
8577
+ *
8578
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434 (服务商商家转账)
8579
+ */
8580
+ declare class PartnerTransferBatchService {
8581
+ private readonly client;
8582
+ constructor(client: WxPayClient);
8583
+ /**
8584
+ * 发起服务商批量转账
8585
+ *
8586
+ * @param request - 批量转账请求参数
8587
+ * @returns 批量转账结果
8588
+ */
8589
+ initiateBatchTransfer(request: InitiatePartnerBatchTransferRequest): Promise<WxPayResponse<InitiatePartnerBatchTransferResponse>>;
8590
+ /**
8591
+ * 通过微信批次单号查询批次单
8592
+ *
8593
+ * @param batchId - 微信批次单号
8594
+ * @param params - 可选查询参数
8595
+ * @returns 批次单详情
8596
+ */
8597
+ getTransferBatchByNo(batchId: string, params?: GetPartnerTransferBatchParams): Promise<WxPayResponse<PartnerTransferBatchEntity>>;
8598
+ /**
8599
+ * 通过商家批次单号查询批次单
8600
+ *
8601
+ * @param outBatchNo - 商家批次单号
8602
+ * @param params - 可选查询参数
8603
+ * @returns 批次单详情
8604
+ */
8605
+ getTransferBatchByOutNo(outBatchNo: string, params?: GetPartnerTransferBatchParams): Promise<WxPayResponse<PartnerTransferBatchEntity>>;
8606
+ /**
8607
+ * 通过微信明细单号查询明细单
8608
+ *
8609
+ * @param batchId - 微信批次单号
8610
+ * @param detailId - 微信明细单号
8611
+ * @returns 明细单详情
8612
+ */
8613
+ getTransferDetailByNo(batchId: string, detailId: string): Promise<WxPayResponse<PartnerTransferDetailEntity>>;
8614
+ /**
8615
+ * 通过商家明细单号查询明细单
8616
+ *
8617
+ * @param outBatchNo - 商家批次单号
8618
+ * @param outDetailNo - 商家明细单号
8619
+ * @returns 明细单详情
8620
+ */
8621
+ getTransferDetailByOutNo(outBatchNo: string, outDetailNo: string): Promise<WxPayResponse<PartnerTransferDetailEntity>>;
8622
+ }
8623
+
8624
+ /** 电商收付通分账接收方 */
8625
+ interface EcommerceProfitSharingReceiver {
8626
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
8627
+ type: string;
8628
+ /** 接收方账号 */
8629
+ receiver_account: string;
8630
+ /** 分账金额(分) */
8631
+ amount: number;
8632
+ /** 分账描述 */
8633
+ description: string;
8634
+ /** 接收方姓名(加密) */
8635
+ receiver_name?: string;
8636
+ }
8637
+ /** 电商收付通请求分账请求 */
8638
+ interface CreateEcommerceProfitSharingRequest {
8639
+ /** 特约商户号 */
8640
+ sub_mchid: string;
8641
+ /** 电商平台 AppID */
8642
+ appid: string;
8643
+ /** 微信支付订单号 */
8644
+ transaction_id: string;
8645
+ /** 商户分账单号 */
8646
+ out_order_no: string;
8647
+ /** 分账接收方列表 */
8648
+ receivers: EcommerceProfitSharingReceiver[];
8649
+ /** 是否解冻剩余资金 */
8650
+ finish: boolean;
8651
+ }
8652
+ /** 电商收付通请求分账响应 */
8653
+ interface CreateEcommerceProfitSharingResponse {
8654
+ sub_mchid: string;
8655
+ transaction_id: string;
8656
+ out_order_no: string;
8657
+ /** 微信分账单号 */
8658
+ order_id: string;
8659
+ }
8660
+ /** 电商收付通查询分账响应 */
8661
+ interface QueryEcommerceProfitSharingResponse {
8662
+ sub_mchid: string;
8663
+ transaction_id: string;
8664
+ out_order_no: string;
8665
+ order_id: string;
8666
+ /** 分账状态 */
8667
+ state: string;
8668
+ receivers: {
8669
+ amount: number;
8670
+ description: string;
8671
+ type: string;
8672
+ receiver_account: string;
8673
+ result: string;
8674
+ fail_reason?: string;
8675
+ detail_id: string;
8676
+ create_time: string;
8677
+ finish_time: string;
8678
+ }[];
8679
+ }
8680
+ /** 电商收付通分账回退请求 */
8681
+ interface EcommerceProfitSharingReturnRequest {
8682
+ sub_mchid: string;
8683
+ order_id: string;
8684
+ out_order_no: string;
8685
+ out_return_no: string;
8686
+ return_mchid: string;
8687
+ amount: number;
8688
+ description: string;
8689
+ }
8690
+ /** 电商收付通分账回退响应 */
8691
+ interface EcommerceProfitSharingReturnResponse {
8692
+ sub_mchid: string;
8693
+ order_id: string;
8694
+ out_order_no: string;
8695
+ out_return_no: string;
8696
+ return_no: string;
8697
+ return_mchid: string;
8698
+ amount: number;
8699
+ result: string;
8700
+ fail_reason?: string;
8701
+ }
8702
+ /** 电商收付通完结分账请求 */
8703
+ interface EcommerceFinishOrderRequest {
8704
+ sub_mchid: string;
8705
+ transaction_id: string;
8706
+ out_order_no: string;
8707
+ description: string;
8708
+ }
8709
+ /** 电商收付通售后服务分账请求 */
8710
+ interface CreateAfterSalesOrderRequest {
8711
+ /** 子商户号 */
8712
+ sub_mchid: string;
8713
+ /** 微信支付订单号 */
8714
+ transaction_id: string;
8715
+ /** 分账金额(分) */
8716
+ amount: number;
8717
+ /** 类型:SERVICE_FEE_INCOME */
8718
+ type: string;
8719
+ /** 场景:REFUND_TICKET / CHANGE_TICKET / RETURN_GOODS */
8720
+ scene: string;
8721
+ /** 微信退款单号(退票/改签/退货收入分账时必填) */
8722
+ refund_id?: string;
8723
+ }
8724
+ /** 电商收付通售后服务分账响应 */
8725
+ interface CreateAfterSalesOrderResponse {
8726
+ sub_mchid: string;
8727
+ transaction_id: string;
8728
+ /** 分账金额(分) */
8729
+ amount: number;
8730
+ }
8731
+ /** 电商收付通查询售后服务分账响应 */
8732
+ interface QueryAfterSalesOrderResponse {
8733
+ sub_mchid: string;
8734
+ transaction_id: string;
8735
+ /** 分账金额(分) */
8736
+ amount: number;
8737
+ /** 分账结果:PROCESSING / SUCCESS / FAILED */
8738
+ result: string;
8739
+ /** 分账完成时间 */
8740
+ finish_time?: string;
8741
+ /** 分账失败原因 */
8742
+ fail_reason?: string;
8743
+ }
8744
+ /** 电商收付通查询订单剩余待分金额响应 */
8745
+ interface QueryEcommerceOrderAmountResponse {
8746
+ /** 微信支付订单号 */
8747
+ transaction_id: string;
8748
+ /** 订单剩余待分金额(分) */
8749
+ unsplit_amount: number;
8750
+ }
8751
+ /** 电商收付通添加分账接收方请求 */
8752
+ interface AddEcommerceReceiverRequest {
8753
+ /** 公众账号ID */
8754
+ appid: string;
8755
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
8756
+ type: string;
8757
+ /** 接收方账号 */
8758
+ account: string;
8759
+ /** 接收方名称(商户全称,仅 MERCHANT_ID 时需要) */
8760
+ name?: string;
8761
+ /** 与分账方的关系类型:SUPPLIER / DISTRIBUTOR / SERVICE_PROVIDER / PLATFORM / OTHERS */
8762
+ relation_type: string;
8763
+ }
8764
+ /** 电商收付通添加分账接收方响应 */
8765
+ interface AddEcommerceReceiverResponse {
8766
+ type: string;
8767
+ account: string;
8768
+ }
8769
+ /** 电商收付通删除分账接收方请求 */
8770
+ interface DeleteEcommerceReceiverRequest {
8771
+ /** 公众账号ID */
8772
+ appid: string;
8773
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
8774
+ type: string;
8775
+ /** 接收方账号 */
8776
+ account: string;
8777
+ }
8778
+ /** 电商收付通删除分账接收方响应 */
8779
+ interface DeleteEcommerceReceiverResponse {
8780
+ type: string;
8781
+ account: string;
8782
+ }
8783
+ /**
8784
+ * 电商收付通分账服务
8785
+ *
8786
+ * 用于电商平台对二级商户的订单进行分账。
8787
+ *
8788
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (分账)
8789
+ */
8790
+ declare class EcommerceProfitSharingService {
8791
+ private readonly client;
8792
+ constructor(client: WxPayClient);
8793
+ /**
8794
+ * 请求分账
8795
+ *
8796
+ * @param request - 分账请求参数
8797
+ * @returns 分账结果
8798
+ */
8799
+ createOrder(request: CreateEcommerceProfitSharingRequest): Promise<WxPayResponse<CreateEcommerceProfitSharingResponse>>;
8800
+ /**
8801
+ * 查询分账结果
8802
+ *
8803
+ * @param subMchid - 特约商户号
8804
+ * @param transactionId - 微信支付订单号
8805
+ * @param outOrderNo - 商户分账单号
8806
+ * @returns 分账结果详情
8807
+ */
8808
+ queryOrder(subMchid: string, transactionId: string, outOrderNo: string): Promise<WxPayResponse<QueryEcommerceProfitSharingResponse>>;
8809
+ /**
8810
+ * 请求分账回退
8811
+ *
8812
+ * @param request - 分账回退请求参数
8813
+ * @returns 回退结果
8814
+ */
8815
+ createReturnOrder(request: EcommerceProfitSharingReturnRequest): Promise<WxPayResponse<EcommerceProfitSharingReturnResponse>>;
8816
+ /**
8817
+ * 查询分账回退结果
8818
+ *
8819
+ * @param subMchid - 特约商户号
8820
+ * @param orderId - 微信分账单号
8821
+ * @param outReturnNo - 商户回退单号
8822
+ * @returns 回退结果详情
8823
+ */
8824
+ queryReturnOrder(subMchid: string, orderId: string, outReturnNo: string): Promise<WxPayResponse<EcommerceProfitSharingReturnResponse>>;
8825
+ /**
8826
+ * 完结分账
8827
+ *
8828
+ * @param request - 完结分账请求参数
8829
+ */
8830
+ finishOrder(request: EcommerceFinishOrderRequest): Promise<WxPayResponse>;
8831
+ /**
8832
+ * 请求售后服务分账
8833
+ *
8834
+ * @param request - 售后服务分账请求参数
8835
+ * @returns 售后服务分账结果
8836
+ */
8837
+ createAfterSalesOrder(request: CreateAfterSalesOrderRequest): Promise<WxPayResponse<CreateAfterSalesOrderResponse>>;
8838
+ /**
8839
+ * 查询售后服务分账结果
8840
+ *
8841
+ * @param subMchid - 子商户号
8842
+ * @param transactionId - 微信支付订单号
8843
+ * @returns 售后服务分账结果详情
8844
+ */
8845
+ queryAfterSalesOrder(subMchid: string, transactionId: string): Promise<WxPayResponse<QueryAfterSalesOrderResponse>>;
8846
+ /**
8847
+ * 查询订单剩余待分金额
8848
+ *
8849
+ * @param transactionId - 微信支付订单号
8850
+ * @returns 订单剩余待分金额
8851
+ */
8852
+ queryOrderAmount(transactionId: string): Promise<WxPayResponse<QueryEcommerceOrderAmountResponse>>;
8853
+ /**
8854
+ * 添加分账接收方
8855
+ *
8856
+ * @param request - 添加接收方请求参数
8857
+ * @returns 添加接收方结果
8858
+ */
8859
+ addReceiver(request: AddEcommerceReceiverRequest): Promise<WxPayResponse<AddEcommerceReceiverResponse>>;
8860
+ /**
8861
+ * 删除分账接收方
8862
+ *
8863
+ * @param request - 删除接收方请求参数
8864
+ * @returns 删除接收方结果
8865
+ */
8866
+ deleteReceiver(request: DeleteEcommerceReceiverRequest): Promise<WxPayResponse<DeleteEcommerceReceiverResponse>>;
8867
+ }
8868
+
8869
+ /** 电商收付通退款金额 */
8870
+ interface EcommerceRefundAmount {
8871
+ /** 退款金额(分) */
8872
+ refund: number;
8873
+ /** 原订单金额(分) */
8874
+ total: number;
8875
+ /** 货币类型 */
8876
+ currency?: string;
8877
+ }
8878
+ /** 电商收付通申请退款请求 */
8879
+ interface CreateEcommerceRefundRequest {
8880
+ /** 特约商户号 */
8881
+ sub_mchid: string;
8882
+ /** 电商平台 AppID */
8883
+ sp_appid: string;
8884
+ /** 特约商户 AppID */
8885
+ sub_appid?: string;
8886
+ /** 微信支付订单号 */
8887
+ transaction_id?: string;
8888
+ /** 商户订单号 */
8889
+ out_trade_no?: string;
8890
+ /** 商户退款单号 */
8891
+ out_refund_no: string;
8892
+ /** 退款原因 */
8893
+ reason?: string;
8894
+ /** 退款金额 */
8895
+ amount: EcommerceRefundAmount;
8896
+ /** 回调通知地址 */
8897
+ notify_url?: string;
8898
+ /** 退款资金来源 */
8899
+ funds_account?: string;
8900
+ }
8901
+ /** 电商收付通申请退款响应 */
8902
+ interface CreateEcommerceRefundResponse {
8903
+ /** 微信退款单号 */
8904
+ refund_id: string;
8905
+ /** 商户退款单号 */
8906
+ out_refund_no: string;
8907
+ /** 创建时间 */
8908
+ create_time: string;
8909
+ /** 退款金额 */
8910
+ amount: EcommerceRefundAmount;
8911
+ }
8912
+ /** 电商收付通查询退款响应 */
8913
+ interface QueryEcommerceRefundResponse {
8914
+ refund_id: string;
8915
+ out_refund_no: string;
8916
+ transaction_id: string;
8917
+ out_trade_no: string;
8918
+ channel?: string;
8919
+ user_received_account: string;
8920
+ success_time?: string;
8921
+ create_time: string;
8922
+ /** 退款状态 */
8923
+ status: string;
8924
+ amount: EcommerceRefundAmount;
8925
+ promotion_detail?: {
8926
+ promotion_id: string;
8927
+ scope: string;
8928
+ type: string;
8929
+ amount: number;
8930
+ refund_amount: number;
8931
+ }[];
8932
+ /** 退款出资账户 */
8933
+ refund_account?: string;
8934
+ /** 资金账户 */
8935
+ funds_account?: string;
8936
+ }
8937
+ /** 电商收付通垫付退款回补请求 */
8938
+ interface CreateReturnAdvanceRequest {
8939
+ /** 微信退款单号(必须是垫付退款的微信退款单) */
8940
+ refund_id: string;
8941
+ /** 二级商户号 */
8942
+ sub_mchid: string;
8943
+ }
8944
+ /** 电商收付通垫付退款回补响应 */
8945
+ interface ReturnAdvanceResponse {
8946
+ /** 微信退款单号 */
8947
+ refund_id: string;
8948
+ /** 微信回补单号 */
8949
+ advance_return_id: string;
8950
+ /** 垫付回补金额(分) */
8951
+ return_amount: number;
8952
+ /** 出款方商户号 */
8953
+ payer_mchid: string;
8954
+ /** 出款方账户:BASIC / OPERATION */
8955
+ payer_account: string;
8956
+ /** 入账方商户号 */
8957
+ payee_mchid: string;
8958
+ /** 入账方账户:BASIC / OPERATION */
8959
+ payee_account: string;
8960
+ /** 垫付回补结果:SUCCESS / FAILED / PROCESSING */
8961
+ result: string;
8962
+ /** 垫付回补完成时间 */
8963
+ success_time?: string;
8964
+ }
7894
8965
  /**
7895
- * 零售门店服务
8966
+ * 电商收付通退款服务
7896
8967
  *
7897
- * 提供微信支付零售门店相关 API 封装,包括:
7898
- * - 门店活动管理
7899
- * - 门店资质管理
7900
- * - 零售门店活动操作
8968
+ * 用于电商平台对二级商户的订单进行退款。
7901
8969
  *
7902
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
8970
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080625 (申请退款)
7903
8971
  */
7904
- declare class RetailStoreService {
8972
+ declare class EcommerceRefundService {
7905
8973
  private readonly client;
7906
8974
  constructor(client: WxPayClient);
7907
8975
  /**
7908
- * 创建门店活动
8976
+ * 申请退款
7909
8977
  *
7910
- * @param request - 活动创建请求参数
7911
- * @returns 创建结果
8978
+ * @param request - 退款请求参数
8979
+ * @returns 退款结果
8980
+ *
8981
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080625
7912
8982
  */
7913
- createActivity(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
8983
+ create(request: CreateEcommerceRefundRequest): Promise<WxPayResponse<CreateEcommerceRefundResponse>>;
7914
8984
  /**
7915
- * 查询门店活动详情
8985
+ * 查询单笔退款(通过商户退款单号)
7916
8986
  *
7917
- * @param activityId - 活动ID
7918
- * @returns 活动详情
8987
+ * @param subMchid - 特约商户号
8988
+ * @param outRefundNo - 商户退款单号
8989
+ * @returns 退款详情
7919
8990
  */
7920
- queryActivity(activityId: string): Promise<WxPayResponse<Record<string, unknown>>>;
8991
+ queryByOutRefundNo(subMchid: string, outRefundNo: string): Promise<WxPayResponse<QueryEcommerceRefundResponse>>;
7921
8992
  /**
7922
- * 更新门店活动
8993
+ * 查询单笔退款(通过微信支付退款单号)
7923
8994
  *
7924
- * @param activityId - 活动ID
7925
- * @param request - 更新请求参数
7926
- * @returns 更新结果
8995
+ * @param subMchid - 特约商户号
8996
+ * @param refundId - 微信支付退款单号
8997
+ * @returns 退款详情
7927
8998
  */
7928
- updateActivity(activityId: string, request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
8999
+ queryByRefundId(subMchid: string, refundId: string): Promise<WxPayResponse<QueryEcommerceRefundResponse>>;
7929
9000
  /**
7930
- * 创建门店资质
9001
+ * 垫付退款回补
7931
9002
  *
7932
- * @param request - 资质创建请求参数
7933
- * @returns 创建结果
9003
+ * 当电商平台已垫付退款给用户,后续从二级商户处回补该笔退款资金。
9004
+ *
9005
+ * @param request - 垫付回补请求参数
9006
+ * @returns 垫付回补结果
7934
9007
  */
7935
- createQualification(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9008
+ createReturnAdvance(request: CreateReturnAdvanceRequest): Promise<WxPayResponse<ReturnAdvanceResponse>>;
7936
9009
  /**
7937
- * 查询门店资质
9010
+ * 查询垫付回补结果
7938
9011
  *
7939
- * @param qualificationId - 资质ID
7940
- * @returns 资质详情
9012
+ * @param subMchid - 特约商户号
9013
+ * @param refundId - 微信退款单号
9014
+ * @returns 垫付回补结果
7941
9015
  */
7942
- queryQualification(qualificationId: string): Promise<WxPayResponse<Record<string, unknown>>>;
9016
+ queryReturnAdvance(subMchid: string, refundId: string): Promise<WxPayResponse<ReturnAdvanceResponse>>;
7943
9017
  }
7944
9018
 
9019
+ /** 电商收付通请求补差请求 */
9020
+ interface CreateEcommerceSubsidyRequest {
9021
+ /** 特约商户号 */
9022
+ sub_mchid: string;
9023
+ /** 微信支付订单号 */
9024
+ transaction_id: string;
9025
+ /** 补差金额(分) */
9026
+ amount: number;
9027
+ /** 补差描述 */
9028
+ description: string;
9029
+ /** 商户补差单号 */
9030
+ out_subsidy_no?: string;
9031
+ }
9032
+ /** 电商收付通请求补差响应 */
9033
+ interface CreateEcommerceSubsidyResponse {
9034
+ sub_mchid: string;
9035
+ transaction_id: string;
9036
+ /** 微信补差单号 */
9037
+ subsidy_id: string;
9038
+ amount: number;
9039
+ description: string;
9040
+ /** 补差结果 */
9041
+ result: string;
9042
+ success_time?: string;
9043
+ }
9044
+ /** 电商收付通补差回退请求 */
9045
+ interface EcommerceSubsidyReturnRequest {
9046
+ sub_mchid: string;
9047
+ transaction_id: string;
9048
+ refund_id?: string;
9049
+ amount: number;
9050
+ description: string;
9051
+ /** 商户补差回退单号 */
9052
+ out_order_no: string;
9053
+ }
9054
+ /** 电商收付通补差回退响应 */
9055
+ interface EcommerceSubsidyReturnResponse {
9056
+ sub_mchid: string;
9057
+ transaction_id: string;
9058
+ /** 微信补差回退单号 */
9059
+ subsidy_refund_id: string;
9060
+ amount: number;
9061
+ description: string;
9062
+ result: string;
9063
+ success_time?: string;
9064
+ }
9065
+ /** 电商收付通取消补差请求 */
9066
+ interface CancelEcommerceSubsidyRequest {
9067
+ /** 特约商户号 */
9068
+ sub_mchid: string;
9069
+ /** 微信支付订单号 */
9070
+ transaction_id: string;
9071
+ /** 取消补差描述 */
9072
+ description: string;
9073
+ }
9074
+ /** 电商收付通取消补差响应 */
9075
+ interface CancelEcommerceSubsidyResponse {
9076
+ sub_mchid: string;
9077
+ transaction_id: string;
9078
+ /** 取消补差结果 */
9079
+ result: string;
9080
+ description: string;
9081
+ }
7945
9082
  /**
7946
- * 商家零钱服务
9083
+ * 电商收付通补差服务
7947
9084
  *
7948
- * 提供微信支付商家零钱(金盘计划)相关 API 封装,包括:
7949
- * - 查询商户零钱余额
7950
- * - 查询商户零钱流水
7951
- * - 商家零钱状态管理
9085
+ * 用于电商平台对二级商户的订单进行补差。
7952
9086
  *
7953
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
9087
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (补差)
7954
9088
  */
7955
- declare class GoldPlanService {
9089
+ declare class EcommerceSubsidyService {
7956
9090
  private readonly client;
7957
9091
  constructor(client: WxPayClient);
7958
9092
  /**
7959
- * 查询商户零钱余额
9093
+ * 请求补差
7960
9094
  *
7961
- * @param mchid - 商户号
7962
- * @returns 零钱余额信息
9095
+ * @param request - 补差请求参数
9096
+ * @returns 补差结果
7963
9097
  */
7964
- queryBalance(mchid: string): Promise<WxPayResponse<Record<string, unknown>>>;
9098
+ create(request: CreateEcommerceSubsidyRequest): Promise<WxPayResponse<CreateEcommerceSubsidyResponse>>;
7965
9099
  /**
7966
- * 查询商户零钱流水
9100
+ * 请求补差回退
7967
9101
  *
7968
- * @param mchid - 商户号
7969
- * @param params - 查询参数
7970
- * @returns 零钱流水列表
9102
+ * @param request - 补差回退请求参数
9103
+ * @returns 回退结果
7971
9104
  */
7972
- queryFlow(mchid: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9105
+ returnSubsidy(request: EcommerceSubsidyReturnRequest): Promise<WxPayResponse<EcommerceSubsidyReturnResponse>>;
7973
9106
  /**
7974
- * 查询商家零钱状态
9107
+ * 取消补差
7975
9108
  *
7976
- * @param mchid - 商户号
7977
- * @returns 零钱状态信息
9109
+ * @param request - 取消补差请求参数
9110
+ * @returns 取消补差结果
7978
9111
  */
7979
- queryStatus(mchid: string): Promise<WxPayResponse<Record<string, unknown>>>;
9112
+ cancelSubsidy(request: CancelEcommerceSubsidyRequest): Promise<WxPayResponse<CancelEcommerceSubsidyResponse>>;
7980
9113
  }
7981
9114
 
9115
+ /** 连锁品牌分账接收方 */
9116
+ interface BrandProfitSharingReceiver {
9117
+ /** 接收方类型 */
9118
+ type: string;
9119
+ /** 接收方账号 */
9120
+ account: string;
9121
+ /** 分账金额(分) */
9122
+ amount: number;
9123
+ /** 分账描述 */
9124
+ description: string;
9125
+ /** 接收方姓名 */
9126
+ name?: string;
9127
+ }
9128
+ /** 连锁品牌请求分账请求 */
9129
+ interface CreateBrandProfitSharingRequest {
9130
+ /** 品牌主商户号 */
9131
+ brand_mchid: string;
9132
+ /** 特约商户号 */
9133
+ sub_mchid: string;
9134
+ /** 微信支付订单号 */
9135
+ transaction_id: string;
9136
+ /** 商户分账单号 */
9137
+ out_order_no: string;
9138
+ /** 分账接收方列表 */
9139
+ receivers: BrandProfitSharingReceiver[];
9140
+ /** 是否解冻剩余资金 */
9141
+ finish: boolean;
9142
+ }
9143
+ /** 连锁品牌请求分账响应 */
9144
+ interface CreateBrandProfitSharingResponse {
9145
+ transaction_id: string;
9146
+ out_order_no: string;
9147
+ /** 微信分账单号 */
9148
+ order_id: string;
9149
+ }
9150
+ /** 连锁品牌分账回退请求 */
9151
+ interface BrandProfitSharingReturnRequest {
9152
+ brand_mchid: string;
9153
+ sub_mchid: string;
9154
+ order_id: string;
9155
+ out_order_no: string;
9156
+ out_return_no: string;
9157
+ return_mchid: string;
9158
+ amount: number;
9159
+ description: string;
9160
+ }
9161
+ /** 连锁品牌分账回退响应 */
9162
+ interface BrandProfitSharingReturnResponse {
9163
+ order_id: string;
9164
+ out_order_no: string;
9165
+ out_return_no: string;
9166
+ return_no: string;
9167
+ return_mchid: string;
9168
+ amount: number;
9169
+ result: string;
9170
+ }
9171
+ /** 连锁品牌完结分账请求 */
9172
+ interface BrandFinishOrderRequest {
9173
+ brand_mchid: string;
9174
+ sub_mchid: string;
9175
+ transaction_id: string;
9176
+ out_order_no: string;
9177
+ description: string;
9178
+ }
9179
+ /** 连锁品牌查询最大分账比例响应 */
9180
+ interface QueryBrandMerchantRatioResponse {
9181
+ /** 品牌商户号 */
9182
+ brand_mchid: string;
9183
+ /** 最大分账比例(万分比,如2000表示20%) */
9184
+ max_ratio: number;
9185
+ }
9186
+ /** 连锁品牌查询订单剩余待分金额响应 */
9187
+ interface QueryBrandOrderAmountResponse {
9188
+ /** 微信支付订单号 */
9189
+ transaction_id: string;
9190
+ /** 订单剩余待分金额(分) */
9191
+ unsplit_amount: number;
9192
+ }
9193
+ /** 连锁品牌添加分账接收方请求 */
9194
+ interface AddBrandReceiverRequest {
9195
+ /** 品牌主商户号 */
9196
+ brand_mchid: string;
9197
+ /** 公众账号ID */
9198
+ appid: string;
9199
+ /** 子商户公众账号ID(PERSONAL_SUB_OPENID 时必填) */
9200
+ sub_appid?: string;
9201
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID / PERSONAL_SUB_OPENID */
9202
+ type: string;
9203
+ /** 接收方账号 */
9204
+ account: string;
9205
+ /** 接收方名称 */
9206
+ name?: string;
9207
+ /** 与品牌主的关系类型:SUPPLIER / DISTRIBUTOR / SERVICE_PROVIDER / PLATFORM / STAFF / OTHERS */
9208
+ relation_type: string;
9209
+ }
9210
+ /** 连锁品牌添加分账接收方响应 */
9211
+ interface AddBrandReceiverResponse {
9212
+ brand_mchid: string;
9213
+ type: string;
9214
+ account: string;
9215
+ }
9216
+ /** 连锁品牌删除分账接收方请求 */
9217
+ interface DeleteBrandReceiverRequest {
9218
+ /** 品牌主商户号 */
9219
+ brand_mchid: string;
9220
+ /** 公众账号ID */
9221
+ appid: string;
9222
+ /** 子商户公众账号ID */
9223
+ sub_appid?: string;
9224
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID / PERSONAL_SUB_OPENID */
9225
+ type: string;
9226
+ /** 接收方账号 */
9227
+ account: string;
9228
+ }
9229
+ /** 连锁品牌删除分账接收方响应 */
9230
+ interface DeleteBrandReceiverResponse {
9231
+ brand_mchid: string;
9232
+ type: string;
9233
+ account: string;
9234
+ }
7982
9235
  /**
7983
- * 爱心餐服务
9236
+ * 连锁品牌分账服务
7984
9237
  *
7985
- * 提供微信支付爱心餐相关 API 封装,包括:
7986
- * - 品牌管理
7987
- * - 订单管理
9238
+ * 用于连锁品牌对门店的订单进行分账。
7988
9239
  *
7989
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012064295
9240
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (连锁品牌分账)
7990
9241
  */
7991
- declare class LoveFeastService {
9242
+ declare class BrandProfitSharingService {
7992
9243
  private readonly client;
7993
9244
  constructor(client: WxPayClient);
7994
9245
  /**
7995
- * 创建爱心餐品牌
9246
+ * 请求分账
7996
9247
  *
7997
- * @param request - 品牌创建请求参数
7998
- * @returns 创建结果
9248
+ * @param request - 分账请求参数
9249
+ * @returns 分账结果
7999
9250
  */
8000
- createBrand(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9251
+ createOrder(request: CreateBrandProfitSharingRequest): Promise<WxPayResponse<CreateBrandProfitSharingResponse>>;
8001
9252
  /**
8002
- * 查询爱心餐品牌
9253
+ * 查询分账结果
8003
9254
  *
8004
- * @param brandId - 品牌ID
8005
- * @returns 品牌详情
9255
+ * @param brandMchid - 品牌主商户号
9256
+ * @param subMchid - 特约商户号
9257
+ * @param transactionId - 微信支付订单号
9258
+ * @param outOrderNo - 商户分账单号
9259
+ * @returns 分账结果详情
8006
9260
  */
8007
- queryBrand(brandId: string): Promise<WxPayResponse<Record<string, unknown>>>;
9261
+ queryOrder(brandMchid: string, subMchid: string, transactionId: string, outOrderNo: string): Promise<WxPayResponse<CreateBrandProfitSharingResponse>>;
8008
9262
  /**
8009
- * 创建爱心餐订单
9263
+ * 请求分账回退
8010
9264
  *
8011
- * @param request - 订单创建请求参数
8012
- * @returns 订单创建结果
9265
+ * @param request - 分账回退请求参数
9266
+ * @returns 回退结果
8013
9267
  */
8014
- createOrder(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9268
+ createReturnOrder(request: BrandProfitSharingReturnRequest): Promise<WxPayResponse<BrandProfitSharingReturnResponse>>;
8015
9269
  /**
8016
- * 查询爱心餐订单
9270
+ * 查询分账回退结果
8017
9271
  *
8018
- * @param outTradeNo - 商户订单号
8019
- * @param params - 查询参数
8020
- * @returns 订单详情
9272
+ * @param brandMchid - 品牌主商户号
9273
+ * @param subMchid - 特约商户号
9274
+ * @param orderId - 微信分账单号
9275
+ * @param outReturnNo - 商户回退单号
9276
+ * @returns 回退结果详情
8021
9277
  */
8022
- queryOrder(outTradeNo: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
8023
- }
8024
-
8025
- /**
8026
- * 商户专属优惠券服务
8027
- *
8028
- * 提供微信支付商户专属优惠券相关 API 封装,包括:
8029
- * - 优惠券批次管理
8030
- * - 优惠券发放
8031
- * - 优惠券查询
8032
- *
8033
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012084079
8034
- */
8035
- declare class MerchantExclusiveCouponService {
8036
- private readonly client;
8037
- constructor(client: WxPayClient);
9278
+ queryReturnOrder(brandMchid: string, subMchid: string, orderId: string, outReturnNo: string): Promise<WxPayResponse<BrandProfitSharingReturnResponse>>;
8038
9279
  /**
8039
- * 创建优惠券批次
9280
+ * 完结分账
8040
9281
  *
8041
- * @param request - 批次创建请求参数
8042
- * @returns 创建结果
9282
+ * @param request - 完结分账请求参数
8043
9283
  */
8044
- createCouponStock(request: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9284
+ finishOrder(request: BrandFinishOrderRequest): Promise<WxPayResponse>;
8045
9285
  /**
8046
- * 查询优惠券批次详情
9286
+ * 查询最大分账比例
8047
9287
  *
8048
- * @param stockId - 批次ID
8049
- * @returns 批次详情
9288
+ * @param brandMchid - 品牌主商户号
9289
+ * @returns 最大分账比例
8050
9290
  */
8051
- queryCouponStock(stockId: string): Promise<WxPayResponse<Record<string, unknown>>>;
9291
+ queryBrandMerchantRatio(brandMchid: string): Promise<WxPayResponse<QueryBrandMerchantRatioResponse>>;
8052
9292
  /**
8053
- * 发放优惠券
9293
+ * 查询订单剩余待分金额
8054
9294
  *
8055
- * @param request - 发放请求参数
8056
- * @returns 发放结果
9295
+ * @param transactionId - 微信支付订单号
9296
+ * @returns 订单剩余待分金额
8057
9297
  */
8058
- sendCoupon(request: {
8059
- stock_id: string;
8060
- out_request_no: string;
8061
- openid: string;
8062
- }): Promise<WxPayResponse<Record<string, unknown>>>;
9298
+ queryOrderAmount(transactionId: string): Promise<WxPayResponse<QueryBrandOrderAmountResponse>>;
8063
9299
  /**
8064
- * 查询用户优惠券
9300
+ * 添加分账接收方
8065
9301
  *
8066
- * @param openid - 用户标识
8067
- * @param params - 查询参数
8068
- * @returns 用户优惠券列表
9302
+ * @param request - 添加接收方请求参数
9303
+ * @returns 添加接收方结果
8069
9304
  */
8070
- queryUserCoupons(openid: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9305
+ addReceiver(request: AddBrandReceiverRequest): Promise<WxPayResponse<AddBrandReceiverResponse>>;
8071
9306
  /**
8072
- * 查询优惠券详情
9307
+ * 删除分账接收方
8073
9308
  *
8074
- * @param couponId - 优惠券ID
8075
- * @param params - 查询参数
8076
- * @returns 优惠券详情
9309
+ * @param request - 删除接收方请求参数
9310
+ * @returns 删除接收方结果
8077
9311
  */
8078
- queryCoupon(couponId: string, params?: Record<string, unknown>): Promise<WxPayResponse<Record<string, unknown>>>;
9312
+ deleteReceiver(request: DeleteBrandReceiverRequest): Promise<WxPayResponse<DeleteBrandReceiverResponse>>;
8079
9313
  }
8080
9314
 
8081
9315
  /**
@@ -8525,4 +9759,39 @@ declare function oaepEncrypt(plaintext: string, publicKey: string | Buffer): str
8525
9759
  */
8526
9760
  declare function oaepDecrypt(ciphertext: string, privateKey: string | Buffer): string;
8527
9761
 
8528
- export { type ActivateCouponStockRequest, type ActivateCouponStockResponse, type AddProfitSharingReceiverRequest, type AddProfitSharingReceiverResponse, type AppBridgeConfig, AppService, type ApplyAbnormalRefundRequest, type ApplyAbnormalRefundResponse, type ApplyMerchantTransferElecSignByOutBillNoRequest, type ApplyMerchantTransferElecSignByTransferBillNoRequest, type ApplyMerchantTransferElecSignResponse, type ApplyParkingRefundRequest, type ApplyParkingRefundResponse, type AssignSmartGuideRequest, type AuthorizationCloseInfo, type AuthorizationCloseReason, BillService, type BuildPartnershipRequest, type BuildPartnershipResponse, type BusinessCircleAuthorizeCallbackData, type BusinessCircleRefundCallbackData, BusinessCircleService, type BusinessCircleTransactionCallbackData, CallbackHandler, type CallbackHeaders, type CallbackNotification, type CallbackResource, type CancelMerchantTransferResponse, type CancelPayScoreOrderRequest, type CancelPayScoreOrderResponse, CertificateManager, CertificateService, type CloseCombineOrderParams, type CloseCombineOrderRequest, type CloseCombineSubOrder, type CloseMerchantTransferAuthorizationResponse, type CloseOrderParams, type CloseOrderRequest, CombineAppService, CombineH5Service, CombineMiniProgramService, CombineNativeService, type CombinePayerInfo, type CombinePayerInfoResponse, type CombinePromotionDetail, type CombinePromotionGoodsDetail, type CombineSceneInfo, type CombineSceneInfoResponse, CombineService, type CombineSubOrder, type CombineSubOrderAmount, type CombineSubOrderAmountResponse, type CombineSubOrderResponse, type CombineSubOrderSettleInfo, type CombineTransactionCallbackData, type CombineTransactionSubOrder, type ComplaintCallbackData, type ComplaintCallbackUrlRequest, type ComplaintCallbackUrlResponse, type ComplaintNegotiationHistoryResponse, type ComplaintNegotiationRecord, type ComplaintNegotiationState, ComplaintService, type ComplaintState, type ComplaintSummary, type CompleteComplaintRequest, type CompletePayScoreOrderRequest, type CompletePayScoreOrderResponse, type CouponConsumeGoodsDetail, type CouponConsumeInformation, type CouponCutToMessage, type CouponFixedNormalCoupon, type CouponLimitCard, type CouponNormalCouponInformation, type CouponPatternInfo, CouponService, type CouponStatus, type CouponStockItem, type CouponStockStatus, type CouponStockType, type CouponStockUseRule, type CouponType, type CouponUseCallbackData, type CouponUseRule, type CreateAppCombineOrderRequest, type CreateAppCombineOrderResponse, type CreateAppOrderRequest, type CreateAppOrderResponse, type CreateCombineOrderRequest, type CreateCombineOrderResponse, type CreateCouponStockRequest, type CreateCouponStockResponse, type CreateH5CombineOrderRequest, type CreateH5CombineOrderResponse, type CreateH5OrderRequest, type CreateH5OrderResponse, type CreateJsapiOrderRequest, type CreateJsapiOrderResponse, type CreateMedInsOrderRequest, type CreateMerchantTransferAuthorizationRequest, type CreateMerchantTransferAuthorizationResponse, type CreateMerchantTransferRequest, type CreateMerchantTransferResponse, type CreateMiniProgramCombineOrderRequest, type CreateMiniProgramCombineOrderResponse, type CreateNativeCombineOrderRequest, type CreateNativeCombineOrderResponse, type CreateNativeOrderRequest, type CreateNativeOrderResponse, type CreateParkingRequest, type CreateParkingResponse, type CreateParkingTransactionRequest, type CreateParkingTransactionResponse, type CreatePayGiftActivityRequest, type CreatePayGiftActivityResponse, type CreatePayScoreOrderRequest, type CreatePayScoreOrderResponse, type CreateProfitSharingOrderRequest, type CreateProfitSharingOrderResponse, type CreateProfitSharingReturnOrderRequest, type CreateProfitSharingReturnOrderResponse, type CreateRefundRequest, type CreateRefundResponse, type CreateTransferAfterAuthorizationRequest, type CreateTransferAfterAuthorizationResponse, type CreateTransferWithAuthorizationRequest, type CreateTransferWithAuthorizationResponse, type DecryptedCallback, type DecryptedCertificate, DecryptionException, type DeleteProfitSharingReceiverRequest, type DeleteProfitSharingReceiverResponse, type DownloadBillParams, type DownloadBillResponse, type DownloadCouponStockFlowResponse, type EchoTestRequest, type EchoTestResponse, type ElecSignHashType, type ElecSignState, type FundFlowBillParams, type FundFlowBillResponse, type GetPayGiftActivityGoodsResponse, type GetPayGiftActivityMerchantsResponse, GoldPlanService, type GoodsDetail, type H5CombineSceneInfo, type H5Info, type H5SceneInfo, H5Service, HttpException, type JsapiBridgeConfig, JsapiService, LoveFeastService, MalformedMessageException, type MedInsCashAddEntity, type MedInsCashReduceEntity, type MedInsJsapiBridgeConfig, type MedInsMedInsPayStatus, type MedInsMiniProgramBridgeConfig, type MedInsMixPayStatus, type MedInsMixPayType, type MedInsOrderResponse, type MedInsOrderType, type MedInsPersonIdentification, type MedInsRefundCallbackData, type MedInsSelfPayStatus, MedInsService, type MedInsSuccessCallbackData, MediaService, MerchantExclusiveCouponService, type MerchantTransferAuthorizationCallbackData, type MerchantTransferAuthorizationJsapiBridgeConfig, type MerchantTransferAuthorizationState, type MerchantTransferCallbackData, type MerchantTransferJsapiBridgeConfig, MerchantTransferService, type MerchantTransferState, type MiniProgramBridgeConfig, type ModifyPayScoreOrderRequest, type ModifyPayScoreOrderResponse, NativeService, type OrderAmount, type OrderAmountResponse, type OrderDetail, type OrderPayer, type ParkingAmount, type ParkingAppBridgeConfig, type ParkingBlockReason, type ParkingCallbackBlockReason, type ParkingEntryStatusCallbackData, type ParkingH5BridgeConfig, type ParkingMiniProgramBridgeConfig, type ParkingPayer, type ParkingPromotionDetail, type ParkingRefundAmount, type ParkingRefundFrom, type ParkingRefundGoodsDetail, type ParkingRefundPromotionDetail, type ParkingRepayBridgeConfig, type ParkingSceneInfo, ParkingService, type ParkingState, type ParkingTradeState, type ParkingTransactionCallbackData, type PartnershipAuthorizedData, type PartnershipBusinessType, type PartnershipPartner, type PartnershipPartnerType, type PartnershipRecord, PartnershipService, type PartnershipState, type PauseCouponStockRequest, type PauseCouponStockResponse, PayGiftActivityService, type PayGiftActivityState, type PayGiftActivitySummary, type PayScoreAppBridgeConfig, type PayScoreCollection, type PayScoreCollectionDetail, type PayScoreCollectionState, type PayScoreDetailAppBridgeConfig, type PayScoreDetailJsapiBridgeConfig, type PayScoreDetailMiniProgramBridgeConfig, type PayScoreDevice, type PayScoreDiscount, type PayScoreJsapiBridgeConfig, type PayScoreLocation, type PayScoreMiniProgramBridgeConfig, type PayScoreOrderState, type PayScoreOrderStateDescription, type PayScorePayment, type PayScorePromotionDetail, type PayScorePromotionGoodsDetail, type PayScoreRefundCallbackData, type PayScoreRiskFund, PayScoreService, type PayScoreTimeRange, type PayScoreUserConfirmCallbackData, type PayScoreUserPaidCallbackData, PayrollCardService, type PlateColor, type PlateServiceState, type PlatformCertificate, type ProfitSharingBillParams, type ProfitSharingBillResponse, type ProfitSharingCallbackData, type ProfitSharingFailReason, type ProfitSharingReceiver, type ProfitSharingReceiverResponse, type ProfitSharingReceiverResult, type ProfitSharingReceiverType, type ProfitSharingRelationType, type ProfitSharingReturnFailReason, type ProfitSharingReturnResult, ProfitSharingService, type ProfitSharingState, type PromotionDetail, type PromotionGoodsDetail, type QueryBusinessCircleAuthorizationResponse, type QueryBusinessCirclePendingPointsParams, type QueryBusinessCirclePendingPointsResponse, type QueryCombineOrderParams, type QueryCombineOrderResponse, type QueryComplaintResponse, type QueryComplaintsParams, type QueryComplaintsResponse, type QueryCouponDetailParams, type QueryCouponDetailResponse, type QueryCouponStockItemsParams, type QueryCouponStockItemsResponse, type QueryCouponStockMerchantsParams, type QueryCouponStockMerchantsResponse, type QueryCouponStocksParams, type QueryCouponStocksResponse, type QueryMerchantTransferAuthorizationResponse, type QueryMerchantTransferElecSignResponse, type QueryMerchantTransferResponse, type QueryOrderParams, type QueryOrderResponse, type QueryParkingOrderResponse, type QueryParkingRefundResponse, type QueryPartnershipsParams, type QueryPartnershipsResponse, type QueryPayGiftActivitiesParams, type QueryPayGiftActivitiesResponse, type QueryPayGiftActivityResponse, type QueryPayScoreOrderParams, type QueryPayScoreOrderResponse, type QueryPlateServiceParams, type QueryPlateServiceResponse, type QueryProfitSharingAmountResponse, type QueryProfitSharingOrderParams, type QueryProfitSharingOrderResponse, type QueryProfitSharingReturnOrderParams, type QueryProfitSharingReturnOrderResponse, type QueryRefundParams, type QueryRefundResponse, type QuerySmartGuidesParams, type QuerySmartGuidesResponse, type QueryUserCouponsParams, type QueryUserCouponsResponse, type RefundAmount, type RefundAmountResponse, type RefundCallbackData, type RefundFromAccount, type RefundGoodsDetail, type RefundPromotionDetail, type RegisterSmartGuideRequest, type RegisterSmartGuideResponse, type ReplyComplaintRequest, type ReplyImmediateServiceRequest, type RequestParams, type RestartCouponStockRequest, type RestartCouponStockResponse, RetailStoreService, ScanAndRideService, type SceneInfo, type SceneInfoResponse, SecurityService, type SendCouponRequest, type SendCouponResponse, ServiceException, type SetCouponCallbackRequest, type SetCouponCallbackResponse, type SettleInfo, type SignPayload, type SignType, type SignatureType, type SmartGuide, SmartGuideService, type StoreInfo, type SyncBusinessCircleParkingStatusRequest, type SyncBusinessCirclePointsRequest, type SyncPayScoreOrderRequest, type SyncPayScoreOrderResponse, type TradeBillParams, type TradeBillResponse, type TransactionCallbackData, type TransferSceneReportInfo, type UnfreezeProfitSharingRequest, type UnfreezeProfitSharingResponse, type UpdateComplaintRefundRequest, type UpdateSmartGuideRequest, type UploadComplaintImageResponse, type UploadMarketingImageRequest, type UploadMarketingImageResponse, type UserCouponItem, ValidationException, WxPayClient, WxPayError, type WxPayErrorDetail$1 as WxPayErrorDetail, type WxPayOptions, type WxPayResponse, buildAppBridgeConfig, buildAuthorization, buildH5CouponUrl, buildJsapiBridgeConfig, buildMedInsJsapiBridgeConfig, buildMedInsMiniProgramBridgeConfig, buildMerchantTransferAuthorizationJsapiBridgeConfig, buildMerchantTransferJsapiBridgeConfig, buildMerchantTransferMiniProgramBridgeConfig, buildMiniProgramBridgeConfig, buildParkingAppBridgePath, buildParkingH5BridgeUrl, buildParkingMiniProgramBridgeConfig, buildParkingRepayBridgeConfig, buildPayScoreAppBridgeConfig, buildPayScoreDetailAppBridgeConfig, buildPayScoreDetailJsapiBridgeConfig, buildPayScoreDetailMiniProgramBridgeConfig, buildPayScoreJsapiBridgeConfig, buildPayScoreMiniProgramBridgeConfig, buildSignString, decryptSensitiveFields, decryptSensitiveFieldsInArray, encryptSensitiveFields, encryptSensitiveFieldsInArray, generateAppPaySign, generateNonce, generateNonceStr, generatePayScorePaySign, generatePaySign, isTimestampValid, oaepDecrypt, oaepEncrypt, registerSensitiveFields, sign, verifySignature };
9762
+ /**
9763
+ * 从 PEM 字符串加载 X.509 证书
9764
+ */
9765
+ declare function loadCertificate(certificate: string): crypto.X509Certificate;
9766
+ /**
9767
+ * 从文件路径加载 X.509 证书
9768
+ */
9769
+ declare function loadCertificateFromPath(path: string): crypto.X509Certificate;
9770
+ /**
9771
+ * 加载私钥内容(支持 PEM 字符串、文件路径、Buffer)
9772
+ */
9773
+ declare function loadPrivateKey(key: string | Buffer): string;
9774
+ /**
9775
+ * 加载公钥内容(支持 PEM 字符串、文件路径、Buffer)
9776
+ */
9777
+ declare function loadPublicKey(key: string | Buffer): string;
9778
+ /**
9779
+ * 获取 X.509 证书序列号(大写十六进制)
9780
+ */
9781
+ declare function getCertificateSerialNumber(cert: crypto.X509Certificate): string;
9782
+ /**
9783
+ * 判断证书是否已过期
9784
+ *
9785
+ * @param cert - X.509 证书
9786
+ * @param now - 检查时间点,默认为当前时间
9787
+ */
9788
+ declare function isCertificateExpired(cert: crypto.X509Certificate, now?: Date): boolean;
9789
+ /**
9790
+ * 判断证书是否在有效期内
9791
+ *
9792
+ * @param cert - X.509 证书
9793
+ * @param now - 检查时间点,默认为当前时间
9794
+ */
9795
+ declare function isCertificateValid(cert: crypto.X509Certificate, now?: Date): boolean;
9796
+
9797
+ export { type ActivateCouponStockRequest, type ActivateCouponStockResponse, type AddProfitSharingReceiverRequest, type AddProfitSharingReceiverResponse, type AppBridgeConfig, AppService, type ApplyAbnormalRefundRequest, type ApplyAbnormalRefundResponse, type ApplyMerchantTransferElecSignByOutBillNoRequest, type ApplyMerchantTransferElecSignByTransferBillNoRequest, type ApplyMerchantTransferElecSignResponse, type ApplyParkingRefundRequest, type ApplyParkingRefundResponse, type AssignSmartGuideRequest, type AuthorizationCloseInfo, type AuthorizationCloseReason, BillService, BrandProfitSharingService, type BuildPartnershipRequest, type BuildPartnershipResponse, type BusinessCircleAuthorizeCallbackData, type BusinessCircleRefundCallbackData, BusinessCircleService, type BusinessCircleTransactionCallbackData, CallbackHandler, type CallbackHeaders, type CallbackNotification, type CallbackResource, type CancelMerchantTransferResponse, type CancelPayScoreOrderRequest, type CancelPayScoreOrderResponse, CertificateManager, CertificateService, type CloseCombineOrderParams, type CloseCombineOrderRequest, type CloseCombineSubOrder, type CloseMerchantTransferAuthorizationResponse, type CloseOrderParams, type CloseOrderRequest, CombineAppService, CombineH5Service, CombineMiniProgramService, CombineNativeService, type CombinePayerInfo, type CombinePayerInfoResponse, type CombinePromotionDetail, type CombinePromotionGoodsDetail, type CombineSceneInfo, type CombineSceneInfoResponse, CombineService, type CombineSubOrder, type CombineSubOrderAmount, type CombineSubOrderAmountResponse, type CombineSubOrderResponse, type CombineSubOrderSettleInfo, type CombineTransactionCallbackData, type CombineTransactionSubOrder, type ComplaintCallbackData, type ComplaintCallbackUrlRequest, type ComplaintCallbackUrlResponse, type ComplaintNegotiationHistoryResponse, type ComplaintNegotiationRecord, type ComplaintNegotiationState, ComplaintService, type ComplaintState, type ComplaintSummary, type CompleteComplaintRequest, type CompletePayScoreOrderRequest, type CompletePayScoreOrderResponse, type CouponConsumeGoodsDetail, type CouponConsumeInformation, type CouponCutToMessage, type CouponFixedNormalCoupon, type CouponLimitCard, type CouponNormalCouponInformation, type CouponPatternInfo, CouponService, type CouponStatus, type CouponStockItem, type CouponStockStatus, type CouponStockType, type CouponStockUseRule, type CouponType, type CouponUseCallbackData, type CouponUseRule, type CreateAppCombineOrderRequest, type CreateAppCombineOrderResponse, type CreateAppOrderRequest, type CreateAppOrderResponse, type CreateCombineOrderRequest, type CreateCombineOrderResponse, type CreateCouponStockRequest, type CreateCouponStockResponse, type CreateH5CombineOrderRequest, type CreateH5CombineOrderResponse, type CreateH5OrderRequest, type CreateH5OrderResponse, type CreateJsapiOrderRequest, type CreateJsapiOrderResponse, type CreateMedInsOrderRequest, type CreateMerchantTransferAuthorizationRequest, type CreateMerchantTransferAuthorizationResponse, type CreateMerchantTransferRequest, type CreateMerchantTransferResponse, type CreateMiniProgramCombineOrderRequest, type CreateMiniProgramCombineOrderResponse, type CreateNativeCombineOrderRequest, type CreateNativeCombineOrderResponse, type CreateNativeOrderRequest, type CreateNativeOrderResponse, type CreateParkingRequest, type CreateParkingResponse, type CreateParkingTransactionRequest, type CreateParkingTransactionResponse, type CreatePartnerAppOrderRequest, type CreatePartnerAppOrderResponse, type CreatePartnerH5OrderRequest, type CreatePartnerH5OrderResponse, type CreatePartnerJsapiOrderRequest, type CreatePartnerJsapiOrderResponse, type CreatePartnerNativeOrderRequest, type CreatePartnerNativeOrderResponse, type CreatePayGiftActivityRequest, type CreatePayGiftActivityResponse, type CreatePayScoreOrderRequest, type CreatePayScoreOrderResponse, type CreateProfitSharingOrderRequest, type CreateProfitSharingOrderResponse, type CreateProfitSharingReturnOrderRequest, type CreateProfitSharingReturnOrderResponse, type CreateRefundRequest, type CreateRefundResponse, type CreateTransferAfterAuthorizationRequest, type CreateTransferAfterAuthorizationResponse, type CreateTransferWithAuthorizationRequest, type CreateTransferWithAuthorizationResponse, type DecryptedCallback, type DecryptedCertificate, DecryptionException, type DeleteProfitSharingReceiverRequest, type DeleteProfitSharingReceiverResponse, type DownloadBillParams, type DownloadBillResponse, type DownloadCouponStockFlowResponse, type EchoTestRequest, type EchoTestResponse, type EcommerceFundFlowBillParams, EcommerceProfitSharingService, EcommerceRefundService, EcommerceSubsidyService, type ElecSignHashType, type ElecSignState, type EncryptBillEntity, type EncryptBillResponse, type FundFlowBillParams, type FundFlowBillResponse, type GetPayGiftActivityGoodsResponse, type GetPayGiftActivityMerchantsResponse, GoldPlanService, type GoodsDetail, type H5CombineSceneInfo, type H5Info, type H5SceneInfo, H5Service, HttpException, type JsapiBridgeConfig, JsapiService, LoveFeastService, MalformedMessageException, type MedInsCashAddEntity, type MedInsCashReduceEntity, type MedInsJsapiBridgeConfig, type MedInsMedInsPayStatus, type MedInsMiniProgramBridgeConfig, type MedInsMixPayStatus, type MedInsMixPayType, type MedInsOrderResponse, type MedInsOrderType, type MedInsPersonIdentification, type MedInsRefundCallbackData, type MedInsSelfPayStatus, MedInsService, type MedInsSuccessCallbackData, MediaService, MerchantExclusiveCouponService, type MerchantTransferAuthorizationCallbackData, type MerchantTransferAuthorizationJsapiBridgeConfig, type MerchantTransferAuthorizationState, type MerchantTransferCallbackData, type MerchantTransferJsapiBridgeConfig, MerchantTransferService, type MerchantTransferState, type MiniProgramBridgeConfig, type ModifyPayScoreOrderRequest, type ModifyPayScoreOrderResponse, NativeService, type OrderAmount, type OrderAmountResponse, type OrderDetail, type OrderPayer, type ParkingAmount, type ParkingAppBridgeConfig, type ParkingBlockReason, type ParkingCallbackBlockReason, type ParkingEntryStatusCallbackData, type ParkingH5BridgeConfig, type ParkingMiniProgramBridgeConfig, type ParkingPayer, type ParkingPromotionDetail, type ParkingRefundAmount, type ParkingRefundFrom, type ParkingRefundGoodsDetail, type ParkingRefundPromotionDetail, type ParkingRepayBridgeConfig, type ParkingSceneInfo, ParkingService, type ParkingState, type ParkingTradeState, type ParkingTransactionCallbackData, PartnerAppService, type PartnerCloseOrderRequest, type PartnerH5SceneInfo, PartnerH5Service, type PartnerJsapiPayer, PartnerJsapiService, PartnerNativeService, type PartnerQueryOrderParams, type PartnerQueryOrderResponse, PartnerTransferBatchService, PartnerTransferService, type PartnershipAuthorizedData, type PartnershipBusinessType, type PartnershipPartner, type PartnershipPartnerType, type PartnershipRecord, PartnershipService, type PartnershipState, type PauseCouponStockRequest, type PauseCouponStockResponse, PayGiftActivityService, type PayGiftActivityState, type PayGiftActivitySummary, type PayScoreAppBridgeConfig, type PayScoreCollection, type PayScoreCollectionDetail, type PayScoreCollectionState, type PayScoreDetailAppBridgeConfig, type PayScoreDetailJsapiBridgeConfig, type PayScoreDetailMiniProgramBridgeConfig, type PayScoreDevice, type PayScoreDiscount, type PayScoreJsapiBridgeConfig, type PayScoreLocation, type PayScoreMiniProgramBridgeConfig, type PayScoreOrderState, type PayScoreOrderStateDescription, type PayScorePayment, type PayScorePromotionDetail, type PayScorePromotionGoodsDetail, type PayScoreRefundCallbackData, type PayScoreRiskFund, PayScoreService, type PayScoreTimeRange, type PayScoreUserConfirmCallbackData, type PayScoreUserPaidCallbackData, PayrollCardService, type PlateColor, type PlateServiceState, type PlatformCertificate, type ProfitSharingBillParams, type ProfitSharingBillResponse, type ProfitSharingCallbackData, type ProfitSharingFailReason, type ProfitSharingReceiver, type ProfitSharingReceiverResponse, type ProfitSharingReceiverResult, type ProfitSharingReceiverType, type ProfitSharingRelationType, type ProfitSharingReturnFailReason, type ProfitSharingReturnResult, ProfitSharingService, type ProfitSharingState, type PromotionDetail, type PromotionGoodsDetail, type QueryBusinessCircleAuthorizationResponse, type QueryBusinessCirclePendingPointsParams, type QueryBusinessCirclePendingPointsResponse, type QueryCombineOrderParams, type QueryCombineOrderResponse, type QueryComplaintResponse, type QueryComplaintsParams, type QueryComplaintsResponse, type QueryCouponDetailParams, type QueryCouponDetailResponse, type QueryCouponStockItemsParams, type QueryCouponStockItemsResponse, type QueryCouponStockMerchantsParams, type QueryCouponStockMerchantsResponse, type QueryCouponStocksParams, type QueryCouponStocksResponse, type QueryMerchantTransferAuthorizationResponse, type QueryMerchantTransferElecSignResponse, type QueryMerchantTransferResponse, type QueryOrderParams, type QueryOrderResponse, type QueryParkingOrderResponse, type QueryParkingRefundResponse, type QueryPartnershipsParams, type QueryPartnershipsResponse, type QueryPayGiftActivitiesParams, type QueryPayGiftActivitiesResponse, type QueryPayGiftActivityResponse, type QueryPayScoreOrderParams, type QueryPayScoreOrderResponse, type QueryPlateServiceParams, type QueryPlateServiceResponse, type QueryProfitSharingAmountResponse, type QueryProfitSharingOrderParams, type QueryProfitSharingOrderResponse, type QueryProfitSharingReturnOrderParams, type QueryProfitSharingReturnOrderResponse, type QueryRefundParams, type QueryRefundResponse, type QuerySmartGuidesParams, type QuerySmartGuidesResponse, type QueryUserCouponsParams, type QueryUserCouponsResponse, type RefundAmount, type RefundAmountResponse, type RefundCallbackData, type RefundFromAccount, type RefundGoodsDetail, type RefundPromotionDetail, RefundService, type RegisterSmartGuideRequest, type RegisterSmartGuideResponse, type ReplyComplaintRequest, type ReplyImmediateServiceRequest, type RequestParams, type RestartCouponStockRequest, type RestartCouponStockResponse, RetailStoreService, ScanAndRideService, type SceneInfo, type SceneInfoResponse, SecurityService, type SendCouponRequest, type SendCouponResponse, ServiceException, type SetCouponCallbackRequest, type SetCouponCallbackResponse, type SettleInfo, type SignPayload, type SignType, type SignatureType, type SmartGuide, SmartGuideService, type StoreInfo, type SubMerchantFundFlowBillParams, type SyncBusinessCircleParkingStatusRequest, type SyncBusinessCirclePointsRequest, type SyncPayScoreOrderRequest, type SyncPayScoreOrderResponse, type TradeBillParams, type TradeBillResponse, type TransactionCallbackData, TransferBatchService, type TransferSceneReportInfo, type UnfreezeProfitSharingRequest, type UnfreezeProfitSharingResponse, type UpdateComplaintRefundRequest, type UpdateSmartGuideRequest, type UploadComplaintImageResponse, type UploadMarketingImageRequest, type UploadMarketingImageResponse, type UserCouponItem, ValidationException, WxPayClient, WxPayError, type WxPayErrorDetail$1 as WxPayErrorDetail, type WxPayOptions, type WxPayResponse, buildAppBridgeConfig, buildAuthorization, buildH5CouponUrl, buildJsapiBridgeConfig, buildMedInsJsapiBridgeConfig, buildMedInsMiniProgramBridgeConfig, buildMerchantTransferAuthorizationJsapiBridgeConfig, buildMerchantTransferJsapiBridgeConfig, buildMerchantTransferMiniProgramBridgeConfig, buildMiniProgramBridgeConfig, buildParkingAppBridgePath, buildParkingH5BridgeUrl, buildParkingMiniProgramBridgeConfig, buildParkingRepayBridgeConfig, buildPayScoreAppBridgeConfig, buildPayScoreDetailAppBridgeConfig, buildPayScoreDetailJsapiBridgeConfig, buildPayScoreDetailMiniProgramBridgeConfig, buildPayScoreJsapiBridgeConfig, buildPayScoreMiniProgramBridgeConfig, buildSignString, decryptSensitiveFields, decryptSensitiveFieldsInArray, encryptSensitiveFields, encryptSensitiveFieldsInArray, generateAppPaySign, generateNonce, generateNonceStr, generatePayScorePaySign, generatePaySign, getCertificateSerialNumber, isCertificateExpired, isCertificateValid, isTimestampValid, loadCertificate, loadCertificateFromPath, loadPrivateKey, loadPublicKey, oaepDecrypt, oaepEncrypt, registerSensitiveFields, sign, verifySignature };