| | |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | System.err.println("调起支付结果-------------->" + body1); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | map1 = PayMoneyUtil.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | |
| | | map2.put("nonceStr", map1.get("nonce_str")); |
| | | map2.put("package", "prepay_id=" + prepay_id); |
| | | map2.put("signType", "MD5"); |
| | | map2.put("timeStamp", new Date().getTime() + ""); |
| | | map2.put("timeStamp", System.currentTimeMillis() + ""); |
| | | String s2 = this.weixinSignature(map2); |
| | | |
| | | map2.put("prepay_id", prepay_id); |
| | |
| | | map3.put("package", "Sign=WXPay"); |
| | | map3.put("partnerid", mchId); |
| | | map3.put("prepayid", prepay_id); |
| | | map3.put("timestamp", new Date().getTime() / 1000); |
| | | map3.put("timestamp", System.currentTimeMillis() / 1000); |
| | | String s1 = this.weixinSignature(map3); |
| | | map3.put("sign", s1); |
| | | System.err.println(map3); |
| | |
| | | } |
| | | return null; |
| | | }else{ |
| | | System.err.println(map1.get("err_code_des")); |
| | | System.err.println("调起支付异常-------------->" + map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | }else{//签名错误,请检查后再试1----1602881362 |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | System.err.println("调起支付异常-------------->" + map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | |
| | | String param = this.getParam(request); |
| | | param = param.replaceAll("<!\\[CDATA\\[",""); |
| | | param = param.replaceAll("]]>", ""); |
| | | Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | Map<String, String> map = PayMoneyUtil.xmlToMap(param, "UTF-8"); |
| | | String return_code = map.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map.get("result_code"); |
| | |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | map1 = PayMoneyUtil.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |