Sha256: ea5148646bd717b702aca94ca555a081aaa1800d9fdbb9432e7f4317c333452b

Contents?: true

Size: 817 Bytes

Versions: 27

Compression:

Stored size: 817 Bytes

Contents

module Braintree
  class Transaction
    class CreditCardDetails # :nodoc:
      include BaseModule

      attr_reader :bin, :card_type, :cardholder_name, :customer_location, :expiration_month,
        :expiration_year, :last_4, :token

      def initialize(attributes)
        set_instance_variables_from_hash attributes unless attributes.nil?
      end

      def expiration_date
        "#{expiration_month}/#{expiration_year}"
      end

      def inspect
        attr_order = [:token, :bin, :last_4, :card_type, :expiration_date, :cardholder_name, :customer_location]
        formatted_attrs = attr_order.map do |attr|
          "#{attr}: #{send(attr).inspect}"
        end
        "#<#{formatted_attrs.join(", ")}>"
      end

      def masked_number
        "#{bin}******#{last_4}"
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
braintree-2.20.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.19.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.18.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.17.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.16.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.15.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.14.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.13.4 lib/braintree/transaction/credit_card_details.rb
braintree-2.13.3 lib/braintree/transaction/credit_card_details.rb
braintree-2.13.2 lib/braintree/transaction/credit_card_details.rb
braintree-2.13.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.10.3 lib/braintree/transaction/credit_card_details.rb
braintree-2.13.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.12.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.11.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.10.2 lib/braintree/transaction/credit_card_details.rb
braintree-2.10.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.10.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.9.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.8.0 lib/braintree/transaction/credit_card_details.rb