mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-21 00:16:13 +08:00
#新增#
新增退款接口 新增接口等注释 #修改# 更新新的支付接口
This commit is contained in:
@@ -4,15 +4,18 @@ package com.egzosn.pay.demo.controller;
|
||||
|
||||
import com.egzosn.pay.ali.bean.AliTransactionType;
|
||||
import com.egzosn.pay.common.api.Callback;
|
||||
import com.egzosn.pay.common.api.PayConfigStorage;
|
||||
import com.egzosn.pay.common.bean.*;
|
||||
import com.egzosn.pay.common.util.MatrixToImageWriter;
|
||||
import com.egzosn.pay.common.util.str.StringUtils;
|
||||
import com.egzosn.pay.demo.entity.ApyAccount;
|
||||
import com.egzosn.pay.demo.entity.PayType;
|
||||
import com.egzosn.pay.demo.request.QueryOrder;
|
||||
import com.egzosn.pay.demo.service.ApyAccountService;
|
||||
import com.egzosn.pay.demo.service.PayResponse;
|
||||
import com.egzosn.pay.demo.entity.PayType;
|
||||
import com.egzosn.pay.common.api.PayConfigStorage;
|
||||
import com.egzosn.pay.union.api.UnionPayService;
|
||||
import com.egzosn.pay.union.enums.UnionTransactionType;
|
||||
import com.egzosn.pay.union.request.UnionQueryOrder;
|
||||
import com.egzosn.pay.wx.bean.WxTransactionType;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -300,6 +303,19 @@ public class PayController {
|
||||
PayResponse payResponse = service.getPayResponse(order.getPayId());
|
||||
return payResponse.getService().query(order.getTradeNo(), order.getOutTradeNo());
|
||||
}
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param order 订单的请求体
|
||||
* @return 返回查询回来的结果集,支付方原值返回
|
||||
*/
|
||||
@RequestMapping("unionRefundOrConsumeUndo")
|
||||
public Map<String, Object> unionQuery(UnionQueryOrder order,String transactionType) {
|
||||
PayResponse payResponse = service.getPayResponse(order.getPayId());
|
||||
UnionPayService service = (UnionPayService)payResponse.getService();
|
||||
|
||||
return service.unionRefundOrConsumeUndo(order,UnionTransactionType.valueOf(transactionType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易关闭接口
|
||||
|
||||
@@ -81,6 +81,22 @@ public class ApyAccountRepository {
|
||||
apyAccount3.setMsgType(MsgType.xml);
|
||||
apyAccounts.put(apyAccount3.getPayId(), apyAccount3);
|
||||
|
||||
ApyAccount apyAccount4 = new ApyAccount();
|
||||
apyAccount4.setPayId(4);
|
||||
apyAccount4.setPartner("777290058110097");
|
||||
// apyAccount4.setAppid("777290058110097");
|
||||
apyAccount4.setPublicKey("");
|
||||
apyAccount4.setPrivateKey("000000");
|
||||
apyAccount4.setNotifyUrl("http://sailinmu.iok.la:19088/backRcvResponse");
|
||||
// 无需同步回调可不填 app填这个就可以
|
||||
apyAccount4.setReturnUrl("http://sailinmu.iok.la:19088/backRcvResponse");
|
||||
apyAccount4.setSeller("");
|
||||
apyAccount4.setInputCharset("UTF-8");
|
||||
apyAccount4.setSignType(SignUtils.RSA.name());
|
||||
apyAccount4.setPayType(PayType.unionPay);
|
||||
apyAccount4.setMsgType(MsgType.json);
|
||||
apyAccounts.put(apyAccount4.getPayId(), apyAccount3);
|
||||
|
||||
}
|
||||
//_____________________________________________________________
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ 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.fuiou.api.FuiouPayConfigStorage;
|
||||
import com.egzosn.pay.fuiou.api.FuiouPayService;
|
||||
import com.egzosn.pay.union.api.UnionPayConfigStorage;
|
||||
import com.egzosn.pay.union.api.UnionPayService;
|
||||
import com.egzosn.pay.union.enums.UnionTransactionType;
|
||||
import com.egzosn.pay.wx.api.WxPayConfigStorage;
|
||||
import com.egzosn.pay.wx.api.WxPayService;
|
||||
import com.egzosn.pay.wx.bean.WxTransactionType;
|
||||
@@ -144,6 +144,29 @@ public enum PayType implements BasePayType {
|
||||
}
|
||||
|
||||
|
||||
},unionPay{
|
||||
|
||||
@Override
|
||||
public PayService getPayService(ApyAccount apyAccount) {
|
||||
UnionPayConfigStorage unionPayConfigStorage = new UnionPayConfigStorage();
|
||||
unionPayConfigStorage.setKeyPublic(apyAccount.getPublicKey());
|
||||
unionPayConfigStorage.setKeyPrivate(apyAccount.getPrivateKey());
|
||||
unionPayConfigStorage.setNotifyUrl(apyAccount.getNotifyUrl());
|
||||
unionPayConfigStorage.setReturnUrl(apyAccount.getReturnUrl());
|
||||
unionPayConfigStorage.setSignType(apyAccount.getSignType());
|
||||
unionPayConfigStorage.setPayType(apyAccount.getPayType().toString());
|
||||
unionPayConfigStorage.setMsgType(apyAccount.getMsgType());
|
||||
unionPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
unionPayConfigStorage.setTest(apyAccount.isTest());
|
||||
return new UnionPayService(unionPayConfigStorage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionType getTransactionType(String transactionType) {
|
||||
return UnionTransactionType.valueOf(transactionType);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
public abstract PayService getPayService(ApyAccount apyAccount);
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
package com.egzosn.pay.demo.service;
|
||||
|
||||
import com.egzosn.pay.common.api.PayMessageRouter;
|
||||
import com.egzosn.pay.common.http.HttpConfigStorage;
|
||||
import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.YouDianPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.interceptor.AliPayMessageInterceptor;
|
||||
import com.egzosn.pay.demo.entity.ApyAccount;
|
||||
import com.egzosn.pay.demo.entity.PayType;
|
||||
import com.egzosn.pay.demo.service.handler.AliPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.WxPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.YouDianPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.interceptor.AliPayMessageInterceptor;
|
||||
import com.egzosn.pay.common.api.PayConfigStorage;
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.api.PayMessageRouter;
|
||||
import com.egzosn.pay.common.api.PayService;
|
||||
import com.egzosn.pay.common.bean.MsgType;
|
||||
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.*;
|
||||
import com.egzosn.pay.demo.service.interceptor.AliPayMessageInterceptor;
|
||||
import com.egzosn.pay.demo.service.interceptor.YoudianPayMessageInterceptor;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
|
||||
@@ -116,7 +110,12 @@ public class PayResponse {
|
||||
.payType(PayType.fuiou.name())
|
||||
.handler(autowire(new FuiouPayMessageHandler(payId)))
|
||||
.end()
|
||||
|
||||
.rule()
|
||||
.async(false)
|
||||
.msgType(MsgType.json.name())
|
||||
.payType(PayType.unionPay.name())
|
||||
.handler(autowire(new UnionPayMessageHandler(payId)))
|
||||
.end()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.egzosn.pay.demo.service.handler;
|
||||
|
||||
import com.egzosn.pay.common.api.PayService;
|
||||
import com.egzosn.pay.common.bean.PayMessage;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Actinia
|
||||
* @email hayesfu@qq.com
|
||||
* <pre>
|
||||
create 2017 2017/11/4 0004
|
||||
* </pre>
|
||||
*/
|
||||
public class UnionPayMessageHandler extends BasePayMessageHandler {
|
||||
|
||||
|
||||
|
||||
|
||||
public UnionPayMessageHandler (Integer payId) {
|
||||
super(payId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayOutMessage handle(PayMessage payMessage, Map<String, Object> context, PayService payService) throws PayErrorException {
|
||||
//交易状态
|
||||
if ("0000".equals(payMessage.getPayMessage().get("order_pay_code"))){
|
||||
/////这里进行成功的处理
|
||||
|
||||
return PayOutMessage.JSON().content("success","成功").build();
|
||||
}
|
||||
|
||||
return PayOutMessage.JSON().content("fail", "失败").build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user