Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing Paypal Express in ActiveMerchant

How can I test Paypal Express with ActiveMerchant in a Rails 3.2 app with rspec/capybara integration test?

like image 387
robzolkos Avatar asked Nov 12 '22 13:11

robzolkos


1 Answers

You can test by setting:

ActiveMerchant::Billing::Base.mode = :test

PayPal however will require you to enter complete billing information or the API won't even accept it and will return:

Error: There's an error with this transaction. Please enter a complete billing address.

In which case you can supply it with some generic info:

:billing_address => {
    :name     => "Test Person",
    :address1 => "123 W 423 E",
    :city     => "Somewhere",
    :state    => "CA",
    :country  => "US",
    :zip      => "88888"
 }
like image 82
My God Avatar answered Nov 15 '22 05:11

My God