@Override @Transactional(rollbackFor = Exception.class) public void receiveOperationPostCallback(ServletRequest request) throws TrusteeshipReturnException { try { request.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String resp = request.getParameter("resp"); String sign = request.getParameter("sign"); log.debug(resp); log.debug(sign); boolean flag = CFCASignUtil.isVerifySign(resp, sign); log.debug(flag); if (flag) { // 处理账户开通成功 @SuppressWarnings("unchecked") Map<String, String> resultMap = Dom4jUtil.xmltoMap(resp); String code = resultMap.get("code"); String requestNo = resultMap .get("requestNo") .replaceFirst(YeePayConstants.RequestNoPre.UNBINDING_YEEPAY_BANKCARD, ""); String description = resultMap.get("description"); TrusteeshipOperation to = trusteeshipOperationBO.get( YeePayConstants.OperationType.UNBINDING_YEEPAY_BANKCARD, requestNo, requestNo, "yeepay"); if ("1".equals(code)) { BankCard bc = ht.get(BankCard.class, requestNo); if (bc != null) { bc.setStatus(BankCardConstants.BankCardStatus.DELETED); ht.update(bc); } to.setStatus(TrusteeshipConstants.Status.PASSED); to.setResponseTime(new Date()); to.setResponseData(resp); ht.update(to); } else { to.setStatus(TrusteeshipConstants.Status.REFUSED); to.setResponseTime(new Date()); to.setResponseData(description); ht.update(to); // 真实错误原因 throw new TrusteeshipReturnException(code + ":" + description); } } }
@Override @Transactional(rollbackFor = Exception.class) public void receiveOperationS2SCallback(ServletRequest request, ServletResponse response) { try { request.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String notifyXML = request.getParameter("notify"); String sign = request.getParameter("sign"); @SuppressWarnings("unchecked") Map<String, String> resultMap = Dom4jUtil.xmltoMap(notifyXML); String cardNo = resultMap .get("requestNo") .replaceFirst(YeePayConstants.RequestNoPre.UNBINDING_YEEPAY_BANKCARD, ""); // String cardNo = resultMap.get("cardNo"); // String bank = resultMap.get("bank"); // String cardStatus = resultMap.get("cardStatus"); // String platformUserNo = resultMap.get("platformUserNo"); boolean flag = CFCASignUtil.isVerifySign(notifyXML, sign); log.debug(notifyXML); if (flag) { BankCard bc = ht.get(BankCard.class, cardNo); if (bc != null) { bc.setStatus(BankCardConstants.BankCardStatus.DELETED); ht.update(bc); } try { response.getWriter().print("SUCCESS"); FacesUtil.getCurrentInstance().responseComplete(); } catch (IOException e) { log.debug("trusteeshipBindingBancCard S2S response" + e.getMessage()); throw new RuntimeException(e.getMessage()); } } }