class Braintree::CreditCard

Constants

Commercial

Attributes

billing_address[R]
bin[R]
card_type[R]
cardholder_name[R]
commercial[R]
country_of_issuance[R]
created_at[R]
customer_id[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

create(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 65
def self.create(*args)
  Configuration.gateway.credit_card.create(*args)
end
create!(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 69
def self.create!(*args)
  Configuration.gateway.credit_card.create!(*args)
end
credit(token, transaction_attributes) click to toggle source
# File lib/braintree/credit_card.rb, line 73
def self.credit(token, transaction_attributes)
  Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
end
credit!(token, transaction_attributes) click to toggle source
# File lib/braintree/credit_card.rb, line 77
def self.credit!(token, transaction_attributes)
  return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
end
delete(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 81
def self.delete(*args)
  Configuration.gateway.credit_card.delete(*args)
end
expired(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 85
def self.expired(*args)
  Configuration.gateway.credit_card.expired(*args)
end
expiring_between(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 89
def self.expiring_between(*args)
  Configuration.gateway.credit_card.expiring_between(*args)
end
find(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 93
def self.find(*args)
  Configuration.gateway.credit_card.find(*args)
end
from_nonce(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 97
def self.from_nonce(*args)
  Configuration.gateway.credit_card.from_nonce(*args)
end
sale(token, transaction_attributes) click to toggle source
# File lib/braintree/credit_card.rb, line 101
def self.sale(token, transaction_attributes)
  Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
end
sale!(token, transaction_attributes) click to toggle source
# File lib/braintree/credit_card.rb, line 105
def self.sale!(token, transaction_attributes)
  return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
end
update(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 109
def self.update(*args)
  Configuration.gateway.credit_card.update(*args)
end
update!(*args) click to toggle source
# File lib/braintree/credit_card.rb, line 113
def self.update!(*args)
  Configuration.gateway.credit_card.update!(*args)
end

Public Instance Methods

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

Returns true if this credit card is the customer's default payment method.

# File lib/braintree/credit_card.rb, line 131
def default?
  @default
end
expiration_date() click to toggle source

Expiration date formatted as MM/YYYY

# File lib/braintree/credit_card.rb, line 136
def expiration_date
  "#{expiration_month}/#{expiration_year}"
end
expired?() click to toggle source

Returns true if the credit card is expired.

# File lib/braintree/credit_card.rb, line 141
def expired?
  @expired
end
is_network_tokenized?() click to toggle source
# File lib/braintree/credit_card.rb, line 167
def is_network_tokenized?
  @is_network_tokenized
end
masked_number() click to toggle source
# File lib/braintree/credit_card.rb, line 154
def masked_number
  "#{bin}******#{last_4}"
end
nonce() click to toggle source
# File lib/braintree/credit_card.rb, line 158
def nonce
  @nonce ||= PaymentMethodNonce.create(token)
end
venmo_sdk?() click to toggle source

Returns true if the card is associated with Venmo SDK

# File lib/braintree/credit_card.rb, line 163
def venmo_sdk?
  @venmo_sdk
end