com.alipay.v3.model.AlipayTradeCreateModel Maven / Gradle / Ivy
The newest version!
/*
* 支付宝开放平台API
* 支付宝开放平台v3协议文档
*
* The version of the OpenAPI document: 2024-08-30
*
*
* 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.LogisticsDetail;
import com.alipay.v3.model.ReceiverAddressInfo;
import com.alipay.v3.model.RoyaltyInfo;
import com.alipay.v3.model.SettleInfo;
import com.alipay.v3.model.SignParams;
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;
/**
* AlipayTradeCreateModel
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AlipayTradeCreateModel {
public static final String SERIALIZED_NAME_AGREEMENT_SIGN_PARAMS = "agreement_sign_params";
@SerializedName(SERIALIZED_NAME_AGREEMENT_SIGN_PARAMS)
private SignParams agreementSignParams;
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_ID = "buyer_id";
@SerializedName(SERIALIZED_NAME_BUYER_ID)
private String buyerId;
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_BUYER_OPEN_ID = "buyer_open_id";
@SerializedName(SERIALIZED_NAME_BUYER_OPEN_ID)
private String buyerOpenId;
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_LOGISTICS_DETAIL = "logistics_detail";
@SerializedName(SERIALIZED_NAME_LOGISTICS_DETAIL)
private LogisticsDetail logisticsDetail;
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_OP_APP_ID = "op_app_id";
@SerializedName(SERIALIZED_NAME_OP_APP_ID)
private String opAppId;
public static final String SERIALIZED_NAME_OP_BUYER_OPEN_ID = "op_buyer_open_id";
@SerializedName(SERIALIZED_NAME_OP_BUYER_OPEN_ID)
private String opBuyerOpenId;
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_QUERY_OPTIONS = "query_options";
@SerializedName(SERIALIZED_NAME_QUERY_OPTIONS)
private List queryOptions = null;
public static final String SERIALIZED_NAME_RECEIVER_ADDRESS_INFO = "receiver_address_info";
@SerializedName(SERIALIZED_NAME_RECEIVER_ADDRESS_INFO)
private ReceiverAddressInfo receiverAddressInfo;
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 AlipayTradeCreateModel() {
}
public AlipayTradeCreateModel agreementSignParams(SignParams agreementSignParams) {
this.agreementSignParams = agreementSignParams;
return this;
}
/**
* Get agreementSignParams
* @return agreementSignParams
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public SignParams getAgreementSignParams() {
return agreementSignParams;
}
public void setAgreementSignParams(SignParams agreementSignParams) {
this.agreementSignParams = agreementSignParams;
}
public AlipayTradeCreateModel alipayStoreId(String alipayStoreId) {
this.alipayStoreId = alipayStoreId;
return this;
}
/**
* 支付宝店铺编号。 指商户创建门店后支付宝生成的门店ID。
* @return alipayStoreId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2016041400077000000003314986", value = "支付宝店铺编号。 指商户创建门店后支付宝生成的门店ID。")
public String getAlipayStoreId() {
return alipayStoreId;
}
public void setAlipayStoreId(String alipayStoreId) {
this.alipayStoreId = alipayStoreId;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel buyerId(String buyerId) {
this.buyerId = buyerId;
return this;
}
/**
* 买家支付宝用户ID。 2088开头的16位纯数字,小程序场景下获取用户ID请参考:<a target=\"_blank\" href=\"https://opendocs.alipay.com/mini/introduce/authcode\" >用户授权</a>; 其它场景下获取用户ID请参考:<a target=\"_blank\" href=\"https://opendocs.alipay.com/open/284/106001/#s4\" >网页授权获取用户信息</a>; 注:交易的买家与卖家不能相同。
* @return buyerId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2088102146225135", value = "买家支付宝用户ID。 2088开头的16位纯数字,小程序场景下获取用户ID请参考:用户授权; 其它场景下获取用户ID请参考:网页授权获取用户信息; 注:交易的买家与卖家不能相同。")
public String getBuyerId() {
return buyerId;
}
public void setBuyerId(String buyerId) {
this.buyerId = buyerId;
}
public AlipayTradeCreateModel buyerLogonId(String buyerLogonId) {
this.buyerLogonId = buyerLogonId;
return this;
}
/**
* 买家支付宝登录账号。 建议通过open_id来传递买家信息。
* @return buyerLogonId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "15901825620", value = "买家支付宝登录账号。 建议通过open_id来传递买家信息。")
public String getBuyerLogonId() {
return buyerLogonId;
}
public void setBuyerLogonId(String buyerLogonId) {
this.buyerLogonId = buyerLogonId;
}
public AlipayTradeCreateModel buyerOpenId(String buyerOpenId) {
this.buyerOpenId = buyerOpenId;
return this;
}
/**
* 买家支付宝用户唯一标识
* @return buyerOpenId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5", value = "买家支付宝用户唯一标识")
public String getBuyerOpenId() {
return buyerOpenId;
}
public void setBuyerOpenId(String buyerOpenId) {
this.buyerOpenId = buyerOpenId;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel goodsDetail(List goodsDetail) {
this.goodsDetail = goodsDetail;
return this;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel logisticsDetail(LogisticsDetail logisticsDetail) {
this.logisticsDetail = logisticsDetail;
return this;
}
/**
* Get logisticsDetail
* @return logisticsDetail
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public LogisticsDetail getLogisticsDetail() {
return logisticsDetail;
}
public void setLogisticsDetail(LogisticsDetail logisticsDetail) {
this.logisticsDetail = logisticsDetail;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel opAppId(String opAppId) {
this.opAppId = opAppId;
return this;
}
/**
* 小程序支付中,商户实际经营主体的小程序应用的appid
* @return opAppId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "2014072300007148", value = "小程序支付中,商户实际经营主体的小程序应用的appid")
public String getOpAppId() {
return opAppId;
}
public void setOpAppId(String opAppId) {
this.opAppId = opAppId;
}
public AlipayTradeCreateModel opBuyerOpenId(String opBuyerOpenId) {
this.opBuyerOpenId = opBuyerOpenId;
return this;
}
/**
* 买家支付宝用户唯一标识(商户实际经营主体的小程序应用关联的买家open_id)
* @return opBuyerOpenId
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5", value = "买家支付宝用户唯一标识(商户实际经营主体的小程序应用关联的买家open_id)")
public String getOpBuyerOpenId() {
return opBuyerOpenId;
}
public void setOpBuyerOpenId(String opBuyerOpenId) {
this.opBuyerOpenId = opBuyerOpenId;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel queryOptions(List queryOptions) {
this.queryOptions = queryOptions;
return this;
}
public AlipayTradeCreateModel addQueryOptionsItem(String queryOptionsItem) {
if (this.queryOptions == null) {
this.queryOptions = new ArrayList<>();
}
this.queryOptions.add(queryOptionsItem);
return this;
}
/**
* 返回参数选项。 商户通过传递该参数来定制需要额外返回的信息字段,数组格式。包括但不限于:[\"enterprise_pay_info\",\"hyb_amount\"]
* @return queryOptions
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "[\"enterprise_pay_info\",\"hyb_amount\"]", value = "返回参数选项。 商户通过传递该参数来定制需要额外返回的信息字段,数组格式。包括但不限于:[\"enterprise_pay_info\",\"hyb_amount\"]")
public List getQueryOptions() {
return queryOptions;
}
public void setQueryOptions(List queryOptions) {
this.queryOptions = queryOptions;
}
public AlipayTradeCreateModel receiverAddressInfo(ReceiverAddressInfo receiverAddressInfo) {
this.receiverAddressInfo = receiverAddressInfo;
return this;
}
/**
* Get receiverAddressInfo
* @return receiverAddressInfo
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public ReceiverAddressInfo getReceiverAddressInfo() {
return receiverAddressInfo;
}
public void setReceiverAddressInfo(ReceiverAddressInfo receiverAddressInfo) {
this.receiverAddressInfo = receiverAddressInfo;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel timeoutExpress(String timeoutExpress) {
this.timeoutExpress = timeoutExpress;
return this;
}
/**
* 订单相对超时时间。从交易创建时间开始计算。 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。 当面付场景默认值为3h,如需指定,推荐设置5m及以上。 注: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及以上。 注:time_expire和timeout_express两者只需传入一个或者都不传,如果两者都传,优先使用time_expire。")
public String getTimeoutExpress() {
return timeoutExpress;
}
public void setTimeoutExpress(String timeoutExpress) {
this.timeoutExpress = timeoutExpress;
}
public AlipayTradeCreateModel 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 AlipayTradeCreateModel 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 AlipayTradeCreateModel instance itself
*/
public AlipayTradeCreateModel 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;
}
AlipayTradeCreateModel alipayTradeCreateModel = (AlipayTradeCreateModel) o;
return Objects.equals(this.agreementSignParams, alipayTradeCreateModel.agreementSignParams) &&
Objects.equals(this.alipayStoreId, alipayTradeCreateModel.alipayStoreId) &&
Objects.equals(this.bkagentReqInfo, alipayTradeCreateModel.bkagentReqInfo) &&
Objects.equals(this.body, alipayTradeCreateModel.body) &&
Objects.equals(this.businessParams, alipayTradeCreateModel.businessParams) &&
Objects.equals(this.buyerId, alipayTradeCreateModel.buyerId) &&
Objects.equals(this.buyerLogonId, alipayTradeCreateModel.buyerLogonId) &&
Objects.equals(this.buyerOpenId, alipayTradeCreateModel.buyerOpenId) &&
Objects.equals(this.disablePayChannels, alipayTradeCreateModel.disablePayChannels) &&
Objects.equals(this.discountableAmount, alipayTradeCreateModel.discountableAmount) &&
Objects.equals(this.enablePayChannels, alipayTradeCreateModel.enablePayChannels) &&
Objects.equals(this.extUserInfo, alipayTradeCreateModel.extUserInfo) &&
Objects.equals(this.extendParams, alipayTradeCreateModel.extendParams) &&
Objects.equals(this.goodsDetail, alipayTradeCreateModel.goodsDetail) &&
Objects.equals(this.logisticsDetail, alipayTradeCreateModel.logisticsDetail) &&
Objects.equals(this.merchantOrderNo, alipayTradeCreateModel.merchantOrderNo) &&
Objects.equals(this.notifyUrl, alipayTradeCreateModel.notifyUrl) &&
Objects.equals(this.opAppId, alipayTradeCreateModel.opAppId) &&
Objects.equals(this.opBuyerOpenId, alipayTradeCreateModel.opBuyerOpenId) &&
Objects.equals(this.operatorId, alipayTradeCreateModel.operatorId) &&
Objects.equals(this.outTradeNo, alipayTradeCreateModel.outTradeNo) &&
Objects.equals(this.passbackParams, alipayTradeCreateModel.passbackParams) &&
Objects.equals(this.productCode, alipayTradeCreateModel.productCode) &&
Objects.equals(this.queryOptions, alipayTradeCreateModel.queryOptions) &&
Objects.equals(this.receiverAddressInfo, alipayTradeCreateModel.receiverAddressInfo) &&
Objects.equals(this.royaltyInfo, alipayTradeCreateModel.royaltyInfo) &&
Objects.equals(this.sellerId, alipayTradeCreateModel.sellerId) &&
Objects.equals(this.settleInfo, alipayTradeCreateModel.settleInfo) &&
Objects.equals(this.storeId, alipayTradeCreateModel.storeId) &&
Objects.equals(this.subMerchant, alipayTradeCreateModel.subMerchant) &&
Objects.equals(this.subject, alipayTradeCreateModel.subject) &&
Objects.equals(this.terminalId, alipayTradeCreateModel.terminalId) &&
Objects.equals(this.timeExpire, alipayTradeCreateModel.timeExpire) &&
Objects.equals(this.timeoutExpress, alipayTradeCreateModel.timeoutExpress) &&
Objects.equals(this.totalAmount, alipayTradeCreateModel.totalAmount) &&
Objects.equals(this.undiscountableAmount, alipayTradeCreateModel.undiscountableAmount)&&
Objects.equals(this.additionalProperties, alipayTradeCreateModel.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(agreementSignParams, alipayStoreId, bkagentReqInfo, body, businessParams, buyerId, buyerLogonId, buyerOpenId, disablePayChannels, discountableAmount, enablePayChannels, extUserInfo, extendParams, goodsDetail, logisticsDetail, merchantOrderNo, notifyUrl, opAppId, opBuyerOpenId, operatorId, outTradeNo, passbackParams, productCode, queryOptions, receiverAddressInfo, royaltyInfo, sellerId, settleInfo, storeId, subMerchant, subject, terminalId, timeExpire, timeoutExpress, totalAmount, undiscountableAmount, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AlipayTradeCreateModel {\n");
sb.append(" agreementSignParams: ").append(toIndentedString(agreementSignParams)).append("\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(" buyerId: ").append(toIndentedString(buyerId)).append("\n");
sb.append(" buyerLogonId: ").append(toIndentedString(buyerLogonId)).append("\n");
sb.append(" buyerOpenId: ").append(toIndentedString(buyerOpenId)).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(" logisticsDetail: ").append(toIndentedString(logisticsDetail)).append("\n");
sb.append(" merchantOrderNo: ").append(toIndentedString(merchantOrderNo)).append("\n");
sb.append(" notifyUrl: ").append(toIndentedString(notifyUrl)).append("\n");
sb.append(" opAppId: ").append(toIndentedString(opAppId)).append("\n");
sb.append(" opBuyerOpenId: ").append(toIndentedString(opBuyerOpenId)).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(" queryOptions: ").append(toIndentedString(queryOptions)).append("\n");
sb.append(" receiverAddressInfo: ").append(toIndentedString(receiverAddressInfo)).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("agreement_sign_params");
openapiFields.add("alipay_store_id");
openapiFields.add("bkagent_req_info");
openapiFields.add("body");
openapiFields.add("business_params");
openapiFields.add("buyer_id");
openapiFields.add("buyer_logon_id");
openapiFields.add("buyer_open_id");
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("logistics_detail");
openapiFields.add("merchant_order_no");
openapiFields.add("notify_url");
openapiFields.add("op_app_id");
openapiFields.add("op_buyer_open_id");
openapiFields.add("operator_id");
openapiFields.add("out_trade_no");
openapiFields.add("passback_params");
openapiFields.add("product_code");
openapiFields.add("query_options");
openapiFields.add("receiver_address_info");
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 AlipayTradeCreateModel
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (AlipayTradeCreateModel.openapiRequiredFields.isEmpty()) {
return;
} else { // has required fields
throw new IllegalArgumentException(String.format("The required field(s) %s in AlipayTradeCreateModel is not found in the empty JSON string", AlipayTradeCreateModel.openapiRequiredFields.toString()));
}
}
// validate the optional field `agreement_sign_params`
if (jsonObj.getAsJsonObject("agreement_sign_params") != null) {
SignParams.validateJsonObject(jsonObj.getAsJsonObject("agreement_sign_params"));
}
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_id") != null && !jsonObj.get("buyer_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `buyer_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("buyer_id").toString()));
}
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("buyer_open_id") != null && !jsonObj.get("buyer_open_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `buyer_open_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("buyer_open_id").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());
};
}
// validate the optional field `logistics_detail`
if (jsonObj.getAsJsonObject("logistics_detail") != null) {
LogisticsDetail.validateJsonObject(jsonObj.getAsJsonObject("logistics_detail"));
}
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("op_app_id") != null && !jsonObj.get("op_app_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `op_app_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("op_app_id").toString()));
}
if (jsonObj.get("op_buyer_open_id") != null && !jsonObj.get("op_buyer_open_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `op_buyer_open_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("op_buyer_open_id").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()));
}
// 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 `receiver_address_info`
if (jsonObj.getAsJsonObject("receiver_address_info") != null) {
ReceiverAddressInfo.validateJsonObject(jsonObj.getAsJsonObject("receiver_address_info"));
}
// 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 (!AlipayTradeCreateModel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'AlipayTradeCreateModel' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(AlipayTradeCreateModel.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, AlipayTradeCreateModel 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 AlipayTradeCreateModel read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
// store additional fields in the deserialized instance
AlipayTradeCreateModel 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 AlipayTradeCreateModel given an JSON string
*
* @param jsonString JSON string
* @return An instance of AlipayTradeCreateModel
* @throws IOException if the JSON string is invalid with respect to AlipayTradeCreateModel
*/
public static AlipayTradeCreateModel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, AlipayTradeCreateModel.class);
}
/**
* Convert an instance of AlipayTradeCreateModel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}