Sha256: dd862c887f39700c42b7ef893f21626628053a193488946736a47b4bc39f3277
Contents?: true
Size: 944 Bytes
Versions: 2
Compression:
Stored size: 944 Bytes
Contents
class Transaction < ActiveRecord::Base belongs_to :subscription serialize :params belongs_to :billing_activity after_create :generate_billing_activity attr_accessible :action, :amount, :response, :subscription def response=(response) self.success = response.success? self.authorization = response.authorization self.message = response.message self.params = response.params rescue ActiveMerchant::ActiveMerchantError => e self.success = false self.authorization = nil self.message = e.message self.params = {} end scope :successful, lambda { where("success = ?", true) } scope :recent, order("created_at DESC") private def generate_billing_activity if success self.create_billing_activity(:message => BillingActivity::MESSAGES[:success], :subscription => subscription, :amount => amount) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
saasaparilla-0.2.2 | app/models/transaction.rb |
saasaparilla-0.2.1 | app/models/transaction.rb |