I'm trying to query the payment method associated with a Braintree::Customer
. I would like to display the type of the payment method(s) attached to the account and additional information (last 4 digits of card number if it's a credit card; email if it's a Paypal account).
I cannot find any documentation on how to retrieve the type of the Braintree::PaymentMethod
object (i.e. whether it's a credit card or a Paypal account).
This is important because I need to access attributes that are exclusive to either types.
So I completely forgot about Ruby's native methods and how to compare objects...
You can do a simple comparison by using the
.class
methode.g.