|
@@ -193,9 +193,9 @@ public class WxPayScoreStrategy implements PayScoreStrategy {
|
|
|
body.put("appid", wxPayConfig.getAppId());
|
|
body.put("appid", wxPayConfig.getAppId());
|
|
|
body.put("service_id", wxPayConfig.getServiceId());
|
|
body.put("service_id", wxPayConfig.getServiceId());
|
|
|
|
|
|
|
|
- // 后付费项目(实际收费)
|
|
|
|
|
|
|
+ // 后付费项目(实际收费)- 必填,无人设备行业必须回传交易内容
|
|
|
|
|
+ ArrayNode postPayments = objectMapper.createArrayNode();
|
|
|
if (request.getPostPayments() != null && !request.getPostPayments().isEmpty()) {
|
|
if (request.getPostPayments() != null && !request.getPostPayments().isEmpty()) {
|
|
|
- ArrayNode postPayments = objectMapper.createArrayNode();
|
|
|
|
|
for (PayScoreCreateRequest.PostPayment payment : request.getPostPayments()) {
|
|
for (PayScoreCreateRequest.PostPayment payment : request.getPostPayments()) {
|
|
|
ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
|
paymentObj.put("name", payment.getName());
|
|
paymentObj.put("name", payment.getName());
|
|
@@ -208,8 +208,16 @@ public class WxPayScoreStrategy implements PayScoreStrategy {
|
|
|
}
|
|
}
|
|
|
postPayments.add(paymentObj);
|
|
postPayments.add(paymentObj);
|
|
|
}
|
|
}
|
|
|
- body.set("post_payments", postPayments);
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("[微信支付分] 完结订单未提供post_payments,使用fallback - orderNo: {}", request.getOutOrderNo());
|
|
|
|
|
+ ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
|
|
|
+ paymentObj.put("name", "商品信息");
|
|
|
|
|
+ paymentObj.put("amount", yuanToFen(request.getTotalAmount()));
|
|
|
|
|
+ paymentObj.put("description", "商品");
|
|
|
|
|
+ paymentObj.put("count", 1);
|
|
|
|
|
+ postPayments.add(paymentObj);
|
|
|
}
|
|
}
|
|
|
|
|
+ body.set("post_payments", postPayments);
|
|
|
|
|
|
|
|
// 商户优惠
|
|
// 商户优惠
|
|
|
if (request.getPostDiscounts() != null && !request.getPostDiscounts().isEmpty()) {
|
|
if (request.getPostDiscounts() != null && !request.getPostDiscounts().isEmpty()) {
|
|
@@ -452,8 +460,9 @@ public class WxPayScoreStrategy implements PayScoreStrategy {
|
|
|
body.put("appid", wxPayConfig.getAppId());
|
|
body.put("appid", wxPayConfig.getAppId());
|
|
|
body.put("service_id", wxPayConfig.getServiceId());
|
|
body.put("service_id", wxPayConfig.getServiceId());
|
|
|
|
|
|
|
|
|
|
+ // 后付费项目 - 必填,无人设备行业必须回传交易内容
|
|
|
|
|
+ ArrayNode postPayments = objectMapper.createArrayNode();
|
|
|
if (request.getPostPayments() != null && !request.getPostPayments().isEmpty()) {
|
|
if (request.getPostPayments() != null && !request.getPostPayments().isEmpty()) {
|
|
|
- ArrayNode postPayments = objectMapper.createArrayNode();
|
|
|
|
|
for (PayScoreModifyRequest.PostPayment payment : request.getPostPayments()) {
|
|
for (PayScoreModifyRequest.PostPayment payment : request.getPostPayments()) {
|
|
|
ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
|
paymentObj.put("name", payment.getName());
|
|
paymentObj.put("name", payment.getName());
|
|
@@ -466,8 +475,16 @@ public class WxPayScoreStrategy implements PayScoreStrategy {
|
|
|
}
|
|
}
|
|
|
postPayments.add(paymentObj);
|
|
postPayments.add(paymentObj);
|
|
|
}
|
|
}
|
|
|
- body.set("post_payments", postPayments);
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("[微信支付分] 修改订单未提供post_payments,使用fallback - orderNo: {}", request.getOutOrderNo());
|
|
|
|
|
+ ObjectNode paymentObj = objectMapper.createObjectNode();
|
|
|
|
|
+ paymentObj.put("name", "商品信息");
|
|
|
|
|
+ paymentObj.put("amount", yuanToFen(request.getTotalAmount()));
|
|
|
|
|
+ paymentObj.put("description", "商品");
|
|
|
|
|
+ paymentObj.put("count", 1);
|
|
|
|
|
+ postPayments.add(paymentObj);
|
|
|
}
|
|
}
|
|
|
|
|
+ body.set("post_payments", postPayments);
|
|
|
|
|
|
|
|
body.put("total_amount", yuanToFen(request.getTotalAmount()));
|
|
body.put("total_amount", yuanToFen(request.getTotalAmount()));
|
|
|
body.put("reason", request.getReason() != null ? request.getReason() : "金额调整");
|
|
body.put("reason", request.getReason() != null ? request.getReason() : "金额调整");
|