bonobos/spree_encrypted_credit_card — pull request #6 by jordan-brough (2014-12-05 23:00:09+00:00)
Title: Updates PUT /api/orders for credit cards and fix crazy bug

Add an "encrypted_attributes" permitted attribute that can be used to pass encrypted attributes.

We need this due to a pernicious bug in this code that resulted in this:

order.update_attributes(hash1) # <= fails consistently
order.update_attributes(hash2) # <= succeeds consistently

>> hash1 == hash2
=> true

Due to how `def number=` is defined, if you do `update_attributes` and the hash
keys are in the 'wrong' order then the code [here](https://github.com/bonobos/spree_encrypted_credit_card/blob/db989d5/app/models/spree/encrypted_credit_card.rb#L26)
will do the wrong thing. That is, if `"number":"xxx"` comes before `"encrypted_values":true`
in the hash then `has_encrypted_values?` returns the wrong thing when `number` is
set. This was an adventure to track down.

After this gets deployed then we can update the frontend to pass values under
"encrypted_attributes" and do some further cleanup in here.