运营端充值
This commit is contained in:
@@ -47,6 +47,19 @@ public class DistributionPayController {
|
||||
payParam.setShopId(shopId);
|
||||
return payService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运营端小程序支付
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
*/
|
||||
@PostMapping("/mchRecharge")
|
||||
@Debounce(value = "#payParam.userId")
|
||||
public CzgResult<Map<String, String>> mchRecharge(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody MkDistributionPayDTO payParam) {
|
||||
payParam.setShopId(shopId);
|
||||
return CzgResult.success(payService.mchRecharge(ServletUtil.getClientIP(request), payParam));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 正扫
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.czg.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
@@ -9,12 +10,17 @@ import com.czg.entity.CzgBaseRespParams;
|
||||
import com.czg.mq.PrintMqListener;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.service.ShopTableOrderStatisticService;
|
||||
import com.czg.service.Impl.WxServiceImpl;
|
||||
import com.czg.system.service.WxService;
|
||||
import com.czg.task.StatisticTask;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.ijpay.core.kit.AesUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -38,15 +44,17 @@ public class NotifyController {
|
||||
|
||||
@Resource
|
||||
private ShopTableOrderStatisticService shopTableOrderStatisticService;
|
||||
@Resource
|
||||
private WxService wxService;
|
||||
|
||||
|
||||
@GetMapping("testOpen")
|
||||
public Map<String, String> test1(String code) throws Exception {
|
||||
// return WxService.v3Pay("oeQYq5LzW-kSxJL9TR4s_UmOmNLE", new BigDecimal("0.01"), "测试", "testZs" + RandomUtil.randomNumbers(20), "test");
|
||||
return null;
|
||||
return wxService.v3Pay("oeQYq5LzW-kSxJL9TR4s_UmOmNLE", new BigDecimal("0.01"), "测试", "testZs" + RandomUtil.randomNumbers(20), "test");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/payCallBack")
|
||||
public String notifyCallBack(@RequestBody CzgBaseRespParams respParams) {
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
@@ -56,6 +64,35 @@ public class NotifyController {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping("/wx/pay/distributionRecharge")
|
||||
public String nativeNotify(HttpServletRequest request) throws IOException {
|
||||
|
||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
String nonce = request.getHeader("Wechatpay-Nonce");
|
||||
String serialNo = request.getHeader("Wechatpay-Serial");
|
||||
String signature = request.getHeader("Wechatpay-Signature");
|
||||
String result = IoUtil.readUtf8(request.getInputStream());
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
JSONObject resource = jsonObject.getJSONObject("resource");
|
||||
String associatedData = resource.getString("associated_data");
|
||||
String ciphertext = resource.getString("ciphertext");
|
||||
String nonceStr = resource.getString("nonce");
|
||||
|
||||
String plainText = wxService.decryptToString(associatedData, nonceStr, ciphertext);
|
||||
log.info("支付通知明文 {}", plainText);
|
||||
|
||||
JSONObject plainTextJson = JSONObject.parseObject(plainText);
|
||||
String outTradeNo = plainTextJson.getString("out_trade_no");
|
||||
String tradeState = plainTextJson.getString("trade_state");
|
||||
String transactionId = plainTextJson.getString("transaction_id");
|
||||
if ("SUCCESS" == tradeState) {
|
||||
|
||||
}
|
||||
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/refundCallBack")
|
||||
public String refundCallBack(@RequestBody CzgBaseRespParams respParams) {
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
|
||||
Reference in New Issue
Block a user