package com.walker.pay.allinpaycloud; import com.walker.infrastructure.utils.StringUtils; import com.walker.pay.RequestNotifyBean; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; /** * 通知的最外层对象定义。 * @author 时克英 * @date 2023-02-26 */ public class RequestNotify extends RequestNotifyBean { @Override public String toString(){ return new StringBuilder("[notifyId=").append(this.getNotifyId()) .append(", notifyType=").append(this.getNotifyType()) .append(", notifyTime=").append(this.getNotifyTime()) .append(", sign=").append(this.getSign()) .append(", appId=").append(this.getAppId()) .append(", signType=").append(this.getSignType()) .append(", bizContent=").append(this.getBizContent()) .append("]").toString(); } /** * 把对象转成等待验证签名的数据字符串。 * @return * @date 2023-03-05 */ public String toSignSource(){ StringBuilder sb = new StringBuilder("appId=").append(this.appId) .append("&bizContent=").append(this.bizContent) .append("&charset=").append(this.charset) .append("¬ifyId=").append(this.notifyId) .append("¬ifyTime=").append(this.notifyTime) .append("¬ifyType=").append(this.notifyType) .append("&version=").append(this.version); try { return URLDecoder.decode(sb.toString(), StringUtils.DEFAULT_CHARSET_UTF8); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } // /** // * 转换成签名序列化字符串,按照key/value拼接方式,以字母表顺序。 // * @return // * @date 2023-03-06 // */ // public String toSignSerialize(){ // Field[] fields = this.getClass().getDeclaredFields(); // List fieldNameList = new ArrayList<>(8); // for(int i=0;i 0){ // sb.append("&"); // } // sb.append(fieldNameList.get(i)) // .append("=") // .append(ClassUtils.getFieldValueByName(fieldNameList.get(i), this)); // } // return sb.toString(); // } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getNotifyType() { return notifyType; } public void setNotifyType(String notifyType) { this.notifyType = notifyType; } public String getNotifyTime() { return notifyTime; } public void setNotifyTime(String notifyTime) { this.notifyTime = notifyTime; } public String getNotifyId() { return notifyId; } public void setNotifyId(String notifyId) { this.notifyId = notifyId; } public String getCharset() { return charset; } public void setCharset(String charset) { this.charset = charset; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getSignType() { return signType; } public void setSignType(String signType) { this.signType = signType; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } // public OrderNotifyInfo getBizContent() { // return bizContent; // } // // public void setBizContent(OrderNotifyInfo bizContent) { // this.bizContent = bizContent; // } public String getBizContent() { return bizContent; } public void setBizContent(String bizContent) { this.bizContent = bizContent; } private String bizContent; private String appId; private String notifyType; private String notifyTime; private String notifyId; private String charset; private String version; private String signType; private String sign; // private OrderNotifyInfo bizContent; }