class Braintree::CreditCard
Constants
- Business
Attributes
Public Class Methods
Source
# File lib/braintree/credit_card.rb, line 206 def self._attributes [ :billing_address, :bin, :business, :card_type, :cardholder_name, :commercial, :consumer, :corporate, :country_of_issuance, :created_at, :customer_id, :debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare, :image_url, :is_network_tokenized?, :issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :purchase, :token, :updated_at ] end
Source
# File lib/braintree/credit_card.rb, line 215 def self._new(*args) self.new(*args) end
Source
# File lib/braintree/credit_card.rb, line 82 def self.create(*args) Configuration.gateway.credit_card.create(*args) end
Source
# File lib/braintree/credit_card.rb, line 86 def self.create!(*args) Configuration.gateway.credit_card.create!(*args) end
Source
# File lib/braintree/credit_card.rb, line 92 def self.credit(token, transaction_attributes) warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead" Transaction.credit(transaction_attributes.merge(:payment_method_token => token)) end
NEXT_MAJOR_VERSION remove this method CreditCard.credit
has been deprecated in favor of Transaction.credit
Source
# File lib/braintree/credit_card.rb, line 99 def self.credit!(token, transaction_attributes) warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead" return_object_or_raise(:transaction) { credit(token, transaction_attributes) } end
NEXT_MAJOR_VERSION remove this method CreditCard.credit
has been deprecated in favor of Transaction.credit
Source
# File lib/braintree/credit_card.rb, line 104 def self.delete(*args) Configuration.gateway.credit_card.delete(*args) end
Source
# File lib/braintree/credit_card.rb, line 108 def self.expired(*args) Configuration.gateway.credit_card.expired(*args) end
Source
# File lib/braintree/credit_card.rb, line 112 def self.expiring_between(*args) Configuration.gateway.credit_card.expiring_between(*args) end
Source
# File lib/braintree/credit_card.rb, line 116 def self.find(*args) Configuration.gateway.credit_card.find(*args) end
Source
# File lib/braintree/credit_card.rb, line 120 def self.from_nonce(*args) Configuration.gateway.credit_card.from_nonce(*args) end
Source
# File lib/braintree/credit_card.rb, line 126 def self.sale(token, transaction_attributes) warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead" Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token)) end
NEXT_MAJOR_VERSION remove this method CreditCard.sale
has been deprecated in favor of Transaction.sale
Source
# File lib/braintree/credit_card.rb, line 133 def self.sale!(token, transaction_attributes) warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead" return_object_or_raise(:transaction) { sale(token, transaction_attributes) } end
NEXT_MAJOR_VERSION remove this method CreditCard.sale
has been deprecated in favor of Transaction.sale
Source
# File lib/braintree/credit_card.rb, line 138 def self.update(*args) Configuration.gateway.credit_card.update(*args) end
Source
# File lib/braintree/credit_card.rb, line 142 def self.update!(*args) Configuration.gateway.credit_card.update!(*args) end
Protected Class Methods
Source
# File lib/braintree/credit_card.rb, line 146 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
Source
# File lib/braintree/credit_card.rb, line 154 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
Source
# File lib/braintree/credit_card.rb, line 164 def expiration_date "#{expiration_month}/#{expiration_year}" end
Expiration date formatted as MM/YYYY
Source
# File lib/braintree/credit_card.rb, line 172 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
Source
# File lib/braintree/credit_card.rb, line 198 def is_network_tokenized? @is_network_tokenized end
Source
# File lib/braintree/credit_card.rb, line 181 def masked_number "#{bin}******#{last_4}" end
Source
# File lib/braintree/credit_card.rb, line 185 def nonce @nonce ||= PaymentMethodNonce.create(token) end
Source
# File lib/braintree/credit_card.rb, line 193 def venmo_sdk? warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead." @venmo_sdk end
NEXT_MAJOR_VERSION can this be removed? Venmo SDK integration is no more Returns true if the card is associated with Venmo SDK NEXT_MAJOR_VERSION Remove this method The old venmo SDK class has been deprecated