diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java index 5c7fa3940..01ae466c2 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.codec.Base64; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.TemporalAccessorUtil; import cn.hutool.core.lang.Assert; @@ -34,6 +35,7 @@ import static cn.hutool.core.date.DatePattern.UTC_WITH_XXX_OFFSET_PATTERN; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; +import static cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig.API_VERSION_V2; /** * 微信支付抽象类,实现微信统一的接口、以及部分实现(退款) @@ -59,12 +61,17 @@ public abstract class AbstractWxPayClient extends AbstractPayClient - * 注意,可通过 {@link #main(String[])} 读取 + * apiclient_cert.pem 证书文件的对应的字符串 */ @NotBlank(message = "apiclient_cert 不能为空", groups = V3.class) private String privateCertContent; /** * apiV3 密钥值 */ - @NotBlank(message = "apiV3 密钥值 不能为空", groups = V3.class) + @NotBlank(message = "apiV3 密钥值不能为空", groups = V3.class) private String apiV3Key; /** diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java index d32879bc6..f36cd0b04 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java @@ -44,7 +44,7 @@ public class WxBarPayClientIntegrationTest { .totalFee(1) // 单位分 .timeExpire(formatDateV2(LocalDateTimeUtils.addTime(Duration.ofMinutes(2)))) .spbillCreateIp("127.0.0.1") - .authCode("131276541518138032") + .authCode("134298744426278497") .build(); System.out.println("========= request =========="); System.out.println(JsonUtils.toJsonPrettyString(request)); @@ -63,7 +63,7 @@ public class WxBarPayClientIntegrationTest { // 执行发起退款 WxPayRefundRequest request = new WxPayRefundRequest() - .setOutTradeNo("1689504162805") + .setOutTradeNo("1689545667276") .setOutRefundNo(String.valueOf(System.currentTimeMillis())) .setRefundFee(1) .setRefundDesc("就是想退了") @@ -103,8 +103,6 @@ public class WxBarPayClientIntegrationTest { config.setMchKey("dS1ngeN63JLr3NRbvPH9AJy3MyUxZdim"); config.setSignType(WxPayConstants.SignType.MD5); config.setKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.p12"); - config.setPrivateCertPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem"); - config.setPrivateKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_key.pem"); return config; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java index e411a6236..5e73601c2 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java @@ -58,7 +58,7 @@ public class WxNativePayClientIntegrationTest { // 执行发起退款 WxPayRefundV3Request request = new WxPayRefundV3Request() - .setOutTradeNo("1689506153043") + .setOutTradeNo("1689545729695") .setOutRefundNo(String.valueOf(System.currentTimeMillis())) .setAmount(new WxPayRefundV3Request.Amount().setTotal(1).setRefund(1).setCurrency("CNY")) .setReason("就是想退了"); @@ -73,10 +73,8 @@ public class WxNativePayClientIntegrationTest { WxPayConfig config = new WxPayConfig(); config.setAppId("wx62056c0d5e8db250"); config.setMchId("1545083881"); - config.setMchKey("dS1ngeN63JLr3NRbvPH9AJy3MyUxZdim"); config.setApiV3Key("459arNsYHl1mgkiO6H9ZH5KkhFXSxaA4"); // config.setCertSerialNo(serialNo); - config.setKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.p12"); config.setPrivateCertPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem"); config.setPrivateKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_key.pem"); return config; diff --git a/yudao-ui-admin/src/views/pay/app/components/wechatChannelForm.vue b/yudao-ui-admin/src/views/pay/app/components/wechatChannelForm.vue index b28fd4d2b..af210e5d9 100644 --- a/yudao-ui-admin/src/views/pay/app/components/wechatChannelForm.vue +++ b/yudao-ui-admin/src/views/pay/app/components/wechatChannelForm.vue @@ -8,8 +8,8 @@ - - + + @@ -29,29 +29,41 @@ - - - -
- - + + - + + + + + + 点击上传 + + +
+
+ + + + 点击上传 @@ -64,18 +76,17 @@ 点击上传
- +