| | |
| | | import com.java110.api.properties.WechatAuthProperties; |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.api.smo.payment.adapt.IPayNotifyAdapt; |
| | | import com.java110.core.factory.CommunitySettingFactory; |
| | | import com.java110.core.factory.PlutusFactory; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.PayUtil; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.bouncycastle.util.encoders.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | |
| | | String signature = json.getString("signature"); |
| | | String content = json.getString("content"); |
| | | |
| | | String appId = WechatFactory.getAppId(wId); |
| | | SmallWeChatDto smallWeChatDto = getSmallWechat(appId); |
| | | if (smallWeChatDto == null) { |
| | | throw new IllegalArgumentException("未配置公众号或者小程序信息"); |
| | | } |
| | | String publicKey = CommunitySettingFactory.getRemark(smallWeChatDto.getObjId(),"PLUTUS_PUBLIC_KEY"); |
| | | //验签 |
| | | Boolean verify = PlutusFactory.verify256(param, org.bouncycastle.util.encoders.Base64.decode(signature)); |
| | | Boolean verify = PlutusFactory.verify256(content, org.bouncycastle.util.encoders.Base64.decode(signature),publicKey); |
| | | //验签成功 |
| | | if (!verify) { |
| | | throw new IllegalArgumentException("支付失败签名失败"); |
| | | } |
| | | //解密 |
| | | byte[] bb = PlutusFactory.decrypt(Base64.decode(content), PlutusFactory.SECRET_KEY); |
| | | byte[] bb = PlutusFactory.decrypt(Base64.decode(content), smallWeChatDto.getPayPassword()); |
| | | //服务器返回内容 |
| | | String paramOut = new String(bb); |
| | | String paramOut = new String(bb); |
| | | try { |
| | | JSONObject map = JSONObject.parseObject(paramOut); |
| | | logger.info("【银联支付回调】 回调数据: \n" + map); |
| | |
| | | smallWeChatDto.setMchId(wechatAuthProperties.getMchId()); |
| | | smallWeChatDto.setPayPassword(wechatAuthProperties.getKey()); |
| | | } |
| | | TreeMap<String, String> paramMap = new TreeMap<String, String>(); |
| | | for (String key : map.keySet()) { |
| | | // if ("wId".equals(key)) { |
| | | // continue; |
| | | // } |
| | | paramMap.put(key, map.get(key).toString()); |
| | | } |
| | | |
| | | //String sign = PayUtil.createChinaUmsSign(paramMap, smallWeChatDto.getPayPassword()); |
| | | //JSONObject billPayment = JSONObject.parseObject(map.getString("billPayment")); |
| | | String outTradeNo = map.get("outTransId").toString(); |
| | | String outTradeNo = map.getString("outTransId"); |
| | | |
| | | //查询用户ID |
| | | JSONObject paramIn = new JSONObject(); |