lib/pay/braintree/billable.rb
def card_details_for_braintree_transaction(transaction)
        case transaction.payment_instrument_type
        when "credit_card", "samsung_pay_card", "masterpass_card", "samsung_pay_card", "visa_checkout_card"
          payment_method = transaction.send("#{transaction.payment_instrument_type}_details")
          {
            card_type: payment_method.card_type,
            card_last4: payment_method.last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }

        when "paypal_account"
          {
            card_type: "PayPal",
            card_last4: transaction.paypal_details.payer_email,
            card_exp_month: nil,
            card_exp_year: nil
          }

        when "android_pay_card"
          payment_method = transaction.android_pay_details
          {
            card_type: payment_method.source_card_type,
            card_last4: payment_method.source_card_last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }

        when "venmo_account"
          {
            card_type: "Venmo",
            card_last4: transaction.venmo_account_details.username,
            card_exp_month: nil,
            card_exp_year: nil
          }

        when "apple_pay_card"
          payment_method = transaction.apple_pay_details
          {
            card_type: payment_method.card_type,
            card_last4: payment_method.last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }

        else
          {}
        end
      end
# Handles Billable#customer
#
# Returns Braintree::Customer
Handles Billable#customer
Returns Braintree::Customer
Handles Billable#customer Returns Braintree :: Customer
def card_details_for_braintree_transaction(transaction)
        case transaction.payment_instrument_type
        when "credit_card", "samsung_pay_card", "masterpass_card", "samsung_pay_card", "visa_checkout_card"
          payment_method = transaction.send("#{transaction.payment_instrument_type}_details")
          {
            card_type: payment_method.card_type,
            card_last4: payment_method.last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }
        when "paypal_account"
          {
            card_type: "PayPal",
            card_last4: transaction.paypal_details.payer_email,
            card_exp_month: nil,
            card_exp_year: nil
          }
        when "android_pay_card"
          payment_method = transaction.android_pay_details
          {
            card_type: payment_method.source_card_type,
            card_last4: payment_method.source_card_last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }
        when "venmo_account"
          {
            card_type: "Venmo",
            card_last4: transaction.venmo_account_details.username,
            card_exp_month: nil,
            card_exp_year: nil
          }
        when "apple_pay_card"
          payment_method = transaction.apple_pay_details
          {
            card_type: payment_method.card_type,
            card_last4: payment_method.last_4,
            card_exp_month: payment_method.expiration_month,
            card_exp_year: payment_method.expiration_year
          }
        else
          {}
        end
      end
def card_details_for_braintree_transaction ( transaction ) case transaction . payment_instrument_type when "credit_card" , "samsung_pay_card" , "masterpass_card" , "samsung_pay_card" , "visa_checkout_card" payment_method = transaction . send ( "#{transaction.payment_instrument_type}_details" ) { card_type : payment_method . card_type , card_last4 : payment_method . last_4 , card_exp_month : payment_method . expiration_month , card_exp_year : payment_method . expiration_year } when "paypal_account" { card_type : "PayPal" , card_last4 : transaction . paypal_details . payer_email , card_exp_month : nil , card_exp_year : nil } when "android_pay_card" payment_method = transaction . android_pay_details { card_type : payment_method . source_card_type , card_last4 : payment_method . source_card_last_4 , card_exp_month : payment_method . expiration_month , card_exp_year : payment_method . expiration_year } when "venmo_account" { card_type : "Venmo" , card_last4 : transaction . venmo_account_details . username , card_exp_month : nil , card_exp_year : nil } when "apple_pay_card" payment_method = transaction . apple_pay_details { card_type : payment_method . card_type , card_last4 : payment_method . last_4 , card_exp_month : payment_method . expiration_month , card_exp_year : payment_method . expiration_year } else { } end end
Handles Billable#customer
Returns Braintree::Customer
Handles Billable#customer Returns Braintree :: Customer
transaction