Sha256: 360f060314a3ad899083d2a496265454ae4a799c412af3023f4b921a4bdc4359

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

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

      attr_reader :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance,
        :customer_location, :debit, :durbin_regulated, :expiration_month, :expiration_year,
        :healthcare, :image_url, :issuing_bank, :last_4, :payroll, :prepaid, :product_id,
        :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, :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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
braintree-2.80.1 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.80.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.79.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.78.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.77.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.76.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.75.0 lib/braintree/transaction/masterpass_card_details.rb
braintree-2.74.0 lib/braintree/transaction/masterpass_card_details.rb