spree_paypal_api_checkout 0.0.5 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/spree/admin/payments_controller_decorator.rb +2 -2
- data/app/controllers/spree/admin/paypal_checkout_payments_controller.rb +1 -1
- data/app/controllers/spree/paypal_checkout_controller.rb +3 -3
- data/app/models/spree/gateway/pay_pal_checkout.rb +1 -1
- data/app/views/spree/admin/payments/{_paypal_complete.html.erb → _paypal_checkout_complete.html.erb} +1 -1
- data/app/views/spree/admin/payments/{paypal_refund.html.erb → paypal_checkout_refund.html.erb} +1 -1
- data/app/views/spree/admin/payments/source_forms/{_paypal.html.erb → _paypal_checkout.html.erb} +0 -0
- data/app/views/spree/admin/payments/source_views/{_paypal.html.erb → _paypal_checkout.html.erb} +1 -1
- data/app/views/spree/checkout/payment/_paypal_checkout.html.erb +4 -1
- data/config/routes.rb +11 -0
- data/lib/spree_paypal_api_checkout/version.rb +1 -1
- data/spree_paypal_api_checkout.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a5a5201c741e77e835868a6fda79d71b658c1b58fabca8ef39d3990199294f2
|
4
|
+
data.tar.gz: d9b4e0c18fef43f234f07ed9bfc011811fbd87b49751cb524dfba3f189c428df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb54727dee1cef2a75bdf4527b6ba3c33d2dad98cb14a85ec36099be4c7f3dd9c0ed80918fd4a794330d47055c069113b20fc01fb8b62c0df73cfe2988dc4e33
|
7
|
+
data.tar.gz: 9cf9906841e3359b96fae7f8581dcea5c24026035c7a02e46a7351efc9c1b17d8bb9a3c1f029330b07f7f4f89cb5dae9be5c04d14f034cd2335282e31fabfe45
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Spree::Admin::PaymentsControllerDecorator
|
2
|
-
def
|
2
|
+
def paypal_checkout_refund
|
3
3
|
if request.get?
|
4
4
|
if @payment.source.state == 'refunded'
|
5
5
|
flash[:error] = Spree.t(:already_refunded, :scope => 'paypal')
|
@@ -7,7 +7,7 @@ module Spree::Admin::PaymentsControllerDecorator
|
|
7
7
|
end
|
8
8
|
elsif request.post?
|
9
9
|
response = @payment.payment_method.refund(@payment, params[:refund_amount])
|
10
|
-
if response
|
10
|
+
if response['status']=='COMPLETED'
|
11
11
|
flash[:success] = Spree.t(:refund_successful, :scope => 'paypal')
|
12
12
|
redirect_to admin_order_payments_path(@order)
|
13
13
|
else
|
@@ -3,7 +3,7 @@ module Spree
|
|
3
3
|
before_action :load_order
|
4
4
|
|
5
5
|
def index
|
6
|
-
@payments = @order.payments.includes(:payment_method).where(:spree_payment_methods => {
|
6
|
+
@payments = @order.payments.includes(:payment_method).where(:spree_payment_methods => {:name => 'PayPal Checkout'})
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
@@ -49,14 +49,14 @@ module Spree
|
|
49
49
|
order = current_order || raise(ActiveRecord::RecordNotFound)
|
50
50
|
order.payments.last.source.update(transaction_id: params[:transaction_id])
|
51
51
|
order.next
|
52
|
+
path = checkout_state_path(order.state)
|
52
53
|
if order.complete?
|
53
54
|
flash.notice = Spree.t(:order_processed_successfully)
|
54
55
|
flash[:order_completed] = true
|
55
56
|
session[:order_id] = nil
|
56
|
-
|
57
|
-
else
|
58
|
-
redirect_to checkout_state_path(order.state)
|
57
|
+
path = completion_route(order)
|
59
58
|
end
|
59
|
+
render json: { redirect_to: path }
|
60
60
|
end
|
61
61
|
|
62
62
|
def cancel
|
@@ -2,7 +2,7 @@ module Spree
|
|
2
2
|
class Gateway::PayPalCheckout < Gateway
|
3
3
|
preference :api_key, :string
|
4
4
|
preference :secret_key, :string
|
5
|
-
preference :server, :string, default: '
|
5
|
+
preference :server, :string, default: 'api-m.sandbox.paypal.com'
|
6
6
|
|
7
7
|
def supports?(source)
|
8
8
|
true
|
data/app/views/spree/admin/payments/{paypal_refund.html.erb → paypal_checkout_refund.html.erb}
RENAMED
@@ -6,7 +6,7 @@
|
|
6
6
|
/ <%= Spree.t('refund', :scope => :paypal) %>
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
<%= form_tag
|
9
|
+
<%= form_tag paypal_checkout_refund_admin_order_payment_path(@order, @payment) do %>
|
10
10
|
<div class="label-block left five columns alpha">
|
11
11
|
<div>
|
12
12
|
<fieldset data-hook="admin_variant_new_form">
|
data/app/views/spree/admin/payments/source_forms/{_paypal.html.erb → _paypal_checkout.html.erb}
RENAMED
File without changes
|
data/app/views/spree/admin/payments/source_views/{_paypal.html.erb → _paypal_checkout.html.erb}
RENAMED
@@ -16,7 +16,7 @@
|
|
16
16
|
</div>
|
17
17
|
|
18
18
|
<% if payment.source.state != 'refunded' %>
|
19
|
-
<%= button_link_to Spree.t('actions.refund', scope: :paypal), spree.
|
19
|
+
<%= button_link_to Spree.t('actions.refund', scope: :paypal), spree.paypal_checkout_refund_admin_order_payment_path(@order, payment), icon: 'money' %>
|
20
20
|
<% else %>
|
21
21
|
<div class="alpha six columns">
|
22
22
|
<dl>
|
@@ -27,7 +27,10 @@
|
|
27
27
|
var transaction = orderData.purchase_units[0].payments.captures[0];
|
28
28
|
fetch(`/paypal_checkout/proceed?number=${data.orderID}&status=${transaction.status}&transaction_id=${transaction.id}`, {
|
29
29
|
method: "get",
|
30
|
-
})
|
30
|
+
}).then((response) => response.json())
|
31
|
+
.then((orderData2) => {
|
32
|
+
window.location.href = `${window.location.origin}${orderData2.redirect_to}`
|
33
|
+
});
|
31
34
|
});
|
32
35
|
}
|
33
36
|
}).render('#paypal-button-container');
|
data/config/routes.rb
CHANGED
@@ -4,4 +4,15 @@ Spree::Core::Engine.add_routes do
|
|
4
4
|
get '/paypal_checkout/cancel', :to => "paypal_checkout#cancel", :as => :cancel_paypal_checkout
|
5
5
|
get '/paypal_checkout/notify', :to => "paypal_checkout#notify", :as => :notify_paypal_checkout
|
6
6
|
get '/paypal_checkout/proceed', :to => "paypal_checkout#proceed", :as => :proceed_paypal_checkout
|
7
|
+
namespace :admin do
|
8
|
+
# Using :only here so it doesn't redraw those routes
|
9
|
+
resources :orders, :only => [] do
|
10
|
+
resources :payments, :only => [] do
|
11
|
+
member do
|
12
|
+
get 'paypal_checkout_refund'
|
13
|
+
post 'paypal_checkout_refund'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "spree_paypal_api_checkout".freeze
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.8"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
6
6
|
s.require_paths = ["lib".freeze]
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.date = "2022-02-22"
|
9
9
|
s.description = "Adds PayPal API Checkout as a Payment Method to Spree Commerce".freeze
|
10
10
|
s.email = "gems@spreecommerce.com".freeze
|
11
|
-
s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "app/assets/javascripts/spree/backend/spree_paypal_checkout.js".freeze, "app/assets/javascripts/spree/frontend/spree_paypal_checkout.js".freeze, "app/assets/stylesheets/spree/backend/spree_paypal_checkout.css".freeze, "app/assets/stylesheets/spree/frontend/spree_paypal_checkout.css".freeze, "app/controllers/spree/admin/payments_controller_decorator.rb".freeze, "app/controllers/spree/admin/paypal_checkout_payments_controller.rb".freeze, "app/controllers/spree/paypal_checkout_controller.rb".freeze, "app/models/spree/gateway/pay_pal_checkout.rb".freeze, "app/models/spree/paypal_api_checkout.rb".freeze, "app/views/spree/admin/payments/
|
11
|
+
s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "app/assets/javascripts/spree/backend/spree_paypal_checkout.js".freeze, "app/assets/javascripts/spree/frontend/spree_paypal_checkout.js".freeze, "app/assets/stylesheets/spree/backend/spree_paypal_checkout.css".freeze, "app/assets/stylesheets/spree/frontend/spree_paypal_checkout.css".freeze, "app/controllers/spree/admin/payments_controller_decorator.rb".freeze, "app/controllers/spree/admin/paypal_checkout_payments_controller.rb".freeze, "app/controllers/spree/paypal_checkout_controller.rb".freeze, "app/models/spree/gateway/pay_pal_checkout.rb".freeze, "app/models/spree/paypal_api_checkout.rb".freeze, "app/views/spree/admin/payments/_paypal_checkout_complete.html.erb".freeze, "app/views/spree/admin/payments/paypal_checkout_refund.html.erb".freeze, "app/views/spree/admin/payments/source_forms/_paypal_checkout.html.erb".freeze, "app/views/spree/admin/payments/source_views/_paypal_checkout.html.erb".freeze, "app/views/spree/checkout/payment/_paypal_checkout.html.erb".freeze, "config/locales/de.yml".freeze, "config/locales/en.yml".freeze, "config/locales/es.yml".freeze, "config/locales/it.yml".freeze, "config/locales/pl.yml".freeze, "config/locales/pt.yml".freeze, "config/routes.rb".freeze, "db/migrate/20220620042734_create_spree_paypal_api_checkouts.rb".freeze, "lib/generators/spree_paypal_api_checkout/install/install_generator.rb".freeze, "lib/spree_paypal_api_checkout.rb".freeze, "lib/spree_paypal_api_checkout/engine.rb".freeze, "lib/spree_paypal_api_checkout/version.rb".freeze, "script/rails".freeze, "spree_paypal_api_checkout.gemspec".freeze]
|
12
12
|
s.homepage = "http://www.spreecommerce.com".freeze
|
13
13
|
s.required_ruby_version = Gem::Requirement.new(">= 2.2.2".freeze)
|
14
14
|
s.requirements = ["none".freeze]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_paypal_api_checkout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spree Commerce
|
@@ -363,10 +363,10 @@ files:
|
|
363
363
|
- app/controllers/spree/paypal_checkout_controller.rb
|
364
364
|
- app/models/spree/gateway/pay_pal_checkout.rb
|
365
365
|
- app/models/spree/paypal_api_checkout.rb
|
366
|
-
- app/views/spree/admin/payments/
|
367
|
-
- app/views/spree/admin/payments/
|
368
|
-
- app/views/spree/admin/payments/source_forms/
|
369
|
-
- app/views/spree/admin/payments/source_views/
|
366
|
+
- app/views/spree/admin/payments/_paypal_checkout_complete.html.erb
|
367
|
+
- app/views/spree/admin/payments/paypal_checkout_refund.html.erb
|
368
|
+
- app/views/spree/admin/payments/source_forms/_paypal_checkout.html.erb
|
369
|
+
- app/views/spree/admin/payments/source_views/_paypal_checkout.html.erb
|
370
370
|
- app/views/spree/checkout/payment/_paypal_checkout.html.erb
|
371
371
|
- config/locales/de.yml
|
372
372
|
- config/locales/en.yml
|
@@ -401,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
401
401
|
version: '0'
|
402
402
|
requirements:
|
403
403
|
- none
|
404
|
-
rubygems_version: 3.2.
|
404
|
+
rubygems_version: 3.2.15
|
405
405
|
signing_key:
|
406
406
|
specification_version: 4
|
407
407
|
summary: Adds PayPal API Checkout as a Payment Method to Spree Commerce
|