Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.alipay.v3.model.VoucherConsultInfo Maven / Gradle / Ivy
/*
* 支付宝开放平台API
* 支付宝开放平台v3协议文档
*
* The version of the OpenAPI document: 2022-12-23
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.alipay.v3.model;
import java.util.Objects;
import java.util.Arrays;
import com.alipay.v3.model.ItemPromoInfo;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.io.Serializable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.alipay.v3.JSON;
/**
* VoucherConsultInfo
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class VoucherConsultInfo {
private static final long serialVersionUID = 1L;
public static final String SERIALIZED_NAME_CEILING_AMOUNT = "ceiling_amount";
@SerializedName(SERIALIZED_NAME_CEILING_AMOUNT)
private String ceilingAmount;
public static final String SERIALIZED_NAME_ITEM_PROMO_INFO = "item_promo_info";
@SerializedName(SERIALIZED_NAME_ITEM_PROMO_INFO)
private ItemPromoInfo itemPromoInfo;
public static final String SERIALIZED_NAME_OPTIMAL = "optimal";
@SerializedName(SERIALIZED_NAME_OPTIMAL)
private Boolean optimal;
public static final String SERIALIZED_NAME_PROMO_AMOUNT = "promo_amount";
@SerializedName(SERIALIZED_NAME_PROMO_AMOUNT)
private String promoAmount;
public static final String SERIALIZED_NAME_PROMO_TEXT = "promo_text";
@SerializedName(SERIALIZED_NAME_PROMO_TEXT)
private String promoText;
public static final String SERIALIZED_NAME_PROMO_TYPE = "promo_type";
@SerializedName(SERIALIZED_NAME_PROMO_TYPE)
private String promoType;
public static final String SERIALIZED_NAME_REDUCTION_AMOUNT = "reduction_amount";
@SerializedName(SERIALIZED_NAME_REDUCTION_AMOUNT)
private String reductionAmount;
public static final String SERIALIZED_NAME_REDUCTION_RATIO = "reduction_ratio";
@SerializedName(SERIALIZED_NAME_REDUCTION_RATIO)
private String reductionRatio;
public static final String SERIALIZED_NAME_SPECIFIED_AMOUNT = "specified_amount";
@SerializedName(SERIALIZED_NAME_SPECIFIED_AMOUNT)
private String specifiedAmount;
public static final String SERIALIZED_NAME_THRESHOLD_AMOUNT = "threshold_amount";
@SerializedName(SERIALIZED_NAME_THRESHOLD_AMOUNT)
private String thresholdAmount;
public static final String SERIALIZED_NAME_VOUCHER_ID = "voucher_id";
@SerializedName(SERIALIZED_NAME_VOUCHER_ID)
private String voucherId;
public static final String SERIALIZED_NAME_VOUCHER_NAME = "voucher_name";
@SerializedName(SERIALIZED_NAME_VOUCHER_NAME)
private String voucherName;
public static final String SERIALIZED_NAME_VOUCHER_TYPE = "voucher_type";
@SerializedName(SERIALIZED_NAME_VOUCHER_TYPE)
private String voucherType;
public VoucherConsultInfo() {
}
public VoucherConsultInfo ceilingAmount(String ceilingAmount) {
this.ceilingAmount = ceilingAmount;
return this;
}
/**
* 封顶优惠金额,单位为元
* @return ceilingAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "4.0", value = "封顶优惠金额,单位为元")
public String getCeilingAmount() {
return ceilingAmount;
}
public void setCeilingAmount(String ceilingAmount) {
this.ceilingAmount = ceilingAmount;
}
public VoucherConsultInfo itemPromoInfo(ItemPromoInfo itemPromoInfo) {
this.itemPromoInfo = itemPromoInfo;
return this;
}
/**
* Get itemPromoInfo
* @return itemPromoInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public ItemPromoInfo getItemPromoInfo() {
return itemPromoInfo;
}
public void setItemPromoInfo(ItemPromoInfo itemPromoInfo) {
this.itemPromoInfo = itemPromoInfo;
}
public VoucherConsultInfo optimal(Boolean optimal) {
this.optimal = optimal;
return this;
}
/**
* 是否为可使用的互斥券中最优的(目前返回的记录该值均为true,即可忽略该值判断)
* @return optimal
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "true", value = "是否为可使用的互斥券中最优的(目前返回的记录该值均为true,即可忽略该值判断)")
public Boolean getOptimal() {
return optimal;
}
public void setOptimal(Boolean optimal) {
this.optimal = optimal;
}
public VoucherConsultInfo promoAmount(String promoAmount) {
this.promoAmount = promoAmount;
return this;
}
/**
* 优惠总金额,单位为元
* @return promoAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "30.00", value = "优惠总金额,单位为元")
public String getPromoAmount() {
return promoAmount;
}
public void setPromoAmount(String promoAmount) {
this.promoAmount = promoAmount;
}
public VoucherConsultInfo promoText(String promoText) {
this.promoText = promoText;
return this;
}
/**
* 优惠文案
* @return promoText
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "大杯拿铁限时享受满10减1", value = "优惠文案")
public String getPromoText() {
return promoText;
}
public void setPromoText(String promoText) {
this.promoText = promoText;
}
public VoucherConsultInfo promoType(String promoType) {
this.promoType = promoType;
return this;
}
/**
* 优惠类型: 代金(FIX),折扣(DISCOUNT),减至(SPECIAL,即特价券)
* @return promoType
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "FIX", value = "优惠类型: 代金(FIX),折扣(DISCOUNT),减至(SPECIAL,即特价券)")
public String getPromoType() {
return promoType;
}
public void setPromoType(String promoType) {
this.promoType = promoType;
}
public VoucherConsultInfo reductionAmount(String reductionAmount) {
this.reductionAmount = reductionAmount;
return this;
}
/**
* 满减金额,单位为元,仅针对代金券
* @return reductionAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2.0", value = "满减金额,单位为元,仅针对代金券")
public String getReductionAmount() {
return reductionAmount;
}
public void setReductionAmount(String reductionAmount) {
this.reductionAmount = reductionAmount;
}
public VoucherConsultInfo reductionRatio(String reductionRatio) {
this.reductionRatio = reductionRatio;
return this;
}
/**
* 优惠额度,如3折券,返回0.7,仅针对折扣券
* @return reductionRatio
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "0.7", value = "优惠额度,如3折券,返回0.7,仅针对折扣券")
public String getReductionRatio() {
return reductionRatio;
}
public void setReductionRatio(String reductionRatio) {
this.reductionRatio = reductionRatio;
}
public VoucherConsultInfo specifiedAmount(String specifiedAmount) {
this.specifiedAmount = specifiedAmount;
return this;
}
/**
* 减至金额,单位为元,仅针对减至券
* @return specifiedAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "32.0", value = "减至金额,单位为元,仅针对减至券")
public String getSpecifiedAmount() {
return specifiedAmount;
}
public void setSpecifiedAmount(String specifiedAmount) {
this.specifiedAmount = specifiedAmount;
}
public VoucherConsultInfo thresholdAmount(String thresholdAmount) {
this.thresholdAmount = thresholdAmount;
return this;
}
/**
* 优惠门槛,单位为元
* @return thresholdAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "120.00", value = "优惠门槛,单位为元")
public String getThresholdAmount() {
return thresholdAmount;
}
public void setThresholdAmount(String thresholdAmount) {
this.thresholdAmount = thresholdAmount;
}
public VoucherConsultInfo voucherId(String voucherId) {
this.voucherId = voucherId;
return this;
}
/**
* 券id
* @return voucherId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "202010220007300232330005DGEE", value = "券id")
public String getVoucherId() {
return voucherId;
}
public void setVoucherId(String voucherId) {
this.voucherId = voucherId;
}
public VoucherConsultInfo voucherName(String voucherName) {
this.voucherName = voucherName;
return this;
}
/**
* 券名称
* @return voucherName
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "商家全场5折优惠", value = "券名称")
public String getVoucherName() {
return voucherName;
}
public void setVoucherName(String voucherName) {
this.voucherName = voucherName;
}
public VoucherConsultInfo voucherType(String voucherType) {
this.voucherType = voucherType;
return this;
}
/**
* 券类型: 1)全场券(ALL) 2)单品券(ITEM)
* @return voucherType
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "ALL", value = "券类型: 1)全场券(ALL) 2)单品券(ITEM)")
public String getVoucherType() {
return voucherType;
}
public void setVoucherType(String voucherType) {
this.voucherType = voucherType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
VoucherConsultInfo voucherConsultInfo = (VoucherConsultInfo) o;
return Objects.equals(this.ceilingAmount, voucherConsultInfo.ceilingAmount) &&
Objects.equals(this.itemPromoInfo, voucherConsultInfo.itemPromoInfo) &&
Objects.equals(this.optimal, voucherConsultInfo.optimal) &&
Objects.equals(this.promoAmount, voucherConsultInfo.promoAmount) &&
Objects.equals(this.promoText, voucherConsultInfo.promoText) &&
Objects.equals(this.promoType, voucherConsultInfo.promoType) &&
Objects.equals(this.reductionAmount, voucherConsultInfo.reductionAmount) &&
Objects.equals(this.reductionRatio, voucherConsultInfo.reductionRatio) &&
Objects.equals(this.specifiedAmount, voucherConsultInfo.specifiedAmount) &&
Objects.equals(this.thresholdAmount, voucherConsultInfo.thresholdAmount) &&
Objects.equals(this.voucherId, voucherConsultInfo.voucherId) &&
Objects.equals(this.voucherName, voucherConsultInfo.voucherName) &&
Objects.equals(this.voucherType, voucherConsultInfo.voucherType);
}
@Override
public int hashCode() {
return Objects.hash(ceilingAmount, itemPromoInfo, optimal, promoAmount, promoText, promoType, reductionAmount, reductionRatio, specifiedAmount, thresholdAmount, voucherId, voucherName, voucherType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class VoucherConsultInfo {\n");
sb.append(" ceilingAmount: ").append(toIndentedString(ceilingAmount)).append("\n");
sb.append(" itemPromoInfo: ").append(toIndentedString(itemPromoInfo)).append("\n");
sb.append(" optimal: ").append(toIndentedString(optimal)).append("\n");
sb.append(" promoAmount: ").append(toIndentedString(promoAmount)).append("\n");
sb.append(" promoText: ").append(toIndentedString(promoText)).append("\n");
sb.append(" promoType: ").append(toIndentedString(promoType)).append("\n");
sb.append(" reductionAmount: ").append(toIndentedString(reductionAmount)).append("\n");
sb.append(" reductionRatio: ").append(toIndentedString(reductionRatio)).append("\n");
sb.append(" specifiedAmount: ").append(toIndentedString(specifiedAmount)).append("\n");
sb.append(" thresholdAmount: ").append(toIndentedString(thresholdAmount)).append("\n");
sb.append(" voucherId: ").append(toIndentedString(voucherId)).append("\n");
sb.append(" voucherName: ").append(toIndentedString(voucherName)).append("\n");
sb.append(" voucherType: ").append(toIndentedString(voucherType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("ceiling_amount");
openapiFields.add("item_promo_info");
openapiFields.add("optimal");
openapiFields.add("promo_amount");
openapiFields.add("promo_text");
openapiFields.add("promo_type");
openapiFields.add("reduction_amount");
openapiFields.add("reduction_ratio");
openapiFields.add("specified_amount");
openapiFields.add("threshold_amount");
openapiFields.add("voucher_id");
openapiFields.add("voucher_name");
openapiFields.add("voucher_type");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Object and throws an exception if issues found
*
* @param jsonObj JSON Object
* @throws IOException if the JSON Object is invalid with respect to VoucherConsultInfo
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (VoucherConsultInfo.openapiRequiredFields.isEmpty()) {
return;
} else { // has required fields
throw new IllegalArgumentException(String.format("The required field(s) %s in VoucherConsultInfo is not found in the empty JSON string", VoucherConsultInfo.openapiRequiredFields.toString()));
}
}
Set> entries = jsonObj.entrySet();
// check to see if the JSON string contains additional fields
for (Entry entry : entries) {
if (!VoucherConsultInfo.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VoucherConsultInfo` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("ceiling_amount") != null && !jsonObj.get("ceiling_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `ceiling_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ceiling_amount").toString()));
}
// validate the optional field `item_promo_info`
if (jsonObj.getAsJsonObject("item_promo_info") != null) {
ItemPromoInfo.validateJsonObject(jsonObj.getAsJsonObject("item_promo_info"));
}
if (jsonObj.get("promo_amount") != null && !jsonObj.get("promo_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `promo_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("promo_amount").toString()));
}
if (jsonObj.get("promo_text") != null && !jsonObj.get("promo_text").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `promo_text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("promo_text").toString()));
}
if (jsonObj.get("promo_type") != null && !jsonObj.get("promo_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `promo_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("promo_type").toString()));
}
if (jsonObj.get("reduction_amount") != null && !jsonObj.get("reduction_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `reduction_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reduction_amount").toString()));
}
if (jsonObj.get("reduction_ratio") != null && !jsonObj.get("reduction_ratio").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `reduction_ratio` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reduction_ratio").toString()));
}
if (jsonObj.get("specified_amount") != null && !jsonObj.get("specified_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `specified_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("specified_amount").toString()));
}
if (jsonObj.get("threshold_amount") != null && !jsonObj.get("threshold_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `threshold_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("threshold_amount").toString()));
}
if (jsonObj.get("voucher_id") != null && !jsonObj.get("voucher_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `voucher_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("voucher_id").toString()));
}
if (jsonObj.get("voucher_name") != null && !jsonObj.get("voucher_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `voucher_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("voucher_name").toString()));
}
if (jsonObj.get("voucher_type") != null && !jsonObj.get("voucher_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `voucher_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("voucher_type").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!VoucherConsultInfo.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'VoucherConsultInfo' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(VoucherConsultInfo.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, VoucherConsultInfo value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public VoucherConsultInfo read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
return thisAdapter.fromJsonTree(jsonObj);
}
}.nullSafe();
}
}
/**
* Create an instance of VoucherConsultInfo given an JSON string
*
* @param jsonString JSON string
* @return An instance of VoucherConsultInfo
* @throws IOException if the JSON string is invalid with respect to VoucherConsultInfo
*/
public static VoucherConsultInfo fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, VoucherConsultInfo.class);
}
/**
* Convert an instance of VoucherConsultInfo to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}