| | |
| | | return JsonUtilV2.loadFalseJson("用户不存在"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(user.getPhone())) { |
| | | if (StringUtil.isNullOrEmpty(user.getPhone()) && payWay != OrderRecord.PAY_WAY_IAPP) { |
| | | return JsonUtilV2.loadFalseJson(10001, "请绑定电话号码"); |
| | | } |
| | | |
| | |
| | | } catch (VideoBuyRecordException e) { |
| | | return JsonUtilV2.loadFalseJson("单片购买失败"); |
| | | } |
| | | return JsonUtilV2.loadTrueJson(new Gson().toJson(payResult)); |
| | | if (payResult.getPayWay() == OrderRecord.PAY_WAY_IAPP) { |
| | | //苹果内购 |
| | | JSONObject root = new JSONObject(); |
| | | root.put("orderNo", record.getId()); |
| | | root.put("productId", vipPrice.getIosProductId()); |
| | | return JsonUtilV2.loadTrueJson(root.toString()); |
| | | } else { |
| | | return JsonUtilV2.loadTrueJson(new Gson().toJson(payResult)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查是否支付 |
| | |
| | | * @param acceptData |
| | | * @param loginUid |
| | | * @param id |
| | | * @param receipt -ios支付结果receipt |
| | | * @return |
| | | */ |
| | | @RequestMapping("checkPay") |
| | | @ResponseBody |
| | | @RequestSerializableByKey(key = "'vip-checkPay-'+#id") |
| | | public String checkPay(AcceptData acceptData, String loginUid, String id) { |
| | | public String checkPay(AcceptData acceptData, String loginUid, String id, String receipt) { |
| | | OrderRecord record = orderService.getOrderRecord(id); |
| | | if (record == null || !record.getUid().equalsIgnoreCase(loginUid)) { |
| | | return JsonUtilV2.loadFalseJson("记录不存在/不是您的订单"); |
| | | } |
| | | |
| | | record = orderService.checkOrderPayState(id); |
| | | //未支付 |
| | | if (record != null && record.getState() != OrderRecord.STATE_PAY) { |
| | | return JsonUtilV2.loadFalseJson(1, "支付未完成"); |
| | | if (record.getPayWay() == OrderRecord.PAY_WAY_IAPP) { |
| | | //TODO 验证支付结果是否一致 |
| | | return JsonUtilV2.loadFalseJson(""); |
| | | } else { |
| | | record = orderService.checkOrderPayState(id); |
| | | //未支付 |
| | | if (record != null && record.getState() != OrderRecord.STATE_PAY) { |
| | | return JsonUtilV2.loadFalseJson(1, "支付未完成"); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("money", record.getPayMoney() == null ? record.getMoney() : record.getPayMoney()); |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("money", record.getPayMoney() == null ? record.getMoney() : record.getPayMoney()); |
| | | |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } |
| | | |
| | | |