Class CreditCard.Builder

  • Enclosing class:
    CreditCard

    public static final class CreditCard.Builder
    extends Object
    Builder creates instances of the parent CreditCard from values set by the builder's methods.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • issuerIdNumber

        public CreditCard.Builder issuerIdNumber​(String number)
        Parameters:
        number - The issuer ID number for the credit card. This is the first 6 digits of the credit card number. It identifies the issuing bank.
        Returns:
        The builder object.
        Throws:
        IllegalArgumentException - when number is not a six digit string.
      • last4Digits

        public CreditCard.Builder last4Digits​(String digits)
        Parameters:
        digits - The last four digits of the credit card number.
        Returns:
        The builder object.
        Throws:
        IllegalArgumentException - when number is not a four digit string.
      • bankName

        public CreditCard.Builder bankName​(String name)
        Parameters:
        name - The name of the issuing bank as provided by the end user.
        Returns:
        The builder object.
      • bankPhoneCountryCode

        public CreditCard.Builder bankPhoneCountryCode​(String code)
        Parameters:
        code - The phone country code for the issuing bank as provided by the end user.
        Returns:
        The builder object.
      • bankPhoneNumber

        public CreditCard.Builder bankPhoneNumber​(String number)
        Parameters:
        number - The phone number, without the country code, for the issuing bank as provided by the end user.
        Returns:
        The builder object.
      • avsResult

        public CreditCard.Builder avsResult​(Character code)
        Parameters:
        code - The phone number, without the country code, for the issuing bank as provided by the end user.
        Returns:
        The builder object.
      • cvvResult

        public CreditCard.Builder cvvResult​(Character code)
        Parameters:
        code - The card verification value (CVV) code as provided by the payment processor.
        Returns:
        The builder object.
      • token

        public CreditCard.Builder token​(String token)
        Parameters:
        token - A token uniquely identifying the card. The token should consist of non-space printable ASCII characters. If the token is all digits, it must be more than 19 characters long. The token must not be a primary account number (PAN) or a simple transformation of it. If you have a valid token that looks like a PAN but is not one, you may prefix that token with a fixed string, e.g., "token-".
        Returns:
        The builder object.
        Throws:
        IllegalArgumentException - when the token is invalid.
      • build

        public CreditCard build()
        Returns:
        An instance of CreditCard created from the fields set on this builder.