wxpay-nodejs-sdk 0.2.3 → 0.2.5

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.mts 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);
@@ -5030,6 +5210,31 @@ declare class JsapiService {
5030
5210
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791859 (商户订单号查询订单)
5031
5211
  */
5032
5212
  queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5213
+ /**
5214
+ * 通过商户订单号查询订单
5215
+ *
5216
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791859
5217
+ */
5218
+ queryOrderByOutTradeNo(outTradeNo: string): Promise<WxPayResponse<QueryOrderResponse>>;
5219
+ /**
5220
+ * 通过微信支付订单号查询订单
5221
+ *
5222
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791858
5223
+ */
5224
+ queryOrderByTransactionId(transactionId: string): Promise<WxPayResponse<QueryOrderResponse>>;
5225
+ /**
5226
+ * JSAPI 下单并生成调起支付参数
5227
+ *
5228
+ * 封装了下单和调起支付参数生成两个步骤,一次调用即可获得
5229
+ * prepay_id 和前端 WeixinJSBridge.invoke() 所需的全部参数。
5230
+ *
5231
+ * @param request - 下单请求参数(需包含 appid)
5232
+ * @param privateKey - 商户私钥
5233
+ * @returns 下单响应 + 调起支付参数
5234
+ */
5235
+ prepayWithRequestPayment(request: CreateJsapiOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreateJsapiOrderResponse> & {
5236
+ bridgeConfig: JsapiBridgeConfig;
5237
+ }>;
5033
5238
  /**
5034
5239
  * 关闭订单
5035
5240
  *
@@ -5133,6 +5338,8 @@ declare class H5Service {
5133
5338
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791838 (商户订单号查询订单)
5134
5339
  */
5135
5340
  queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5341
+ queryOrderByOutTradeNo(outTradeNo: string): Promise<WxPayResponse<QueryOrderResponse>>;
5342
+ queryOrderByTransactionId(transactionId: string): Promise<WxPayResponse<QueryOrderResponse>>;
5136
5343
  /**
5137
5344
  * 关闭订单
5138
5345
  *
@@ -5236,6 +5443,11 @@ declare class AppService {
5236
5443
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070356 (商户订单号查询订单)
5237
5444
  */
5238
5445
  queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5446
+ queryOrderByOutTradeNo(outTradeNo: string): Promise<WxPayResponse<QueryOrderResponse>>;
5447
+ queryOrderByTransactionId(transactionId: string): Promise<WxPayResponse<QueryOrderResponse>>;
5448
+ prepayWithRequestPayment(request: CreateAppOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreateAppOrderResponse> & {
5449
+ bridgeConfig: AppBridgeConfig;
5450
+ }>;
5239
5451
  /**
5240
5452
  * 关闭订单
5241
5453
  *
@@ -5342,6 +5554,8 @@ declare class NativeService {
5342
5554
  * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791880 (商户订单号查询订单)
5343
5555
  */
5344
5556
  queryOrderById(params: QueryOrderParams): Promise<WxPayResponse<QueryOrderResponse>>;
5557
+ queryOrderByOutTradeNo(outTradeNo: string): Promise<WxPayResponse<QueryOrderResponse>>;
5558
+ queryOrderByTransactionId(transactionId: string): Promise<WxPayResponse<QueryOrderResponse>>;
5345
5559
  /**
5346
5560
  * 关闭订单
5347
5561
  *
@@ -6567,6 +6781,30 @@ declare class BillService {
6567
6781
  * ```
6568
6782
  */
6569
6783
  applyProfitSharingBill(params: ProfitSharingBillParams): Promise<WxPayResponse<ProfitSharingBillResponse>>;
6784
+ /**
6785
+ * 申请单个子商户资金账单
6786
+ *
6787
+ * 服务商调用该接口获取单个子商户资金账单的下载链接。
6788
+ * 返回的账单文件使用 AES-256-GCM 加密,需用子商户的 API 证书私钥解密。
6789
+ *
6790
+ * @param params - 账单请求参数
6791
+ * @returns 加密账单下载信息
6792
+ *
6793
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071235
6794
+ */
6795
+ applySubMerchantFundFlowBill(params: SubMerchantFundFlowBillParams): Promise<WxPayResponse<EncryptBillResponse>>;
6796
+ /**
6797
+ * 申请二级商户资金账单
6798
+ *
6799
+ * 电商平台调用该接口获取二级商户资金账单的下载链接。
6800
+ * 返回的账单文件使用 AES-256-GCM 加密,需用平台的 API 证书私钥解密。
6801
+ *
6802
+ * @param params - 账单请求参数
6803
+ * @returns 加密账单下载信息
6804
+ *
6805
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071235
6806
+ */
6807
+ applyEcommerceFundFlowBill(params: EcommerceFundFlowBillParams): Promise<WxPayResponse<EncryptBillResponse>>;
6570
6808
  /**
6571
6809
  * 下载账单文件
6572
6810
  *
@@ -6602,6 +6840,28 @@ declare class BillService {
6602
6840
  * ```
6603
6841
  */
6604
6842
  downloadBill(downloadUrl: string): Promise<WxPayResponse<Buffer>>;
6843
+ /**
6844
+ * 下载账单文件并自动解压、校验摘要
6845
+ *
6846
+ * 封装了完整的账单下载流程:
6847
+ * 1. 下载原始文件
6848
+ * 2. 自动检测并解压 GZIP 格式
6849
+ * 3. 可选:与申请账单返回的 hash_value 进行 SHA-1 摘要校验
6850
+ *
6851
+ * @param downloadUrl - 申请账单接口返回的 download_url
6852
+ * @param expectedDigest - 期望的 SHA-1 摘要值(来自申请账单接口返回的 hash_value)
6853
+ * @returns 包含解压后账单文件 Buffer 的响应
6854
+ * @throws 如果摘要校验失败
6855
+ *
6856
+ * @example
6857
+ * ```ts
6858
+ * const result = await billService.downloadAndVerifyBill(
6859
+ * applyResult.data.download_url,
6860
+ * applyResult.data.hash_value,
6861
+ * );
6862
+ * ```
6863
+ */
6864
+ downloadAndVerifyBill(downloadUrl: string, expectedDigest?: string): Promise<WxPayResponse<Buffer>>;
6605
6865
  }
6606
6866
 
6607
6867
  /**
@@ -8079,48 +8339,1487 @@ declare class MerchantExclusiveCouponService {
8079
8339
  }
8080
8340
 
8081
8341
  /**
8082
- * 调起支付参数生成工具
8342
+ * 境内退款服务
8083
8343
  *
8084
- * 用于生成各场景下调起微信支付所需的参数,包括签名计算:
8085
- * - APP 支付:生成 PayReq 对象参数(通过 OpenSDK 的 sendReq 调起)
8086
- * - JSAPI 支付:生成 WeixinJSBridge.invoke() 参数
8087
- * - 小程序支付:生成 wx.requestPayment() 参数
8344
+ * 提供独立的退款 API 封装,不绑定特定支付方式。
8345
+ * 适用于所有支付方式(JSAPI/APP/H5/Native)的退款场景。
8088
8346
  *
8089
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070351 (APP 调起支付)
8090
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012365340 (APP 调起支付签名)
8091
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791857 (JSAPI 调起支付)
8092
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791898 (小程序调起支付)
8093
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4012365341 (小程序调起支付签名)
8347
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071001 (产品介绍)
8348
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071036 (申请退款)
8349
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071041 (查询单笔退款)
8350
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071193 (发起异常退款)
8094
8351
  */
8352
+ declare class RefundService {
8353
+ private readonly client;
8354
+ constructor(client: WxPayClient);
8355
+ /**
8356
+ * 申请退款
8357
+ *
8358
+ * 当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,
8359
+ * 卖家可以通过退款接口将支付款退还给买家。
8360
+ * 支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号。
8361
+ * 一笔退款失败后重新提交,要采用原来的退款单号。
8362
+ *
8363
+ * @param request - 退款请求参数,包含商户订单号、退款单号、退款金额等信息
8364
+ * @returns 退款申请结果,包含微信退款单号、退款状态等
8365
+ *
8366
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071036
8367
+ */
8368
+ create(request: CreateRefundRequest): Promise<WxPayResponse<CreateRefundResponse>>;
8369
+ /**
8370
+ * 查询单笔退款(通过商户退款单号)
8371
+ *
8372
+ * 提交退款申请后,通过调用该接口查询退款状态。
8373
+ * 退款有一定延时,建议在提交退款申请后1分钟再查询退款状态。
8374
+ *
8375
+ * @param params - 查询参数,需包含 outRefundNo(商户退款单号)
8376
+ * @returns 退款单详情,包含退款状态、退款金额、退款渠道等
8377
+ *
8378
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071041
8379
+ */
8380
+ queryByOutRefundNo(params: QueryRefundParams): Promise<WxPayResponse<QueryRefundResponse>>;
8381
+ /**
8382
+ * 发起异常退款
8383
+ *
8384
+ * 当退款因为用户账户异常而无法原路退回时,可使用此接口将退款资金
8385
+ * 退到用户的其他银行卡或商户的银行账户。
8386
+ *
8387
+ * @param refundId - 微信支付退款单号
8388
+ * @param request - 异常退款请求参数,包含退款方式、收款账户信息等
8389
+ * @returns 异常退款处理结果
8390
+ *
8391
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013071193
8392
+ */
8393
+ applyAbnormalRefund(refundId: string, request: ApplyAbnormalRefundRequest): Promise<WxPayResponse<ApplyAbnormalRefundResponse>>;
8394
+ }
8395
+
8095
8396
  /**
8096
- * 生成 APP 调起支付的 sign
8397
+ * 服务商 JSAPI 支付服务
8097
8398
  *
8098
- * 签名算法:使用商户私钥对签名串进行 RSA-SHA256 签名
8099
- * 签名串格式:appId\ntimeStamp\nnonceStr\nprepay_id\n
8399
+ * 服务商模式下,服务商代替特约商户发起 JSAPI 支付请求。
8400
+ * 与直连商户模式的区别在于请求中包含 sp_appid、sp_mchid、sub_mchid 等字段。
8100
8401
  *
8101
- * @param appId - 应用ID
8102
- * @param timeStamp - 时间戳(秒)
8103
- * @param nonceStr - 随机字符串
8104
- * @param prepayId - 预支付ID
8105
- * @param privateKey - 商户私钥
8106
- * @returns Base64 编码的签名
8402
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738519 (JSAPI/小程序下单)
8403
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738964 (微信支付订单号查询)
8404
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739008 (商户订单号查询)
8405
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739019 (关闭订单)
8107
8406
  */
8108
- declare function generateAppPaySign(appId: string, timeStamp: string, nonceStr: string, prepayId: string, privateKey: string | Buffer): string;
8407
+ declare class PartnerJsapiService {
8408
+ private readonly client;
8409
+ constructor(client: WxPayClient);
8410
+ /**
8411
+ * 服务商 JSAPI/小程序下单
8412
+ *
8413
+ * 服务商通过此接口代特约商户发起 JSAPI 支付下单,获取 prepay_id。
8414
+ *
8415
+ * @param request - 下单请求参数,需包含 sp_appid、sp_mchid、sub_mchid 等
8416
+ * @returns 下单结果,包含 prepay_id
8417
+ *
8418
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738519
8419
+ */
8420
+ createOrder(request: CreatePartnerJsapiOrderRequest): Promise<WxPayResponse<CreatePartnerJsapiOrderResponse>>;
8421
+ /**
8422
+ * 通过商户订单号查询订单
8423
+ *
8424
+ * @param params - 查询参数,需包含 out_trade_no、sp_mchid、sub_mchid
8425
+ * @returns 订单详情
8426
+ *
8427
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739008
8428
+ */
8429
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8430
+ /**
8431
+ * 通过微信支付订单号查询订单
8432
+ *
8433
+ * @param params - 查询参数,需包含 transaction_id、sp_mchid、sub_mchid
8434
+ * @returns 订单详情
8435
+ *
8436
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738964
8437
+ */
8438
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8439
+ /**
8440
+ * 关闭订单
8441
+ *
8442
+ * 对于未支付的订单,服务商可通过此接口代特约商户关闭订单。
8443
+ *
8444
+ * @param outTradeNo - 商户订单号
8445
+ * @param request - 关单请求参数,需包含 sp_mchid、sub_mchid
8446
+ *
8447
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012739019
8448
+ */
8449
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
8450
+ /**
8451
+ * 服务商 JSAPI 下单并生成调起支付参数
8452
+ *
8453
+ * 封装了下单和调起支付参数生成两个步骤,一次调用即可获得
8454
+ * prepay_id 和前端 WeixinJSBridge.invoke() 所需的全部参数。
8455
+ *
8456
+ * @param request - 下单请求参数
8457
+ * @param privateKey - 商户私钥,用于生成调起支付签名
8458
+ * @returns 下单响应 + 调起支付参数
8459
+ */
8460
+ prepayWithRequestPayment(request: CreatePartnerJsapiOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreatePartnerJsapiOrderResponse> & {
8461
+ bridgeConfig: JsapiBridgeConfig;
8462
+ }>;
8463
+ }
8464
+
8109
8465
  /**
8110
- * 生成 APP 调起支付所需的完整配置
8111
- *
8112
- * 用于生成 OpenSDK sendReq 方法中 PayReq 对象所需的全部参数。
8113
- * sign 使用商户 API 证书私钥进行 RSA-SHA256 签名。
8466
+ * 服务商 APP 支付服务
8114
8467
  *
8115
- * @param appId - 应用ID(下单时传入的 appid)
8116
- * @param partnerId - 商户号(下单时传入的 mchid)
8117
- * @param prepayId - 预支付ID(从 APP 下单接口获取)
8118
- * @param privateKey - 商户私钥
8119
- * @returns PayReq 对象所需的参数
8468
+ * 服务商模式下,服务商代替特约商户发起 APP 支付请求。
8120
8469
  *
8121
- * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070351
8470
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080231 (APP下单)
8471
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080234 (微信支付订单号查询)
8472
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080235 (商户订单号查询)
8473
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080236 (关闭订单)
8122
8474
  */
8123
- declare function buildAppBridgeConfig(appId: string, partnerId: string, prepayId: string, privateKey: string | Buffer): AppBridgeConfig;
8475
+ declare class PartnerAppService {
8476
+ private readonly client;
8477
+ constructor(client: WxPayClient);
8478
+ /**
8479
+ * 服务商 APP 下单
8480
+ *
8481
+ * @param request - 下单请求参数
8482
+ * @returns 下单结果,包含 prepay_id
8483
+ *
8484
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080231
8485
+ */
8486
+ createOrder(request: CreatePartnerAppOrderRequest): Promise<WxPayResponse<CreatePartnerAppOrderResponse>>;
8487
+ /**
8488
+ * 通过商户订单号查询订单
8489
+ *
8490
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080235
8491
+ */
8492
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8493
+ /**
8494
+ * 通过微信支付订单号查询订单
8495
+ *
8496
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080234
8497
+ */
8498
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8499
+ /**
8500
+ * 关闭订单
8501
+ *
8502
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080236
8503
+ */
8504
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
8505
+ /**
8506
+ * 服务商 APP 下单并生成调起支付参数
8507
+ *
8508
+ * @param request - 下单请求参数
8509
+ * @param privateKey - 商户私钥
8510
+ * @returns 下单响应 + 调起支付参数
8511
+ */
8512
+ prepayWithRequestPayment(request: CreatePartnerAppOrderRequest, privateKey: string | Buffer): Promise<WxPayResponse<CreatePartnerAppOrderResponse> & {
8513
+ bridgeConfig: AppBridgeConfig;
8514
+ }>;
8515
+ }
8516
+
8517
+ /**
8518
+ * 服务商 H5 支付服务
8519
+ *
8520
+ * 服务商模式下,服务商代替特约商户发起 H5 支付请求。
8521
+ *
8522
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738604 (H5下单)
8523
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738969 (微信支付订单号查询)
8524
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759661 (商户订单号查询)
8525
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759669 (关闭订单)
8526
+ */
8527
+ declare class PartnerH5Service {
8528
+ private readonly client;
8529
+ constructor(client: WxPayClient);
8530
+ /**
8531
+ * 服务商 H5 下单
8532
+ *
8533
+ * @param request - 下单请求参数,需包含 scene_info.h5_info
8534
+ * @returns 下单结果,包含 h5_url
8535
+ *
8536
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738604
8537
+ */
8538
+ createOrder(request: CreatePartnerH5OrderRequest): Promise<WxPayResponse<CreatePartnerH5OrderResponse>>;
8539
+ /**
8540
+ * 通过商户订单号查询订单
8541
+ *
8542
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759661
8543
+ */
8544
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8545
+ /**
8546
+ * 通过微信支付订单号查询订单
8547
+ *
8548
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738969
8549
+ */
8550
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8551
+ /**
8552
+ * 关闭订单
8553
+ *
8554
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759669
8555
+ */
8556
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
8557
+ }
8558
+
8559
+ /**
8560
+ * 服务商 Native 支付服务
8561
+ *
8562
+ * 服务商模式下,服务商代替特约商户发起 Native 支付请求。
8563
+ *
8564
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738659 (Native下单)
8565
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738971 (微信支付订单号查询)
8566
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759714 (商户订单号查询)
8567
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759725 (关闭订单)
8568
+ */
8569
+ declare class PartnerNativeService {
8570
+ private readonly client;
8571
+ constructor(client: WxPayClient);
8572
+ /**
8573
+ * 服务商 Native 下单
8574
+ *
8575
+ * @param request - 下单请求参数
8576
+ * @returns 下单结果,包含 code_url
8577
+ *
8578
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738659
8579
+ */
8580
+ createOrder(request: CreatePartnerNativeOrderRequest): Promise<WxPayResponse<CreatePartnerNativeOrderResponse>>;
8581
+ /**
8582
+ * 通过商户订单号查询订单
8583
+ *
8584
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759714
8585
+ */
8586
+ queryOrderByOutTradeNo(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8587
+ /**
8588
+ * 通过微信支付订单号查询订单
8589
+ *
8590
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012738971
8591
+ */
8592
+ queryOrderByTransactionId(params: PartnerQueryOrderParams): Promise<WxPayResponse<PartnerQueryOrderResponse>>;
8593
+ /**
8594
+ * 关闭订单
8595
+ *
8596
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012759725
8597
+ */
8598
+ closeOrder(outTradeNo: string, request: PartnerCloseOrderRequest): Promise<WxPayResponse>;
8599
+ }
8600
+
8601
+ /** 服务商商家转账请求参数 */
8602
+ interface PartnerTransferRequest {
8603
+ /** 特约商户号 */
8604
+ sub_mchid: string;
8605
+ /** 特约商户 AppID */
8606
+ sub_appid?: string;
8607
+ /** 免确认收款授权单号 */
8608
+ authorization_id?: string;
8609
+ /** 商户转账单号 */
8610
+ out_bill_no: string;
8611
+ /** 转账场景ID */
8612
+ transfer_scene_id: string;
8613
+ /** 用户 OpenID */
8614
+ openid: string;
8615
+ /** 收款用户姓名 */
8616
+ user_name?: string;
8617
+ /** 转账金额(分) */
8618
+ transfer_amount: number;
8619
+ /** 转账备注 */
8620
+ transfer_remark: string;
8621
+ /** 回调通知地址 */
8622
+ notify_url?: string;
8623
+ /** 用户收款感知 */
8624
+ user_recv_perception?: string;
8625
+ /** 转账场景报备信息 */
8626
+ transfer_scene_report_infos: {
8627
+ info_type: string;
8628
+ info_content: string;
8629
+ }[];
8630
+ }
8631
+ /** 服务商商家转账响应 */
8632
+ interface PartnerTransferResponse {
8633
+ /** 商户转账单号 */
8634
+ out_bill_no: string;
8635
+ /** 微信转账单号 */
8636
+ transfer_bill_no: string;
8637
+ /** 创建时间 */
8638
+ create_time: string;
8639
+ /** 转账状态 */
8640
+ state: string;
8641
+ /** 跳转领取页面的 package 信息 */
8642
+ package_info?: string;
8643
+ }
8644
+ /** 服务商商家转账查询响应 */
8645
+ interface PartnerTransferQueryResponse {
8646
+ /** 服务商户号 */
8647
+ sp_mchid: string;
8648
+ /** 特约商户号 */
8649
+ sub_mchid: string;
8650
+ /** 商户转账单号 */
8651
+ out_bill_no: string;
8652
+ /** 微信转账单号 */
8653
+ transfer_bill_no: string;
8654
+ /** 创建时间 */
8655
+ create_time: string;
8656
+ /** 转账状态 */
8657
+ state: string;
8658
+ /** 转账金额(分) */
8659
+ transfer_amount: number;
8660
+ /** 转账备注 */
8661
+ transfer_remark: string;
8662
+ /** 失败原因 */
8663
+ fail_reason?: string;
8664
+ /** 用户 OpenID */
8665
+ openid: string;
8666
+ /** 收款用户姓名 */
8667
+ user_name?: string;
8668
+ /** 更新时间 */
8669
+ update_time?: string;
8670
+ }
8671
+ /**
8672
+ * 服务商商家转账服务
8673
+ *
8674
+ * 服务商模式下,服务商代替特约商户发起商家转账。
8675
+ *
8676
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434 (商家转账)
8677
+ */
8678
+ declare class PartnerTransferService {
8679
+ private readonly client;
8680
+ constructor(client: WxPayClient);
8681
+ /**
8682
+ * 服务商发起商家转账
8683
+ *
8684
+ * @param request - 转账请求参数
8685
+ * @returns 转账结果
8686
+ *
8687
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434
8688
+ */
8689
+ createTransfer(request: PartnerTransferRequest): Promise<WxPayResponse<PartnerTransferResponse>>;
8690
+ /**
8691
+ * 通过商户单号查询转账单
8692
+ *
8693
+ * @param outBillNo - 商户转账单号
8694
+ * @param subMchid - 特约商户号
8695
+ * @returns 转账单详情
8696
+ */
8697
+ queryTransferByOutBillNo(outBillNo: string, subMchid: string): Promise<WxPayResponse<PartnerTransferQueryResponse>>;
8698
+ /**
8699
+ * 撤销转账
8700
+ *
8701
+ * @param outBillNo - 商户转账单号
8702
+ * @param subMchid - 特约商户号
8703
+ */
8704
+ cancelTransfer(outBillNo: string, subMchid: string): Promise<WxPayResponse>;
8705
+ }
8706
+
8707
+ /** 批量转账明细输入 */
8708
+ interface TransferDetailInput {
8709
+ /** 商家明细单号 */
8710
+ out_detail_no: string;
8711
+ /** 转账金额(分) */
8712
+ transfer_amount: number;
8713
+ /** 转账备注(UTF8编码,最多32字符) */
8714
+ transfer_remark: string;
8715
+ /** 收款用户openid */
8716
+ openid: string;
8717
+ /** 收款用户姓名(加密,转账金额>=2000元时必填) */
8718
+ user_name?: string;
8719
+ }
8720
+ /** 发起批量转账请求 */
8721
+ interface InitiateBatchTransferRequest {
8722
+ /** 商户appid */
8723
+ appid: string;
8724
+ /** 商家批次单号 */
8725
+ out_batch_no: string;
8726
+ /** 批次名称 */
8727
+ batch_name: string;
8728
+ /** 批次备注(UTF8编码,最多32字符) */
8729
+ batch_remark: string;
8730
+ /** 转账总金额(分),必须与明细金额之和一致 */
8731
+ total_amount: number;
8732
+ /** 转账总笔数,最多1000笔,必须与明细数一致 */
8733
+ total_num: number;
8734
+ /** 转账明细列表 */
8735
+ transfer_detail_list: TransferDetailInput[];
8736
+ /** 转账场景ID(如 1001-现金营销) */
8737
+ transfer_scene_id?: string;
8738
+ /** 异步通知回调地址 */
8739
+ notify_url?: string;
8740
+ }
8741
+ /** 发起批量转账响应 */
8742
+ interface InitiateBatchTransferResponse {
8743
+ /** 商家批次单号 */
8744
+ out_batch_no: string;
8745
+ /** 微信批次单号 */
8746
+ batch_id: string;
8747
+ /** 批次创建时间(RFC3339) */
8748
+ create_time: string;
8749
+ /** 批次状态:ACCEPTED / PROCESSING / FINISHED / CLOSED */
8750
+ batch_status: string;
8751
+ }
8752
+ /** 批次单信息 */
8753
+ interface TransferBatchGet {
8754
+ /** 商户号 */
8755
+ mchid: string;
8756
+ /** 商家批次单号 */
8757
+ out_batch_no: string;
8758
+ /** 微信批次单号 */
8759
+ batch_id: string;
8760
+ /** 商户appid */
8761
+ appid: string;
8762
+ /** 批次状态 */
8763
+ batch_status: string;
8764
+ /** 批次类型 */
8765
+ batch_type?: string;
8766
+ /** 批次名称 */
8767
+ batch_name: string;
8768
+ /** 批次备注 */
8769
+ batch_remark: string;
8770
+ /** 转账总金额(分) */
8771
+ total_amount: number;
8772
+ /** 转账总笔数 */
8773
+ total_num: number;
8774
+ /** 转账成功金额(分) */
8775
+ success_amount?: number;
8776
+ /** 转账成功笔数 */
8777
+ success_num?: number;
8778
+ /** 转账失败金额(分) */
8779
+ fail_amount?: number;
8780
+ /** 转账失败笔数 */
8781
+ fail_num?: number;
8782
+ /** 批次关闭原因 */
8783
+ close_reason?: string;
8784
+ /** 批次创建时间 */
8785
+ create_time?: string;
8786
+ /** 批次更新时间 */
8787
+ update_time?: string;
8788
+ }
8789
+ /** 转账明细简要信息 */
8790
+ interface TransferDetailCompact {
8791
+ /** 微信明细单号 */
8792
+ detail_id: string;
8793
+ /** 商家明细单号 */
8794
+ out_detail_no: string;
8795
+ /** 明细状态 */
8796
+ detail_status: string;
8797
+ }
8798
+ /** 查询批次单响应 */
8799
+ interface TransferBatchEntity {
8800
+ /** 转账批次单基本信息 */
8801
+ transfer_batch: TransferBatchGet;
8802
+ /** 转账明细单列表(批次完成时返回) */
8803
+ transfer_detail_list?: TransferDetailCompact[];
8804
+ }
8805
+ /** 转账明细单详情 */
8806
+ interface TransferDetailEntity {
8807
+ /** 商户号 */
8808
+ mchid: string;
8809
+ /** 商家批次单号 */
8810
+ out_batch_no: string;
8811
+ /** 微信批次单号 */
8812
+ batch_id: string;
8813
+ /** 商户appid */
8814
+ appid: string;
8815
+ /** 商家明细单号 */
8816
+ out_detail_no: string;
8817
+ /** 微信明细单号 */
8818
+ detail_id: string;
8819
+ /** 明细状态:INIT / WAIT_PAY / PROCESSING / SUCCESS / FAIL */
8820
+ detail_status: string;
8821
+ /** 转账金额(分) */
8822
+ transfer_amount: number;
8823
+ /** 转账备注 */
8824
+ transfer_remark: string;
8825
+ /** 明细失败原因 */
8826
+ fail_reason?: string;
8827
+ /** 收款用户openid */
8828
+ openid: string;
8829
+ /** 收款用户姓名(加密) */
8830
+ user_name?: string;
8831
+ /** 转账发起时间 */
8832
+ initiate_time?: string;
8833
+ /** 明细更新时间 */
8834
+ update_time?: string;
8835
+ }
8836
+ /** 查询批次单参数 */
8837
+ interface GetTransferBatchParams {
8838
+ /** 是否查询明细单(默认 false) */
8839
+ need_query_detail?: boolean;
8840
+ /** 请求资源起始位置(默认 0) */
8841
+ offset?: number;
8842
+ /** 最大资源条数(20~100,默认 20) */
8843
+ limit?: number;
8844
+ /** 明细状态筛选:WAIT_PAY / ALL / SUCCESS / FAIL */
8845
+ detail_status?: string;
8846
+ }
8847
+ /**
8848
+ * 批量转账服务
8849
+ *
8850
+ * 商户可通过该产品实现同时向多个用户微信零钱进行转账的操作。
8851
+ *
8852
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012716434 (商家转账)
8853
+ */
8854
+ declare class TransferBatchService {
8855
+ private readonly client;
8856
+ constructor(client: WxPayClient);
8857
+ /**
8858
+ * 发起批量转账
8859
+ *
8860
+ * @param request - 批量转账请求参数
8861
+ * @returns 批量转账结果
8862
+ */
8863
+ initiateBatchTransfer(request: InitiateBatchTransferRequest): Promise<WxPayResponse<InitiateBatchTransferResponse>>;
8864
+ /**
8865
+ * 通过微信批次单号查询批次单
8866
+ *
8867
+ * @param batchId - 微信批次单号
8868
+ * @param params - 可选查询参数
8869
+ * @returns 批次单详情
8870
+ */
8871
+ getTransferBatchByNo(batchId: string, params?: GetTransferBatchParams): Promise<WxPayResponse<TransferBatchEntity>>;
8872
+ /**
8873
+ * 通过商家批次单号查询批次单
8874
+ *
8875
+ * @param outBatchNo - 商家批次单号
8876
+ * @param params - 可选查询参数
8877
+ * @returns 批次单详情
8878
+ */
8879
+ getTransferBatchByOutNo(outBatchNo: string, params?: GetTransferBatchParams): Promise<WxPayResponse<TransferBatchEntity>>;
8880
+ /**
8881
+ * 通过微信明细单号查询明细单
8882
+ *
8883
+ * @param batchId - 微信批次单号
8884
+ * @param detailId - 微信明细单号
8885
+ * @returns 明细单详情
8886
+ */
8887
+ getTransferDetailByNo(batchId: string, detailId: string): Promise<WxPayResponse<TransferDetailEntity>>;
8888
+ /**
8889
+ * 通过商家明细单号查询明细单
8890
+ *
8891
+ * @param outBatchNo - 商家批次单号
8892
+ * @param outDetailNo - 商家明细单号
8893
+ * @returns 明细单详情
8894
+ */
8895
+ getTransferDetailByOutNo(outBatchNo: string, outDetailNo: string): Promise<WxPayResponse<TransferDetailEntity>>;
8896
+ }
8897
+
8898
+ /** 服务商批量转账明细输入 */
8899
+ interface PartnerTransferDetailInput {
8900
+ /** 商家明细单号 */
8901
+ out_detail_no: string;
8902
+ /** 转账金额(分) */
8903
+ transfer_amount: number;
8904
+ /** 转账备注(UTF8编码,最多32字符) */
8905
+ transfer_remark: string;
8906
+ /** 收款用户openid */
8907
+ openid: string;
8908
+ /** 收款用户姓名(加密) */
8909
+ user_name?: string;
8910
+ }
8911
+ /** 发起服务商批量转账请求 */
8912
+ interface InitiatePartnerBatchTransferRequest {
8913
+ /** 商户appid */
8914
+ appid: string;
8915
+ /** 商家批次单号 */
8916
+ out_batch_no: string;
8917
+ /** 批次名称 */
8918
+ batch_name: string;
8919
+ /** 批次备注(UTF8编码,最多32字符) */
8920
+ batch_remark: string;
8921
+ /** 转账总金额(分),必须与明细金额之和一致 */
8922
+ total_amount: number;
8923
+ /** 转账总笔数,最多1000笔,必须与明细数一致 */
8924
+ total_num: number;
8925
+ /** 转账明细列表 */
8926
+ transfer_detail_list: PartnerTransferDetailInput[];
8927
+ /** 转账场景ID */
8928
+ transfer_scene_id?: string;
8929
+ /** 异步通知回调地址 */
8930
+ notify_url?: string;
8931
+ }
8932
+ /** 发起服务商批量转账响应 */
8933
+ interface InitiatePartnerBatchTransferResponse {
8934
+ /** 商家批次单号 */
8935
+ out_batch_no: string;
8936
+ /** 微信批次单号 */
8937
+ batch_id: string;
8938
+ /** 批次创建时间(RFC3339) */
8939
+ create_time: string;
8940
+ /** 批次状态:ACCEPTED / PROCESSING / FINISHED / CLOSED */
8941
+ batch_status: string;
8942
+ }
8943
+ /** 服务商批次单信息 */
8944
+ interface PartnerTransferBatchGet {
8945
+ /** 商户号 */
8946
+ mchid: string;
8947
+ /** 商家批次单号 */
8948
+ out_batch_no: string;
8949
+ /** 微信批次单号 */
8950
+ batch_id: string;
8951
+ /** 商户appid */
8952
+ appid: string;
8953
+ /** 批次状态 */
8954
+ batch_status: string;
8955
+ /** 批次类型 */
8956
+ batch_type?: string;
8957
+ /** 批次名称 */
8958
+ batch_name: string;
8959
+ /** 批次备注 */
8960
+ batch_remark: string;
8961
+ /** 转账总金额(分) */
8962
+ total_amount: number;
8963
+ /** 转账总笔数 */
8964
+ total_num: number;
8965
+ /** 转账成功金额(分) */
8966
+ success_amount?: number;
8967
+ /** 转账成功笔数 */
8968
+ success_num?: number;
8969
+ /** 转账失败金额(分) */
8970
+ fail_amount?: number;
8971
+ /** 转账失败笔数 */
8972
+ fail_num?: number;
8973
+ /** 批次关闭原因 */
8974
+ close_reason?: string;
8975
+ /** 批次创建时间 */
8976
+ create_time?: string;
8977
+ /** 批次更新时间 */
8978
+ update_time?: string;
8979
+ }
8980
+ /** 服务商转账明细简要信息 */
8981
+ interface PartnerTransferDetailCompact {
8982
+ /** 微信明细单号 */
8983
+ detail_id: string;
8984
+ /** 商家明细单号 */
8985
+ out_detail_no: string;
8986
+ /** 明细状态 */
8987
+ detail_status: string;
8988
+ }
8989
+ /** 查询服务商批次单响应 */
8990
+ interface PartnerTransferBatchEntity {
8991
+ /** 转账批次单基本信息 */
8992
+ transfer_batch: PartnerTransferBatchGet;
8993
+ /** 转账明细单列表(批次完成时返回) */
8994
+ transfer_detail_list?: PartnerTransferDetailCompact[];
8995
+ }
8996
+ /** 服务商转账明细单详情 */
8997
+ interface PartnerTransferDetailEntity {
8998
+ /** 商户号 */
8999
+ mchid: string;
9000
+ /** 商家批次单号 */
9001
+ out_batch_no: string;
9002
+ /** 微信批次单号 */
9003
+ batch_id: string;
9004
+ /** 商户appid */
9005
+ appid: string;
9006
+ /** 商家明细单号 */
9007
+ out_detail_no: string;
9008
+ /** 微信明细单号 */
9009
+ detail_id: string;
9010
+ /** 明细状态:INIT / WAIT_PAY / PROCESSING / SUCCESS / FAIL */
9011
+ detail_status: string;
9012
+ /** 转账金额(分) */
9013
+ transfer_amount: number;
9014
+ /** 转账备注 */
9015
+ transfer_remark: string;
9016
+ /** 明细失败原因 */
9017
+ fail_reason?: string;
9018
+ /** 收款用户openid */
9019
+ openid: string;
9020
+ /** 收款用户姓名(加密) */
9021
+ user_name?: string;
9022
+ /** 转账发起时间 */
9023
+ initiate_time?: string;
9024
+ /** 明细更新时间 */
9025
+ update_time?: string;
9026
+ }
9027
+ /** 查询服务商批次单参数 */
9028
+ interface GetPartnerTransferBatchParams {
9029
+ /** 是否查询明细单(默认 false) */
9030
+ need_query_detail?: boolean;
9031
+ /** 请求资源起始位置(默认 0) */
9032
+ offset?: number;
9033
+ /** 最大资源条数(20~100,默认 20) */
9034
+ limit?: number;
9035
+ /** 明细状态筛选:WAIT_PAY / ALL / SUCCESS / FAIL */
9036
+ detail_status?: string;
9037
+ }
9038
+ /**
9039
+ * 服务商批量转账服务
9040
+ *
9041
+ * 服务商模式下,实现同时向多个用户微信零钱进行转账的操作。
9042
+ *
9043
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012716434 (服务商商家转账)
9044
+ */
9045
+ declare class PartnerTransferBatchService {
9046
+ private readonly client;
9047
+ constructor(client: WxPayClient);
9048
+ /**
9049
+ * 发起服务商批量转账
9050
+ *
9051
+ * @param request - 批量转账请求参数
9052
+ * @returns 批量转账结果
9053
+ */
9054
+ initiateBatchTransfer(request: InitiatePartnerBatchTransferRequest): Promise<WxPayResponse<InitiatePartnerBatchTransferResponse>>;
9055
+ /**
9056
+ * 通过微信批次单号查询批次单
9057
+ *
9058
+ * @param batchId - 微信批次单号
9059
+ * @param params - 可选查询参数
9060
+ * @returns 批次单详情
9061
+ */
9062
+ getTransferBatchByNo(batchId: string, params?: GetPartnerTransferBatchParams): Promise<WxPayResponse<PartnerTransferBatchEntity>>;
9063
+ /**
9064
+ * 通过商家批次单号查询批次单
9065
+ *
9066
+ * @param outBatchNo - 商家批次单号
9067
+ * @param params - 可选查询参数
9068
+ * @returns 批次单详情
9069
+ */
9070
+ getTransferBatchByOutNo(outBatchNo: string, params?: GetPartnerTransferBatchParams): Promise<WxPayResponse<PartnerTransferBatchEntity>>;
9071
+ /**
9072
+ * 通过微信明细单号查询明细单
9073
+ *
9074
+ * @param batchId - 微信批次单号
9075
+ * @param detailId - 微信明细单号
9076
+ * @returns 明细单详情
9077
+ */
9078
+ getTransferDetailByNo(batchId: string, detailId: string): Promise<WxPayResponse<PartnerTransferDetailEntity>>;
9079
+ /**
9080
+ * 通过商家明细单号查询明细单
9081
+ *
9082
+ * @param outBatchNo - 商家批次单号
9083
+ * @param outDetailNo - 商家明细单号
9084
+ * @returns 明细单详情
9085
+ */
9086
+ getTransferDetailByOutNo(outBatchNo: string, outDetailNo: string): Promise<WxPayResponse<PartnerTransferDetailEntity>>;
9087
+ }
9088
+
9089
+ /** 电商收付通分账接收方 */
9090
+ interface EcommerceProfitSharingReceiver {
9091
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
9092
+ type: string;
9093
+ /** 接收方账号 */
9094
+ receiver_account: string;
9095
+ /** 分账金额(分) */
9096
+ amount: number;
9097
+ /** 分账描述 */
9098
+ description: string;
9099
+ /** 接收方姓名(加密) */
9100
+ receiver_name?: string;
9101
+ }
9102
+ /** 电商收付通请求分账请求 */
9103
+ interface CreateEcommerceProfitSharingRequest {
9104
+ /** 特约商户号 */
9105
+ sub_mchid: string;
9106
+ /** 电商平台 AppID */
9107
+ appid: string;
9108
+ /** 微信支付订单号 */
9109
+ transaction_id: string;
9110
+ /** 商户分账单号 */
9111
+ out_order_no: string;
9112
+ /** 分账接收方列表 */
9113
+ receivers: EcommerceProfitSharingReceiver[];
9114
+ /** 是否解冻剩余资金 */
9115
+ finish: boolean;
9116
+ }
9117
+ /** 电商收付通请求分账响应 */
9118
+ interface CreateEcommerceProfitSharingResponse {
9119
+ sub_mchid: string;
9120
+ transaction_id: string;
9121
+ out_order_no: string;
9122
+ /** 微信分账单号 */
9123
+ order_id: string;
9124
+ }
9125
+ /** 电商收付通查询分账响应 */
9126
+ interface QueryEcommerceProfitSharingResponse {
9127
+ sub_mchid: string;
9128
+ transaction_id: string;
9129
+ out_order_no: string;
9130
+ order_id: string;
9131
+ /** 分账状态 */
9132
+ state: string;
9133
+ receivers: {
9134
+ amount: number;
9135
+ description: string;
9136
+ type: string;
9137
+ receiver_account: string;
9138
+ result: string;
9139
+ fail_reason?: string;
9140
+ detail_id: string;
9141
+ create_time: string;
9142
+ finish_time: string;
9143
+ }[];
9144
+ }
9145
+ /** 电商收付通分账回退请求 */
9146
+ interface EcommerceProfitSharingReturnRequest {
9147
+ sub_mchid: string;
9148
+ order_id: string;
9149
+ out_order_no: string;
9150
+ out_return_no: string;
9151
+ return_mchid: string;
9152
+ amount: number;
9153
+ description: string;
9154
+ }
9155
+ /** 电商收付通分账回退响应 */
9156
+ interface EcommerceProfitSharingReturnResponse {
9157
+ sub_mchid: string;
9158
+ order_id: string;
9159
+ out_order_no: string;
9160
+ out_return_no: string;
9161
+ return_no: string;
9162
+ return_mchid: string;
9163
+ amount: number;
9164
+ result: string;
9165
+ fail_reason?: string;
9166
+ }
9167
+ /** 电商收付通完结分账请求 */
9168
+ interface EcommerceFinishOrderRequest {
9169
+ sub_mchid: string;
9170
+ transaction_id: string;
9171
+ out_order_no: string;
9172
+ description: string;
9173
+ }
9174
+ /** 电商收付通售后服务分账请求 */
9175
+ interface CreateAfterSalesOrderRequest {
9176
+ /** 子商户号 */
9177
+ sub_mchid: string;
9178
+ /** 微信支付订单号 */
9179
+ transaction_id: string;
9180
+ /** 分账金额(分) */
9181
+ amount: number;
9182
+ /** 类型:SERVICE_FEE_INCOME */
9183
+ type: string;
9184
+ /** 场景:REFUND_TICKET / CHANGE_TICKET / RETURN_GOODS */
9185
+ scene: string;
9186
+ /** 微信退款单号(退票/改签/退货收入分账时必填) */
9187
+ refund_id?: string;
9188
+ }
9189
+ /** 电商收付通售后服务分账响应 */
9190
+ interface CreateAfterSalesOrderResponse {
9191
+ sub_mchid: string;
9192
+ transaction_id: string;
9193
+ /** 分账金额(分) */
9194
+ amount: number;
9195
+ }
9196
+ /** 电商收付通查询售后服务分账响应 */
9197
+ interface QueryAfterSalesOrderResponse {
9198
+ sub_mchid: string;
9199
+ transaction_id: string;
9200
+ /** 分账金额(分) */
9201
+ amount: number;
9202
+ /** 分账结果:PROCESSING / SUCCESS / FAILED */
9203
+ result: string;
9204
+ /** 分账完成时间 */
9205
+ finish_time?: string;
9206
+ /** 分账失败原因 */
9207
+ fail_reason?: string;
9208
+ }
9209
+ /** 电商收付通查询订单剩余待分金额响应 */
9210
+ interface QueryEcommerceOrderAmountResponse {
9211
+ /** 微信支付订单号 */
9212
+ transaction_id: string;
9213
+ /** 订单剩余待分金额(分) */
9214
+ unsplit_amount: number;
9215
+ }
9216
+ /** 电商收付通添加分账接收方请求 */
9217
+ interface AddEcommerceReceiverRequest {
9218
+ /** 公众账号ID */
9219
+ appid: string;
9220
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
9221
+ type: string;
9222
+ /** 接收方账号 */
9223
+ account: string;
9224
+ /** 接收方名称(商户全称,仅 MERCHANT_ID 时需要) */
9225
+ name?: string;
9226
+ /** 与分账方的关系类型:SUPPLIER / DISTRIBUTOR / SERVICE_PROVIDER / PLATFORM / OTHERS */
9227
+ relation_type: string;
9228
+ }
9229
+ /** 电商收付通添加分账接收方响应 */
9230
+ interface AddEcommerceReceiverResponse {
9231
+ type: string;
9232
+ account: string;
9233
+ }
9234
+ /** 电商收付通删除分账接收方请求 */
9235
+ interface DeleteEcommerceReceiverRequest {
9236
+ /** 公众账号ID */
9237
+ appid: string;
9238
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID */
9239
+ type: string;
9240
+ /** 接收方账号 */
9241
+ account: string;
9242
+ }
9243
+ /** 电商收付通删除分账接收方响应 */
9244
+ interface DeleteEcommerceReceiverResponse {
9245
+ type: string;
9246
+ account: string;
9247
+ }
9248
+ /**
9249
+ * 电商收付通分账服务
9250
+ *
9251
+ * 用于电商平台对二级商户的订单进行分账。
9252
+ *
9253
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (分账)
9254
+ */
9255
+ declare class EcommerceProfitSharingService {
9256
+ private readonly client;
9257
+ constructor(client: WxPayClient);
9258
+ /**
9259
+ * 请求分账
9260
+ *
9261
+ * @param request - 分账请求参数
9262
+ * @returns 分账结果
9263
+ */
9264
+ createOrder(request: CreateEcommerceProfitSharingRequest): Promise<WxPayResponse<CreateEcommerceProfitSharingResponse>>;
9265
+ /**
9266
+ * 查询分账结果
9267
+ *
9268
+ * @param subMchid - 特约商户号
9269
+ * @param transactionId - 微信支付订单号
9270
+ * @param outOrderNo - 商户分账单号
9271
+ * @returns 分账结果详情
9272
+ */
9273
+ queryOrder(subMchid: string, transactionId: string, outOrderNo: string): Promise<WxPayResponse<QueryEcommerceProfitSharingResponse>>;
9274
+ /**
9275
+ * 请求分账回退
9276
+ *
9277
+ * @param request - 分账回退请求参数
9278
+ * @returns 回退结果
9279
+ */
9280
+ createReturnOrder(request: EcommerceProfitSharingReturnRequest): Promise<WxPayResponse<EcommerceProfitSharingReturnResponse>>;
9281
+ /**
9282
+ * 查询分账回退结果
9283
+ *
9284
+ * @param subMchid - 特约商户号
9285
+ * @param orderId - 微信分账单号
9286
+ * @param outReturnNo - 商户回退单号
9287
+ * @returns 回退结果详情
9288
+ */
9289
+ queryReturnOrder(subMchid: string, orderId: string, outReturnNo: string): Promise<WxPayResponse<EcommerceProfitSharingReturnResponse>>;
9290
+ /**
9291
+ * 完结分账
9292
+ *
9293
+ * @param request - 完结分账请求参数
9294
+ */
9295
+ finishOrder(request: EcommerceFinishOrderRequest): Promise<WxPayResponse>;
9296
+ /**
9297
+ * 请求售后服务分账
9298
+ *
9299
+ * @param request - 售后服务分账请求参数
9300
+ * @returns 售后服务分账结果
9301
+ */
9302
+ createAfterSalesOrder(request: CreateAfterSalesOrderRequest): Promise<WxPayResponse<CreateAfterSalesOrderResponse>>;
9303
+ /**
9304
+ * 查询售后服务分账结果
9305
+ *
9306
+ * @param subMchid - 子商户号
9307
+ * @param transactionId - 微信支付订单号
9308
+ * @returns 售后服务分账结果详情
9309
+ */
9310
+ queryAfterSalesOrder(subMchid: string, transactionId: string): Promise<WxPayResponse<QueryAfterSalesOrderResponse>>;
9311
+ /**
9312
+ * 查询订单剩余待分金额
9313
+ *
9314
+ * @param transactionId - 微信支付订单号
9315
+ * @returns 订单剩余待分金额
9316
+ */
9317
+ queryOrderAmount(transactionId: string): Promise<WxPayResponse<QueryEcommerceOrderAmountResponse>>;
9318
+ /**
9319
+ * 添加分账接收方
9320
+ *
9321
+ * @param request - 添加接收方请求参数
9322
+ * @returns 添加接收方结果
9323
+ */
9324
+ addReceiver(request: AddEcommerceReceiverRequest): Promise<WxPayResponse<AddEcommerceReceiverResponse>>;
9325
+ /**
9326
+ * 删除分账接收方
9327
+ *
9328
+ * @param request - 删除接收方请求参数
9329
+ * @returns 删除接收方结果
9330
+ */
9331
+ deleteReceiver(request: DeleteEcommerceReceiverRequest): Promise<WxPayResponse<DeleteEcommerceReceiverResponse>>;
9332
+ }
9333
+
9334
+ /** 电商收付通退款金额 */
9335
+ interface EcommerceRefundAmount {
9336
+ /** 退款金额(分) */
9337
+ refund: number;
9338
+ /** 原订单金额(分) */
9339
+ total: number;
9340
+ /** 货币类型 */
9341
+ currency?: string;
9342
+ }
9343
+ /** 电商收付通申请退款请求 */
9344
+ interface CreateEcommerceRefundRequest {
9345
+ /** 特约商户号 */
9346
+ sub_mchid: string;
9347
+ /** 电商平台 AppID */
9348
+ sp_appid: string;
9349
+ /** 特约商户 AppID */
9350
+ sub_appid?: string;
9351
+ /** 微信支付订单号 */
9352
+ transaction_id?: string;
9353
+ /** 商户订单号 */
9354
+ out_trade_no?: string;
9355
+ /** 商户退款单号 */
9356
+ out_refund_no: string;
9357
+ /** 退款原因 */
9358
+ reason?: string;
9359
+ /** 退款金额 */
9360
+ amount: EcommerceRefundAmount;
9361
+ /** 回调通知地址 */
9362
+ notify_url?: string;
9363
+ /** 退款资金来源 */
9364
+ funds_account?: string;
9365
+ }
9366
+ /** 电商收付通申请退款响应 */
9367
+ interface CreateEcommerceRefundResponse {
9368
+ /** 微信退款单号 */
9369
+ refund_id: string;
9370
+ /** 商户退款单号 */
9371
+ out_refund_no: string;
9372
+ /** 创建时间 */
9373
+ create_time: string;
9374
+ /** 退款金额 */
9375
+ amount: EcommerceRefundAmount;
9376
+ }
9377
+ /** 电商收付通查询退款响应 */
9378
+ interface QueryEcommerceRefundResponse {
9379
+ refund_id: string;
9380
+ out_refund_no: string;
9381
+ transaction_id: string;
9382
+ out_trade_no: string;
9383
+ channel?: string;
9384
+ user_received_account: string;
9385
+ success_time?: string;
9386
+ create_time: string;
9387
+ /** 退款状态 */
9388
+ status: string;
9389
+ amount: EcommerceRefundAmount;
9390
+ promotion_detail?: {
9391
+ promotion_id: string;
9392
+ scope: string;
9393
+ type: string;
9394
+ amount: number;
9395
+ refund_amount: number;
9396
+ }[];
9397
+ /** 退款出资账户 */
9398
+ refund_account?: string;
9399
+ /** 资金账户 */
9400
+ funds_account?: string;
9401
+ }
9402
+ /** 电商收付通垫付退款回补请求 */
9403
+ interface CreateReturnAdvanceRequest {
9404
+ /** 微信退款单号(必须是垫付退款的微信退款单) */
9405
+ refund_id: string;
9406
+ /** 二级商户号 */
9407
+ sub_mchid: string;
9408
+ }
9409
+ /** 电商收付通垫付退款回补响应 */
9410
+ interface ReturnAdvanceResponse {
9411
+ /** 微信退款单号 */
9412
+ refund_id: string;
9413
+ /** 微信回补单号 */
9414
+ advance_return_id: string;
9415
+ /** 垫付回补金额(分) */
9416
+ return_amount: number;
9417
+ /** 出款方商户号 */
9418
+ payer_mchid: string;
9419
+ /** 出款方账户:BASIC / OPERATION */
9420
+ payer_account: string;
9421
+ /** 入账方商户号 */
9422
+ payee_mchid: string;
9423
+ /** 入账方账户:BASIC / OPERATION */
9424
+ payee_account: string;
9425
+ /** 垫付回补结果:SUCCESS / FAILED / PROCESSING */
9426
+ result: string;
9427
+ /** 垫付回补完成时间 */
9428
+ success_time?: string;
9429
+ }
9430
+ /**
9431
+ * 电商收付通退款服务
9432
+ *
9433
+ * 用于电商平台对二级商户的订单进行退款。
9434
+ *
9435
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080625 (申请退款)
9436
+ */
9437
+ declare class EcommerceRefundService {
9438
+ private readonly client;
9439
+ constructor(client: WxPayClient);
9440
+ /**
9441
+ * 申请退款
9442
+ *
9443
+ * @param request - 退款请求参数
9444
+ * @returns 退款结果
9445
+ *
9446
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4013080625
9447
+ */
9448
+ create(request: CreateEcommerceRefundRequest): Promise<WxPayResponse<CreateEcommerceRefundResponse>>;
9449
+ /**
9450
+ * 查询单笔退款(通过商户退款单号)
9451
+ *
9452
+ * @param subMchid - 特约商户号
9453
+ * @param outRefundNo - 商户退款单号
9454
+ * @returns 退款详情
9455
+ */
9456
+ queryByOutRefundNo(subMchid: string, outRefundNo: string): Promise<WxPayResponse<QueryEcommerceRefundResponse>>;
9457
+ /**
9458
+ * 查询单笔退款(通过微信支付退款单号)
9459
+ *
9460
+ * @param subMchid - 特约商户号
9461
+ * @param refundId - 微信支付退款单号
9462
+ * @returns 退款详情
9463
+ */
9464
+ queryByRefundId(subMchid: string, refundId: string): Promise<WxPayResponse<QueryEcommerceRefundResponse>>;
9465
+ /**
9466
+ * 垫付退款回补
9467
+ *
9468
+ * 当电商平台已垫付退款给用户,后续从二级商户处回补该笔退款资金。
9469
+ *
9470
+ * @param request - 垫付回补请求参数
9471
+ * @returns 垫付回补结果
9472
+ */
9473
+ createReturnAdvance(request: CreateReturnAdvanceRequest): Promise<WxPayResponse<ReturnAdvanceResponse>>;
9474
+ /**
9475
+ * 查询垫付回补结果
9476
+ *
9477
+ * @param subMchid - 特约商户号
9478
+ * @param refundId - 微信退款单号
9479
+ * @returns 垫付回补结果
9480
+ */
9481
+ queryReturnAdvance(subMchid: string, refundId: string): Promise<WxPayResponse<ReturnAdvanceResponse>>;
9482
+ }
9483
+
9484
+ /** 电商收付通请求补差请求 */
9485
+ interface CreateEcommerceSubsidyRequest {
9486
+ /** 特约商户号 */
9487
+ sub_mchid: string;
9488
+ /** 微信支付订单号 */
9489
+ transaction_id: string;
9490
+ /** 补差金额(分) */
9491
+ amount: number;
9492
+ /** 补差描述 */
9493
+ description: string;
9494
+ /** 商户补差单号 */
9495
+ out_subsidy_no?: string;
9496
+ }
9497
+ /** 电商收付通请求补差响应 */
9498
+ interface CreateEcommerceSubsidyResponse {
9499
+ sub_mchid: string;
9500
+ transaction_id: string;
9501
+ /** 微信补差单号 */
9502
+ subsidy_id: string;
9503
+ amount: number;
9504
+ description: string;
9505
+ /** 补差结果 */
9506
+ result: string;
9507
+ success_time?: string;
9508
+ }
9509
+ /** 电商收付通补差回退请求 */
9510
+ interface EcommerceSubsidyReturnRequest {
9511
+ sub_mchid: string;
9512
+ transaction_id: string;
9513
+ refund_id?: string;
9514
+ amount: number;
9515
+ description: string;
9516
+ /** 商户补差回退单号 */
9517
+ out_order_no: string;
9518
+ }
9519
+ /** 电商收付通补差回退响应 */
9520
+ interface EcommerceSubsidyReturnResponse {
9521
+ sub_mchid: string;
9522
+ transaction_id: string;
9523
+ /** 微信补差回退单号 */
9524
+ subsidy_refund_id: string;
9525
+ amount: number;
9526
+ description: string;
9527
+ result: string;
9528
+ success_time?: string;
9529
+ }
9530
+ /** 电商收付通取消补差请求 */
9531
+ interface CancelEcommerceSubsidyRequest {
9532
+ /** 特约商户号 */
9533
+ sub_mchid: string;
9534
+ /** 微信支付订单号 */
9535
+ transaction_id: string;
9536
+ /** 取消补差描述 */
9537
+ description: string;
9538
+ }
9539
+ /** 电商收付通取消补差响应 */
9540
+ interface CancelEcommerceSubsidyResponse {
9541
+ sub_mchid: string;
9542
+ transaction_id: string;
9543
+ /** 取消补差结果 */
9544
+ result: string;
9545
+ description: string;
9546
+ }
9547
+ /**
9548
+ * 电商收付通补差服务
9549
+ *
9550
+ * 用于电商平台对二级商户的订单进行补差。
9551
+ *
9552
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (补差)
9553
+ */
9554
+ declare class EcommerceSubsidyService {
9555
+ private readonly client;
9556
+ constructor(client: WxPayClient);
9557
+ /**
9558
+ * 请求补差
9559
+ *
9560
+ * @param request - 补差请求参数
9561
+ * @returns 补差结果
9562
+ */
9563
+ create(request: CreateEcommerceSubsidyRequest): Promise<WxPayResponse<CreateEcommerceSubsidyResponse>>;
9564
+ /**
9565
+ * 请求补差回退
9566
+ *
9567
+ * @param request - 补差回退请求参数
9568
+ * @returns 回退结果
9569
+ */
9570
+ returnSubsidy(request: EcommerceSubsidyReturnRequest): Promise<WxPayResponse<EcommerceSubsidyReturnResponse>>;
9571
+ /**
9572
+ * 取消补差
9573
+ *
9574
+ * @param request - 取消补差请求参数
9575
+ * @returns 取消补差结果
9576
+ */
9577
+ cancelSubsidy(request: CancelEcommerceSubsidyRequest): Promise<WxPayResponse<CancelEcommerceSubsidyResponse>>;
9578
+ }
9579
+
9580
+ /** 连锁品牌分账接收方 */
9581
+ interface BrandProfitSharingReceiver {
9582
+ /** 接收方类型 */
9583
+ type: string;
9584
+ /** 接收方账号 */
9585
+ account: string;
9586
+ /** 分账金额(分) */
9587
+ amount: number;
9588
+ /** 分账描述 */
9589
+ description: string;
9590
+ /** 接收方姓名 */
9591
+ name?: string;
9592
+ }
9593
+ /** 连锁品牌请求分账请求 */
9594
+ interface CreateBrandProfitSharingRequest {
9595
+ /** 品牌主商户号 */
9596
+ brand_mchid: string;
9597
+ /** 特约商户号 */
9598
+ sub_mchid: string;
9599
+ /** 微信支付订单号 */
9600
+ transaction_id: string;
9601
+ /** 商户分账单号 */
9602
+ out_order_no: string;
9603
+ /** 分账接收方列表 */
9604
+ receivers: BrandProfitSharingReceiver[];
9605
+ /** 是否解冻剩余资金 */
9606
+ finish: boolean;
9607
+ }
9608
+ /** 连锁品牌请求分账响应 */
9609
+ interface CreateBrandProfitSharingResponse {
9610
+ transaction_id: string;
9611
+ out_order_no: string;
9612
+ /** 微信分账单号 */
9613
+ order_id: string;
9614
+ }
9615
+ /** 连锁品牌分账回退请求 */
9616
+ interface BrandProfitSharingReturnRequest {
9617
+ brand_mchid: string;
9618
+ sub_mchid: string;
9619
+ order_id: string;
9620
+ out_order_no: string;
9621
+ out_return_no: string;
9622
+ return_mchid: string;
9623
+ amount: number;
9624
+ description: string;
9625
+ }
9626
+ /** 连锁品牌分账回退响应 */
9627
+ interface BrandProfitSharingReturnResponse {
9628
+ order_id: string;
9629
+ out_order_no: string;
9630
+ out_return_no: string;
9631
+ return_no: string;
9632
+ return_mchid: string;
9633
+ amount: number;
9634
+ result: string;
9635
+ }
9636
+ /** 连锁品牌完结分账请求 */
9637
+ interface BrandFinishOrderRequest {
9638
+ brand_mchid: string;
9639
+ sub_mchid: string;
9640
+ transaction_id: string;
9641
+ out_order_no: string;
9642
+ description: string;
9643
+ }
9644
+ /** 连锁品牌查询最大分账比例响应 */
9645
+ interface QueryBrandMerchantRatioResponse {
9646
+ /** 品牌商户号 */
9647
+ brand_mchid: string;
9648
+ /** 最大分账比例(万分比,如2000表示20%) */
9649
+ max_ratio: number;
9650
+ }
9651
+ /** 连锁品牌查询订单剩余待分金额响应 */
9652
+ interface QueryBrandOrderAmountResponse {
9653
+ /** 微信支付订单号 */
9654
+ transaction_id: string;
9655
+ /** 订单剩余待分金额(分) */
9656
+ unsplit_amount: number;
9657
+ }
9658
+ /** 连锁品牌添加分账接收方请求 */
9659
+ interface AddBrandReceiverRequest {
9660
+ /** 品牌主商户号 */
9661
+ brand_mchid: string;
9662
+ /** 公众账号ID */
9663
+ appid: string;
9664
+ /** 子商户公众账号ID(PERSONAL_SUB_OPENID 时必填) */
9665
+ sub_appid?: string;
9666
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID / PERSONAL_SUB_OPENID */
9667
+ type: string;
9668
+ /** 接收方账号 */
9669
+ account: string;
9670
+ /** 接收方名称 */
9671
+ name?: string;
9672
+ /** 与品牌主的关系类型:SUPPLIER / DISTRIBUTOR / SERVICE_PROVIDER / PLATFORM / STAFF / OTHERS */
9673
+ relation_type: string;
9674
+ }
9675
+ /** 连锁品牌添加分账接收方响应 */
9676
+ interface AddBrandReceiverResponse {
9677
+ brand_mchid: string;
9678
+ type: string;
9679
+ account: string;
9680
+ }
9681
+ /** 连锁品牌删除分账接收方请求 */
9682
+ interface DeleteBrandReceiverRequest {
9683
+ /** 品牌主商户号 */
9684
+ brand_mchid: string;
9685
+ /** 公众账号ID */
9686
+ appid: string;
9687
+ /** 子商户公众账号ID */
9688
+ sub_appid?: string;
9689
+ /** 接收方类型:MERCHANT_ID / PERSONAL_OPENID / PERSONAL_SUB_OPENID */
9690
+ type: string;
9691
+ /** 接收方账号 */
9692
+ account: string;
9693
+ }
9694
+ /** 连锁品牌删除分账接收方响应 */
9695
+ interface DeleteBrandReceiverResponse {
9696
+ brand_mchid: string;
9697
+ type: string;
9698
+ account: string;
9699
+ }
9700
+ /**
9701
+ * 连锁品牌分账服务
9702
+ *
9703
+ * 用于连锁品牌对门店的订单进行分账。
9704
+ *
9705
+ * @see https://pay.weixin.qq.com/doc/v3/partner/4012690683 (连锁品牌分账)
9706
+ */
9707
+ declare class BrandProfitSharingService {
9708
+ private readonly client;
9709
+ constructor(client: WxPayClient);
9710
+ /**
9711
+ * 请求分账
9712
+ *
9713
+ * @param request - 分账请求参数
9714
+ * @returns 分账结果
9715
+ */
9716
+ createOrder(request: CreateBrandProfitSharingRequest): Promise<WxPayResponse<CreateBrandProfitSharingResponse>>;
9717
+ /**
9718
+ * 查询分账结果
9719
+ *
9720
+ * @param brandMchid - 品牌主商户号
9721
+ * @param subMchid - 特约商户号
9722
+ * @param transactionId - 微信支付订单号
9723
+ * @param outOrderNo - 商户分账单号
9724
+ * @returns 分账结果详情
9725
+ */
9726
+ queryOrder(brandMchid: string, subMchid: string, transactionId: string, outOrderNo: string): Promise<WxPayResponse<CreateBrandProfitSharingResponse>>;
9727
+ /**
9728
+ * 请求分账回退
9729
+ *
9730
+ * @param request - 分账回退请求参数
9731
+ * @returns 回退结果
9732
+ */
9733
+ createReturnOrder(request: BrandProfitSharingReturnRequest): Promise<WxPayResponse<BrandProfitSharingReturnResponse>>;
9734
+ /**
9735
+ * 查询分账回退结果
9736
+ *
9737
+ * @param brandMchid - 品牌主商户号
9738
+ * @param subMchid - 特约商户号
9739
+ * @param orderId - 微信分账单号
9740
+ * @param outReturnNo - 商户回退单号
9741
+ * @returns 回退结果详情
9742
+ */
9743
+ queryReturnOrder(brandMchid: string, subMchid: string, orderId: string, outReturnNo: string): Promise<WxPayResponse<BrandProfitSharingReturnResponse>>;
9744
+ /**
9745
+ * 完结分账
9746
+ *
9747
+ * @param request - 完结分账请求参数
9748
+ */
9749
+ finishOrder(request: BrandFinishOrderRequest): Promise<WxPayResponse>;
9750
+ /**
9751
+ * 查询最大分账比例
9752
+ *
9753
+ * @param brandMchid - 品牌主商户号
9754
+ * @returns 最大分账比例
9755
+ */
9756
+ queryBrandMerchantRatio(brandMchid: string): Promise<WxPayResponse<QueryBrandMerchantRatioResponse>>;
9757
+ /**
9758
+ * 查询订单剩余待分金额
9759
+ *
9760
+ * @param transactionId - 微信支付订单号
9761
+ * @returns 订单剩余待分金额
9762
+ */
9763
+ queryOrderAmount(transactionId: string): Promise<WxPayResponse<QueryBrandOrderAmountResponse>>;
9764
+ /**
9765
+ * 添加分账接收方
9766
+ *
9767
+ * @param request - 添加接收方请求参数
9768
+ * @returns 添加接收方结果
9769
+ */
9770
+ addReceiver(request: AddBrandReceiverRequest): Promise<WxPayResponse<AddBrandReceiverResponse>>;
9771
+ /**
9772
+ * 删除分账接收方
9773
+ *
9774
+ * @param request - 删除接收方请求参数
9775
+ * @returns 删除接收方结果
9776
+ */
9777
+ deleteReceiver(request: DeleteBrandReceiverRequest): Promise<WxPayResponse<DeleteBrandReceiverResponse>>;
9778
+ }
9779
+
9780
+ /**
9781
+ * 调起支付参数生成工具
9782
+ *
9783
+ * 用于生成各场景下调起微信支付所需的参数,包括签名计算:
9784
+ * - APP 支付:生成 PayReq 对象参数(通过 OpenSDK 的 sendReq 调起)
9785
+ * - JSAPI 支付:生成 WeixinJSBridge.invoke() 参数
9786
+ * - 小程序支付:生成 wx.requestPayment() 参数
9787
+ *
9788
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070351 (APP 调起支付)
9789
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012365340 (APP 调起支付签名)
9790
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791857 (JSAPI 调起支付)
9791
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012791898 (小程序调起支付)
9792
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4012365341 (小程序调起支付签名)
9793
+ */
9794
+ /**
9795
+ * 生成 APP 调起支付的 sign
9796
+ *
9797
+ * 签名算法:使用商户私钥对签名串进行 RSA-SHA256 签名
9798
+ * 签名串格式:appId\ntimeStamp\nnonceStr\nprepay_id\n
9799
+ *
9800
+ * @param appId - 应用ID
9801
+ * @param timeStamp - 时间戳(秒)
9802
+ * @param nonceStr - 随机字符串
9803
+ * @param prepayId - 预支付ID
9804
+ * @param privateKey - 商户私钥
9805
+ * @returns Base64 编码的签名
9806
+ */
9807
+ declare function generateAppPaySign(appId: string, timeStamp: string, nonceStr: string, prepayId: string, privateKey: string | Buffer): string;
9808
+ /**
9809
+ * 生成 APP 调起支付所需的完整配置
9810
+ *
9811
+ * 用于生成 OpenSDK sendReq 方法中 PayReq 对象所需的全部参数。
9812
+ * sign 使用商户 API 证书私钥进行 RSA-SHA256 签名。
9813
+ *
9814
+ * @param appId - 应用ID(下单时传入的 appid)
9815
+ * @param partnerId - 商户号(下单时传入的 mchid)
9816
+ * @param prepayId - 预支付ID(从 APP 下单接口获取)
9817
+ * @param privateKey - 商户私钥
9818
+ * @returns PayReq 对象所需的参数
9819
+ *
9820
+ * @see https://pay.weixin.qq.com/doc/v3/merchant/4013070351
9821
+ */
9822
+ declare function buildAppBridgeConfig(appId: string, partnerId: string, prepayId: string, privateKey: string | Buffer): AppBridgeConfig;
8124
9823
  /**
8125
9824
  * 生成 JSAPI 调起支付的 paySign
8126
9825
  *
@@ -8525,4 +10224,39 @@ declare function oaepEncrypt(plaintext: string, publicKey: string | Buffer): str
8525
10224
  */
8526
10225
  declare function oaepDecrypt(ciphertext: string, privateKey: string | Buffer): string;
8527
10226
 
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 };
10227
+ /**
10228
+ * 从 PEM 字符串加载 X.509 证书
10229
+ */
10230
+ declare function loadCertificate(certificate: string): crypto.X509Certificate;
10231
+ /**
10232
+ * 从文件路径加载 X.509 证书
10233
+ */
10234
+ declare function loadCertificateFromPath(path: string): crypto.X509Certificate;
10235
+ /**
10236
+ * 加载私钥内容(支持 PEM 字符串、文件路径、Buffer)
10237
+ */
10238
+ declare function loadPrivateKey(key: string | Buffer): string;
10239
+ /**
10240
+ * 加载公钥内容(支持 PEM 字符串、文件路径、Buffer)
10241
+ */
10242
+ declare function loadPublicKey(key: string | Buffer): string;
10243
+ /**
10244
+ * 获取 X.509 证书序列号(大写十六进制)
10245
+ */
10246
+ declare function getCertificateSerialNumber(cert: crypto.X509Certificate): string;
10247
+ /**
10248
+ * 判断证书是否已过期
10249
+ *
10250
+ * @param cert - X.509 证书
10251
+ * @param now - 检查时间点,默认为当前时间
10252
+ */
10253
+ declare function isCertificateExpired(cert: crypto.X509Certificate, now?: Date): boolean;
10254
+ /**
10255
+ * 判断证书是否在有效期内
10256
+ *
10257
+ * @param cert - X.509 证书
10258
+ * @param now - 检查时间点,默认为当前时间
10259
+ */
10260
+ declare function isCertificateValid(cert: crypto.X509Certificate, now?: Date): boolean;
10261
+
10262
+ 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 };