the behaviour is inconsistent: The first time it is done on a CreditCard instance, the change is not registered. After that, it seems to work fine.
See testcase gist: https://gist.github.com/n0nick/5299333
In my debugging efforts, I've concluded that this is related to lib/braintree_rails/credit_card.rb:57:
attributes.delete(:expiration_date) if expiration_month.present?
The trouble is, expiration_month is always present for CreditCards that were fetched from Braintree! And so, expiration_date gets deleted.
I've included a unit test that expects expiration_date to be pending an update, and thus failing for now.
I wasn't sure how to go about actually fixing the bug, since this seems like more of a design decision.
It seems that when trying to update a
CreditCard
instance using theexpiration_date
field, leaving outexpiration_month
andexpiration_year
, i.e.the behaviour is inconsistent: The first time it is done on a
CreditCard
instance, the change is not registered. After that, it seems to work fine. See testcase gist: https://gist.github.com/n0nick/5299333In my debugging efforts, I've concluded that this is related to
lib/braintree_rails/credit_card.rb:57
:The trouble is,
expiration_month
is always present forCreditCard
s that were fetched from Braintree! And so,expiration_date
gets deleted.I've included a unit test that expects
expiration_date
to be pending an update, and thus failing for now. I wasn't sure how to go about actually fixing the bug, since this seems like more of a design decision.