网页支付相关,如果有出现'(单引号)则直接剔除

This commit is contained in:
egzosn
2021-10-31 21:01:27 +08:00
parent 2d74c2a959
commit e10812cacc
2 changed files with 8 additions and 2 deletions

View File

@@ -162,6 +162,12 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
*/
@Override
public <O extends PayOrder> String toPay(O order) {
if (StringUtils.isNotEmpty(order.getSubject()) && order.getSubject().contains("'")){
order.setSubject(order.getSubject().replace("'",""));
}
if (StringUtils.isNotEmpty(order.getBody()) && order.getBody().contains("'")){
order.setBody(order.getBody().replace("'",""));
}
Map<String, Object> orderInfo = orderInfo(order);
return buildRequest(orderInfo, MethodType.POST);
}

View File

@@ -123,7 +123,7 @@ public class AliPayController {
@RequestMapping(value = "toPay.html", produces = "text/html;charset=UTF-8")
public String toPay(BigDecimal price) {
//及时收款
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE);
PayOrder order = new PayOrder("订单title", "'", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.PAGE);
//WAP
// PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAP);
@@ -200,7 +200,7 @@ public class AliPayController {
//支付结果
Map<String, Object> params = service.microPay(order);
//校验
if (service.verify(params)) {
if (service.verify(new NoticeParams(params))) {
//支付校验通过后的处理
//......业务逻辑处理块........