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 d9abb3f..d53562c 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 @@ -96,7 +96,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, "9d1c43152c304ed2b9d2db320ef0a742", PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos); + ImageIO.write(payResponse.getService().genQrPay(new PayOrder("订单title", "摘要", null == price ? new BigDecimal(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType(transactionType))), "JPEG", baos); return baos.toByteArray(); } diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java index a157bef..3e1eec1 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/entity/PayType.java @@ -6,6 +6,10 @@ import com.egzosn.pay.ali.bean.AliTransactionType; import com.egzosn.pay.common.api.PayService; import com.egzosn.pay.common.bean.BasePayType; import com.egzosn.pay.common.bean.TransactionType; +import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler; +import com.egzosn.pay.fuiou.api.FuiouPayConfigStorage; +import com.egzosn.pay.fuiou.api.FuiouPayService; +import com.egzosn.pay.fuiou.bean.FuiouTransactionType; import com.egzosn.pay.wx.api.WxPayConfigStorage; import com.egzosn.pay.wx.api.WxPayService; import com.egzosn.pay.wx.bean.WxTransactionType; @@ -118,26 +122,22 @@ public enum PayType implements BasePayType { @Override public PayService getPayService(ApyAccount apyAccount) { - AliPayConfigStorage aliPayConfigStorage = new AliPayConfigStorage(); - aliPayConfigStorage.setPid(apyAccount.getPartner()); - aliPayConfigStorage.setAppId(apyAccount.getAppid()); - aliPayConfigStorage.setAliPublicKey(apyAccount.getPublicKey()); - aliPayConfigStorage.setKeyPrivate(apyAccount.getPrivateKey()); - aliPayConfigStorage.setNotifyUrl(apyAccount.getNotifyUrl()); - aliPayConfigStorage.setReturnUrl(apyAccount.getReturnUrl()); - aliPayConfigStorage.setSignType(apyAccount.getSignType()); - aliPayConfigStorage.setSeller(apyAccount.getSeller()); - aliPayConfigStorage.setPayType(apyAccount.getPayType().toString()); - aliPayConfigStorage.setMsgType(apyAccount.getMsgType()); - aliPayConfigStorage.setInputCharset(apyAccount.getInputCharset()); - aliPayConfigStorage.setTest(apyAccount.isTest()); - return new AliPayService(aliPayConfigStorage); + FuiouPayConfigStorage fuiouPayConfigStorage = new FuiouPayConfigStorage(); + fuiouPayConfigStorage.setKeyPrivate(apyAccount.getPrivateKey()); + fuiouPayConfigStorage.setNotifyUrl(apyAccount.getNotifyUrl()); + fuiouPayConfigStorage.setReturnUrl(apyAccount.getReturnUrl()); + fuiouPayConfigStorage.setSignType(apyAccount.getSignType()); + fuiouPayConfigStorage.setPayType(apyAccount.getPayType().toString()); + fuiouPayConfigStorage.setMsgType(apyAccount.getMsgType()); + fuiouPayConfigStorage.setInputCharset(apyAccount.getInputCharset()); + fuiouPayConfigStorage.setTest(apyAccount.isTest()); + return new FuiouPayService(fuiouPayConfigStorage); } @Override public TransactionType getTransactionType(String transactionType) { // in.egan.pay.ali.before.bean.AliTransactionType 17年更新的版本,旧版本请自行切换 - return AliTransactionType.valueOf(transactionType); + return FuiouTransactionType.valueOf(transactionType); } diff --git a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java index 451ca04..752a617 100644 --- a/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java +++ b/pay-java-demo/src/main/java/com/egzosn/pay/demo/service/PayResponse.java @@ -3,6 +3,7 @@ package com.egzosn.pay.demo.service; import com.egzosn.pay.ali.bean.AliTransactionType; +import com.egzosn.pay.common.http.HttpConfigStorage; import com.egzosn.pay.demo.entity.ApyAccount; import com.egzosn.pay.demo.entity.PayType; import com.egzosn.pay.demo.service.handler.AliPayMessageHandler; diff --git a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java index 73a48ac..5375962 100644 --- a/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java +++ b/pay-java-fuiou/src/main/java/com/egzosn/pay/fuiou/api/FuiouPayService.java @@ -58,6 +58,14 @@ public class FuiouPayService extends BasePayService { super(payConfigStorage, configStorage); } + /** + * 构造函数,初始化时候使用 + * @param payConfigStorage + */ + public FuiouPayService (PayConfigStorage payConfigStorage) { + super(payConfigStorage, null); + } + /** * 回调校验 diff --git a/pom.xml b/pom.xml index 0cc5830..4264294 100644 --- a/pom.xml +++ b/pom.xml @@ -114,7 +114,7 @@ 1.7 - +