Authored by tanling

跨境支付回调

@@ -8,6 +8,8 @@ import java.util.Map; @@ -8,6 +8,8 @@ import java.util.Map;
8 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletRequest;
9 import javax.servlet.http.HttpServletResponse; 9 import javax.servlet.http.HttpServletResponse;
10 10
  11 +import com.yohoufo.order.service.pay.alipay.AlipayCrossBorderService;
  12 +import com.yohoufo.order.service.pay.alipay.AlipayServiceAbstract;
11 import com.yohoufo.order.service.pay.unionpay.JsUnionpayService; 13 import com.yohoufo.order.service.pay.unionpay.JsUnionpayService;
12 import net.sf.oval.constraint.AssertURL; 14 import net.sf.oval.constraint.AssertURL;
13 import org.apache.commons.lang.StringUtils; 15 import org.apache.commons.lang.StringUtils;
@@ -64,6 +66,9 @@ public class PaymentController { @@ -64,6 +66,9 @@ public class PaymentController {
64 AlipayOuyinService alipayService; 66 AlipayOuyinService alipayService;
65 67
66 @Autowired 68 @Autowired
  69 + AlipayCrossBorderService alipayCrossBorderService;
  70 +
  71 + @Autowired
67 JsUnionpayService jsUnionpayService; 72 JsUnionpayService jsUnionpayService;
68 73
69 public static final String RETURN_CODE = "return_code"; 74 public static final String RETURN_CODE = "return_code";
@@ -243,8 +248,17 @@ public class PaymentController { @@ -243,8 +248,17 @@ public class PaymentController {
243 return ; 248 return ;
244 } 249 }
245 250
  251 + AlipayServiceAbstract alipayServiceAbstract;
  252 +
  253 + // 跨境支付宝的回调
  254 + if (params.containsKey("currency")){
  255 + alipayServiceAbstract = alipayCrossBorderService;
  256 + }else{
  257 + alipayServiceAbstract = alipayService;
  258 + }
  259 +
246 //回调验证 260 //回调验证
247 - if(!alipayService.notifyVerify(params)) { 261 + if(!alipayServiceAbstract.notifyVerify(params)) {
248 notifyResponse.setNotifyResult(NotifyResponse.PAYMENT_NOTIFY_RESULT_VERFAIL); 262 notifyResponse.setNotifyResult(NotifyResponse.PAYMENT_NOTIFY_RESULT_VERFAIL);
249 alipayLogger.error("[{}] notification verify failed", out_trade_no); 263 alipayLogger.error("[{}] notification verify failed", out_trade_no);
250 return ; 264 return ;
@@ -252,7 +266,7 @@ public class PaymentController { @@ -252,7 +266,7 @@ public class PaymentController {
252 266
253 PaymentData paymentData = null; 267 PaymentData paymentData = null;
254 try { 268 try {
255 - paymentData = alipayService.getPaymentData(params); 269 + paymentData = alipayServiceAbstract.getPaymentData(params);
256 270
257 alipayLogger.info("method alipayService.getPaymentData is {}", paymentData); 271 alipayLogger.info("method alipayService.getPaymentData is {}", paymentData);
258 272
@@ -412,7 +426,7 @@ public class PaymentController { @@ -412,7 +426,7 @@ public class PaymentController {
412 return false; 426 return false;
413 } 427 }
414 428
415 - if (!trade_status.equals("TRADE_SUCCESS")) { 429 + if (!trade_status.equals("TRADE_SUCCESS") && !trade_status.equals("TRADE_FINISHED")) {
416 logger.info("[{}] trade_status: {}", params.get("out_trade_no"), trade_status); 430 logger.info("[{}] trade_status: {}", params.get("out_trade_no"), trade_status);
417 return false; 431 return false;
418 } 432 }