Report abuse

1
2
3
4
5
6
7
8
9
class PaymentMethod < ActiveRecord::Base
  def authorize(amount)
    processor = Payment::TrustCommerce.new('billingid' => self.processor_id)
    if !processor.process('preauth', 'amount' => amount.to_s)
      raise PaymentMethodError, processor.error
    end
    self.payment_transactions.create(:processor => processor, :action => 'Authorization')
  end
end