feat(支付): 添加微信小程序支付支持
在订单提交和支付请求中添加微信小程序支付标识字段,并处理相关逻辑。包括在SubmitOrderCommand和WxJsApiPreCreateRequest中添加字段,以及在OrderApplicationService和PaymentApplicationService中处理该字段的默认值和转换逻辑。
This commit is contained in:
parent
ed9c2d43c0
commit
a78da5cb59
|
|
@ -199,6 +199,12 @@ public class OrderApplicationService {
|
|||
if (Objects.equals(command.getPaymentType(), "wechat")) {
|
||||
// 新增支付接口调用
|
||||
WxJsApiPreCreateRequest paymentRequest = buildPaymentRequest(orderModel);
|
||||
// 设置是否为微信小程序支付
|
||||
if (command.getIsWxMp() == null) {
|
||||
command.setIsWxMp(0);
|
||||
}
|
||||
paymentRequest.setIs_wx_mp(command.getIsWxMp() == 1 ? "true" : "false");
|
||||
|
||||
WxJsApiPreCreateResponse paymentResponse = paymentApplicationService.callJsApiPreCreate(paymentRequest);
|
||||
// 记录支付操作日志
|
||||
AddPaymentOperationLogCommand paymentOperationLogCommand = new AddPaymentOperationLogCommand();
|
||||
|
|
|
|||
|
|
@ -42,4 +42,7 @@ public class SubmitOrderCommand {
|
|||
|
||||
@ApiModelProperty("是否内部订单 0否 1汇邦云用户 2企业微信用户")
|
||||
private Integer isInternal;
|
||||
|
||||
@ApiModelProperty("是否为微信小程序支付,0否 1是")
|
||||
private Integer isWxMp;
|
||||
}
|
||||
|
|
@ -47,6 +47,9 @@ public class PaymentApplicationService {
|
|||
String result = "";
|
||||
String jsonBody = "";
|
||||
try {
|
||||
if (StringUtils.isBlank(request.getIs_wx_mp()) || (!"true".equals(request.getIs_wx_mp()) && !"false".equals(request.getIs_wx_mp()))) {
|
||||
request.setIs_wx_mp("false");
|
||||
}
|
||||
jsonBody = JSONUtil.toJsonStr(request);
|
||||
log.info("callJsApiPreCreate 请求body:{}", jsonBody);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,7 @@ public class WxJsApiPreCreateRequest {
|
|||
|
||||
private String ucid; // 选填
|
||||
private String extra; // 选填
|
||||
|
||||
// 是否为微信小程序支付,"true"或"false"
|
||||
private String is_wx_mp;
|
||||
}
|
||||
Loading…
Reference in New Issue