Sha256: c543866edf498bef6ab40b46f2838137bbd9e5f4148860419b4859eee1e4089d

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 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, :product_id, :country_of_issuance, :issuing_bank, :image_url

      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, :product_id, :country_of_issuance, :issuing_bank, :image_url]
        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

10 entries across 10 versions & 1 rubygems

Version Path
braintree-2.72.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.71.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.70.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.69.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.69.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.68.2 lib/braintree/transaction/credit_card_details.rb
braintree-2.68.1 lib/braintree/transaction/credit_card_details.rb
braintree-2.68.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.67.0 lib/braintree/transaction/credit_card_details.rb
braintree-2.66.0 lib/braintree/transaction/credit_card_details.rb