太米支付(待测试)
This commit is contained in:
parent
2aff1af796
commit
f6ff7b75ac
|
@ -90,7 +90,7 @@ public class TmPayService {
|
||||||
body.put("payAmount", String.valueOf(payable.payableMoney()));
|
body.put("payAmount", String.valueOf(payable.payableMoney()));
|
||||||
body.put("terminalType", "1");
|
body.put("terminalType", "1");
|
||||||
body.put("shopId", config.getShopId()); // 从渠道获取shopId
|
body.put("shopId", config.getShopId()); // 从渠道获取shopId
|
||||||
body.put("sn", config.getSn());
|
body.put("sn", null);
|
||||||
body.put("payType", "wx_pay");
|
body.put("payType", "wx_pay");
|
||||||
body.put("outTradeId", payable.payableOutTradeNo());
|
body.put("outTradeId", payable.payableOutTradeNo());
|
||||||
body.put("body", payable.payableDescription());
|
body.put("body", payable.payableDescription());
|
||||||
|
@ -129,7 +129,6 @@ public class TmPayService {
|
||||||
headerData.put("Content-Type", "application/json");
|
headerData.put("Content-Type", "application/json");
|
||||||
|
|
||||||
String response = HttpUtils.sendPostWithHeaders(url, headerData, JSON.toJSONString(body));
|
String response = HttpUtils.sendPostWithHeaders(url, headerData, JSON.toJSONString(body));
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,4 +325,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
public static String format(LocalDateTime time, String format) {
|
public static String format(LocalDateTime time, String format) {
|
||||||
return time.format(DateTimeFormatter.ofPattern(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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ public class PayBillServiceImpl implements PayBillService
|
||||||
// 太米微信支付
|
// 太米微信支付
|
||||||
TmTradeInfo result = tmPayService.orderQuery(bill.getPayNo());
|
TmTradeInfo result = tmPayService.orderQuery(bill.getPayNo());
|
||||||
if (result != null && TmPayStatus.isSuccess(result.getPayStatus())) {
|
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 {
|
} else {
|
||||||
return PayResultVO.fail("暂未支付成功");
|
return PayResultVO.fail("暂未支付成功");
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class AppPayController extends BaseController {
|
||||||
String outTradeId = tradeInfo.getString("outTradeId"); // 商户自定义订单号
|
String outTradeId = tradeInfo.getString("outTradeId"); // 商户自定义订单号
|
||||||
String payStatus = tradeInfo.getString("payStatus"); // 交易结果
|
String payStatus = tradeInfo.getString("payStatus"); // 交易结果
|
||||||
if(TmPayStatus.isSuccess(payStatus) && payType.equals("wx_pay")) {
|
if(TmPayStatus.isSuccess(payStatus) && payType.equals("wx_pay")) {
|
||||||
payBillService.handleSuccess(outTradeId, LocalDateTime.now()); // TODO 支付时间待定
|
payBillService.handleSuccess(outTradeId, DateUtils.toLocalDateTime(tradeInfo.getDate("payTime")));
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
throw new ServiceException("签名验证失败");
|
throw new ServiceException("签名验证失败");
|
||||||
|
|
|
@ -126,7 +126,7 @@ syb:
|
||||||
# 太米支付
|
# 太米支付
|
||||||
tm:
|
tm:
|
||||||
developerId: "100232"
|
developerId: "100232"
|
||||||
shopId: "0034947"
|
shopId: "0035790"
|
||||||
signKey: b4ixpiogfj5vu3tbkv23gj0dvo2j2ksz
|
signKey: b4ixpiogfj5vu3tbkv23gj0dvo2j2ksz
|
||||||
httpUrl: https://v5.taimi100.com
|
httpUrl: https://v5.taimi100.com
|
||||||
sn: ""
|
sn: ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user