mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 优化重构部分代码
This commit is contained in:
@@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import me.chanjar.weixin.common.error.WxRuntimeException;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.security.PrivateKey;
|
||||
@@ -72,6 +73,8 @@ public class WxPayUnifiedOrderV3Result implements Serializable {
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class JsapiResult implements Serializable {
|
||||
private static final long serialVersionUID = 4465376277943307271L;
|
||||
|
||||
private String appId;
|
||||
private String timeStamp;
|
||||
private String nonceStr;
|
||||
@@ -80,16 +83,18 @@ public class WxPayUnifiedOrderV3Result implements Serializable {
|
||||
private String paySign;
|
||||
|
||||
private String getSignStr() {
|
||||
return String.format("%s\n%s\n%s\n%s\n", appId, timeStamp, nonceStr, packageValue);
|
||||
return String.format("%s%n%s%n%s%n%s%n", appId, timeStamp, nonceStr, packageValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class AppResult implements Serializable {
|
||||
private static final long serialVersionUID = 5465773025172875110L;
|
||||
|
||||
private String appid;
|
||||
private String partnerid;
|
||||
private String prepayid;
|
||||
private String partnerId;
|
||||
private String prepayId;
|
||||
private String packageValue;
|
||||
private String noncestr;
|
||||
private String timestamp;
|
||||
@@ -111,14 +116,15 @@ public class WxPayUnifiedOrderV3Result implements Serializable {
|
||||
return (T) this.h5Url;
|
||||
case APP:
|
||||
AppResult appResult = new AppResult();
|
||||
appResult.setAppid(appId).setPrepayid(this.prepayId).setPartnerid(mchId)
|
||||
appResult.setAppid(appId).setPrepayId(this.prepayId).setPartnerId(mchId)
|
||||
.setNoncestr(nonceStr).setTimestamp(timestamp)
|
||||
//暂填写固定值Sign=WXPay
|
||||
.setPackageValue("Sign=WXPay");
|
||||
return (T) appResult;
|
||||
case NATIVE:
|
||||
return (T) this.codeUrl;
|
||||
default:
|
||||
throw new WxRuntimeException("不支持的支付类型");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user