public
Description: RESTful Rails app for storing credit cards
Clone URL: git://github.com/joevandyk/monkeycharger.git
make sure to crypt number on updates too

git-svn-id: https://monkeycharger.googlecode.com/svn@64 
ca20866a-8536-0410-a432-c7584e41aef3
joevandyk (author)
Mon Oct 22 00:33:58 -0700 2007
commit  377ea5a9c26a7a0e2be8064efcd3996e0259761a
tree    338c8deab6a5e43a39becd0fe1736e7de3a6041e
parent  a0157e694b056bbdd62527f7a9a6f7f9a66c0e75
...
14
15
16
17
 
18
19
20
...
14
15
16
 
17
18
19
20
0
@@ -14,7 +14,7 @@ class CreditCard < ActiveRecord::Base
0
    has_many :captures
0
 
0
    before_validation :convert_number_to_string
0
- before_create :crypt_number
0
+ before_save :crypt_number
0
    before_save :save_last_four_digits
0
 
0
    # Needed for authorize.net and active merchant
...
90
91
92
 
 
 
93
94
...
90
91
92
93
94
95
96
97
0
@@ -90,5 +90,8 @@ describe "Editing a saved credit card" do
0
     @card.number = "4242424242424242"
0
     @card.save!
0
     @card.last_four_digits.should == "4242"
0
+ # Be sure the number was updated
0
+ @card = CreditCard.find @card.id
0
+ @card.decrypt!('12345').number.should == '4242424242424242'
0
   end
0
 end

Comments

    No one has commented yet.