Sha256: 99ba0c1bcf56f9c2ed07443de43c0868419f8dd6bdc8c3d42b8454aaa82c7bfd

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

# ActiveMerchant supplies a credit card class but it is not implemented as an ActiveRecord object in order to 
# discourage storing the information in the database.  It is, however, both safe and desirable to store this 
# information provided the necessary precautions are taken.  It is safe if you use PGP encryption to encrypt
# the number and verification code.  The private key, however, must be stored securely on a separate physical machine.  
# It is desirable, because your gateway could go down for several minutes or even hours and you may want to run 
# these transactions later when the gateway becomes available again.
class CreditCard < ActiveRecord::Base
  has_many :txns
  belongs_to :order
  
  # creates a new instance of CreditCard using the active merchant version
  def self.new_from_active_merchant(cc)
    card = self.new
    card.number = cc.number
    card.cc_type = cc.type
    card.display_number = cc.display_number
    card.verification_value = cc.verification_value
    card.month = cc.month
    card.year = cc.year
    card.first_name = cc.first_name
    card.last_name = cc.last_name
    card
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree-0.0.5 starter-app/vendor/plugins/spree/app/models/credit_card.rb
spree-0.0.6 starter-app/vendor/plugins/spree/app/models/credit_card.rb
spree-0.0.9 app/models/credit_card.rb
spree-0.0.7 starter-app/vendor/plugins/spree/app/models/credit_card.rb
spree-0.0.8 starter-app/vendor/plugins/spree/app/models/credit_card.rb
spree-0.2.0 app/models/credit_card.rb