All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openapitools.client.model.Card Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
* Quickstart API Reference
* Zuora Quickstart API is the API that helps you achieve fundamental use cases.
* It provides a much simplified object model and improved performance, enabling developers to easily learn and use.
*/

package org.openapitools.client.model;

import java.util.Objects;
import java.util.Arrays;
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.math.BigDecimal;
import org.openapitools.client.model.CardMandate;

import org.openapitools.client.JSON.CustomFieldAdapter;
import org.openapitools.client.JSON.NullableFieldAdapter;
/**
 * Credit card information. When providing a card number, you must meet the requirements for PCI compliance. We strongly recommend using Zuora's [Payment Pages 2.0](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/LA_Hosted_Payment_Pages/B_Payment_Pages_2.0) instead of interacting with this API directly.
 */
@ApiModel(description = "Credit card information. When providing a card number, you must meet the requirements for PCI compliance. We strongly recommend using Zuora's [Payment Pages 2.0](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/LA_Hosted_Payment_Pages/B_Payment_Pages_2.0) instead of interacting with this API directly.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Card {
  public static final String SERIALIZED_NAME_CARD_NUMBER = "card_number";
  @SerializedName(SERIALIZED_NAME_CARD_NUMBER)
  private String cardNumber;

  /**
   * Card brand.
   */
  @JsonAdapter(BrandEnum.Adapter.class)
  public enum BrandEnum {
    VISA("visa"),
    
    MASTERCARD("mastercard"),
    
    AMERICAN_EXPRESS("american_express"),
    
    DISCOVER("discover"),
    
    JCB("jcb"),
    
    DINERS("diners"),
    
    UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

    private String value;

    BrandEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static BrandEnum fromValue(String value) {
      for (BrandEnum b : BrandEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter {
      @Override
      public void write(final JsonWriter jsonWriter, final BrandEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public BrandEnum read(final JsonReader jsonReader) throws IOException {
        String value =  jsonReader.nextString();
        return BrandEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_BRAND = "brand";
  @SerializedName(SERIALIZED_NAME_BRAND)
  private BrandEnum brand;

  public static final String SERIALIZED_NAME_EXPIRY_MONTH = "expiry_month";
  @SerializedName(SERIALIZED_NAME_EXPIRY_MONTH)
  private BigDecimal expiryMonth;

  public static final String SERIALIZED_NAME_EXPIRY_YEAR = "expiry_year";
  @SerializedName(SERIALIZED_NAME_EXPIRY_YEAR)
  private BigDecimal expiryYear;

  public static final String SERIALIZED_NAME_SECURITY_CODE = "security_code";
  @SerializedName(SERIALIZED_NAME_SECURITY_CODE)
  private String securityCode;

  public static final String SERIALIZED_NAME_MANDATE = "mandate";
  @SerializedName(SERIALIZED_NAME_MANDATE)
  private CardMandate mandate;

  public static final String SERIALIZED_NAME_LAST4 = "last_4";
  @SerializedName(SERIALIZED_NAME_LAST4)
  private String last4;

  public Card() { 
  }

  
  public Card(
     String last4
  ) {
    this();
    this.last4 = last4;
  }

  public Card cardNumber(String cardNumber) {
    
    this.cardNumber = cardNumber;
    return this;
  }

   /**
   * The card number, as a string without any separators.
   * @return cardNumber
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "4001100010112042", required = true, value = "The card number, as a string without any separators.")

  public String getCardNumber() {
    return cardNumber;
  }


  public void setCardNumber(String cardNumber) {
    this.cardNumber = cardNumber;
  }


  public Card brand(BrandEnum brand) {
    
    this.brand = brand;
    return this;
  }

   /**
   * Card brand.
   * @return brand
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "Card brand.")

  public BrandEnum getBrand() {
    return brand;
  }


  public void setBrand(BrandEnum brand) {
    this.brand = brand;
  }


  public Card expiryMonth(BigDecimal expiryMonth) {
    
    this.expiryMonth = expiryMonth;
    return this;
  }

   /**
   * One or two digit expiration month (1-12) of the credit card.
   * @return expiryMonth
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "10", required = true, value = "One or two digit expiration month (1-12) of the credit card.")

  public BigDecimal getExpiryMonth() {
    return expiryMonth;
  }


  public void setExpiryMonth(BigDecimal expiryMonth) {
    this.expiryMonth = expiryMonth;
  }


  public Card expiryYear(BigDecimal expiryYear) {
    
    this.expiryYear = expiryYear;
    return this;
  }

   /**
   * Two- or four-digit number representing the card's expiration year.
   * @return expiryYear
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "2024", required = true, value = "Two- or four-digit number representing the card's expiration year.")

  public BigDecimal getExpiryYear() {
    return expiryYear;
  }


  public void setExpiryYear(BigDecimal expiryYear) {
    this.expiryYear = expiryYear;
  }


  public Card securityCode(String securityCode) {
    
    this.securityCode = securityCode;
    return this;
  }

   /**
   * Card security code. It is highly recommended to always include this value.
   * @return securityCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "111", value = "Card security code. It is highly recommended to always include this value.")

  public String getSecurityCode() {
    return securityCode;
  }


  public void setSecurityCode(String securityCode) {
    this.securityCode = securityCode;
  }


  public Card mandate(CardMandate mandate) {
    
    this.mandate = mandate;
    return this;
  }

   /**
   * Get mandate
   * @return mandate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public CardMandate getMandate() {
    return mandate;
  }


  public void setMandate(CardMandate mandate) {
    this.mandate = mandate;
  }


   /**
   * The last four digits of the card number.
   * @return last4
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2042", value = "The last four digits of the card number.")

  public String getLast4() {
    return last4;
  }




  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Card card = (Card) o;
    return Objects.equals(this.cardNumber, card.cardNumber) &&
        Objects.equals(this.brand, card.brand) &&
        Objects.equals(this.expiryMonth, card.expiryMonth) &&
        Objects.equals(this.expiryYear, card.expiryYear) &&
        Objects.equals(this.securityCode, card.securityCode) &&
        Objects.equals(this.mandate, card.mandate) &&
        Objects.equals(this.last4, card.last4);
  }

  @Override
  public int hashCode() {
    return Objects.hash(cardNumber, brand, expiryMonth, expiryYear, securityCode, mandate, last4);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Card {\n");
    sb.append("    cardNumber: ").append(toIndentedString(cardNumber)).append("\n");
    sb.append("    brand: ").append(toIndentedString(brand)).append("\n");
    sb.append("    expiryMonth: ").append(toIndentedString(expiryMonth)).append("\n");
    sb.append("    expiryYear: ").append(toIndentedString(expiryYear)).append("\n");
    sb.append("    securityCode: ").append(toIndentedString(securityCode)).append("\n");
    sb.append("    mandate: ").append(toIndentedString(mandate)).append("\n");
    sb.append("    last4: ").append(toIndentedString(last4)).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    ");
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy