|
@@ -1,5 +1,6 @@
|
|
package cn.newfeifan.mall.module.pay.service.fuyouorder;
|
|
package cn.newfeifan.mall.module.pay.service.fuyouorder;
|
|
|
|
|
|
|
|
+import cn.newfeifan.mall.framework.common.exception.ErrorCode;
|
|
import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
|
|
import cn.newfeifan.mall.module.pay.dal.dataobject.order.PayOrderDO;
|
|
import cn.newfeifan.mall.module.pay.fuiou.reqvo.SubmitOrderRequestVO;
|
|
import cn.newfeifan.mall.module.pay.fuiou.reqvo.SubmitOrderRequestVO;
|
|
import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouPayOrderSubmitRespVO;
|
|
import cn.newfeifan.mall.module.pay.fuiou.respVO.FuYouPayOrderSubmitRespVO;
|
|
@@ -37,6 +38,7 @@ public class FiYouPayOrderServiceImpl implements FuYouPayOrderService {
|
|
@Override
|
|
@Override
|
|
public String submitOrder(SubmitOrderRequestVO requestVO) {
|
|
public String submitOrder(SubmitOrderRequestVO requestVO) {
|
|
|
|
|
|
|
|
+ try{
|
|
// 1.1 获得 PayOrderDO ,并校验其是否存在
|
|
// 1.1 获得 PayOrderDO ,并校验其是否存在
|
|
PayOrderDO payOrder = payOrderService.validateOrderCanSubmit(requestVO.getId());
|
|
PayOrderDO payOrder = payOrderService.validateOrderCanSubmit(requestVO.getId());
|
|
|
|
|
|
@@ -76,29 +78,29 @@ public class FiYouPayOrderServiceImpl implements FuYouPayOrderService {
|
|
.append(privateKey);
|
|
.append(privateKey);
|
|
requestVO.getReq().setSign(MD5.MD5Encode(sb.toString()));
|
|
requestVO.getReq().setSign(MD5.MD5Encode(sb.toString()));
|
|
String res = null;
|
|
String res = null;
|
|
- try {
|
|
|
|
- res = http.newPost(JSON.toJSONString(requestVO.getReq()));
|
|
|
|
-
|
|
|
|
- // 解析返回结果,获取参数
|
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
|
- FuYouPaymentResponseVO resp = mapper.readValue(res, FuYouPaymentResponseVO.class);
|
|
|
|
-
|
|
|
|
- if(!"000000".equals(resp.getResult_code())){
|
|
|
|
- throw exception(SUBMIT_ORDER_ERROR);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- FuYouPayOrderSubmitRespVO vo = FuYouPayOrderSubmitRespVO.builder()
|
|
|
|
- .appId(resp.getSdk_appid())
|
|
|
|
- .timeStamp(resp.getSdk_timestamp())
|
|
|
|
- .nonceStr(resp.getRandom_str())
|
|
|
|
- .sdk_package(resp.getSdk_package())
|
|
|
|
- .signType(resp.getSdk_signtype())
|
|
|
|
- .paySign(resp.getSdk_paysign())
|
|
|
|
- .build();
|
|
|
|
- return JSON.toJSONString(vo);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ res = http.newPost(JSON.toJSONString(requestVO.getReq()));
|
|
|
|
+
|
|
|
|
+ // 解析返回结果,获取参数
|
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
|
+ FuYouPaymentResponseVO resp = mapper.readValue(res, FuYouPaymentResponseVO.class);
|
|
|
|
+
|
|
|
|
+ if(!"000000".equals(resp.getResult_code())){
|
|
throw exception(SUBMIT_ORDER_ERROR);
|
|
throw exception(SUBMIT_ORDER_ERROR);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ FuYouPayOrderSubmitRespVO vo = FuYouPayOrderSubmitRespVO.builder()
|
|
|
|
+ .appId(resp.getSdk_appid())
|
|
|
|
+ .timeStamp(resp.getSdk_timestamp())
|
|
|
|
+ .nonceStr(resp.getRandom_str())
|
|
|
|
+ .sdk_package(resp.getSdk_package())
|
|
|
|
+ .signType(resp.getSdk_signtype())
|
|
|
|
+ .paySign(resp.getSdk_paysign())
|
|
|
|
+ .build();
|
|
|
|
+ return JSON.toJSONString(vo);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ ErrorCode err = new ErrorCode(1,e.getMessage());
|
|
|
|
+ throw exception(err);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|