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

Commit 7e340d2c authored by zhengfuxin's avatar zhengfuxin

修改验签问题。

parent 1deac058
...@@ -158,7 +158,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl ...@@ -158,7 +158,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
|| AlipayConstant.AlipayTradeStateEnum.TRADE_FINISHED.getCode().equals(resultMap.get("tradeStatus"))) { || AlipayConstant.AlipayTradeStateEnum.TRADE_FINISHED.getCode().equals(resultMap.get("tradeStatus"))) {
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode())); respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode()));
if(ordersDto.getPaymentType().equals(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_ALIPAY.getCode())){ if(ordersDto.getPaymentType().equals(DragonConstant.PayTypeEnum.PAYMENT_TYPE_MICROPAY_ALIPAY.getCode())){
this.completeSuccessOrder(ordersDto, resultMap.get("trade_no").toString(), LocalDateTime.now(), resultMap.toString()); this.completeSuccessOrder(ordersDto, resultMap.get("tradeNo").toString(), LocalDateTime.now(), resultMap.toString());
} }
}else{ }else{
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAY_FAIL.getCode())); respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAY_FAIL.getCode()));
......
...@@ -111,7 +111,8 @@ public class WepayStrategyMicropayImpl extends AbstractWepayStrategy { ...@@ -111,7 +111,8 @@ public class WepayStrategyMicropayImpl extends AbstractWepayStrategy {
} }
// 当trade_state为SUCCESS时才返回result_code // 当trade_state为SUCCESS时才返回result_code
if ("SUCCESS".equals(resultMap.get("trade_state"))) { if ("SUCCESS".equals(resultMap.get("trade_state"))) {
if(PayWepayUtils.getInstance().notifySign(resultMap, resultMap.get("sign"))){ String sign = resultMap.remove("sign");
if(PayWepayUtils.getInstance().notifySign(resultMap, sign)){
// 修改订单状态等。 // 修改订单状态等。
payChannelStrategyWepay.completeSuccessOrder(dragonOrdersDto,resultMap.get("transaction_id"), LocalDateTime.now(),resultMap.toString()); payChannelStrategyWepay.completeSuccessOrder(dragonOrdersDto,resultMap.get("transaction_id"), LocalDateTime.now(),resultMap.toString());
respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode())); respDto.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_PAID.getCode()));
......
...@@ -55,11 +55,12 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService { ...@@ -55,11 +55,12 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
if(StringUtil.isEmpty(ordersDto)){ if(StringUtil.isEmpty(ordersDto)){
throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getCode(),DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getMessage()); throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getCode(),DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getMessage());
} }
//如果已支付 直接返回结果 //如果已支付 直接返回结果 // MICROPAYWEPAY MICROPAYALIPAY
if(!ordersDto.getStatus().toString().equals(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode())){ if(!ordersDto.getStatus().toString().equals(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode())&&!ordersDto.getPaymentType().equals("MICROPAYALIPAY")&&!ordersDto.getPaymentType().equals("MICROPAYWEPAY")){
return dragonPayBiz.buildPayOrderQueryRespDto(ordersDto); return dragonPayBiz.buildPayOrderQueryRespDto(ordersDto);
} }
//如果未支付进行三方查询 //如果未支付进行三方查询`
String payType = DragonConstant.PayTypeEnum.getEnumByCode(ordersDto.getPaymentType()).getPayType(); String payType = DragonConstant.PayTypeEnum.getEnumByCode(ordersDto.getPaymentType()).getPayType();
return payChannelStrategyContext.getStrategy(payType).checkOrderStatus(code); return payChannelStrategyContext.getStrategy(payType).checkOrderStatus(code);
} }
......
...@@ -2,6 +2,7 @@ package com.liquidnet.service.dragon.utils; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.dragon.utils;
import com.alipay.api.internal.util.file.IOUtils; import com.alipay.api.internal.util.file.IOUtils;
import com.liquidnet.commons.lang.util.MD5Utils; import com.liquidnet.commons.lang.util.MD5Utils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.Registry; import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder; import org.apache.http.config.RegistryBuilder;
...@@ -265,7 +266,12 @@ public class PayWepayUtils { ...@@ -265,7 +266,12 @@ public class PayWepayUtils {
SortedMap<String, Object> smap = new TreeMap<String, Object>(map); SortedMap<String, Object> smap = new TreeMap<String, Object>(map);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (Map.Entry<String, Object> m : smap.entrySet()) { for (Map.Entry<String, Object> m : smap.entrySet()) {
sb.append(m.getKey()).append("=").append(m.getValue()).append("&"); if(null!=m.getValue()){
if(StringUtils.isNotBlank(m.getValue().toString())){
sb.append(m.getKey()).append("=").append(m.getValue()).append("&");
}
}
} }
sb.delete(sb.length() - 1, sb.length()); sb.delete(sb.length() - 1, sb.length());
return sb.toString(); return sb.toString();
......
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