| | |
| | | |
| | | private static String SIGN_TYPE = "RSA2";// 加密算法:SM4、RSA2 |
| | | |
| | | private static String gzhPayUrl = "https://epaytest.bankofbbg.com/www/corepaycer/WxGzhPay"; |
| | | private static String gzhPayUrl = "https://mbank.bankofbbg.com/www/corepaycer/WxGzhPay"; |
| | | |
| | | @Autowired |
| | | private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl; |
| | |
| | | ); |
| | | |
| | | |
| | | if ("SUCCESS".equals(resMap.get("return_code")) && "SUCCESS".equals(resMap.get("result_code"))) { |
| | | if (TRADE_TYPE_JSAPI.equals(tradeType)) { |
| | | |
| | | resultMap.put("appId", smallWeChatDto.getAppId()); |
| | | resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp()); |
| | | resultMap.put("nonceStr", PayUtil.makeUUID(32)); |
| | | resultMap.put("package", "prepay_id=" + resMap.get("prepay_id")); |
| | | resultMap.put("signType", "MD5"); |
| | | resultMap.put("sign", PayUtil.createSign(resultMap, smallWeChatDto.getPayPassword())); |
| | | } else if (TRADE_TYPE_APP.equals(tradeType)) { |
| | | resultMap.put("appId", smallWeChatDto.getAppId()); |
| | | resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp()); |
| | | resultMap.put("nonceStr", PayUtil.makeUUID(32)); |
| | | resultMap.put("partnerid", smallWeChatDto.getMchId()); |
| | | resultMap.put("prepayid", resMap.get("prepay_id")); |
| | | //resultMap.put("signType", "MD5"); |
| | | resultMap.put("sign", PayUtil.createSign(resultMap, smallWeChatDto.getPayPassword())); |
| | | } else if (TRADE_TYPE_NATIVE.equals(tradeType)) { |
| | | resultMap.put("prepayId", resMap.get("prepay_id")); |
| | | resultMap.put("codeUrl", resMap.get("code_url")); |
| | | } |
| | | resultMap.put("code", "0"); |
| | | resultMap.put("msg", "下单成功"); |
| | | logger.info("【小程序支付】统一下单成功,返回参数:" + resultMap + "===notifyUrl===" + notifyUrl); |
| | | } else { |
| | | resultMap.put("code", resMap.get("return_code")); |
| | | resultMap.put("msg", resMap.get("return_msg")); |
| | | logger.info("【小程序支付】统一下单失败,失败原因:" + resMap.get("return_msg") + "===code===" + resMap.get("return_code") + "===notifyUrl===" + notifyUrl); |
| | | } |
| | | return resultMap; |
| | | return resMap; |
| | | } |
| | | |
| | | |
| | |
| | | params.put("asyn_url", notifyUrl + "?wId=" + WechatFactory.getWId(smallWeChatDto.getAppId()));// 通知地址 |
| | | String decryParams = EncryptDecryptFactory.execute(smallWeChatDto.getObjId(), gzhPayUrl, params); |
| | | JSONObject paramOut = JSONObject.parseObject(decryParams); |
| | | if (!"SUCCESS".equals(paramOut.getString("status")) |
| | | || !"SUCCESS".equals(paramOut.getString("deal_status"))) { |
| | | throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); |
| | | } |
| | | |
| | | if (!"0000".equals(paramOut.getString("return_code")) |
| | | || !"SUCCESS".equals(paramOut.getString("status")) |
| | | || !"SUCCESS".equals(paramOut.getString("deal_status"))) { |
| | | && !"0001".equals(paramOut.getString("return_code")) |
| | | ) { |
| | | throw new IllegalArgumentException("支付失败" + paramOut.getString("return_message")); |
| | | } |
| | | SortedMap<String, String> resultMap = new TreeMap<String, String>(); |