|
@@ -416,7 +416,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
//商品名称
|
|
|
String product = "采美订单" + orderId;
|
|
|
json.put("product", product);
|
|
|
- String attach = payParam.getProductId() + "," + payParam.getPayType();
|
|
|
+ String attach = payParam.getVipId() + "," + payParam.getPayType()+ "," + payParam.getUserId();
|
|
|
json.put("attach", attach);
|
|
|
// 升级超级会员默认公账
|
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
@@ -481,8 +481,46 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* @param data
|
|
|
*/
|
|
|
@Override
|
|
|
- public String paymentSuperVipCallback(String data) {
|
|
|
- return null;
|
|
|
+ public String paymentSuperVipCallback(String data) throws NoSuchAlgorithmException, InvalidKeySpecException {
|
|
|
+ log.info("******************** 升级超级会员异步回调 start *******************");
|
|
|
+ // 公钥解密
|
|
|
+ JSONObject json = PayUtil.publicKeyDecrypt(data, PayUtil.publicKey);
|
|
|
+ log.info("公钥解密>>>>>>" + json);
|
|
|
+ // 公钥验签
|
|
|
+ String signaa = json.getString("sign");
|
|
|
+ json.remove("sign");
|
|
|
+ String signbb = PayUtil.getPaySign(json, PayUtil.publicKey);
|
|
|
+ if (!signaa.equals(signbb)) {
|
|
|
+ return "验签失败";
|
|
|
+ }
|
|
|
+ // 订单状态
|
|
|
+ String orderStatus = json.getString("orderStatus");
|
|
|
+ // 平台唯一流水号
|
|
|
+ String mbOrderId = json.getString("mbOrderId");
|
|
|
+ // 金额,以元为单位
|
|
|
+ BigDecimal amount = json.getBigDecimal("amount");
|
|
|
+ log.info("订单状态>>>>>>" + orderStatus);
|
|
|
+ if ("FAILED".equals(orderStatus)) {
|
|
|
+ return "支付失败";
|
|
|
+ }
|
|
|
+ // 附加数据,支付时若有传输则原样返回(vipId,payType,userId),下单时为空,则不返回该数据
|
|
|
+ String attach = json.getString("attach");
|
|
|
+ String[] split = attach.split(",");
|
|
|
+ // 会员套餐Id
|
|
|
+ Integer vipId = Integer.valueOf(split[0]);
|
|
|
+ // 支付类型
|
|
|
+ String payType = split[1];
|
|
|
+ // 用户Id
|
|
|
+ Integer userId = Integer.valueOf(split[2]);
|
|
|
+ // 金额
|
|
|
+ double payAmount = amount.doubleValue();
|
|
|
+ String payFormData = json.toJSONString();
|
|
|
+
|
|
|
+ // todo 支付成功-超级会员数据库修改
|
|
|
+
|
|
|
+ //修改分账付款状态
|
|
|
+ payOrderMapper.updateSplitAccountByPay(mbOrderId);
|
|
|
+ return "SUCCESS";
|
|
|
}
|
|
|
|
|
|
}
|