Add support for Pagseguro checkout as a payment method. Tested on Spree 4.1.1
This gem approach takes in consideration that a incomplete order with an approved PagSeguro transaction is unacceptable. So the user will complete the order process and then will be guided to PagSeguro to pay.
-
Add the following to your Gemfile
gem 'spree_pagseguro_simple'
-
Run
bundle install -
To copy and apply migrations run:
rails g spree_pagseguro_simple:install
-
Add a new Payment Method, using:
Spree::PaymentMethod::PagSeguroas theProvider -
Click
Create, and enter your Store's Pagseguro Email and Token in the fields provided. -
Define ENV['PAGSEGURO_ENV'] with 'sandbox' or 'production'.
-
Saveand enjoy! -
Is important to go to general settings in spree and configure the store url for redirects and notifications
- Need to add test coverage to gem
- Configure enviroment to use payment method preference
- Work in notification controller action
- Improve view in order#show
To make real tests register in PagSeguro sandbox and configure the payment method as test.
Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.
$ bundle exec rake test app
$ bundle exec rspec spec
This gem is inspired by Locomotiva gem but updated to spree 4 and using checkout lightbox.