| | |
| | | |
| | | /** |
| | | * 创博优完成订单支付回调。 |
| | | * out_trade_no 为平台订单号,用于反解订单id和订单类型; |
| | | * trade_no 为创博优支付流水号,用于标记真实支付流水; |
| | | * trade_status=TRADE_SUCCESS 才认为支付成功。 |
| | | * outRequestNo 为平台订单号,用于反解订单id和订单类型; |
| | | * paymentOrderId 为创博优支付流水号,用于标记真实支付流水; |
| | | * paidTime 为支付完成时间,paidAmount 为实付金额。 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/cbyzxPayOrderTaxi") |
| | | public Map<String, Object> cbyzxPayOrderTaxi(@RequestBody String params, HttpServletRequest request) { |
| | | try { |
| | | JSONObject payload = JSONObject.parseObject(params); |
| | | log.info("创博优完成订单支付回调,notify_type={}, out_trade_no={}, trade_no={}, trade_status={}", |
| | | cbyzxOrderPayHelper.extractNotifyType(payload), |
| | | log.info("创博优完成订单支付回调,outRequestNo={}, paymentOrderId={}, paidTime={}, paidAmount={}", |
| | | cbyzxOrderPayHelper.extractOutRequestNo(payload), |
| | | cbyzxOrderPayHelper.extractThirdPartyOrderNo(payload), |
| | | payload == null ? null : payload.getString("trade_status")); |
| | | payload == null ? null : payload.getString("paidTime"), |
| | | payload == null ? null : payload.getString("paidAmount")); |
| | | if (payload == null) { |
| | | return buildCbyzxCallbackResponse(1, "invalid request"); |
| | | } |
| | | if (!cbyzxOrderPayHelper.isPaySuccess(payload)) { |
| | | return buildCbyzxCallbackResponse(1, cbyzxOrderPayHelper.extractMessage(payload)); |
| | | } |
| | | |
| | | String outRequestNo = cbyzxOrderPayHelper.extractOutRequestNo(payload); |
| | | if (StringUtils.isBlank(outRequestNo)) { |
| | | return buildCbyzxCallbackResponse(1, "missing outRequestNo"); |
| | | } |
| | | String paymentOrderId = cbyzxOrderPayHelper.extractThirdPartyOrderNo(payload); |
| | | if (StringUtils.isBlank(paymentOrderId)) { |
| | | return buildCbyzxCallbackResponse(1, "missing paymentOrderId"); |
| | | } |
| | | if (payload.get("paidAmount") == null) { |
| | | return buildCbyzxCallbackResponse(1, "missing paidAmount"); |
| | | } |
| | | |
| | | String[] split = outRequestNo.split("_"); |
| | |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | String recordCode = StringUtils.defaultIfBlank(cbyzxOrderPayHelper.extractRecordCode(payload), outRequestNo); |
| | | String orderId = StringUtils.defaultIfBlank(cbyzxOrderPayHelper.extractThirdPartyOrderNo(payload), recordCode); |
| | | String orderId = paymentOrderId; |
| | | |
| | | switch (type) { |
| | | case 1: |