From 012b71739de1dd41bbd3ec552c999939d9fc32d6 Mon Sep 17 00:00:00 2001 From: egzosn Date: Fri, 13 Nov 2020 22:29:47 +0800 Subject: [PATCH] .. --- pay-java-ali/README.md | 2 +- pay-java-ali/src/test/java/PayTest.java | 2 +- .../java/com/egzosn/pay/common/util/Util.java | 2 +- pay-java-demo/README.md | 6 +++--- .../pay/demo/controller/AliPayController.java | 14 +++++++------- .../pay/demo/controller/FuiouPayController.java | 2 +- .../pay/demo/controller/PayController.java | 16 ++++++++-------- .../demo/controller/PayPalPayController.java | 4 ++-- .../pay/demo/controller/UnionPayController.java | 14 +++++++------- .../pay/demo/controller/WxPayController.java | 17 ++++++++--------- pay-java-fuiou/README.md | 2 +- pay-java-fuiou/src/test/java/PayTest.java | 2 +- pay-java-union/README.md | 2 +- pay-java-union/src/test/java/PayTest.java | 2 +- pay-java-wx-youdian/README.md | 2 +- pay-java-wx-youdian/src/test/java/PayTest.java | 2 +- pay-java-wx/README.md | 4 ++-- pay-java-wx/src/test/java/PayTest.java | 2 +- 18 files changed, 48 insertions(+), 49 deletions(-) diff --git a/pay-java-ali/README.md b/pay-java-ali/README.md index aebefc7..0f27875 100644 --- a/pay-java-ali/README.md +++ b/pay-java-ali/README.md @@ -109,7 +109,7 @@ ```java //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); ``` diff --git a/pay-java-ali/src/test/java/PayTest.java b/pay-java-ali/src/test/java/PayTest.java index 244297e..c098259 100644 --- a/pay-java-ali/src/test/java/PayTest.java +++ b/pay-java-ali/src/test/java/PayTest.java @@ -65,7 +65,7 @@ public class PayTest { //支付服务 PayService service = new AliPayService(aliPayConfigStorage); //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); /*-----------扫码付-------------------*/ payOrder.setTransactionType(AliTransactionType.SWEEPPAY); //获取扫码付的二维码 diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/util/Util.java b/pay-java-common/src/main/java/com/egzosn/pay/common/util/Util.java index e67ce7e..e8c2b14 100644 --- a/pay-java-common/src/main/java/com/egzosn/pay/common/util/Util.java +++ b/pay-java-common/src/main/java/com/egzosn/pay/common/util/Util.java @@ -451,7 +451,7 @@ public class Util { * @param algorism 十进制的数字 * @return String 对应的十六进制字符串 */ - public static String algorismToHEXString(int algorism) { + public static String algorismToHexString(int algorism) { String result = ""; result = Integer.toHexString(algorism); diff --git a/pay-java-demo/README.md b/pay-java-demo/README.md index 0f00886..d6b9a7e 100644 --- a/pay-java-demo/README.md +++ b/pay-java-demo/README.md @@ -334,7 +334,7 @@ public class ApyAccountService { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); //此处只有刷卡支付(银行卡支付)时需要 if (StringUtils.isNotEmpty(bankType)){ @@ -355,7 +355,7 @@ public class ApyAccountService { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); //获取订单信息 - Map orderInfo = payResponse.getService().orderInfo(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))); + Map orderInfo = payResponse.getService().orderInfo(new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(payResponse.getService().genQrPay(orderInfo), "JPEG", baos); @@ -376,7 +376,7 @@ public class ApyAccountService { PayResponse payResponse = service.getPayResponse(payId); Map data = new HashMap<>(); data.put("code", 0); - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); data.put("orderInfo", payResponse.getService().orderInfo(order)); return data; } diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/AliPayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/AliPayController.java index b71161f..c0a918a 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/AliPayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/AliPayController.java @@ -115,9 +115,9 @@ public class AliPayController { @RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8") public String toPay( BigDecimal price) { //及时收款 - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE); //WAP -// PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAP); +// PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAP); // Map orderInfo = service.orderInfo(order); // return service.buildRequest(orderInfo, MethodType.POST); @@ -137,7 +137,7 @@ public class AliPayController { public Map app() { Map data = new HashMap<>(); data.put("code", 0); - PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", "")); + PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", "")); //App支付 order.setTransactionType(AliTransactionType.APP); data.put("orderInfo", UriVariables.getMapToParameters(service.app(order))); @@ -155,7 +155,7 @@ public class AliPayController { public byte[] toQrPay( BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)), "JPEG", baos); + ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)), "JPEG", baos); return baos.toByteArray(); } /** @@ -168,7 +168,7 @@ public class AliPayController { @RequestMapping(value = "getQrPay.json") public String getQrPay(BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) - return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)); + return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", AliTransactionType.SWEEPPAY)); } @@ -182,9 +182,9 @@ public class AliPayController { public Map microPay(BigDecimal price, String authCode) { //获取对应的支付账户操作工具(可根据账户id) //条码付 - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE); //声波付 -// PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE); +// PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE); //设置授权码,条码等 order.setAuthCode(authCode); //支付结果 diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/FuiouPayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/FuiouPayController.java index 06d1114..e3e79a0 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/FuiouPayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/FuiouPayController.java @@ -65,7 +65,7 @@ public class FuiouPayController { @RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8") public String toPay( BigDecimal price) { //支付订单基础信息 - PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); + PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); order.setTransactionType(FuiouTransactionType.B2C); //获取支付所需的信息 // Map directOrderInfo = service.orderInfo(order); diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java index bd998bc..8c4f2fc 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayController.java @@ -88,7 +88,7 @@ public class PayController { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); // ------ 微信H5使用---- order.setSpbillCreateIp(request.getHeader("X-Real-IP")); StringBuffer requestURL = request.getRequestURL(); @@ -123,7 +123,7 @@ public class PayController { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(2); - PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB); + PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB); order.setSpbillCreateIp(request.getHeader("X-Real-IP")); StringBuffer requestURL = request.getRequestURL(); //设置网页地址 @@ -150,7 +150,7 @@ public class PayController { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType("JSAPI")); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType("JSAPI")); order.setOpenid(openid); Map orderInfo = payResponse.getService().orderInfo(order); @@ -173,7 +173,7 @@ public class PayController { PayResponse payResponse = service.getPayResponse(payId); Map data = new HashMap<>(); data.put("code", 0); - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); data.put("orderInfo", payResponse.getService().app(order)); return data; } @@ -192,7 +192,7 @@ public class PayController { //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType)); //设置授权码,条码等 order.setAuthCode(authCode); //支付结果 @@ -225,7 +225,7 @@ public class PayController { PayResponse payResponse = service.getPayResponse(payId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos); + ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos); return baos.toByteArray(); } /** @@ -240,7 +240,7 @@ public class PayController { //获取对应的支付账户操作工具(可根据账户id) //获取对应的支付账户操作工具(可根据账户id) PayResponse payResponse = service.getPayResponse(payId); - return payResponse.getService().getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))); + return payResponse.getService().getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + "", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))); } /** * 获取一码付二维码图像 @@ -288,7 +288,7 @@ public class PayController { StringBuilder html = new StringBuilder(); //订单 - PayOrder payOrder = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis() + ""); + PayOrder payOrder = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis() + ""); String ua = request.getHeader("user-agent"); if (ua.contains("MicroMessenger")) { payOrder.setTransactionType(WxTransactionType.NATIVE); diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayPalPayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayPalPayController.java index fe84f00..bd4e344 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayPalPayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/PayPalPayController.java @@ -68,7 +68,7 @@ public class PayPalPayController { @RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8") public String toPay(BigDecimal price) { //及时收款 - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayPalTransactionType.sale); // Map orderInfo = service.orderInfo(order); // return service.buildRequest(orderInfo, MethodType.POST); @@ -93,7 +93,7 @@ public class PayPalPayController { order.setCurType(DefaultCurType.USD); order.setDescription(" description "); order.setTradeNo("paypal 平台的单号"); - order.setRefundAmount(new BigDecimal(0.01)); + order.setRefundAmount(BigDecimal.valueOf(0.01)); return service.refund(order); } diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/UnionPayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/UnionPayController.java index 8c1e6e5..978c90c 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/UnionPayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/UnionPayController.java @@ -97,10 +97,10 @@ public class UnionPayController { @RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8") public String toPay( BigDecimal price) { //网关支付(WEB)/手机网页支付 - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WEB); //企业网银支付(B2B支付) -// PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), UnionTransactionType.B2B); +// PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), UnionTransactionType.B2B); // Map orderInfo = service.orderInfo(order); // return service.buildRequest(orderInfo, MethodType.POST); @@ -117,7 +117,7 @@ public class UnionPayController { @RequestMapping(value = "toPay.json") public Map sendHttpRequest( BigDecimal price) { //手机控件支付产品 - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", "") + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", "") ,UnionTransactionType.WAP); return service.app(order); } @@ -133,7 +133,7 @@ public class UnionPayController { public Map app() { Map data = new HashMap<>(); data.put("code", 0); - PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), SignUtils.randomStr()); + PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), SignUtils.randomStr()); //App支付 order.setTransactionType(UnionTransactionType.APP); @@ -155,7 +155,7 @@ public class UnionPayController { public byte[] toWxQrPay( BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)), "JPEG", baos); + ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)), "JPEG", baos); return baos.toByteArray(); } /** @@ -168,7 +168,7 @@ public class UnionPayController { @RequestMapping(value = "getQrPay.json") public String getQrPay(BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) - return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)); + return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", UnionTransactionType.APPLY_QR_CODE)); } /** @@ -181,7 +181,7 @@ public class UnionPayController { public Map microPay(BigDecimal price, String authCode) { //获取对应的支付账户操作工具(可根据账户id) //条码付 - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, SignUtils.randomStr(), UnionTransactionType.CONSUME); //设置授权码,条码等 order.setAuthCode(authCode); //支付结果 diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/WxPayController.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/WxPayController.java index a554c73..1269ebc 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/WxPayController.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/controller/WxPayController.java @@ -38,7 +38,6 @@ public class WxPayController { //ssl 退款证书相关 不使用可注释 private static String KEYSTORE = "ssl 退款证书"; - private static String STORE_PASSWORD = "ssl 证书对应的密码, 默认为商户号"; @PostConstruct public void init() { @@ -67,7 +66,7 @@ public class WxPayController { //TODO 这里也支持输入流的入参。 // httpConfigStorage.setKeystore(WxPayController.class.getResourceAsStream("/证书文件")); httpConfigStorage.setKeystore(KEYSTORE); - httpConfigStorage.setStorePassword(STORE_PASSWORD); + httpConfigStorage.setStorePassword("ssl 证书对应的密码, 默认为商户号"); //设置ssl证书对应的存储方式,这里默认为文件地址 httpConfigStorage.setCertStoreType(CertStoreType.PATH); } @@ -97,7 +96,7 @@ public class WxPayController { */ @RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8") public String toPay( HttpServletRequest request, BigDecimal price) { - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price , UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price , UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MWEB); order.setSpbillCreateIp(request.getHeader("X-Real-IP")); StringBuffer requestURL = request.getRequestURL(); //设置网页地址 @@ -121,7 +120,7 @@ public class WxPayController { @RequestMapping(value = "jsapi" ) public Map toPay(String openid, BigDecimal price) { - PayOrder order = new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI); + PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI); order.setOpenid(openid); Map orderInfo = service.orderInfo(order); @@ -141,7 +140,7 @@ public class WxPayController { public Map app() { Map data = new HashMap<>(); data.put("code", 0); - PayOrder order = new PayOrder("订单title", "摘要", new BigDecimal(0.01), UUID.randomUUID().toString().replace("-", "")); + PayOrder order = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01), UUID.randomUUID().toString().replace("-", "")); //App支付 order.setTransactionType(WxTransactionType.APP); data.put("orderInfo", service.app(order)); @@ -159,7 +158,7 @@ public class WxPayController { public byte[] toWxQrPay( BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)), "JPEG", baos); + ImageIO.write(service.genQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)), "JPEG", baos); return baos.toByteArray(); } @@ -173,7 +172,7 @@ public class WxPayController { @RequestMapping(value = "getQrPay.json") public String getQrPay(BigDecimal price) throws IOException { //获取对应的支付账户操作工具(可根据账户id) - return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)); + return service.getQrPay( new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, System.currentTimeMillis()+"", WxTransactionType.NATIVE)); } /** * 刷卡付,pos主动扫码付款(条码付) @@ -185,7 +184,7 @@ public class WxPayController { public Map microPay( BigDecimal price, String authCode) { //获取对应的支付账户操作工具(可根据账户id) //条码付 - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.MICROPAY); //设置授权码,条码等 order.setAuthCode(authCode); //支付结果 @@ -212,7 +211,7 @@ public class WxPayController { @RequestMapping(value = "facePay") public Map facePay(BigDecimal price, String authCode, String openid) { //获取对应的支付账户操作工具(可根据账户id) - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY); //设置人脸凭证 order.setAuthCode(authCode); // 用户在商户 appid下的唯一标识 diff --git a/pay-java-fuiou/README.md b/pay-java-fuiou/README.md index deb86df..ea87ca4 100644 --- a/pay-java-fuiou/README.md +++ b/pay-java-fuiou/README.md @@ -51,7 +51,7 @@ ```java //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); ``` diff --git a/pay-java-fuiou/src/test/java/PayTest.java b/pay-java-fuiou/src/test/java/PayTest.java index a59cca0..53dfd25 100644 --- a/pay-java-fuiou/src/test/java/PayTest.java +++ b/pay-java-fuiou/src/test/java/PayTest.java @@ -37,7 +37,7 @@ public class PayTest { //支付服务 PayService service = new FuiouPayService(fuiouPayConfigStorage); //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "").substring(2)); /*----------- 网页支付-------------------*/ diff --git a/pay-java-union/README.md b/pay-java-union/README.md index 4d370b1..7d604a8 100644 --- a/pay-java-union/README.md +++ b/pay-java-union/README.md @@ -80,7 +80,7 @@ ```java //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); ``` diff --git a/pay-java-union/src/test/java/PayTest.java b/pay-java-union/src/test/java/PayTest.java index ff2f114..93ef3d5 100644 --- a/pay-java-union/src/test/java/PayTest.java +++ b/pay-java-union/src/test/java/PayTest.java @@ -52,7 +52,7 @@ public class PayTest { //支付服务 UnionPayService service = new UnionPayService(unionPayConfigStorage); //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , new SimpleDateFormat("yyyyMMddHHmmss").format(System.currentTimeMillis())); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , new SimpleDateFormat("yyyyMMddHHmmss").format(System.currentTimeMillis())); /*----------- 网页支付-------------------*/ diff --git a/pay-java-wx-youdian/README.md b/pay-java-wx-youdian/README.md index 89445d1..e7f855c 100644 --- a/pay-java-wx-youdian/README.md +++ b/pay-java-wx-youdian/README.md @@ -50,7 +50,7 @@ ```java //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); ``` diff --git a/pay-java-wx-youdian/src/test/java/PayTest.java b/pay-java-wx-youdian/src/test/java/PayTest.java index 069cca4..e4d3089 100644 --- a/pay-java-wx-youdian/src/test/java/PayTest.java +++ b/pay-java-wx-youdian/src/test/java/PayTest.java @@ -37,7 +37,7 @@ public class PayTest { //支付服务 PayService service = new WxYouDianPayService(wxPayConfigStorage); //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); /*-----------扫码付-------------------*/ payOrder.setTransactionType(YoudianTransactionType.NATIVE); //获取扫码付的二维码 diff --git a/pay-java-wx/README.md b/pay-java-wx/README.md index ba8783b..488a177 100644 --- a/pay-java-wx/README.md +++ b/pay-java-wx/README.md @@ -81,7 +81,7 @@ ```java //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); ``` @@ -146,7 +146,7 @@ /*-----------刷脸付-------------------*/ //获取对应的支付账户操作工具(可根据账户id) - PayOrder order = new PayOrder("egan order", "egan order", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY); + PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.FACEPAY); //设置人脸凭证 order.setAuthCode(authCode); // 用户在商户 appid下的唯一标识 diff --git a/pay-java-wx/src/test/java/PayTest.java b/pay-java-wx/src/test/java/PayTest.java index e0a604b..4588157 100644 --- a/pay-java-wx/src/test/java/PayTest.java +++ b/pay-java-wx/src/test/java/PayTest.java @@ -44,7 +44,7 @@ public class PayTest { //支付服务 WxPayService service = new WxPayService(wxPayConfigStorage); //支付订单基础信息 - PayOrder payOrder = new PayOrder("订单title", "摘要", new BigDecimal(0.01) , UUID.randomUUID().toString().replace("-", "")); + PayOrder payOrder = new PayOrder("订单title", "摘要", BigDecimal.valueOf(0.01) , UUID.randomUUID().toString().replace("-", "")); /*-----------扫码付-------------------*/ payOrder.setTransactionType(WxTransactionType.NATIVE); //获取扫码付的二维码