| | |
| | | * VALUES ( '9070', '北部湾银行支付', '北部湾银行支付', '2022-08-16 15:51:55', 'community_setting_key', 'setting_type'); |
| | | * <p> |
| | | * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('82', '9070', 'mchtNo_RSA2', 'mchtNo_RSA2', 'mchtNo_RSA2', '2021-10-10 21:25:46', '0'); |
| | | * VALUES ('82', '9070', 'mchtNo_SM4', 'mchtNo_SM4', 'mchtNo_SM4', '2021-10-10 21:25:46', '0'); |
| | | * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('88', '9070', 'productNo_RSA2', 'productNo_RSA2', 'productNo_RSA2', '2021-10-10 21:25:46', '0'); |
| | | * VALUES ('88', '9070', 'productNo_SM4', 'productNo_SM4', 'productNo_SM4', '2021-10-10 21:25:46', '0'); |
| | | * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('83', '9070', 'mcht_PrivateKey_RSA2', 'mcht_PrivateKey_RSA2', '值请填写1 私钥 请填写在备注中', '2021-10-10 21:25:46', '0'); |
| | | * VALUES ('83', '9070', 'publicKey_SM4', 'publicKey_SM4', '值请填写 公钥 ', '2021-10-10 21:25:46', '0'); |
| | | * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('84', '9070', 'bank_PublicKey_RSA2', 'bank_PublicKey_RSA2', '值请填写1 公钥 请填写在备注中 ', '2021-10-10 21:25:46', '0'); |
| | | * INSERT INTO `TT`.`community_setting_key` (`key_id`, `setting_type`, `setting_name`, `setting_key`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('85', '9070', 'opToken_RSA2', 'opToken_RSA2', 'opToken_RSA2', '2021-10-10 21:25:46', '0'); |
| | | * VALUES ('84', '9070', 'privateKey_SM4', 'privateKey_SM4', '值请填写 私钥 ', '2021-10-10 21:25:46', '0'); |
| | | * // 以下数据先查询是否存在 存在则修改 不存在添加 |
| | | * INSERT INTO `TT`.`c_mapping` (`domain`, `name`, `key`, `value`, `remark`, `create_time`, `status_cd`) |
| | | * VALUES ('WECHAT', '被扫支付厂家', 'PAY_QR_ADAPT', 'qrCodeBbgPaymentAdapt', '', '2023-02-18 18:47:14', '0'); |
| | |
| | | |
| | | 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("mcht_no", mchtNo_SM4);// 收款商户编号 |
| | | params.put("product_no", productNo_SM4);// 产品编号 |
| | | params.put("biz_type", "WX_GZH");// 业务类型 |
| | | params.put("tran_no", String.valueOf(System.nanoTime()));// 商户流水 |
| | | params.put("tran_no", orderNum);// 商户流水 |
| | | params.put("code", "");// 授权码 |
| | | params.put("openid", openid);// 用户标识id |
| | | params.put("appid", smallWeChatDto.getAppId());// 公众号appid |
| | |
| | | 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>(); |
| | |
| | | |
| | | JSONObject resJson = new JSONObject(); |
| | | resJson.put("return_code", "SUCCESS"); |
| | | resJson.put("return_code", "成功"); |
| | | resJson.put("return message", "成功"); |
| | | |
| | | paymentOrderDto.setResponseEntity(new ResponseEntity<String>(resJson.toJSONString(), HttpStatus.OK)); |
| | | return paymentOrderDto; |