diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksPauseResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksPauseResult.java new file mode 100755 index 000000000..91e10fbf2 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksPauseResult.java @@ -0,0 +1,37 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 暂停代金券批次返回结果对象 + * + * @author lichuang + */ +@NoArgsConstructor +@Data +public class FavorStocksPauseResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 生效时间 + *

+ * 生效时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss.sss表示时分秒毫秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。 + * 示例值:2015-05-20T13:29:35.120+08:00 + */ + @SerializedName("pause_time") + private String pauseTime; + + /** + * 批次号 + *

+ * 微信为每个代金券批次分配的唯一ID。 + * 示例值:98065001 + */ + @SerializedName("stock_id") + private String stockId; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksRestartResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksRestartResult.java new file mode 100755 index 000000000..b9078bca5 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/FavorStocksRestartResult.java @@ -0,0 +1,37 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 重启代金券批次返回结果对象 + * + * @author lichuang + */ +@NoArgsConstructor +@Data +public class FavorStocksRestartResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 生效时间 + *

+ * 生效时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss.sss表示时分秒毫秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。 + * 示例值:2015-05-20T13:29:35.120+08:00 + */ + @SerializedName("restart_time") + private String restartTime; + + /** + * 批次号 + *

+ * 微信为每个代金券批次分配的唯一ID。 + * 示例值:98065001 + */ + @SerializedName("stock_id") + private String stockId; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingFavorService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingFavorService.java index 5da11aabf..ac0ed5212 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingFavorService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingFavorService.java @@ -187,10 +187,10 @@ public interface MarketingFavorService { * * * @param request 请求对象 - * @return FavorCallbacksSaveResult 微信返回的结果信息。 + * @return FavorStocksPauseResult 微信返回的结果信息。 * @throws WxPayException the wx pay exception */ - FavorStocksStartResult pauseFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException; + FavorStocksPauseResult pauseFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException; /** *

@@ -200,10 +200,10 @@ public interface MarketingFavorService {
    * 
* * @param request 请求对象 - * @return FavorCallbacksSaveResult 微信返回的结果信息。 + * @return FavorStocksRestartResult 微信返回的结果信息。 * @throws WxPayException the wx pay exception */ - FavorStocksStartResult restartFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException; + FavorStocksRestartResult restartFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException; UseNotifyData parseNotifyData(String data, SignatureHeader header) throws WxPayException; diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImpl.java index 5923d0e10..a10bbbb08 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImpl.java @@ -154,19 +154,19 @@ public class MarketingFavorServiceImpl implements MarketingFavorService { } @Override - public FavorStocksStartResult pauseFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException { - String url = String.format("%s/v3/marketing/favor/stocks/%s/start", this.payService.getPayBaseUrl(), stockId); + public FavorStocksPauseResult pauseFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/favor/stocks/%s/pause", this.payService.getPayBaseUrl(), stockId); RsaCryptoUtil.encryptFields(request, this.payService.getConfig().getVerifier().getValidCertificate()); String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); - return GSON.fromJson(result, FavorStocksStartResult.class); + return GSON.fromJson(result, FavorStocksPauseResult.class); } @Override - public FavorStocksStartResult restartFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException { - String url = String.format("%s/v3/marketing/favor/stocks/%s/start", this.payService.getPayBaseUrl(), stockId); + public FavorStocksRestartResult restartFavorStocksV3(String stockId, FavorStocksSetRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/favor/stocks/%s/restart", this.payService.getPayBaseUrl(), stockId); RsaCryptoUtil.encryptFields(request, this.payService.getConfig().getVerifier().getValidCertificate()); String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); - return GSON.fromJson(result, FavorStocksStartResult.class); + return GSON.fromJson(result, FavorStocksRestartResult.class); } /** diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImplTest.java index 48fdf8c8e..7a532d6bd 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImplTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingFavorServiceImplTest.java @@ -175,7 +175,7 @@ public class MarketingFavorServiceImplTest { public void testPauseFavorStocksV3() throws WxPayException { FavorStocksSetRequest request = new FavorStocksSetRequest(); request.setStockCreatorMchid(wxPayService.getConfig().getMchId()); - FavorStocksStartResult result = wxPayService.getMarketingFavorService().pauseFavorStocksV3(stockId, request); + FavorStocksPauseResult result = wxPayService.getMarketingFavorService().pauseFavorStocksV3(stockId, request); log.info("result: {}", GSON.toJson(result)); } @@ -184,7 +184,7 @@ public class MarketingFavorServiceImplTest { public void testRestartFavorStocksV3() throws WxPayException { FavorStocksSetRequest request = new FavorStocksSetRequest(); request.setStockCreatorMchid(wxPayService.getConfig().getMchId()); - FavorStocksStartResult result = wxPayService.getMarketingFavorService().restartFavorStocksV3(stockId, request); + FavorStocksRestartResult result = wxPayService.getMarketingFavorService().restartFavorStocksV3(stockId, request); log.info("result: {}", GSON.toJson(result)); }