记得上下班打卡 | git大法好,push需谨慎

Commit d61f0bac authored by zhengfuxin's avatar zhengfuxin

修改银联查询接口。

parent d4c7551f
......@@ -176,7 +176,9 @@ public class DragonConstant {
PAYMENT_TYPE_WEB_ALIPAY("WEBALIPAY","alipay","web","电脑网页内支付宝即时到账支付"),
PAYMENT_TYPE_WEB_WEPAY("WEBWEPAY","wepay","web","电脑网页内微信二维码支付,用户打开微信扫码支付"),
PAYMENT_TYPE_JS_WEPAY("JSWEPAY","wepay","js","微信内网页、微信公众号"),
PAYMENT_TYPE_APPLET_WEPAY("APPLETWEPAY","wepay","applet","微信小程序");
PAYMENT_TYPE_APPLET_WEPAY("APPLETWEPAY","wepay","applet","微信小程序"),
PAYMENT_TYPE_WAP_UNIONPAY("WAPUNIONPAY","unionpay","wap","银联wap支付"),
PAYMENT_TYPE_APP_UNIONPAY("APPUNIONPAY","unionpay","app","银联app支付");
private String code;
private String message;
......
......@@ -121,49 +121,13 @@ public class PayChannelStrategyUnionpayImpl extends AbstractPayChannelStrategyIm
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
// 查看是哪个deviceForm 的支付
DragonOrdersDto ordersDto = dataUtils.getPayOrderByCode(code);
if(null==ordersDto){
DragonPayOrderQueryRespDto respDto = unionpayStrategyContext.getStrategy(DragonConstant.PayTypeEnum.getEnumByCode(ordersDto.getPaymentType()).getDeviceFrom()).checkOrderStatus(code);
/* if(null==ordersDto){
throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_UNIONPAY_QUERY_ERROR.getCode(),DragonErrorCodeEnum.TRADE_UNIONPAY_QUERY_ERROR.getMessage());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
//判断是wap还是app
if(ordersDto.getPaymentType().contains("WAP")){
//wap类型查询订单
Map<String, String> resultMap = unionpayBiz.tradeQuery(code);
if(("00").equals(resultMap.get("respCode"))){//如果查询交易成功
String origRespCode = resultMap.get("origRespCode");
if((UnionpayConstant.UnionTradeStateEnum.TRADE_SUCCESS).equals(origRespCode)||UnionpayConstant.UnionTradeStateEnum.TRADE_DEFECTIVENESS_SUCCESS.equals(origRespCode)){
//交易成功
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode()));
}else if(("03").equals(origRespCode)||
("04").equals(origRespCode)||
("05").equals(origRespCode)){
//订单处理中或交易状态未明,需稍后发起交易状态查询交易 【如果最终尚未确定交易是否成功请以对账文件为准】
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode()));
}else{
//其他应答码为交易失败
//TODO
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAY_FAIL.getCode()));
}
}
}else{
//app类型查询订单
}
/* DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
if ("10000".equals(resultMap.get("code"))) {
// 当返回状态为“TRADE_FINISHED”交易成功结束和“TRADE_SUCCESS”支付成功时更新交易状态
if (AlipayConstant.AlipayTradeStateEnum.TRADE_SUCCESS.getCode().equals(resultMap.get("tradeStatus"))
|| AlipayConstant.AlipayTradeStateEnum.TRADE_FINISHED.getCode().equals(resultMap.get("tradeStatus"))) {
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode()));
}else{
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAY_FAIL.getCode()));
}
// throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_ALIPAY_QUERY_ERROR.getCode(),DragonErrorCodeEnum.TRADE_ALIPAY_QUERY_ERROR.getMessage());
}else if("40004".equals(resultMap.get("code"))&&"ACQ.TRADE_NOT_EXIST".equalsIgnoreCase(resultMap.get("subCode").toString())){
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode()));
}else{
throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_ALIPAY_QUERY_ERROR.getCode(),DragonErrorCodeEnum.TRADE_ALIPAY_QUERY_ERROR.getMessage());
}*/
*/
return respDto;
}
}
......@@ -252,7 +252,14 @@ public class UnionpayBiz {
log.info("应答报文:</br>"+rspMessage+"");*/
return rspData;
}
/**
* @author zhangfuxin
* @Description: 银联
* @date 2021/11/24 上午11:32
*/
public Map<String, String> tradeQueryApp(String outTradeNo){
return null;
}
public Map<String, Object> appSingleRefund()
throws ServletException, IOException {
String txnTime = DateUtil.format(LocalDateTime.now(),DateUtil.Formatter.yyyyMMddHHmmssTrim);
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.dragon.channel.unionpay.strategy;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
/**
......@@ -16,4 +17,5 @@ import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
*/
public interface IUnionpayStrategy {
ResponseDto<DragonPayBaseRespDto> dragonPay(DragonPayBaseReqDto dragonPayBaseReqDto);
DragonPayOrderQueryRespDto checkOrderStatus(String code);
}
......@@ -10,6 +10,7 @@ import com.liquidnet.service.dragon.channel.unionpay.sdk.SDKConstants;
import com.liquidnet.service.dragon.channel.unionpay.strategy.IUnionpayStrategy;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -126,6 +127,11 @@ public abstract class AbstractUnionPayStrategy implements IUnionpayStrategy {
return respDto;
}
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
return null;
}
/**
* 构造返回参数
*/
......
......@@ -9,6 +9,7 @@ import com.liquidnet.service.dragon.channel.unionpay.strategy.annotation.Strateg
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -58,6 +59,16 @@ public class UnionpayStrategyAppImpl extends AbstractUnionPayStrategy {
payReq.setChannelType("08");
return payReq;
}
/**
* @author zhangfuxin
* @Description: 银联app查询
* @date 2021/11/24 上午11:56
*/
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
return null;
}
@Override
DragonPayBaseRespDto buildResponseDto(DragonPayBaseRespDto payBaseRespDto, Map<String, String> respResult) {
......
package com.liquidnet.service.dragon.channel.unionpay.strategy.impl;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.dragon.channel.strategy.biz.DragonPayBiz;
import com.liquidnet.service.dragon.channel.unionpay.biz.UnionpayBiz;
import com.liquidnet.service.dragon.channel.unionpay.constant.UnionpayConstant;
import com.liquidnet.service.dragon.channel.unionpay.req.UnionpayTradePayReq;
import com.liquidnet.service.dragon.channel.unionpay.sdk.SDKConfig;
import com.liquidnet.service.dragon.channel.unionpay.strategy.annotation.StrategyUnionpayHandler;
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.constant.DragonErrorCodeEnum;
import com.liquidnet.service.dragon.dto.DragonOrdersDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import com.liquidnet.service.dragon.utils.DataUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -42,6 +49,10 @@ public class UnionpayStrategyWapImpl extends AbstractUnionPayStrategy {
@Autowired
private SDKConfig sdkConfig;
@Autowired
private DragonPayBiz dragonPayBiz;
@Autowired
private DataUtils dataUtils;
@Override
protected Map<String, String> executePay(UnionpayTradePayReq payReq) {
......@@ -64,6 +75,36 @@ public class UnionpayStrategyWapImpl extends AbstractUnionPayStrategy {
return payReq;
}
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
DragonOrdersDto ordersDto = dataUtils.getPayOrderByCode(code);
if(null==ordersDto){
throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_UNIONPAY_QUERY_ERROR.getCode(),DragonErrorCodeEnum.TRADE_UNIONPAY_QUERY_ERROR.getMessage());
}
DragonPayOrderQueryRespDto respDto = dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
//wap类型查询订单
Map<String, String> resultMap = unionpayBiz.tradeQuery(code);
if(("00").equals(resultMap.get("respCode"))){//如果查询交易成功
String origRespCode = resultMap.get("origRespCode");
if((UnionpayConstant.UnionTradeStateEnum.TRADE_SUCCESS).equals(origRespCode)||UnionpayConstant.UnionTradeStateEnum.TRADE_DEFECTIVENESS_SUCCESS.equals(origRespCode)){
//交易成功
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode()));
}else if(("03").equals(origRespCode)||
("04").equals(origRespCode)||
("05").equals(origRespCode)){
//订单处理中或交易状态未明,需稍后发起交易状态查询交易 【如果最终尚未确定交易是否成功请以对账文件为准】
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode()));
}else{
//其他应答码为交易失败
//TODO
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAY_FAIL.getCode()));
}
}
return null;
}
@Override
DragonPayBaseRespDto buildResponseDto(DragonPayBaseRespDto payBaseRespDto, Map<String, String> respResult) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment