Okay, I’m try to support two situations “easily”. I need to be able to
use either ActiveRecord or ActionWebService. So I’m trying to handle
this “switch” as transparently as possible.
I’m totally open to suggestions…
Thanks,
Jason
I’m getting the following error:
NoMethodError in Offer renewalController#payment_made
undefined method `make_payment’ for WebservicePaymentApi:Class
Source:
class WebservicePaymentApi < ActionWebService::API::Base
require ‘contract_payment’
api_method :make_credit_card_payment,
:expects => [{:contract_id => :int},
{:amount => :float},
{:card_type => :string},
{:card_number => :string},
{:card_verification_code => :string},
{:card_expiration_date => :date}
],
:returns => [:string]
def make_payment(contract_payment)
puts contract_payment.inspect
end
end
class TestController < ApplicationController
def handle_payment
if (@contract_payment.valid?)
# ActiveRecord - Works!
@contract_payment.save
# WebService
webservice_payment_api = WebservicePaymentApi.new
WebservicePaymentApi.make_payment(@contract_payment)
end
end # handle_payment