Since cybersource measures in dollars, is there an
elegant way to covert in my amount. Per the peepcode, I am loading an
amount in cents, so I multiply my amount by 100, this naturally works
but then I have a total amount in my reports in the thousands. I can
divide again by 100, but I am sure there is a better way.
I can't seem to set this in options, such as:
config.to_prepare do
OrderTransaction.gateway =
ActiveMerchant::Billing::CyberSourceGateway.new(
:login => 'mylogin',
:password => 'mypasssword',
:test => true,
:vat_reg_number => 'your VAT registration number',
# sets the states/provinces where you have a physical presense for
tax purposes
:nexus => "GA OH",
# don‘t want to use AVS so continue processing even if AVS would
have failed
:ignore_avs => true,
# don‘t want to use CVV so continue processing even if CVV would
have failed
:ignore_cvv => true,
:money_format => :dollars
)
end
then i have do things like
def save_order
user = User.find(session[:user_id])
int_gender = user.gender
if not_assigned?(int_gender, params[:health_approval])
flash[:notice] = 'You must answer all consent questions'
redirect_to :action => 'consent'
else
amount = @cart.total_price/100
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
desc = 'test'
@order = Order.new(:user_id => usr_id,
:amount => amount,
:description => desc)
if @order.save
redirect_to :action => :payment, :id => @
order.id
else # something went wrong
redirect_to_index(@order.errors,1)
end
end
end