diff --git a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMarketingApi.java b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMarketingApi.java index be12acd..7e2c5f7 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMarketingApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMarketingApi.java @@ -270,8 +270,10 @@ public class WechatMarketingApi extends AbstractApi { body.add("file", file.getResource()); // 签名 String metaStr = this.getMapper().writeValueAsString(meta); - return RequestEntity.post(uri).header("Content-Type", MediaType.MULTIPART_FORM_DATA_VALUE) - .header("Meta-Info",metaStr).body(body); + return RequestEntity.post(uri) + .header("Content-Type", MediaType.MULTIPART_FORM_DATA_VALUE) + .header("Meta-Info",metaStr) + .body(body); } /** diff --git a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMetaBean.java b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMetaBean.java index 33ae035..ab8f1c3 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMetaBean.java +++ b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatMetaBean.java @@ -20,8 +20,8 @@ public class WechatMetaBean implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { - Assert.notNull(wechatPayProperties, "wechatPayProperties must not be null"); - Assert.notNull(keyPair, "wechat pay p12 certificate has not loaded"); - Assert.hasText(serialNumber, "wechat pay p12 certificate SerialNumber must not null"); + Assert.notNull(wechatPayProperties, "wechatPayProperties is required"); + Assert.notNull(keyPair, "wechat pay p12 certificate is required"); + Assert.hasText(serialNumber, "wechat pay p12 certificate SerialNumber is required"); } } diff --git a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayApi.java b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayApi.java index 8ccf7bc..a8c5110 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayApi.java +++ b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayApi.java @@ -11,7 +11,7 @@ import org.springframework.web.util.UriComponentsBuilder; import java.net.URI; /** - * The type Wechat pay v 3 api. + * The type Wechat pay api. * * @author Dax * @since 16 :15 diff --git a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayClient.java b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayClient.java index d1a8c72..a471fcf 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayClient.java +++ b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatPayClient.java @@ -146,8 +146,6 @@ public class WechatPayClient { if (encodedQuery != null) { canonicalUrl += "?" + encodedQuery; } - - // 签名 HttpMethod httpMethod = requestEntity.getMethod(); Assert.notNull(httpMethod, "httpMethod is required"); diff --git a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatResponseEntity.java b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatResponseEntity.java index c06989f..0b65ad4 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatResponseEntity.java +++ b/payment-spring-boot-autoconfigure/src/main/java/com/enongm/dianji/payment/wechat/v3/WechatResponseEntity.java @@ -8,8 +8,11 @@ import org.springframework.http.ResponseEntity; import java.util.Objects; /** + * The type Wechat response entity. + * + * @param the type parameter * @author Dax - * @since 13:20 + * @since 13 :20 */ @Slf4j @Data @@ -18,6 +21,11 @@ public class WechatResponseEntity { private T body; + /** + * Convert {@link ResponseEntity} to {@link WechatResponseEntity}. + * + * @param responseEntity the response entity + */ public void convert(ResponseEntity responseEntity) { if (log.isDebugEnabled()) { log.debug("wechat response {}", responseEntity); @@ -31,10 +39,64 @@ public class WechatResponseEntity { } } + + /** + * Is 1 xx informational boolean. + * + * @return the boolean + */ + public boolean is1xxInformational() { + if (log.isDebugEnabled()) { + log.debug("wechat httpStatus {}", this.httpStatus); + } + return HttpStatus.valueOf(this.httpStatus).is1xxInformational(); + } + + /** + * Is 2xx successful boolean. + * + * @return the boolean + */ public boolean is2xxSuccessful() { if (log.isDebugEnabled()) { log.debug("wechat httpStatus {}", this.httpStatus); } return HttpStatus.valueOf(this.httpStatus).is2xxSuccessful(); } + + /** + * Is 3xx redirection boolean. + * + * @return the boolean + */ + public boolean is3xxRedirection() { + if (log.isDebugEnabled()) { + log.debug("wechat httpStatus {}", this.httpStatus); + } + return HttpStatus.valueOf(this.httpStatus).is3xxRedirection(); + } + + /** + * Is 4xx client error boolean. + * + * @return the boolean + */ + public boolean is4xxClientError() { + if (log.isDebugEnabled()) { + log.debug("wechat httpStatus {}", this.httpStatus); + } + return HttpStatus.valueOf(this.httpStatus).is4xxClientError(); + } + + /** + * Is 5xx server error boolean. + * + * @return the boolean + */ + public boolean is5xxServerError() { + if (log.isDebugEnabled()) { + log.debug("wechat httpStatus {}", this.httpStatus); + } + return HttpStatus.valueOf(this.httpStatus).is5xxServerError(); + } }