From 82bcc11dad5f7cb799fc150b5285b6e19f5541d8 Mon Sep 17 00:00:00 2001 From: "felord.cn" Date: Sat, 13 Mar 2021 21:26:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #22 --- .../payment/wechat/v3/WechatMarketingBusiFavorApi.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java index 3a05d8d..9fd4018 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java @@ -30,6 +30,7 @@ import org.springframework.util.StringUtils; import org.springframework.web.util.UriComponentsBuilder; import java.net.URI; +import java.util.Optional; /** * 微信支付商家券. @@ -146,7 +147,10 @@ public class WechatMarketingBusiFavorApi extends AbstractApi { queryParams.add("appid", appid); } queryParams.add("stock_id", userBusiFavorQueryParams.getStockId()); - queryParams.add("coupon_state", userBusiFavorQueryParams.getCouponState().name()); + + Optional.ofNullable(userBusiFavorQueryParams.getCouponState()) + .ifPresent(state-> queryParams.add("coupon_state", state.name())); + queryParams.add("creator_merchant", userBusiFavorQueryParams.getCreatorMerchant()); queryParams.add("belong_merchant", userBusiFavorQueryParams.getBelongMerchant()); queryParams.add("sender_merchant", userBusiFavorQueryParams.getSenderMerchant());