Sha256: 7349e6f4cd6ef23a20f2a394e66b0b220286e2756706326637dbcd387dee99a3

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

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, :prepaid, :healthcare, :durbin_regulated, :debit,
        :commercial, :payroll, :country_of_issuance, :issuing_bank

      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, :prepaid,
        :healthcare, :durbin_regulated, :debit, :commercial, :payroll, :country_of_issuance, :issuing_bank]
        formatted_attrs = attr_order.map do |attr|
          "#{attr}: #{send(attr).inspect}"
        end
        "#<#{formatted_attrs.join(", ")}>"
      end

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

      def venmo_sdk?
        @venmo_sdk
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
braintree-2.40.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.39.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.38.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.37.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.36.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.35.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.34.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.34.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.33.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.33.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.32.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.31.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.30.2 lib/braintree/transaction/credit_card_details.rb
braintree-2.30.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.29.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.28.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.27.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.27.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.26.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.25.0 lib/braintree/transaction/credit_card_details.rb