From 278da88f21bff29eef96a2e439ac35eb444630fe Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期五, 22 八月 2025 10:27:23 +0800 Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/jinkuai --- server/services/src/main/java/com/doumee/config/wx/TransferToUser.java | 42 ++++++++++++++++++++++++++---------------- 1 files changed, 26 insertions(+), 16 deletions(-) diff --git a/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java b/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java index 15895e4..3e50307 100644 --- a/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java +++ b/server/services/src/main/java/com/doumee/config/wx/TransferToUser.java @@ -27,6 +27,14 @@ private static String CANCEL_PATH = "/v3/fund-app/mch-transfer/transfer-bills/out-bill-no/{out_bill_no}/cancel"; + public TransferToUser(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { + this.mchid = mchid; + this.certificateSerialNo = certificateSerialNo; + this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); + this.wechatPayPublicKeyId = wechatPayPublicKeyId; + this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); + } + public static void main(String[] args) { // TODO: 璇峰噯澶囧晢鎴峰紑鍙戝繀瑕佸弬鏁帮紝鍙傝�冿細https://pay.weixin.qq.com/doc/v3/merchant/4013070756 // TransferToUser client = new TransferToUser( @@ -38,18 +46,18 @@ // ); TransferToUser client = new TransferToUser( - "1661772003", // 鍟嗘埛鍙凤紝鏄敱寰俊鏀粯绯荤粺鐢熸垚骞跺垎閰嶇粰姣忎釜鍟嗘埛鐨勫敮涓�鏍囪瘑绗︼紝鍟嗘埛鍙疯幏鍙栨柟寮忓弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013070756 - "3C9A32FB6CD453FAAAF97F9737ECAEA9D6625727", // 鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053 - "d://wechatApiclient_key.pem", // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰� - "47E172124E73E8098A565E971064C20ACDE7C911", // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816 - "d://wechatpay_47E172124E73E8098A565E971064C20ACDE7C911.pem" // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰� + "1723326069", // 鍟嗘埛鍙凤紝鏄敱寰俊鏀粯绯荤粺鐢熸垚骞跺垎閰嶇粰姣忎釜鍟嗘埛鐨勫敮涓�鏍囪瘑绗︼紝鍟嗘埛鍙疯幏鍙栨柟寮忓弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013070756 + "12C0F0DD0F3D2B565B45586D3FEA225EBF723BEC", // 鍟嗘埛API璇佷功搴忓垪鍙凤紝濡備綍鑾峰彇璇峰弬鑰� https://pay.weixin.qq.com/doc/v3/merchant/4013053053 + "d://jinkuai/shanghu/apiclient_key.pem", // 鍟嗘埛API璇佷功绉侀挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰� + "PUB_KEY_ID_0117233260692025072500181939000603", // 寰俊鏀粯鍏挜ID锛屽浣曡幏鍙栬鍙傝�� https://pay.weixin.qq.com/doc/v3/merchant/4013038816 + "d://jinkuai/shanghu/pub_key.pem" // 寰俊鏀粯鍏挜鏂囦欢璺緞锛屾湰鍦版枃浠惰矾寰� ); TransferToUserRequest request = new TransferToUserRequest(); - request.appid = "wxcd2b89fd2ff065f8"; //灏忕▼搴廼d + request.appid = "wx332441ae5b12be7d"; //灏忕▼搴廼d request.outBillNo = "plfk2020042016"; request.transferSceneId = "1005"; - request.openid = "oKKHU5IFKpss_DIbFX1lqghFJOEg"; + request.openid = "oFucG7Nu5teWNIZiWkAINfAE4glE"; // request.userName = client.encrypt("鏂芥棴杈�"); request.transferAmount = 10L; request.transferRemark = "~~~"; @@ -83,13 +91,6 @@ private final String wechatPayPublicKeyId; private final PublicKey wechatPayPublicKey; - public TransferToUser(String mchid, String certificateSerialNo, String privateKeyFilePath, String wechatPayPublicKeyId, String wechatPayPublicKeyFilePath) { - this.mchid = mchid; - this.certificateSerialNo = certificateSerialNo; - this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyFilePath); - this.wechatPayPublicKeyId = wechatPayPublicKeyId; - this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath); - } public TransferToUserResponse testRun(TransferToUserRequest request) { String uri = PATH; @@ -126,7 +127,7 @@ public TransferToUserResponse run(TransferToUserRequest request,String name) { String uri = PATH; request.appid = WxMiniConfig.wxProperties.getSubAppId(); -// request.notifyUrl = WxMiniConfig.wxProperties.getWechatNotifyUrl(); + request.notifyUrl = WxMiniConfig.wxProperties.getWechatNotifyUrl(); request.transferSceneId = "1005"; request.userRecvPerception = "鍔冲姟鎶ラ叕"; if(request.transferAmount >= 30){ @@ -170,7 +171,10 @@ httpResponse.headers(), respBody); // 浠嶩TTP搴旂瓟鎶ユ枃鏋勫缓杩斿洖鏁版嵁 - return WXPayUtility.fromJson(respBody, TransferToUserResponse.class); + TransferToUser.TransferToUserResponse response = WXPayUtility.fromJson(respBody, TransferToUserResponse.class); + response.appId = request.appid; + response.mchId = WxMiniConfig.wxProperties.getSubMchId(); + return response; } else { throw new WXPayUtility.ApiException(httpResponse.code(), respBody, httpResponse.headers()); } @@ -236,6 +240,12 @@ @SerializedName("package_info") public String packageInfo; + + @SerializedName("mch_id") + public String mchId; + + @SerializedName("app_id") + public String appId; } public enum TransferBillStatus { -- Gitblit v1.9.3