TypeError problem with active_merchant


#1

Hi folks

I’m doing some work on a project with active_merchant and I keep getting
the following error:

TypeError in CheckoutController#place_order
exception class/object expected

heres the piece of code from my controller that correpsonds:

[code=]@order = Order.new(params[:order])
@order.customer_ip = request.remote_ip
populate_order

#raise “I need to know what values are being sent in the order object”
unless
@order.valid?
return render :action => ‘index’
flash.now[:error] = “error while placing order”
end
########## START of AM##########

ActiveMerchant::Billing::Base.mode = :test #COMMENT OUT / REMOVE FOR

REAL TRANSACTIONS!

ActiveMerchant accepts all amounts as Integer values in cents

#$10.00
amount = @order.total
#twodig_year = @order.card_expiration_year.sub(/.*(\d{2})$/, ‘\1’)

twodig_syear = @order.card_start_year.sub(/.*(\d{2})$/, ‘\1’)

credit_card = ActiveMerchant::Billing::CreditCard.new(
:first_name => @order.first_name,
:last_name => @order.last_name,
:number => @order.card_number,
:month => @order.card_expiration_month,
:year => @order.card_expiration_year,
:start_month => @order.card_start_month,
:start_year => @order.card_start_year,
:issue_number =>@order.card_issue_no,
:verification_value =>@order.card_verification_value
)
raise credit_card.errors[/code]
now this error message has only shown since i tried “raise
credit_card.errors”

can anyone help me at least get a better understanding of what is
causing this error?

many thanks

:slight_smile: