Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add 'default_credit_card' method to Customer #32

Closed
wants to merge 1 commit into from

3 participants

@esbanarango

This pull request let's you write:

customer = Braintree::Customer.find("a_customer_id")
customer.default_credit_card

Having the customer you can get his default_credit_card.

@esbanarango

Any news on this?

@cosgroveb
Owner

Hey @esbanarango

Sorry for the delay in getting back to you on this. We like this pull request, and this seems like totally reasonable functionality to provide.

I can't tell you exactly when we'll be able to get to this, but we'd like to pull it in. We'll likely add this functionality to our other client libraries and release them all together at some point.

Thanks for your contribution!

Brian Cosgrove
Braintree Developer

@lukesteensen
Collaborator

I'm going to go ahead and close this issue since the relevant functionality was added in version 2.23.0.

Thanks!

Luke Steensen
Braintree Developer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 15, 2012
  1. @esbanarango
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/braintree/customer.rb
View
5 lib/braintree/customer.rb
@@ -157,6 +157,11 @@ def transactions(options = {})
@gateway.customer.transactions(id, options)
end
+ # Returns the default +CreditCard+ for the customer.
+ def default_credit_card
+ @credit_cards.find {|credit_card| credit_card.default? }
+ end
+
# Deprecated. Use Braintree::Customer.update
#
# See http://www.braintreepayments.com/docs/ruby/customers/update
Something went wrong with that request. Please try again.