package api.unibill.component;
import static api.util.ComponentConstants.DATE_NULL;
import static api.util.ComponentConstants.DATE_NULL_CODE;
import static api.util.ComponentConstants.INTEGER_NULL;
import static api.util.ComponentConstants.INTEGER_NULL_CODE;
import static api.util.ComponentConstants.LONG_NULL;
import static api.util.ComponentConstants.LONG_NULL_CODE;
import static api.util.ComponentConstants.STRING_NULL;
import static api.util.ComponentConstants.STRING_NULL_CODE;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL;
import api.UnoComponent;
import api.unicore.component_manual.PaymentOption;
import api.util.BooleanFormat;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.LongFormat;
import api.util.StringFormat;
import java.util.Date;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import unipay.fields_manual.Fields;
import unipay.validator.CustomValidator;
import unipay.validator.EnumValidator;
import unipay.validator.SensitiveDataValidator;
/**
* @author CodeGen [Alexander Fliagin]
* @company UnitedThinkers
* @since 2018/05/04
*/
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "code", "createDate", "type", "accountNumber", "accountAccessory", "tokenCode", "isActive", "holderName", "csc", "street1", "street2", "city", "countryCode", "state", "zipCode", "customerId", "accountId", "token"})
@JsonPropertyOrder({"id", "code", "createDate", "type", "accountNumber", "accountAccessory", "tokenCode", "isActive", "holderName", "csc", "street1", "street2", "city", "countryCode", "state", "zipCode", "customerId", "accountId", "token"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(PaymentOption.class)
@CustomValidator
public abstract class AbstractPaymentOption extends UnoComponent<unibill.model.PaymentOption> {
@FormParam("id")
@LongFormat
@DefaultValue(LONG_NULL_CODE)
protected Long id;
@FormParam("code")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String code;
@FormParam("createDate")
@DateFormat
@DefaultValue(DATE_NULL_CODE)
protected Date createDate;
@FormParam("type")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String type;
@FormParam("accountNumber")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String accountNumber;
@FormParam("accountAccessory")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String accountAccessory;
@FormParam("tokenCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String tokenCode;
@FormParam("isActive")
@BooleanFormat
protected Boolean isActive;
@FormParam("holderName")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String holderName;
@FormParam("csc")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String csc;
@FormParam("street1")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String street1;
@FormParam("street2")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String street2;
@FormParam("city")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String city;
@FormParam("countryCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String countryCode;
@FormParam("state")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String state;
@FormParam("zipCode")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String zipCode;
@FormParam("customerId")
@LongFormat
@DefaultValue(LONG_NULL_CODE)
protected Long customerId;
@FormParam("accountId")
@IntegerFormat
@DefaultValue(INTEGER_NULL_CODE)
protected Integer accountId;
@FormParam("token")
@StringFormat
@DefaultValue(STRING_NULL_CODE)
protected String token;
public AbstractPaymentOption(){
super();
applyDefaults();
}
public AbstractPaymentOption(unibill.model.PaymentOption object){
super(object);
}
private void applyDefaults() {
if (!isProxyObject()) {
id = LONG_NULL;
code = STRING_NULL;
createDate = DATE_NULL;
type = STRING_NULL;
accountNumber = STRING_NULL;
accountAccessory = STRING_NULL;
tokenCode = STRING_NULL;
holderName = STRING_NULL;
csc = STRING_NULL;
street1 = STRING_NULL;
street2 = STRING_NULL;
city = STRING_NULL;
countryCode = STRING_NULL;
state = STRING_NULL;
zipCode = STRING_NULL;
customerId = LONG_NULL;
accountId = INTEGER_NULL;
token = STRING_NULL;
}
isActive = true;
}
@Override
public void from() {
fromInternal();
super.from();
}
protected abstract void fromInternal();
@Override
public abstract void to();
@Override
public abstract void initializeNew();
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("payment-option: {");
sb.append("id: ");
sb.append(id);
sb.append(',').append(' ');
sb.append("code: ");
sb.append(code);
sb.append(',').append(' ');
sb.append("createDate: ");
sb.append(createDate);
sb.append(',').append(' ');
sb.append("type: ");
sb.append(type);
sb.append(',').append(' ');
sb.append("accountNumber: ");
sb.append(accountNumber);
sb.append(',').append(' ');
sb.append("accountAccessory: ");
sb.append(accountAccessory);
sb.append(',').append(' ');
sb.append("tokenCode: ");
sb.append(tokenCode);
sb.append(',').append(' ');
sb.append("isActive: ");
sb.append(isActive);
sb.append(',').append(' ');
sb.append("holderName: ");
sb.append(holderName);
sb.append(',').append(' ');
sb.append("csc: ");
sb.append(csc);
sb.append(',').append(' ');
sb.append("street1: ");
sb.append(street1);
sb.append(',').append(' ');
sb.append("street2: ");
sb.append(street2);
sb.append(',').append(' ');
sb.append("city: ");
sb.append(city);
sb.append(',').append(' ');
sb.append("countryCode: ");
sb.append(countryCode);
sb.append(',').append(' ');
sb.append("state: ");
sb.append(state);
sb.append(',').append(' ');
sb.append("zipCode: ");
sb.append(zipCode);
sb.append(',').append(' ');
sb.append("customerId: ");
sb.append(customerId);
sb.append(',').append(' ');
sb.append("accountId: ");
sb.append(accountId);
sb.append(',').append(' ');
sb.append("token: ");
sb.append(token);
sb.append('}');
return sb.toString();
}
@XmlAttribute(name="id")
@XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
@FormParam("id")
@LongFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Long getId(){
return id;
}
@XmlAttribute(name="code")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("code")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 60)
@Pattern(regexp = unipay.validator.PatternName.CODE)
public String getCode(){
return code;
}
public void setCode(String value){
this.code = value;
}
@XmlAttribute(name="createDate")
@XmlJavaTypeAdapter(api.util.DateTimeAdapter.class)
@FormParam("createDate")
@DateFormat
@JsonSerialize(using=api.util.DateTimeSerializer.class, include = NON_NULL)
@JsonDeserialize(using=api.util.DateDeserializer.class)
public Date getCreateDate(){
return createDate;
}
@XmlAttribute(name="type")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("type")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 2)
@EnumValidator(unicore.model.PaymentOptionClassifier.class)
public String getType(){
return type;
}
public void setType(String value){
this.type = value;
}
@XmlAttribute(name="accountNumber")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("accountNumber")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(max = 50)
public String getAccountNumber(){
return accountNumber;
}
public void setAccountNumber(String value){
this.accountNumber = value;
}
@XmlAttribute(name="accountAccessory")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("accountAccessory")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(max = 17)
@Pattern(regexp = unipay.validator.PatternName.NUMERIC)
public String getAccountAccessory(){
return accountAccessory;
}
public void setAccountAccessory(String value){
this.accountAccessory = value;
}
@XmlAttribute(name="tokenCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("tokenCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 40)
public String getTokenCode(){
return tokenCode;
}
@XmlAttribute(name="isActive")
@FormParam("isActive")
@BooleanFormat
public Boolean getIsActive(){
return isActive;
}
public void setIsActive(Boolean value){
this.isActive = value;
}
@XmlAttribute(name="holderName")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("holderName")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@NotNull
@Size(max = 150)
@Pattern(regexp = unipay.validator.PatternName.NAME)
@SensitiveDataValidator
public String getHolderName(){
return holderName;
}
public void setHolderName(String value){
this.holderName = value;
}
@XmlAttribute(name="csc")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("csc")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 4)
@Pattern(regexp = unipay.validator.PatternName.NUMERIC)
public String getCsc(){
return csc;
}
public void setCsc(String value){
this.csc = value;
}
@XmlAttribute(name="street1")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("street1")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 128)
@Pattern(regexp = unipay.validator.PatternName.STREET)
public String getStreet1(){
return street1;
}
public void setStreet1(String value){
this.street1 = value;
}
@XmlAttribute(name="street2")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("street2")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 128)
@Pattern(regexp = unipay.validator.PatternName.STREET)
public String getStreet2(){
return street2;
}
public void setStreet2(String value){
this.street2 = value;
}
@XmlAttribute(name="city")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("city")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 50)
@Pattern(regexp = unipay.validator.PatternName.ALPHANUMERIC_EXTENDED)
public String getCity(){
return city;
}
public void setCity(String value){
this.city = value;
}
@XmlAttribute(name="countryCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("countryCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 2)
@Pattern(regexp = unipay.validator.PatternName.ALPHA)
public String getCountryCode(){
return countryCode;
}
public void setCountryCode(String value){
this.countryCode = value;
}
@XmlAttribute(name="state")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("state")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 3)
public String getState(){
return state;
}
public void setState(String value){
this.state = value;
}
@XmlAttribute(name="zipCode")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("zipCode")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 10)
public String getZipCode(){
return zipCode;
}
public void setZipCode(String value){
this.zipCode = value;
}
@XmlAttribute(name="customerId")
@XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
@FormParam("customerId")
@LongFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Long getCustomerId(){
return customerId;
}
@XmlAttribute(name="accountId")
@XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
@FormParam("accountId")
@IntegerFormat
@JsonDeserialize(using=api.util.NumberDeserializer.class)
public Integer getAccountId(){
return accountId;
}
public void setAccountId(Integer value){
this.accountId = value;
}
@XmlAttribute(name="token")
@XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
@FormParam("token")
@StringFormat
@JsonDeserialize(using = api.util.StringDeserializer.class)
@Size(max = 50)
public String getToken(){
return token;
}
public void setToken(String value){
this.token = value;
}
public abstract String getAddress();
}