mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-16 05:16:24 +08:00
pay模块批量添加缺失的javadoc文档
This commit is contained in:
@@ -35,6 +35,8 @@ public class WxPayApiData {
|
||||
private String exceptionMsg;
|
||||
|
||||
/**
|
||||
* Instantiates a new Wx pay api data.
|
||||
*
|
||||
* @param url 接口请求地址
|
||||
* @param requestData 请求数据
|
||||
* @param responseData 响应数据
|
||||
|
||||
@@ -13,7 +13,6 @@ import me.chanjar.weixin.common.annotation.Required;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
|
||||
@@ -13,7 +13,6 @@ import me.chanjar.weixin.common.annotation.Required;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
|
||||
@@ -20,7 +20,6 @@ import me.chanjar.weixin.common.annotation.Required;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
|
||||
@@ -32,6 +32,12 @@ public class WxPayNotifyResponse {
|
||||
@XStreamAlias("return_msg")
|
||||
private String returnMsg;
|
||||
|
||||
/**
|
||||
* Fail string.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @return the string
|
||||
*/
|
||||
public static String fail(String msg) {
|
||||
WxPayNotifyResponse response = new WxPayNotifyResponse(FAIL, msg);
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
@@ -39,6 +45,12 @@ public class WxPayNotifyResponse {
|
||||
return xstream.toXML(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Success string.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @return the string
|
||||
*/
|
||||
public static String success(String msg) {
|
||||
WxPayNotifyResponse response = new WxPayNotifyResponse(SUCCESS, msg);
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 支付异步通知代金券详细.
|
||||
*
|
||||
* @author aimilin
|
||||
*/
|
||||
@Data
|
||||
@@ -23,6 +24,12 @@ public class WxPayOrderNotifyCoupon implements Serializable {
|
||||
private String couponType;
|
||||
private Integer couponFee;
|
||||
|
||||
/**
|
||||
* To map map.
|
||||
*
|
||||
* @param index the index
|
||||
* @return the map
|
||||
*/
|
||||
public Map<String, String> toMap(int index) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("coupon_id_" + index, this.getCouponId());
|
||||
|
||||
@@ -285,6 +285,12 @@ public class WxPayOrderNotifyResult extends BaseWxPayResult {
|
||||
@XStreamAlias("version")
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* From xml wx pay order notify result.
|
||||
*
|
||||
* @param xmlString the xml string
|
||||
* @return the wx pay order notify result
|
||||
*/
|
||||
public static WxPayOrderNotifyResult fromXML(String xmlString) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.processAnnotations(WxPayOrderNotifyResult.class);
|
||||
|
||||
@@ -40,6 +40,8 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
|
||||
*
|
||||
* @param xmlString xml字符串
|
||||
* @param mchKey 商户密钥
|
||||
* @return the wx pay refund notify result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
public static WxPayRefundNotifyResult fromXML(String xmlString, String mchKey) throws WxPayException {
|
||||
WxPayRefundNotifyResult result = BaseWxPayResult.fromXML(xmlString, WxPayRefundNotifyResult.class);
|
||||
@@ -252,6 +254,12 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
|
||||
@XStreamAlias("refund_request_source")
|
||||
private String refundRequestSource;
|
||||
|
||||
/**
|
||||
* From xml req info.
|
||||
*
|
||||
* @param xmlString the xml string
|
||||
* @return the req info
|
||||
*/
|
||||
public static ReqInfo fromXML(String xmlString) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.processAnnotations(ReqInfo.class);
|
||||
|
||||
@@ -121,6 +121,7 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
* 将单位为元转换为单位为分.
|
||||
*
|
||||
* @param yuan 将要转换的元的数值字符串
|
||||
* @return the integer
|
||||
*/
|
||||
public static Integer yuanToFen(String yuan) {
|
||||
return new BigDecimal(yuan).setScale(2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).intValue();
|
||||
@@ -143,6 +144,8 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 检查约束情况.
|
||||
*
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
protected abstract void checkConstraints() throws WxPayException;
|
||||
|
||||
@@ -178,6 +181,11 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* To xml string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String toXML() {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
//涉及到服务商模式的两个参数,在为空值时置为null,以免在请求时将空值传给微信服务器
|
||||
@@ -189,6 +197,8 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 签名时,是否忽略appid.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
protected boolean ignoreAppid() {
|
||||
return false;
|
||||
@@ -196,6 +206,8 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 签名时,忽略的参数.
|
||||
*
|
||||
* @return the string [ ]
|
||||
*/
|
||||
protected String[] getIgnoredParamsForSign() {
|
||||
return new String[0];
|
||||
@@ -210,6 +222,7 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
* </pre>
|
||||
*
|
||||
* @param config 支付配置对象,用于读取相应系统配置信息
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
public void checkAndSign(WxPayConfig config) throws WxPayException {
|
||||
this.checkFields();
|
||||
|
||||
@@ -116,6 +116,7 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
* 将单位分转换成单位圆.
|
||||
*
|
||||
* @param fen 将要被转换为元的分的数值
|
||||
* @return the string
|
||||
*/
|
||||
public static String fenToYuan(Integer fen) {
|
||||
return BigDecimal.valueOf(Double.valueOf(fen) / 100).setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString();
|
||||
@@ -123,6 +124,11 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
|
||||
/**
|
||||
* 从xml字符串创建bean对象.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @param xmlString the xml string
|
||||
* @param clz the clz
|
||||
* @return the t
|
||||
*/
|
||||
public static <T extends BaseWxPayResult> T fromXML(String xmlString, Class<T> clz) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
@@ -132,6 +138,11 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets logger.
|
||||
*
|
||||
* @return the logger
|
||||
*/
|
||||
protected Logger getLogger() {
|
||||
return LoggerFactory.getLogger(this.getClass());
|
||||
}
|
||||
@@ -143,6 +154,8 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
|
||||
/**
|
||||
* 将bean通过保存的xml字符串转换成map.
|
||||
*
|
||||
* @return the map
|
||||
*/
|
||||
public Map<String, String> toMap() {
|
||||
if (StringUtils.isBlank(this.xmlString)) {
|
||||
@@ -189,6 +202,9 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
|
||||
/**
|
||||
* 获取xml中元素的值.
|
||||
*
|
||||
* @param path the path
|
||||
* @return the xml value
|
||||
*/
|
||||
String getXmlValue(String... path) {
|
||||
Document doc = this.getXmlDoc();
|
||||
@@ -206,6 +222,9 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
|
||||
/**
|
||||
* 获取xml中元素的值,作为int值返回.
|
||||
*
|
||||
* @param path the path
|
||||
* @return the xml value as int
|
||||
*/
|
||||
Integer getXmlValueAsInt(String... path) {
|
||||
String result = this.getXmlValue(path);
|
||||
@@ -219,8 +238,10 @@ public abstract class BaseWxPayResult implements Serializable {
|
||||
/**
|
||||
* 校验返回结果签名.
|
||||
*
|
||||
* @param wxPayService the wx pay service
|
||||
* @param signType 签名类型
|
||||
* @param checkSuccess 是否同时检查结果是否成功
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
public void checkResult(WxPayService wxPayService, String signType, boolean checkSuccess) throws WxPayException {
|
||||
//校验返回结果签名
|
||||
|
||||
@@ -10,6 +10,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Wx pay bill result.
|
||||
*
|
||||
* @author BinaryWang
|
||||
*/
|
||||
@Data
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayCommonResult extends BaseWxPayResult {
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 下载资金账单接口响应结果对象类
|
||||
@@ -15,7 +16,6 @@ import java.util.List;
|
||||
* </pre>
|
||||
*
|
||||
* @author cwivan
|
||||
* @date 2018-08-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
||||
@@ -267,6 +267,9 @@ public class WxPayOrderQueryResult extends BaseWxPayResult {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Coupon.
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -223,6 +223,9 @@ public class WxPayRedpackQueryResult extends BaseWxPayResult {
|
||||
@XStreamAlias("hblist")
|
||||
private List<RedpackInfo> redpackList;
|
||||
|
||||
/**
|
||||
* The type Redpack info.
|
||||
*/
|
||||
@Data
|
||||
@XStreamAlias("hbinfo")
|
||||
public static class RedpackInfo implements Serializable {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -168,6 +172,9 @@ public class WxPayRefundQueryResult extends BaseWxPayResult {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Refund record.
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
|
||||
Reference in New Issue
Block a user