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.AlipayTradePrecreateModel Maven / Gradle / Ivy
/*
* 支付宝开放平台API
* 支付宝开放平台v3协议文档
*
* The version of the OpenAPI document: 2024-11-12
*
*
* 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.BkAgentReqInfo;
import com.alipay.v3.model.BusinessParams;
import com.alipay.v3.model.ExtUserInfo;
import com.alipay.v3.model.ExtendParams;
import com.alipay.v3.model.GoodsDetail;
import com.alipay.v3.model.RoyaltyInfo;
import com.alipay.v3.model.SettleInfo;
import com.alipay.v3.model.SubMerchant;
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.util.ArrayList;
import java.util.List;
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;
/**
* AlipayTradePrecreateModel
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AlipayTradePrecreateModel {
public static final String SERIALIZED_NAME_ALIPAY_STORE_ID = "alipay_store_id";
@SerializedName(SERIALIZED_NAME_ALIPAY_STORE_ID)
private String alipayStoreId;
public static final String SERIALIZED_NAME_BKAGENT_REQ_INFO = "bkagent_req_info";
@SerializedName(SERIALIZED_NAME_BKAGENT_REQ_INFO)
private BkAgentReqInfo bkagentReqInfo;
public static final String SERIALIZED_NAME_BODY = "body";
@SerializedName(SERIALIZED_NAME_BODY)
private String body;
public static final String SERIALIZED_NAME_BUSINESS_PARAMS = "business_params";
@SerializedName(SERIALIZED_NAME_BUSINESS_PARAMS)
private BusinessParams businessParams;
public static final String SERIALIZED_NAME_BUYER_LOGON_ID = "buyer_logon_id";
@SerializedName(SERIALIZED_NAME_BUYER_LOGON_ID)
private String buyerLogonId;
public static final String SERIALIZED_NAME_CODE_TYPE = "code_type";
@SerializedName(SERIALIZED_NAME_CODE_TYPE)
private String codeType;
public static final String SERIALIZED_NAME_DISABLE_PAY_CHANNELS = "disable_pay_channels";
@SerializedName(SERIALIZED_NAME_DISABLE_PAY_CHANNELS)
private String disablePayChannels;
public static final String SERIALIZED_NAME_DISCOUNTABLE_AMOUNT = "discountable_amount";
@SerializedName(SERIALIZED_NAME_DISCOUNTABLE_AMOUNT)
private String discountableAmount;
public static final String SERIALIZED_NAME_ENABLE_PAY_CHANNELS = "enable_pay_channels";
@SerializedName(SERIALIZED_NAME_ENABLE_PAY_CHANNELS)
private String enablePayChannels;
public static final String SERIALIZED_NAME_EXT_USER_INFO = "ext_user_info";
@SerializedName(SERIALIZED_NAME_EXT_USER_INFO)
private ExtUserInfo extUserInfo;
public static final String SERIALIZED_NAME_EXTEND_PARAMS = "extend_params";
@SerializedName(SERIALIZED_NAME_EXTEND_PARAMS)
private ExtendParams extendParams;
public static final String SERIALIZED_NAME_GOODS_DETAIL = "goods_detail";
@SerializedName(SERIALIZED_NAME_GOODS_DETAIL)
private List goodsDetail = null;
public static final String SERIALIZED_NAME_MERCHANT_ORDER_NO = "merchant_order_no";
@SerializedName(SERIALIZED_NAME_MERCHANT_ORDER_NO)
private String merchantOrderNo;
public static final String SERIALIZED_NAME_NOTIFY_URL = "notify_url";
@SerializedName(SERIALIZED_NAME_NOTIFY_URL)
private String notifyUrl;
public static final String SERIALIZED_NAME_OPERATOR_ID = "operator_id";
@SerializedName(SERIALIZED_NAME_OPERATOR_ID)
private String operatorId;
public static final String SERIALIZED_NAME_OUT_TRADE_NO = "out_trade_no";
@SerializedName(SERIALIZED_NAME_OUT_TRADE_NO)
private String outTradeNo;
public static final String SERIALIZED_NAME_PASSBACK_PARAMS = "passback_params";
@SerializedName(SERIALIZED_NAME_PASSBACK_PARAMS)
private String passbackParams;
public static final String SERIALIZED_NAME_PRODUCT_CODE = "product_code";
@SerializedName(SERIALIZED_NAME_PRODUCT_CODE)
private String productCode;
public static final String SERIALIZED_NAME_QR_CODE_TIMEOUT_EXPRESS = "qr_code_timeout_express";
@SerializedName(SERIALIZED_NAME_QR_CODE_TIMEOUT_EXPRESS)
private String qrCodeTimeoutExpress;
public static final String SERIALIZED_NAME_QUERY_OPTIONS = "query_options";
@SerializedName(SERIALIZED_NAME_QUERY_OPTIONS)
private List queryOptions = null;
public static final String SERIALIZED_NAME_ROYALTY_INFO = "royalty_info";
@SerializedName(SERIALIZED_NAME_ROYALTY_INFO)
private RoyaltyInfo royaltyInfo;
public static final String SERIALIZED_NAME_SELLER_ID = "seller_id";
@SerializedName(SERIALIZED_NAME_SELLER_ID)
private String sellerId;
public static final String SERIALIZED_NAME_SETTLE_INFO = "settle_info";
@SerializedName(SERIALIZED_NAME_SETTLE_INFO)
private SettleInfo settleInfo;
public static final String SERIALIZED_NAME_STORE_ID = "store_id";
@SerializedName(SERIALIZED_NAME_STORE_ID)
private String storeId;
public static final String SERIALIZED_NAME_SUB_MERCHANT = "sub_merchant";
@SerializedName(SERIALIZED_NAME_SUB_MERCHANT)
private SubMerchant subMerchant;
public static final String SERIALIZED_NAME_SUBJECT = "subject";
@SerializedName(SERIALIZED_NAME_SUBJECT)
private String subject;
public static final String SERIALIZED_NAME_TERMINAL_ID = "terminal_id";
@SerializedName(SERIALIZED_NAME_TERMINAL_ID)
private String terminalId;
public static final String SERIALIZED_NAME_TIME_EXPIRE = "time_expire";
@SerializedName(SERIALIZED_NAME_TIME_EXPIRE)
private String timeExpire;
public static final String SERIALIZED_NAME_TIMEOUT_EXPRESS = "timeout_express";
@SerializedName(SERIALIZED_NAME_TIMEOUT_EXPRESS)
private String timeoutExpress;
public static final String SERIALIZED_NAME_TOTAL_AMOUNT = "total_amount";
@SerializedName(SERIALIZED_NAME_TOTAL_AMOUNT)
private String totalAmount;
public static final String SERIALIZED_NAME_UNDISCOUNTABLE_AMOUNT = "undiscountable_amount";
@SerializedName(SERIALIZED_NAME_UNDISCOUNTABLE_AMOUNT)
private String undiscountableAmount;
public AlipayTradePrecreateModel() {
}
public AlipayTradePrecreateModel alipayStoreId(String alipayStoreId) {
this.alipayStoreId = alipayStoreId;
return this;
}
/**
* 支付宝店铺编号。 指商户创建门店后支付宝生成的门店ID。
* @return alipayStoreId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2016052600077000000015640104", value = "支付宝店铺编号。 指商户创建门店后支付宝生成的门店ID。")
public String getAlipayStoreId() {
return alipayStoreId;
}
public void setAlipayStoreId(String alipayStoreId) {
this.alipayStoreId = alipayStoreId;
}
public AlipayTradePrecreateModel bkagentReqInfo(BkAgentReqInfo bkagentReqInfo) {
this.bkagentReqInfo = bkagentReqInfo;
return this;
}
/**
* Get bkagentReqInfo
* @return bkagentReqInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public BkAgentReqInfo getBkagentReqInfo() {
return bkagentReqInfo;
}
public void setBkagentReqInfo(BkAgentReqInfo bkagentReqInfo) {
this.bkagentReqInfo = bkagentReqInfo;
}
public AlipayTradePrecreateModel body(String body) {
this.body = body;
return this;
}
/**
* 订单附加信息。 如果请求时传递了该参数,将在异步通知、对账单中原样返回,同时会在商户和用户的pc账单详情中作为交易描述展示
* @return body
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "Iphone6 16G", value = "订单附加信息。 如果请求时传递了该参数,将在异步通知、对账单中原样返回,同时会在商户和用户的pc账单详情中作为交易描述展示")
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public AlipayTradePrecreateModel businessParams(BusinessParams businessParams) {
this.businessParams = businessParams;
return this;
}
/**
* Get businessParams
* @return businessParams
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public BusinessParams getBusinessParams() {
return businessParams;
}
public void setBusinessParams(BusinessParams businessParams) {
this.businessParams = businessParams;
}
public AlipayTradePrecreateModel buyerLogonId(String buyerLogonId) {
this.buyerLogonId = buyerLogonId;
return this;
}
/**
* 买家支付宝账号
* @return buyerLogonId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "15901825620", value = "买家支付宝账号")
public String getBuyerLogonId() {
return buyerLogonId;
}
public void setBuyerLogonId(String buyerLogonId) {
this.buyerLogonId = buyerLogonId;
}
public AlipayTradePrecreateModel codeType(String codeType) {
this.codeType = codeType;
return this;
}
/**
* 码类型,如果请求时传入了share_code,将在响应参数返回吱口令;如果为空,则默认为订单码
* @return codeType
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "share_code", value = "码类型,如果请求时传入了share_code,将在响应参数返回吱口令;如果为空,则默认为订单码")
public String getCodeType() {
return codeType;
}
public void setCodeType(String codeType) {
this.codeType = codeType;
}
public AlipayTradePrecreateModel disablePayChannels(String disablePayChannels) {
this.disablePayChannels = disablePayChannels;
return this;
}
/**
* 禁用渠道,用户不可用指定渠道支付,多个渠道以逗号分割 注,与enable_pay_channels互斥 <a href=\"https://docs.open.alipay.com/common/wifww7\">渠道列表</a>
* @return disablePayChannels
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "pcredit,moneyFund,debitCardExpress", value = "禁用渠道,用户不可用指定渠道支付,多个渠道以逗号分割 注,与enable_pay_channels互斥 渠道列表 ")
public String getDisablePayChannels() {
return disablePayChannels;
}
public void setDisablePayChannels(String disablePayChannels) {
this.disablePayChannels = disablePayChannels;
}
public AlipayTradePrecreateModel discountableAmount(String discountableAmount) {
this.discountableAmount = discountableAmount;
return this;
}
/**
* 可打折金额。 参与优惠计算的金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]。 如果同时传入了【可打折金额】、【不可打折金额】和【订单总金额】,则必须满足如下条件:【订单总金额】=【可打折金额】+【不可打折金额】。 如果订单金额全部参与优惠计算,则【可打折金额】和【不可打折金额】都无需传入。
* @return discountableAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "80.00", value = "可打折金额。 参与优惠计算的金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]。 如果同时传入了【可打折金额】、【不可打折金额】和【订单总金额】,则必须满足如下条件:【订单总金额】=【可打折金额】+【不可打折金额】。 如果订单金额全部参与优惠计算,则【可打折金额】和【不可打折金额】都无需传入。")
public String getDiscountableAmount() {
return discountableAmount;
}
public void setDiscountableAmount(String discountableAmount) {
this.discountableAmount = discountableAmount;
}
public AlipayTradePrecreateModel enablePayChannels(String enablePayChannels) {
this.enablePayChannels = enablePayChannels;
return this;
}
/**
* 指定支付渠道。 用户只能使用指定的渠道进行支付,多个渠道以逗号分割。 与disable_pay_channels互斥,支持传入的值:<a target=\"_blank\" href=\"https://docs.open.alipay.com/common/wifww7\">渠道列表</a>。 注:如果传入了指定支付渠道,则用户只能用指定内的渠道支付,包括营销渠道也要指定才能使用。该参数可能导致用户支付受限,慎用。
* @return enablePayChannels
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "pcredit,moneyFund,debitCardExpress", value = "指定支付渠道。 用户只能使用指定的渠道进行支付,多个渠道以逗号分割。 与disable_pay_channels互斥,支持传入的值:渠道列表 。 注:如果传入了指定支付渠道,则用户只能用指定内的渠道支付,包括营销渠道也要指定才能使用。该参数可能导致用户支付受限,慎用。")
public String getEnablePayChannels() {
return enablePayChannels;
}
public void setEnablePayChannels(String enablePayChannels) {
this.enablePayChannels = enablePayChannels;
}
public AlipayTradePrecreateModel extUserInfo(ExtUserInfo extUserInfo) {
this.extUserInfo = extUserInfo;
return this;
}
/**
* Get extUserInfo
* @return extUserInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public ExtUserInfo getExtUserInfo() {
return extUserInfo;
}
public void setExtUserInfo(ExtUserInfo extUserInfo) {
this.extUserInfo = extUserInfo;
}
public AlipayTradePrecreateModel extendParams(ExtendParams extendParams) {
this.extendParams = extendParams;
return this;
}
/**
* Get extendParams
* @return extendParams
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public ExtendParams getExtendParams() {
return extendParams;
}
public void setExtendParams(ExtendParams extendParams) {
this.extendParams = extendParams;
}
public AlipayTradePrecreateModel goodsDetail(List goodsDetail) {
this.goodsDetail = goodsDetail;
return this;
}
public AlipayTradePrecreateModel addGoodsDetailItem(GoodsDetail goodsDetailItem) {
if (this.goodsDetail == null) {
this.goodsDetail = new ArrayList<>();
}
this.goodsDetail.add(goodsDetailItem);
return this;
}
/**
* 订单包含的商品列表信息.json格式. 其它说明详见:“商品明细说明”
* @return goodsDetail
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "订单包含的商品列表信息.json格式. 其它说明详见:“商品明细说明”")
public List getGoodsDetail() {
return goodsDetail;
}
public void setGoodsDetail(List goodsDetail) {
this.goodsDetail = goodsDetail;
}
public AlipayTradePrecreateModel merchantOrderNo(String merchantOrderNo) {
this.merchantOrderNo = merchantOrderNo;
return this;
}
/**
* 商户的原始订单号
* @return merchantOrderNo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "20161008001", value = "商户的原始订单号")
public String getMerchantOrderNo() {
return merchantOrderNo;
}
public void setMerchantOrderNo(String merchantOrderNo) {
this.merchantOrderNo = merchantOrderNo;
}
public AlipayTradePrecreateModel notifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
return this;
}
/**
* 通知地址
* @return notifyUrl
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "通知地址")
public String getNotifyUrl() {
return notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public AlipayTradePrecreateModel operatorId(String operatorId) {
this.operatorId = operatorId;
return this;
}
/**
* 商户操作员编号。
* @return operatorId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "yx_001", value = "商户操作员编号。")
public String getOperatorId() {
return operatorId;
}
public void setOperatorId(String operatorId) {
this.operatorId = operatorId;
}
public AlipayTradePrecreateModel outTradeNo(String outTradeNo) {
this.outTradeNo = outTradeNo;
return this;
}
/**
* 商户订单号。 由商家自定义,64个字符以内,仅支持字母、数字、下划线且需保证在商户端不重复。
* @return outTradeNo
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "20150320010101001", value = "商户订单号。 由商家自定义,64个字符以内,仅支持字母、数字、下划线且需保证在商户端不重复。")
public String getOutTradeNo() {
return outTradeNo;
}
public void setOutTradeNo(String outTradeNo) {
this.outTradeNo = outTradeNo;
}
public AlipayTradePrecreateModel passbackParams(String passbackParams) {
this.passbackParams = passbackParams;
return this;
}
/**
* 公用回传参数。 如果请求时传递了该参数,支付宝会在异步通知时将该参数原样返回。
* @return passbackParams
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "merchantBizType%3d3C%26merchantBizNo%3d2016010101111", value = "公用回传参数。 如果请求时传递了该参数,支付宝会在异步通知时将该参数原样返回。")
public String getPassbackParams() {
return passbackParams;
}
public void setPassbackParams(String passbackParams) {
this.passbackParams = passbackParams;
}
public AlipayTradePrecreateModel productCode(String productCode) {
this.productCode = productCode;
return this;
}
/**
* 产品码。 商家和支付宝签约的产品码。 枚举值(点击查看签约情况): <a target=\"_blank\" href=\"https://opensupport.alipay.com/support/codelab/detail/486/487\">FACE_TO_FACE_PAYMENT</a>:当面付产品; 默认值为FACE_TO_FACE_PAYMENT。
* @return productCode
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "FACE_TO_FACE_PAYMENT", value = "产品码。 商家和支付宝签约的产品码。 枚举值(点击查看签约情况): FACE_TO_FACE_PAYMENT :当面付产品; 默认值为FACE_TO_FACE_PAYMENT。")
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public AlipayTradePrecreateModel qrCodeTimeoutExpress(String qrCodeTimeoutExpress) {
this.qrCodeTimeoutExpress = qrCodeTimeoutExpress;
return this;
}
/**
* 二维码订单相对超时时间。 该笔订单允许的最晚付款时间,逾期将关闭交易,从生成二维码开始计时。 取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 注:二维码最长有效期是2小时,不管该参数传递的值是多少,超过2小时后二维码都将失效不能再进行扫码支付。
* @return qrCodeTimeoutExpress
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "90m", value = "二维码订单相对超时时间。 该笔订单允许的最晚付款时间,逾期将关闭交易,从生成二维码开始计时。 取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 注:二维码最长有效期是2小时,不管该参数传递的值是多少,超过2小时后二维码都将失效不能再进行扫码支付。")
public String getQrCodeTimeoutExpress() {
return qrCodeTimeoutExpress;
}
public void setQrCodeTimeoutExpress(String qrCodeTimeoutExpress) {
this.qrCodeTimeoutExpress = qrCodeTimeoutExpress;
}
public AlipayTradePrecreateModel queryOptions(List queryOptions) {
this.queryOptions = queryOptions;
return this;
}
public AlipayTradePrecreateModel addQueryOptionsItem(String queryOptionsItem) {
if (this.queryOptions == null) {
this.queryOptions = new ArrayList<>();
}
this.queryOptions.add(queryOptionsItem);
return this;
}
/**
* 返回参数选项。 商户通过传递该参数来定制需要额外返回的信息字段,数组格式。包括但不限于:[\"hyb_amount\",\"enterprise_pay_info\"]
* @return queryOptions
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "[\"hyb_amount\",\"enterprise_pay_info\"]", value = "返回参数选项。 商户通过传递该参数来定制需要额外返回的信息字段,数组格式。包括但不限于:[\"hyb_amount\",\"enterprise_pay_info\"]")
public List getQueryOptions() {
return queryOptions;
}
public void setQueryOptions(List queryOptions) {
this.queryOptions = queryOptions;
}
public AlipayTradePrecreateModel royaltyInfo(RoyaltyInfo royaltyInfo) {
this.royaltyInfo = royaltyInfo;
return this;
}
/**
* Get royaltyInfo
* @return royaltyInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public RoyaltyInfo getRoyaltyInfo() {
return royaltyInfo;
}
public void setRoyaltyInfo(RoyaltyInfo royaltyInfo) {
this.royaltyInfo = royaltyInfo;
}
public AlipayTradePrecreateModel sellerId(String sellerId) {
this.sellerId = sellerId;
return this;
}
/**
* 卖家支付宝用户ID。 当需要指定收款账号时,通过该参数传入,如果该值为空,则默认为商户签约账号对应的支付宝用户ID。 收款账号优先级规则:门店绑定的收款账户>请求传入的seller_id>商户签约账号对应的支付宝用户ID; 注:直付通和机构间联场景下seller_id无需传入或者保持跟pid一致; 如果传入的seller_id与pid不一致,需要联系支付宝小二配置收款关系;
* @return sellerId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2088102146225135", value = "卖家支付宝用户ID。 当需要指定收款账号时,通过该参数传入,如果该值为空,则默认为商户签约账号对应的支付宝用户ID。 收款账号优先级规则:门店绑定的收款账户>请求传入的seller_id>商户签约账号对应的支付宝用户ID; 注:直付通和机构间联场景下seller_id无需传入或者保持跟pid一致; 如果传入的seller_id与pid不一致,需要联系支付宝小二配置收款关系;")
public String getSellerId() {
return sellerId;
}
public void setSellerId(String sellerId) {
this.sellerId = sellerId;
}
public AlipayTradePrecreateModel settleInfo(SettleInfo settleInfo) {
this.settleInfo = settleInfo;
return this;
}
/**
* Get settleInfo
* @return settleInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public SettleInfo getSettleInfo() {
return settleInfo;
}
public void setSettleInfo(SettleInfo settleInfo) {
this.settleInfo = settleInfo;
}
public AlipayTradePrecreateModel storeId(String storeId) {
this.storeId = storeId;
return this;
}
/**
* 商户门店编号。 指商户创建门店时输入的门店编号。
* @return storeId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "NJ_001", value = "商户门店编号。 指商户创建门店时输入的门店编号。")
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public AlipayTradePrecreateModel subMerchant(SubMerchant subMerchant) {
this.subMerchant = subMerchant;
return this;
}
/**
* Get subMerchant
* @return subMerchant
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public SubMerchant getSubMerchant() {
return subMerchant;
}
public void setSubMerchant(SubMerchant subMerchant) {
this.subMerchant = subMerchant;
}
public AlipayTradePrecreateModel subject(String subject) {
this.subject = subject;
return this;
}
/**
* 订单标题。 注意:不可使用特殊字符,如 /,=,& 等。
* @return subject
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "Iphone6 16G", value = "订单标题。 注意:不可使用特殊字符,如 /,=,& 等。")
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public AlipayTradePrecreateModel terminalId(String terminalId) {
this.terminalId = terminalId;
return this;
}
/**
* 商户机具终端编号。
* @return terminalId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "NJ_T_001", value = "商户机具终端编号。")
public String getTerminalId() {
return terminalId;
}
public void setTerminalId(String terminalId) {
this.terminalId = terminalId;
}
public AlipayTradePrecreateModel timeExpire(String timeExpire) {
this.timeExpire = timeExpire;
return this;
}
/**
* 订单绝对超时时间。 格式为yyyy-MM-dd HH:mm:ss。 注:time_expire和timeout_express两者只需传入一个或者都不传,如果两者都传,优先使用time_expire。
* @return timeExpire
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2021-12-31 10:05:00", value = "订单绝对超时时间。 格式为yyyy-MM-dd HH:mm:ss。 注:time_expire和timeout_express两者只需传入一个或者都不传,如果两者都传,优先使用time_expire。")
public String getTimeExpire() {
return timeExpire;
}
public void setTimeExpire(String timeExpire) {
this.timeExpire = timeExpire;
}
public AlipayTradePrecreateModel timeoutExpress(String timeoutExpress) {
this.timeoutExpress = timeoutExpress;
return this;
}
/**
* 订单相对超时时间。 从预下单请求时间开始计算。 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 当面付场景默认值为3h,如需指定,推荐设置5m及以上 注: 1. 二维码最长有效期是2小时,不管该参数传递的值是多少,超过2小时后二维码都将失效不能再进行扫码支付。 2. time_expire和timeout_express两者只需传入一个或者都不传,如果两者都传,优先使用time_expire。
* @return timeoutExpress
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "90m", value = "订单相对超时时间。 从预下单请求时间开始计算。 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 当面付场景默认值为3h,如需指定,推荐设置5m及以上 注: 1. 二维码最长有效期是2小时,不管该参数传递的值是多少,超过2小时后二维码都将失效不能再进行扫码支付。 2. time_expire和timeout_express两者只需传入一个或者都不传,如果两者都传,优先使用time_expire。")
public String getTimeoutExpress() {
return timeoutExpress;
}
public void setTimeoutExpress(String timeoutExpress) {
this.timeoutExpress = timeoutExpress;
}
public AlipayTradePrecreateModel totalAmount(String totalAmount) {
this.totalAmount = totalAmount;
return this;
}
/**
* 订单总金额。 单位为元,精确到小数点后两位,取值范围:[0.01,100000000] 。
* @return totalAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "88.88", value = "订单总金额。 单位为元,精确到小数点后两位,取值范围:[0.01,100000000] 。")
public String getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(String totalAmount) {
this.totalAmount = totalAmount;
}
public AlipayTradePrecreateModel undiscountableAmount(String undiscountableAmount) {
this.undiscountableAmount = undiscountableAmount;
return this;
}
/**
* 不可打折金额。 不参与优惠计算的金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]。 如果同时传入了【可打折金额】、【不可打折金额】和【订单总金额】,则必须满足如下条件:【订单总金额】=【可打折金额】+【不可打折金额】。 如果订单金额全部参与优惠计算,则【可打折金额】和【不可打折金额】都无需传入。
* @return undiscountableAmount
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "8.88", value = "不可打折金额。 不参与优惠计算的金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]。 如果同时传入了【可打折金额】、【不可打折金额】和【订单总金额】,则必须满足如下条件:【订单总金额】=【可打折金额】+【不可打折金额】。 如果订单金额全部参与优惠计算,则【可打折金额】和【不可打折金额】都无需传入。")
public String getUndiscountableAmount() {
return undiscountableAmount;
}
public void setUndiscountableAmount(String undiscountableAmount) {
this.undiscountableAmount = undiscountableAmount;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the AlipayTradePrecreateModel instance itself
*/
public AlipayTradePrecreateModel putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AlipayTradePrecreateModel alipayTradePrecreateModel = (AlipayTradePrecreateModel) o;
return Objects.equals(this.alipayStoreId, alipayTradePrecreateModel.alipayStoreId) &&
Objects.equals(this.bkagentReqInfo, alipayTradePrecreateModel.bkagentReqInfo) &&
Objects.equals(this.body, alipayTradePrecreateModel.body) &&
Objects.equals(this.businessParams, alipayTradePrecreateModel.businessParams) &&
Objects.equals(this.buyerLogonId, alipayTradePrecreateModel.buyerLogonId) &&
Objects.equals(this.codeType, alipayTradePrecreateModel.codeType) &&
Objects.equals(this.disablePayChannels, alipayTradePrecreateModel.disablePayChannels) &&
Objects.equals(this.discountableAmount, alipayTradePrecreateModel.discountableAmount) &&
Objects.equals(this.enablePayChannels, alipayTradePrecreateModel.enablePayChannels) &&
Objects.equals(this.extUserInfo, alipayTradePrecreateModel.extUserInfo) &&
Objects.equals(this.extendParams, alipayTradePrecreateModel.extendParams) &&
Objects.equals(this.goodsDetail, alipayTradePrecreateModel.goodsDetail) &&
Objects.equals(this.merchantOrderNo, alipayTradePrecreateModel.merchantOrderNo) &&
Objects.equals(this.notifyUrl, alipayTradePrecreateModel.notifyUrl) &&
Objects.equals(this.operatorId, alipayTradePrecreateModel.operatorId) &&
Objects.equals(this.outTradeNo, alipayTradePrecreateModel.outTradeNo) &&
Objects.equals(this.passbackParams, alipayTradePrecreateModel.passbackParams) &&
Objects.equals(this.productCode, alipayTradePrecreateModel.productCode) &&
Objects.equals(this.qrCodeTimeoutExpress, alipayTradePrecreateModel.qrCodeTimeoutExpress) &&
Objects.equals(this.queryOptions, alipayTradePrecreateModel.queryOptions) &&
Objects.equals(this.royaltyInfo, alipayTradePrecreateModel.royaltyInfo) &&
Objects.equals(this.sellerId, alipayTradePrecreateModel.sellerId) &&
Objects.equals(this.settleInfo, alipayTradePrecreateModel.settleInfo) &&
Objects.equals(this.storeId, alipayTradePrecreateModel.storeId) &&
Objects.equals(this.subMerchant, alipayTradePrecreateModel.subMerchant) &&
Objects.equals(this.subject, alipayTradePrecreateModel.subject) &&
Objects.equals(this.terminalId, alipayTradePrecreateModel.terminalId) &&
Objects.equals(this.timeExpire, alipayTradePrecreateModel.timeExpire) &&
Objects.equals(this.timeoutExpress, alipayTradePrecreateModel.timeoutExpress) &&
Objects.equals(this.totalAmount, alipayTradePrecreateModel.totalAmount) &&
Objects.equals(this.undiscountableAmount, alipayTradePrecreateModel.undiscountableAmount)&&
Objects.equals(this.additionalProperties, alipayTradePrecreateModel.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(alipayStoreId, bkagentReqInfo, body, businessParams, buyerLogonId, codeType, disablePayChannels, discountableAmount, enablePayChannels, extUserInfo, extendParams, goodsDetail, merchantOrderNo, notifyUrl, operatorId, outTradeNo, passbackParams, productCode, qrCodeTimeoutExpress, queryOptions, royaltyInfo, sellerId, settleInfo, storeId, subMerchant, subject, terminalId, timeExpire, timeoutExpress, totalAmount, undiscountableAmount, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AlipayTradePrecreateModel {\n");
sb.append(" alipayStoreId: ").append(toIndentedString(alipayStoreId)).append("\n");
sb.append(" bkagentReqInfo: ").append(toIndentedString(bkagentReqInfo)).append("\n");
sb.append(" body: ").append(toIndentedString(body)).append("\n");
sb.append(" businessParams: ").append(toIndentedString(businessParams)).append("\n");
sb.append(" buyerLogonId: ").append(toIndentedString(buyerLogonId)).append("\n");
sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n");
sb.append(" disablePayChannels: ").append(toIndentedString(disablePayChannels)).append("\n");
sb.append(" discountableAmount: ").append(toIndentedString(discountableAmount)).append("\n");
sb.append(" enablePayChannels: ").append(toIndentedString(enablePayChannels)).append("\n");
sb.append(" extUserInfo: ").append(toIndentedString(extUserInfo)).append("\n");
sb.append(" extendParams: ").append(toIndentedString(extendParams)).append("\n");
sb.append(" goodsDetail: ").append(toIndentedString(goodsDetail)).append("\n");
sb.append(" merchantOrderNo: ").append(toIndentedString(merchantOrderNo)).append("\n");
sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n");
sb.append(" operatorId: ").append(toIndentedString(operatorId)).append("\n");
sb.append(" outTradeNo: ").append(toIndentedString(outTradeNo)).append("\n");
sb.append(" passbackParams: ").append(toIndentedString(passbackParams)).append("\n");
sb.append(" productCode: ").append(toIndentedString(productCode)).append("\n");
sb.append(" qrCodeTimeoutExpress: ").append(toIndentedString(qrCodeTimeoutExpress)).append("\n");
sb.append(" queryOptions: ").append(toIndentedString(queryOptions)).append("\n");
sb.append(" royaltyInfo: ").append(toIndentedString(royaltyInfo)).append("\n");
sb.append(" sellerId: ").append(toIndentedString(sellerId)).append("\n");
sb.append(" settleInfo: ").append(toIndentedString(settleInfo)).append("\n");
sb.append(" storeId: ").append(toIndentedString(storeId)).append("\n");
sb.append(" subMerchant: ").append(toIndentedString(subMerchant)).append("\n");
sb.append(" subject: ").append(toIndentedString(subject)).append("\n");
sb.append(" terminalId: ").append(toIndentedString(terminalId)).append("\n");
sb.append(" timeExpire: ").append(toIndentedString(timeExpire)).append("\n");
sb.append(" timeoutExpress: ").append(toIndentedString(timeoutExpress)).append("\n");
sb.append(" totalAmount: ").append(toIndentedString(totalAmount)).append("\n");
sb.append(" undiscountableAmount: ").append(toIndentedString(undiscountableAmount)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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("alipay_store_id");
openapiFields.add("bkagent_req_info");
openapiFields.add("body");
openapiFields.add("business_params");
openapiFields.add("buyer_logon_id");
openapiFields.add("code_type");
openapiFields.add("disable_pay_channels");
openapiFields.add("discountable_amount");
openapiFields.add("enable_pay_channels");
openapiFields.add("ext_user_info");
openapiFields.add("extend_params");
openapiFields.add("goods_detail");
openapiFields.add("merchant_order_no");
openapiFields.add("notify_url");
openapiFields.add("operator_id");
openapiFields.add("out_trade_no");
openapiFields.add("passback_params");
openapiFields.add("product_code");
openapiFields.add("qr_code_timeout_express");
openapiFields.add("query_options");
openapiFields.add("royalty_info");
openapiFields.add("seller_id");
openapiFields.add("settle_info");
openapiFields.add("store_id");
openapiFields.add("sub_merchant");
openapiFields.add("subject");
openapiFields.add("terminal_id");
openapiFields.add("time_expire");
openapiFields.add("timeout_express");
openapiFields.add("total_amount");
openapiFields.add("undiscountable_amount");
// 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 AlipayTradePrecreateModel
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (AlipayTradePrecreateModel.openapiRequiredFields.isEmpty()) {
return;
} else { // has required fields
throw new IllegalArgumentException(String.format("The required field(s) %s in AlipayTradePrecreateModel is not found in the empty JSON string", AlipayTradePrecreateModel.openapiRequiredFields.toString()));
}
}
if (jsonObj.get("alipay_store_id") != null && !jsonObj.get("alipay_store_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `alipay_store_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("alipay_store_id").toString()));
}
// validate the optional field `bkagent_req_info`
if (jsonObj.getAsJsonObject("bkagent_req_info") != null) {
BkAgentReqInfo.validateJsonObject(jsonObj.getAsJsonObject("bkagent_req_info"));
}
if (jsonObj.get("body") != null && !jsonObj.get("body").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `body` to be a primitive type in the JSON string but got `%s`", jsonObj.get("body").toString()));
}
// validate the optional field `business_params`
if (jsonObj.getAsJsonObject("business_params") != null) {
BusinessParams.validateJsonObject(jsonObj.getAsJsonObject("business_params"));
}
if (jsonObj.get("buyer_logon_id") != null && !jsonObj.get("buyer_logon_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `buyer_logon_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("buyer_logon_id").toString()));
}
if (jsonObj.get("code_type") != null && !jsonObj.get("code_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `code_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code_type").toString()));
}
if (jsonObj.get("disable_pay_channels") != null && !jsonObj.get("disable_pay_channels").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `disable_pay_channels` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disable_pay_channels").toString()));
}
if (jsonObj.get("discountable_amount") != null && !jsonObj.get("discountable_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `discountable_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("discountable_amount").toString()));
}
if (jsonObj.get("enable_pay_channels") != null && !jsonObj.get("enable_pay_channels").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `enable_pay_channels` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enable_pay_channels").toString()));
}
// validate the optional field `ext_user_info`
if (jsonObj.getAsJsonObject("ext_user_info") != null) {
ExtUserInfo.validateJsonObject(jsonObj.getAsJsonObject("ext_user_info"));
}
// validate the optional field `extend_params`
if (jsonObj.getAsJsonObject("extend_params") != null) {
ExtendParams.validateJsonObject(jsonObj.getAsJsonObject("extend_params"));
}
JsonArray jsonArraygoodsDetail = jsonObj.getAsJsonArray("goods_detail");
if (jsonArraygoodsDetail != null) {
// ensure the json data is an array
if (!jsonObj.get("goods_detail").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `goods_detail` to be an array in the JSON string but got `%s`", jsonObj.get("goods_detail").toString()));
}
// validate the optional field `goods_detail` (array)
for (int i = 0; i < jsonArraygoodsDetail.size(); i++) {
GoodsDetail.validateJsonObject(jsonArraygoodsDetail.get(i).getAsJsonObject());
};
}
if (jsonObj.get("merchant_order_no") != null && !jsonObj.get("merchant_order_no").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `merchant_order_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("merchant_order_no").toString()));
}
if (jsonObj.get("notify_url") != null && !jsonObj.get("notify_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `notify_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notify_url").toString()));
}
if (jsonObj.get("operator_id") != null && !jsonObj.get("operator_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `operator_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operator_id").toString()));
}
if (jsonObj.get("out_trade_no") != null && !jsonObj.get("out_trade_no").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `out_trade_no` to be a primitive type in the JSON string but got `%s`", jsonObj.get("out_trade_no").toString()));
}
if (jsonObj.get("passback_params") != null && !jsonObj.get("passback_params").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `passback_params` to be a primitive type in the JSON string but got `%s`", jsonObj.get("passback_params").toString()));
}
if (jsonObj.get("product_code") != null && !jsonObj.get("product_code").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `product_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("product_code").toString()));
}
if (jsonObj.get("qr_code_timeout_express") != null && !jsonObj.get("qr_code_timeout_express").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `qr_code_timeout_express` to be a primitive type in the JSON string but got `%s`", jsonObj.get("qr_code_timeout_express").toString()));
}
// ensure the json data is an array
if (jsonObj.get("query_options") != null && !jsonObj.get("query_options").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `query_options` to be an array in the JSON string but got `%s`", jsonObj.get("query_options").toString()));
}
// validate the optional field `royalty_info`
if (jsonObj.getAsJsonObject("royalty_info") != null) {
RoyaltyInfo.validateJsonObject(jsonObj.getAsJsonObject("royalty_info"));
}
if (jsonObj.get("seller_id") != null && !jsonObj.get("seller_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `seller_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("seller_id").toString()));
}
// validate the optional field `settle_info`
if (jsonObj.getAsJsonObject("settle_info") != null) {
SettleInfo.validateJsonObject(jsonObj.getAsJsonObject("settle_info"));
}
if (jsonObj.get("store_id") != null && !jsonObj.get("store_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `store_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("store_id").toString()));
}
// validate the optional field `sub_merchant`
if (jsonObj.getAsJsonObject("sub_merchant") != null) {
SubMerchant.validateJsonObject(jsonObj.getAsJsonObject("sub_merchant"));
}
if (jsonObj.get("subject") != null && !jsonObj.get("subject").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `subject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject").toString()));
}
if (jsonObj.get("terminal_id") != null && !jsonObj.get("terminal_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `terminal_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("terminal_id").toString()));
}
if (jsonObj.get("time_expire") != null && !jsonObj.get("time_expire").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `time_expire` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_expire").toString()));
}
if (jsonObj.get("timeout_express") != null && !jsonObj.get("timeout_express").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `timeout_express` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timeout_express").toString()));
}
if (jsonObj.get("total_amount") != null && !jsonObj.get("total_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `total_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("total_amount").toString()));
}
if (jsonObj.get("undiscountable_amount") != null && !jsonObj.get("undiscountable_amount").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `undiscountable_amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("undiscountable_amount").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!AlipayTradePrecreateModel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'AlipayTradePrecreateModel' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(AlipayTradePrecreateModel.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, AlipayTradePrecreateModel value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else {
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}
elementAdapter.write(out, obj);
}
@Override
public AlipayTradePrecreateModel read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
// store additional fields in the deserialized instance
AlipayTradePrecreateModel instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();
}
}
/**
* Create an instance of AlipayTradePrecreateModel given an JSON string
*
* @param jsonString JSON string
* @return An instance of AlipayTradePrecreateModel
* @throws IOException if the JSON string is invalid with respect to AlipayTradePrecreateModel
*/
public static AlipayTradePrecreateModel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, AlipayTradePrecreateModel.class);
}
/**
* Convert an instance of AlipayTradePrecreateModel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}