From 7ff402eae08a5d3202143d824098ab9575117d53 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 29 十二月 2025 16:39:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-system/src/main/java/com/ruoyi/system/wxPay/utils/WxV3Pay.java |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/utils/WxV3Pay.java b/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/utils/WxV3Pay.java
index e34c2e8..1dc9b2f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/utils/WxV3Pay.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/wxPay/utils/WxV3Pay.java
@@ -138,6 +138,36 @@
             throw new RuntimeException("获取支付数据错误!");
         }
     }
+    public Map<String, Object> jsApiInsurance(String tradeNo, Long amount, String openid, String description,String attach) {
+        JsapiPrepay client = new JsapiPrepay(
+                this.config.getMchId(),                    // 商户号,是由微信支付系统生成并分配给每个商户的唯一标识符,商户号获取方式参考 https://pay.weixin.qq.com/doc/v3/merchant/4013070756
+                this.config.getV3().getMchSerialNo(),         // 商户API证书序列号,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013053053
+                this.config.getV3().getPrivateKeyPath(),     // 商户API证书私钥文件路径,本地文件路径
+                this.config.getV3().getPublicKeyId(),      // 微信支付公钥ID,如何获取请参考 https://pay.weixin.qq.com/doc/v3/merchant/4013038816
+                this.config.getV3().getPublicKeyPath()           // 微信支付公钥文件路径,本地文件路径
+        );
+        JsapiPrepay.DirectAPIv3JsapiPrepayRequest request = new JsapiPrepay.DirectAPIv3JsapiPrepayRequest();
+        request.appid = this.config.getAppId();
+        request.mchid = this.config.getMchId();
+        request.description = description;
+        request.outTradeNo = tradeNo;
+//        request.timeExpire = "2018-06-08T10:34:56+08:00";
+        request.attach = attach;
+        request.notifyUrl = this.config.getV3().getInsuranceNotifyPayUrl();
+        request.goodsTag = "WXG";
+        request.supportFapiao = false;
+        request.amount = new JsapiPrepay.CommonAmountInfo();
+        request.amount.total = amount;
+        request.amount.currency = "CNY";
+        request.payer = new JsapiPrepay.JsapiReqPayerInfo();
+        request.payer.openid = openid;
+        try {
+            JsapiPrepay.DirectAPIv3JsapiPrepayResponse response = client.run(request);
+            return wxTuneUp(this.privateKeySigner, this.config.getAppId(), response.prepayId);
+        } catch (WXPayUtility.ApiException e) {
+            throw new RuntimeException("获取支付数据错误!");
+        }
+    }
 //    /**
 //     * jsApi下单
 //     *

--
Gitblit v1.7.1