class Braintree::VisaCheckoutCard

Attributes

billing_address[R]
bin[R]
call_id[R]
card_type[R]
cardholder_name[R]
commercial[R]
country_of_issuance[R]
created_at[R]
customer_id[R]
customer_location[R]
debit[R]
durbin_regulated[R]
expiration_month[R]
expiration_year[R]
healthcare[R]
image_url[R]
issuing_bank[R]
last_4[R]
payroll[R]
prepaid[R]
product_id[R]
subscriptions[R]
token[R]
unique_number_identifier[R]
updated_at[R]
verification[R]

Public Class Methods

_attributes() click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 76
def self._attributes
  [
    :billing_address, :bin, :card_type, :cardholder_name, :created_at,
    :customer_id, :customer_location, :expiration_month, :expiration_year,
    :last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
    :commercial, :debit, :durbin_regulated, :healthcare,
    :country_of_issuance, :issuing_bank, :image_url, :call_id
  ]
end
_new(*args) click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 86
def self._new(*args)
  self.new(*args)
end

Protected Class Methods

new(gateway, attributes) click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 33
def initialize(gateway, attributes)
  @gateway = gateway
  set_instance_variables_from_hash(attributes)
  @billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
  @subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
  @verification = _most_recent_verification(attributes)
end

Public Instance Methods

_most_recent_verification(attributes) click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 41
def _most_recent_verification(attributes)
  sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
  CreditCardVerification._new(sorted_verifications) if sorted_verifications
end
default?() click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 46
def default?
  @default
end
expiration_date() click to toggle source

Expiration date formatted as MM/YYYY

# File lib/braintree/visa_checkout_card.rb, line 51
def expiration_date
  "#{expiration_month}/#{expiration_year}"
end
expired?() click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 55
def expired?
  @expired
end
inspect() click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 59
def inspect
  first = [:token]
  order = first + (self.class._attributes - first)
  nice_attributes = order.map do |attr|
    "#{attr}: #{send(attr).inspect}"
  end
  "#<#{self.class} #{nice_attributes.join(', ')}>"
end
masked_number() click to toggle source
# File lib/braintree/visa_checkout_card.rb, line 68
def masked_number
  "#{bin}******#{last_4}"
end