mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1532 微信支付模块增加汇率查询的接口
This commit is contained in:
@@ -170,6 +170,13 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
*/
|
||||
protected abstract void checkConstraints() throws WxPayException;
|
||||
|
||||
/**
|
||||
* 是否需要nonce_str
|
||||
*/
|
||||
protected boolean needNonceStr() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果配置中已经设置,可以不设置值.
|
||||
*
|
||||
@@ -363,7 +370,7 @@ public abstract class BaseWxPayRequest implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(getNonceStr())) {
|
||||
if (needNonceStr() && StringUtils.isBlank(getNonceStr())) {
|
||||
this.setNonceStr(String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 查询汇率请求.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-05-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayQueryExchangeRateRequest extends BaseWxPayRequest {
|
||||
private static final long serialVersionUID = -8796516942563060554L;
|
||||
/**
|
||||
* 币种
|
||||
* fee_type
|
||||
* 是
|
||||
* String(10)
|
||||
* USD
|
||||
* 外币币种
|
||||
*/
|
||||
@XStreamAlias("fee_type")
|
||||
private String feeType;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
* date
|
||||
* 是
|
||||
* String(14)
|
||||
* 20150807
|
||||
* 格式为yyyyMMdd,如2009年12月25日表示为20091225。时区为GMT+8 beijing
|
||||
*/
|
||||
@XStreamAlias("date")
|
||||
private String date;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() throws WxPayException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void storeMap(Map<String, String> map) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needNonceStr() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* 汇率查询响应.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-05-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayQueryExchangeRateResult extends BaseWxPayResult {
|
||||
private static final long serialVersionUID = 2269734222658532364L;
|
||||
|
||||
/**
|
||||
* 币种
|
||||
* fee_type
|
||||
* 是
|
||||
* String(10)
|
||||
* SUCCESS 外币币种,详细请见参数规定
|
||||
*/
|
||||
@XStreamAlias("fee_type")
|
||||
private String feeType;
|
||||
|
||||
/**
|
||||
* 汇率时间
|
||||
* rate_time
|
||||
* 是
|
||||
* String(14)
|
||||
* 20150807131545
|
||||
* 格式:yyyyMMddhhmmss
|
||||
*/
|
||||
@XStreamAlias("rate_time")
|
||||
private String rateTime;
|
||||
|
||||
/**
|
||||
* 现汇卖出价
|
||||
* rate
|
||||
* 是
|
||||
* String(15)
|
||||
* 系统错误
|
||||
* 外币标准单位乘以100折算为人民币的金额,保留4位小数(如:100美元按当时汇率折算返回的先汇卖出价是628.2100)
|
||||
*/
|
||||
@XStreamAlias("rate")
|
||||
private String rate;
|
||||
|
||||
@Override
|
||||
protected void loadXML(Document d) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user