太米支付(待测试)

This commit is contained in:
磷叶 2024-11-22 16:47:12 +08:00
parent 2aff1af796
commit f6ff7b75ac
5 changed files with 11 additions and 5 deletions
smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common
smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl
smart-switch-web/src/main
java/com/ruoyi/web/controller/app
resources

View File

@ -90,7 +90,7 @@ public class TmPayService {
body.put("payAmount", String.valueOf(payable.payableMoney()));
body.put("terminalType", "1");
body.put("shopId", config.getShopId()); // 从渠道获取shopId
body.put("sn", config.getSn());
body.put("sn", null);
body.put("payType", "wx_pay");
body.put("outTradeId", payable.payableOutTradeNo());
body.put("body", payable.payableDescription());
@ -129,7 +129,6 @@ public class TmPayService {
headerData.put("Content-Type", "application/json");
String response = HttpUtils.sendPostWithHeaders(url, headerData, JSON.toJSONString(body));
return response;
}

View File

@ -325,4 +325,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String format(LocalDateTime time, String format) {
return time.format(DateTimeFormatter.ofPattern(format));
}
public static LocalDateTime toLocalDateTime(String time, String pattern) {
if (StringUtils.isBlank(time) || StringUtils.isBlank(pattern)) {
return null;
}
return LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
}
}

View File

@ -534,7 +534,7 @@ public class PayBillServiceImpl implements PayBillService
// 太米微信支付
TmTradeInfo result = tmPayService.orderQuery(bill.getPayNo());
if (result != null && TmPayStatus.isSuccess(result.getPayStatus())) {
return PayResultVO.success(LocalDateTime.now()); // TODO 支付时间
return PayResultVO.success(DateUtils.toLocalDateTime(result.getPayTime(), "yyyy-MM-dd")); // TODO 支付时间
} else {
return PayResultVO.fail("暂未支付成功");
}

View File

@ -220,7 +220,7 @@ public class AppPayController extends BaseController {
String outTradeId = tradeInfo.getString("outTradeId"); // 商户自定义订单号
String payStatus = tradeInfo.getString("payStatus"); // 交易结果
if(TmPayStatus.isSuccess(payStatus) && payType.equals("wx_pay")) {
payBillService.handleSuccess(outTradeId, LocalDateTime.now()); // TODO 支付时间待定
payBillService.handleSuccess(outTradeId, DateUtils.toLocalDateTime(tradeInfo.getDate("payTime")));
}
}else {
throw new ServiceException("签名验证失败");

View File

@ -126,7 +126,7 @@ syb:
# 太米支付
tm:
developerId: "100232"
shopId: "0034947"
shopId: "0035790"
signKey: b4ixpiogfj5vu3tbkv23gj0dvo2j2ksz
httpUrl: https://v5.taimi100.com
sn: ""