[fix]修改回调
This commit is contained in:
parent
321584d5b1
commit
43b4714db5
@ -19,7 +19,7 @@ public class PaymentSuccessParams {
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String paymentMethod;
|
||||
private Integer paymentMethod;
|
||||
/**
|
||||
* 第三方流水
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ public class RechargeCashier implements CashierExecute {
|
||||
public void paymentSuccess(PaymentSuccessParams paymentSuccessParams) {
|
||||
PayParam payParam = paymentSuccessParams.getPayParam();
|
||||
if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) {
|
||||
// rechargeService.paySuccess(payParam.getSn(), paymentSuccessParams.getReceivableNo(),paymentSuccessParams.getPaymentMethod());
|
||||
chargeService.paySuccess(payParam.getSn(), paymentSuccessParams.getReceivableNo(),paymentSuccessParams.getPaymentMethod());
|
||||
log.info("会员充值-订单号{},第三方流水:{}", payParam.getSn(), paymentSuccessParams.getReceivableNo());
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.wzj.soopin.order.utils.StringUtils;
|
||||
import com.wzj.soopin.transaction.domain.po.RefundLog;
|
||||
import com.wzj.soopin.transaction.enums.CashierEnum;
|
||||
import com.wzj.soopin.transaction.enums.PaymentMethodEnum;
|
||||
import com.wzj.soopin.transaction.kit.CashierSupport;
|
||||
import com.wzj.soopin.transaction.kit.Payment;
|
||||
@ -49,6 +50,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -261,7 +263,10 @@ public class WechatPlugin implements Payment {
|
||||
DateTimeFormatter rfc3339NoMillis = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX");
|
||||
String timeExpire = zonedDateTime.format(rfc3339NoMillis);
|
||||
|
||||
String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam.getSn()), StandardCharsets.UTF_8);
|
||||
Map<String,String> attachMap=new HashMap<>();
|
||||
attachMap.put("orderType",payParam.getOrderType());
|
||||
attachMap.put("outOrderNo",outOrderNo);
|
||||
String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(attachMap), StandardCharsets.UTF_8);
|
||||
|
||||
String appid = setting.getAppId();
|
||||
if (appid == null) {
|
||||
@ -274,7 +279,7 @@ public class WechatPlugin implements Payment {
|
||||
.setOut_trade_no(outOrderNo)
|
||||
.setTime_expire(timeExpire)
|
||||
.setAttach(attach)
|
||||
.setNotify_url("http://cjh.wuzhongjie.com.cn/app/wechat/notify/"+PaymentMethodEnum.WECHAT)
|
||||
.setNotify_url("http://cjh.wuzhongjie.com.cn/app/payment/callback/"+PaymentMethodEnum.WECHAT)
|
||||
.setAmount(new Amount().setTotal(fen));
|
||||
|
||||
|
||||
@ -504,14 +509,13 @@ public class WechatPlugin implements Payment {
|
||||
String payParamJson = URLDecoder.decode(payParamStr, StandardCharsets.UTF_8);
|
||||
PayParam payParam = JSONUtil.toBean(payParamJson, PayParam.class);
|
||||
|
||||
|
||||
String tradeNo = jsonObject.getStr("transaction_id");
|
||||
Double totalAmount = CurrencyUtil.reversalFen(jsonObject.getJSONObject("amount").getDouble("total"));
|
||||
// Double totalAmount = CurrencyUtil.reversalFen(jsonObject.getJSONObject("amount").getDouble("total"));
|
||||
|
||||
PaymentSuccessParams paymentSuccessParams = new PaymentSuccessParams(
|
||||
PaymentMethodEnum.WECHAT.name(),
|
||||
PaymentMethodEnum.WECHAT.getCode(),
|
||||
tradeNo,
|
||||
totalAmount,
|
||||
0d,
|
||||
payParam
|
||||
);
|
||||
|
||||
|
@ -11,4 +11,6 @@ public interface IChargeService extends IService<Charge> {
|
||||
|
||||
Charge getByCode(String code);
|
||||
|
||||
boolean paySuccess(String code, String payNo, Integer method);
|
||||
|
||||
}
|
||||
|
@ -89,4 +89,17 @@ public class ChargeServiceImpl extends ServiceImpl<ChargeMapper, Charge> impleme
|
||||
public Charge getByCode(String code) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<Charge>().eq(Charge::getCode, code));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean paySuccess(String code, String payNo, Integer method) {
|
||||
Charge charge = getByCode(code);
|
||||
if(charge==null){
|
||||
log.error("充值记录不存在,code:{}",code);
|
||||
return false;
|
||||
}
|
||||
charge.setStatus(ChargeStatus.PENDING.getCode());
|
||||
// charge.setPayNo(payNo);
|
||||
charge.setMethod(method);
|
||||
return updateById(charge);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user