spree_pagseguro_simple 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.metrics +28 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/LICENSE +26 -0
- data/README.md +47 -0
- data/Rakefile +15 -0
- data/app/assets/images/btn-pagseguro.gif +0 -0
- data/app/controllers/spree/pagseguro_controller.rb +37 -0
- data/app/models/spree/pag_seguro_transaction.rb +6 -0
- data/app/models/spree/payment_method/pagseguro.rb +54 -0
- data/app/overrides/spree/shared/_order_details/add_pag_seguro.html.erb.deface +2 -0
- data/app/views/spree/admin/payments/source_forms/_checkout.html.erb +8 -0
- data/app/views/spree/admin/payments/source_views/_checkout.html.erb +37 -0
- data/app/views/spree/checkout/payment/_pag_seguro.html.erb +1 -0
- data/app/views/spree/shared/_pag_seguro_info.html.erb +7 -0
- data/app/views/spree/shared/_payments_with_pagseguro.html.erb +7 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20150506164744_create_spree_pag_seguro_transactions.rb +17 -0
- data/lib/generators/spree_pagseguro_simple/install/install_generator.rb +21 -0
- data/lib/spree_pagseguro_simple.rb +4 -0
- data/lib/spree_pagseguro_simple/engine.rb +26 -0
- data/lib/spree_pagseguro_simple/gateway.rb +87 -0
- data/lib/spree_pagseguro_simple/version.rb +3 -0
- data/spree_pagseguro_simple.gemspec +35 -0
- metadata +239 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a073434accf526aa668ce63befde820882e73e3f
|
|
4
|
+
data.tar.gz: 6a40831005efa4f254106617d7ee840854ef9b03
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8628353029aed2f0bb318203121e792779611c66bb4c9de879be29e4ef2fa286d8bf12350327c7097cc420ede8c391742348f73d44402173f2f16e06c420257f
|
|
7
|
+
data.tar.gz: bd895f517cf71d1e1d3463587bedcda67985a3ea23ce6fb30ae47095ed47595b98f82cf4c72e50220a014a37c2c9ae2b843f798828ecab615bbb1d39aa851ea2
|
data/.gitignore
ADDED
data/.metrics
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
MetricFu::Configuration.run do |config|
|
|
3
|
+
config.configure_metrics.each do |metric|
|
|
4
|
+
metric.enabled = false
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
config.configure_metric(:rcov) do |rcov|
|
|
8
|
+
rcov.enabled = true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
config.configure_metric(:cane) do |cane|
|
|
12
|
+
cane.enabled = true
|
|
13
|
+
cane.abc_max = 15
|
|
14
|
+
cane.line_length = 90
|
|
15
|
+
cane.no_doc = 'y'
|
|
16
|
+
cane.no_readme = 'y'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
config.configure_metric(:flay) do |flay|
|
|
20
|
+
flay.enabled = true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
config.configure_metric(:flog) do |flog|
|
|
24
|
+
flog.enabled = true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
config.configure_formatter(:html)
|
|
28
|
+
end
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2012-2015 Locomotiva Pro
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name Spree nor the names of its contributors may be used to
|
|
13
|
+
endorse or promote products derived from this software without specific
|
|
14
|
+
prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Spree PagSeguroSimple (Brazilian Payment Method)
|
|
2
|
+
|
|
3
|
+
[](https://codeclimate.com/github/locomotivapro/spree_pagseguro_simple)
|
|
4
|
+
|
|
5
|
+
Add support for Pagseguro checkout as a payment method.
|
|
6
|
+
__Only tested on Spree 3.0__
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
1. Add the following to your Gemfile
|
|
13
|
+
|
|
14
|
+
gem 'spree_pagseguro_simple'
|
|
15
|
+
|
|
16
|
+
2. Run `bundle install`
|
|
17
|
+
|
|
18
|
+
3. To copy and apply migrations run: `rails g spree_pagseguro_simple:install`
|
|
19
|
+
|
|
20
|
+
## Configuring
|
|
21
|
+
|
|
22
|
+
1. Add a new Payment Method, using: `Spree::PaymentMethod::PagSeguro` as the `Provider`
|
|
23
|
+
|
|
24
|
+
2. Click `Create`, and enter your Store's Pagseguro Email and Token in the fields provided.
|
|
25
|
+
|
|
26
|
+
3. `Save` and enjoy!
|
|
27
|
+
|
|
28
|
+
4. Is important to go to general settings in spree and configure the store url for redirects and notifications
|
|
29
|
+
|
|
30
|
+
Testing
|
|
31
|
+
-------
|
|
32
|
+
|
|
33
|
+
*Need to write lots of tests*
|
|
34
|
+
|
|
35
|
+
To make real tests register in PagSeguro sandbox and configure the payment method as test.
|
|
36
|
+
|
|
37
|
+
Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.
|
|
38
|
+
|
|
39
|
+
$ bundle exec rake test app
|
|
40
|
+
$ bundle exec rspec spec
|
|
41
|
+
|
|
42
|
+
Disclaimer
|
|
43
|
+
----------
|
|
44
|
+
|
|
45
|
+
This gem is inspired by [João Netto gem](https://github.com/jnettome/spree_pagseguro) but updated to spree 3 and using a new approach to checkout flow.
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2013-2015 [!Locomotiva.pro](http://locomotiva.pro), released under the New BSD License
|
data/Rakefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
|
+
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
require 'spree/testing_support/extension_rake'
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new
|
|
8
|
+
|
|
9
|
+
task :default => [:spec]
|
|
10
|
+
|
|
11
|
+
desc 'Generates a dummy app for testing'
|
|
12
|
+
task :test_app do
|
|
13
|
+
ENV['LIB_NAME'] = 'spree_pagseguro'
|
|
14
|
+
Rake::Task['extension:test_app'].invoke
|
|
15
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class PagseguroController < Spree::StoreController
|
|
3
|
+
skip_before_action :verify_authenticity_token, only: :notify
|
|
4
|
+
|
|
5
|
+
def callback
|
|
6
|
+
@order = Spree::Order.find_by_number(params[:order])
|
|
7
|
+
|
|
8
|
+
pagseguro_transaction = Spree::PagseguroTransaction.find_by_order_id(@order.number)
|
|
9
|
+
pagseguro_transaction.update_attribute :state, 'waiting'
|
|
10
|
+
|
|
11
|
+
redirect_to spree.order_path(@order)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def notify
|
|
15
|
+
logger.info "[PAGSEGURO] Gateway is calling /notify"
|
|
16
|
+
logger.info params
|
|
17
|
+
|
|
18
|
+
#notification = Spree::PagseguroTransaction.update_last_transaction(params)
|
|
19
|
+
#payment_method = Spree::PaymentMethod.where(type: 'Spree::Gateway::PagSeguro').first
|
|
20
|
+
|
|
21
|
+
@order = Spree::Order.find_by_number(notification.reference)
|
|
22
|
+
payment = @order.payments.where(:state => "checkout",
|
|
23
|
+
:payment_method_id => payment_method.id).last
|
|
24
|
+
|
|
25
|
+
if notification.approved?
|
|
26
|
+
logger.info "[PAGSEGURO] Order #{@order.number} approved"
|
|
27
|
+
payment.complete!
|
|
28
|
+
else
|
|
29
|
+
logger.info "[PAGSEGURO] Order #{@order.number} failed"
|
|
30
|
+
payment.failure!
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
render nothing: true, head: :ok
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class PaymentMethod::Pagseguro < PaymentMethod
|
|
3
|
+
preference :email, :string
|
|
4
|
+
preference :token, :string
|
|
5
|
+
|
|
6
|
+
def payment_profiles_supported?
|
|
7
|
+
false
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def supports?(source)
|
|
11
|
+
true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def provider_class
|
|
15
|
+
Billing::Pagseguro
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def provider
|
|
19
|
+
provider_class.new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def source_required?
|
|
23
|
+
false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def auto_capture?
|
|
27
|
+
false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def method_type
|
|
31
|
+
'pag_seguro'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Indicates whether its possible to void the payment.
|
|
35
|
+
def can_void?(payment)
|
|
36
|
+
payment.state != 'void'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def capture(*args)
|
|
40
|
+
ActiveMerchant::Billing::Response.new(true, "", {}, {})
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def cancel(response); end
|
|
44
|
+
|
|
45
|
+
def void(*args)
|
|
46
|
+
ActiveMerchant::Billing::Response.new(true, "", {}, {})
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def actions
|
|
50
|
+
%w(capture void)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<% Spree::PagseguroTransaction.where(order_id: @order.id.to_s).each do |transaction| %>
|
|
2
|
+
|
|
3
|
+
<fieldset>
|
|
4
|
+
<legend><%= t('pagseguro') %></legend>
|
|
5
|
+
|
|
6
|
+
<table class="index">
|
|
7
|
+
<tr>
|
|
8
|
+
<th colspan="6"><%= t('pagseguro_transaction') %></th>
|
|
9
|
+
</tr>
|
|
10
|
+
<tr>
|
|
11
|
+
<td><label><%= t("email") %>:</label></td>
|
|
12
|
+
<td>
|
|
13
|
+
<%= transaction.email %>
|
|
14
|
+
</td>
|
|
15
|
+
</tr>
|
|
16
|
+
<tr>
|
|
17
|
+
<td><label><%= t("pagseguro_params") %>:</label></td>
|
|
18
|
+
<td>
|
|
19
|
+
<%= transaction.params %>
|
|
20
|
+
</td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<td><label><%= t("pagseguro_transaction_id") %>:</label></td>
|
|
24
|
+
<td>
|
|
25
|
+
<%= transaction.transaction_id %>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<td><label><%= t("pagseguro_amount") %>:</label></td>
|
|
30
|
+
<td>
|
|
31
|
+
<%= transaction.amount %>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</table>
|
|
35
|
+
</fieldset>
|
|
36
|
+
|
|
37
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Finalize seu pedido para efetuar o pagamento no PagSeguro</p>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<% ps_transaction = SpreePagseguroSimple::Gateway.new(payment) %>
|
|
2
|
+
<% if ps_transaction.is_not_completed? %>
|
|
3
|
+
<p>Clique no botão abaixo e realize o pagamento</p>
|
|
4
|
+
<%= link_to image_tag('btn-pagseguro.gif'), ps_transaction.payment_url, target: :_blank %>
|
|
5
|
+
<% else %>
|
|
6
|
+
<p>Seu pagamento foi recebido</p>
|
|
7
|
+
<% end %>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class CreateSpreePagSeguroTransactions < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :spree_pag_seguro_transactions do |t|
|
|
4
|
+
t.string :email
|
|
5
|
+
t.float :amount
|
|
6
|
+
t.string :transaction_id
|
|
7
|
+
t.string :customer_id
|
|
8
|
+
t.string :order_id
|
|
9
|
+
t.string :payment_id
|
|
10
|
+
t.text :params
|
|
11
|
+
t.string :code
|
|
12
|
+
t.string :state
|
|
13
|
+
|
|
14
|
+
t.timestamps
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module SpreePagseguroSimple
|
|
2
|
+
module Generators
|
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
|
4
|
+
|
|
5
|
+
class_option :auto_run_migrations, :type => :boolean, :default => false
|
|
6
|
+
|
|
7
|
+
def add_migrations
|
|
8
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_pagseguro_simple'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def run_migrations
|
|
12
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
|
|
13
|
+
if run_migrations
|
|
14
|
+
run 'bundle exec rake db:migrate'
|
|
15
|
+
else
|
|
16
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module SpreePagseguro
|
|
2
|
+
class Engine < Rails::Engine
|
|
3
|
+
require 'spree/core'
|
|
4
|
+
isolate_namespace Spree
|
|
5
|
+
engine_name 'spree_pagseguro_simple'
|
|
6
|
+
|
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
|
8
|
+
|
|
9
|
+
# use rspec for tests
|
|
10
|
+
config.generators do |g|
|
|
11
|
+
g.test_framework :rspec
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.activate
|
|
15
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
16
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
config.to_prepare &method(:activate).to_proc
|
|
21
|
+
|
|
22
|
+
initializer "spree_pagseguro.register.payment_methods", :after => 'spree.register.payment_methods' do |app|
|
|
23
|
+
app.config.spree.payment_methods << Spree::PaymentMethod::Pagseguro
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'pag_seguro'
|
|
2
|
+
|
|
3
|
+
module SpreePagseguroSimple
|
|
4
|
+
class Gateway
|
|
5
|
+
|
|
6
|
+
def initialize(payment)
|
|
7
|
+
@payment = payment
|
|
8
|
+
@order = @payment.order
|
|
9
|
+
@payment_method_email = @payment.payment_method.preferred_email
|
|
10
|
+
@payment_method_token = @payment.payment_method.preferred_token
|
|
11
|
+
|
|
12
|
+
process
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def is_not_completed?
|
|
16
|
+
!@payment.completed? && transaction_exists_and_is_loaded && @pag_seguro_transaction.state == 'pending'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def payment_url
|
|
20
|
+
subdomain = @env == :sandbox ? 'sandbox.pagseguro' : 'pagseguro'
|
|
21
|
+
"https://#{subdomain}.uol.com.br/v2/checkout/payment.html?code=#{@pag_seguro_transaction.code}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
def process
|
|
26
|
+
set_environment
|
|
27
|
+
|
|
28
|
+
unless transaction_exists_and_is_loaded
|
|
29
|
+
build_pagseguro
|
|
30
|
+
create_transaction
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def set_environment
|
|
35
|
+
@env = Rails.env.production? ? :production : :sandbox
|
|
36
|
+
PagSeguro::Url.environment = @env
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def transaction_exists_and_is_loaded
|
|
40
|
+
@pag_seguro_transaction ||= Spree::PagSeguroTransaction.find_by!(order_id: @order.number)
|
|
41
|
+
rescue
|
|
42
|
+
false
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def create_transaction
|
|
46
|
+
Spree::PagSeguroTransaction.create!(email: @order.email, amount: @order.total, order_id: @order.number, code: @pagseguro.code, state: 'pending')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def build_pagseguro
|
|
50
|
+
redirect_url = "#{Spree::Store.default.url}/pagseguro/callback?order=#{@order.number}"
|
|
51
|
+
notification_url = "#{Spree::Store.default.url}/pagseguro/notify"
|
|
52
|
+
customer_name = [@order.bill_address.firstname, @order.bill_address.lastname].join(' ')
|
|
53
|
+
customer_email = @order.email
|
|
54
|
+
customer_ddd = @order.bill_address.phone.gsub(/\D/,'')[0..1] if @order.bill_address.phone
|
|
55
|
+
customer_phone = @order.bill_address.phone.gsub(/\D/,'') if @order.bill_address.phone
|
|
56
|
+
address = [@order.bill_address.address1, @order.bill_address.address2].join(' ')
|
|
57
|
+
city = @order.bill_address.city
|
|
58
|
+
postal_code = @order.bill_address.zipcode
|
|
59
|
+
state = @order.bill_address.state.nil? ? @order.bill_address.state_name.to_s : @order.bill_address.state.abbr
|
|
60
|
+
|
|
61
|
+
@pagseguro = ::PagSeguro::Payment.new(@payment_method_email, @payment_method_token,
|
|
62
|
+
extra_amount: (@order.total - @order.item_total).round(2), id: @order.number,
|
|
63
|
+
notification_url: notification_url, redirect_url: redirect_url)
|
|
64
|
+
|
|
65
|
+
@pagseguro.items = @order.line_items.map do |item|
|
|
66
|
+
product = ::PagSeguro::Item.new
|
|
67
|
+
product.id = item.id
|
|
68
|
+
product.description = item.variant.name
|
|
69
|
+
product.amount = item.price.round(2)
|
|
70
|
+
product.weight = (item.variant.weight * 1000).to_i if item.variant.weight.present?
|
|
71
|
+
product.quantity = item.quantity
|
|
72
|
+
product
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
@pagseguro.sender = ::PagSeguro::Sender.new(
|
|
76
|
+
name: customer_name, email: customer_email,
|
|
77
|
+
phone_ddd: customer_ddd, phone_number: customer_phone)
|
|
78
|
+
|
|
79
|
+
@pagseguro.shipping = ::PagSeguro::Shipping.new(
|
|
80
|
+
type: ::PagSeguro::Shipping::UNIDENTIFIED, state: (state ? state : nil),
|
|
81
|
+
city: city, postal_code: postal_code, street: address)
|
|
82
|
+
|
|
83
|
+
@pagseguro
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require 'spree_pagseguro_simple/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.platform = Gem::Platform::RUBY
|
|
7
|
+
s.name = 'spree_pagseguro_simple'
|
|
8
|
+
s.version = SpreePagseguroSimple::VERSION
|
|
9
|
+
s.summary = 'Add support for Pagseguro checkout as a payment method for spree 3.'
|
|
10
|
+
s.description = s.summary
|
|
11
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
12
|
+
|
|
13
|
+
s.author = 'Denis Antoniazzi Tierno'
|
|
14
|
+
s.email = 'contato@locomotiva.pro'
|
|
15
|
+
s.homepage = 'http://locomotiva.pro'
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files`.split("\n")
|
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
|
+
s.require_path = 'lib'
|
|
20
|
+
s.requirements << 'none'
|
|
21
|
+
|
|
22
|
+
s.add_dependency 'spree_core', '>= 3'
|
|
23
|
+
s.add_dependency 'pag_seguro'
|
|
24
|
+
|
|
25
|
+
s.add_development_dependency 'capybara', '~> 2.1'
|
|
26
|
+
s.add_development_dependency 'coffee-rails'
|
|
27
|
+
s.add_development_dependency 'database_cleaner'
|
|
28
|
+
s.add_development_dependency 'factory_girl', '~> 4.2'
|
|
29
|
+
s.add_development_dependency 'ffaker'
|
|
30
|
+
s.add_development_dependency 'rspec-rails', '~> 2.13'
|
|
31
|
+
s.add_development_dependency 'sass-rails'
|
|
32
|
+
s.add_development_dependency 'selenium-webdriver'
|
|
33
|
+
s.add_development_dependency 'simplecov'
|
|
34
|
+
s.add_development_dependency 'sqlite3'
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: spree_pagseguro_simple
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.9'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Denis Antoniazzi Tierno
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: spree_core
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pag_seguro
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: capybara
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.1'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.1'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: coffee-rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: database_cleaner
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: factory_girl
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '4.2'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '4.2'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: ffaker
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec-rails
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '2.13'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '2.13'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: sass-rails
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: selenium-webdriver
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: simplecov
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: sqlite3
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - ">="
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - ">="
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '0'
|
|
181
|
+
description: Add support for Pagseguro checkout as a payment method for spree 3.
|
|
182
|
+
email: contato@locomotiva.pro
|
|
183
|
+
executables: []
|
|
184
|
+
extensions: []
|
|
185
|
+
extra_rdoc_files: []
|
|
186
|
+
files:
|
|
187
|
+
- ".gitignore"
|
|
188
|
+
- ".metrics"
|
|
189
|
+
- ".rspec"
|
|
190
|
+
- ".travis.yml"
|
|
191
|
+
- Gemfile
|
|
192
|
+
- LICENSE
|
|
193
|
+
- README.md
|
|
194
|
+
- Rakefile
|
|
195
|
+
- app/assets/images/btn-pagseguro.gif
|
|
196
|
+
- app/controllers/spree/pagseguro_controller.rb
|
|
197
|
+
- app/models/spree/pag_seguro_transaction.rb
|
|
198
|
+
- app/models/spree/payment_method/pagseguro.rb
|
|
199
|
+
- app/overrides/spree/shared/_order_details/add_pag_seguro.html.erb.deface
|
|
200
|
+
- app/views/spree/admin/payments/source_forms/_checkout.html.erb
|
|
201
|
+
- app/views/spree/admin/payments/source_views/_checkout.html.erb
|
|
202
|
+
- app/views/spree/checkout/payment/_pag_seguro.html.erb
|
|
203
|
+
- app/views/spree/shared/_pag_seguro_info.html.erb
|
|
204
|
+
- app/views/spree/shared/_payments_with_pagseguro.html.erb
|
|
205
|
+
- config/locales/en.yml
|
|
206
|
+
- config/routes.rb
|
|
207
|
+
- db/migrate/20150506164744_create_spree_pag_seguro_transactions.rb
|
|
208
|
+
- lib/generators/spree_pagseguro_simple/install/install_generator.rb
|
|
209
|
+
- lib/spree_pagseguro_simple.rb
|
|
210
|
+
- lib/spree_pagseguro_simple/engine.rb
|
|
211
|
+
- lib/spree_pagseguro_simple/gateway.rb
|
|
212
|
+
- lib/spree_pagseguro_simple/version.rb
|
|
213
|
+
- spree_pagseguro_simple.gemspec
|
|
214
|
+
homepage: http://locomotiva.pro
|
|
215
|
+
licenses: []
|
|
216
|
+
metadata: {}
|
|
217
|
+
post_install_message:
|
|
218
|
+
rdoc_options: []
|
|
219
|
+
require_paths:
|
|
220
|
+
- lib
|
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
|
+
requirements:
|
|
223
|
+
- - ">="
|
|
224
|
+
- !ruby/object:Gem::Version
|
|
225
|
+
version: 2.0.0
|
|
226
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
|
+
requirements:
|
|
228
|
+
- - ">="
|
|
229
|
+
- !ruby/object:Gem::Version
|
|
230
|
+
version: '0'
|
|
231
|
+
requirements:
|
|
232
|
+
- none
|
|
233
|
+
rubyforge_project:
|
|
234
|
+
rubygems_version: 2.2.2
|
|
235
|
+
signing_key:
|
|
236
|
+
specification_version: 4
|
|
237
|
+
summary: Add support for Pagseguro checkout as a payment method for spree 3.
|
|
238
|
+
test_files: []
|
|
239
|
+
has_rdoc:
|