spree_paypal_api_checkout 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d5c1380a64e977885a5654cb5ad51252b873d4111ab7afa3502604bf478e58
4
- data.tar.gz: 8318b8560107a17f02ee3ced1c2b6b469633fcbbe32ce73008a7528adb833f99
3
+ metadata.gz: 06d58fd2ed0b683b5f83542c81c695d25ba58e05807ea20db5a3391b5dc58b36
4
+ data.tar.gz: 5f315cada65b5b7fc6bd0b5d20dfeefbeddea0fc02883119faddbc5eb960cf52
5
5
  SHA512:
6
- metadata.gz: a1898e5770e862572b17cc976f70f385afa521f8390f3a4c9ffd70bd1c1654b8bcad0c84c9f271ec74f00daaa826887e0482fd44561718c2be5296bf9ec6ca35
7
- data.tar.gz: 5e5c22d36c999c412838b78365686a356815ed84fda9d99a88acc3000c34c21fe2ca3ce08e0250a3de2d364f325648444073a1868c462b4194e4ac4d1666e037
6
+ metadata.gz: 59b562c5c96d4ac8deacf23aa16671364ea01bbef64f467a626a04c047260f7e31d2832e340040bf6e588d8c6f9278d68e61e5c4113c05a133cde94aeb742d27
7
+ data.tar.gz: b4ee8db0480d09a7bf2dc2be5ede7af6166128a54eed82367a7d95e94327c7b30affe17b67120b95f3c22c701f7ecbbc5166f877b5c0fd73dc3a33e35551fbde
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  1. Add this extension to your Gemfile with this line:
6
6
 
7
- gem 'spree_paypal_api_checkout', '~> 0.0.6'
7
+ gem 'spree_paypal_api_checkout', '~> 0.0.7'
8
8
 
9
9
  2. Install the gem using Bundler:
10
10
 
@@ -1,5 +1,5 @@
1
1
  module Spree::Admin::PaymentsControllerDecorator
2
- def paypal_refund
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.success?
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
@@ -1,4 +1,4 @@
1
- <%= form_tag paypal_refund_admin_order_payment_path(@order, @payment) do %>
1
+ <%= form_tag paypal_checkout_refund_admin_order_payment_path(@order, @payment) do %>
2
2
  <div class="label-block left five columns alpha">
3
3
  <div>
4
4
  <fieldset data-hook="admin_variant_new_form">
@@ -6,7 +6,7 @@
6
6
  / <%= Spree.t('refund', :scope => :paypal) %>
7
7
  <% end %>
8
8
 
9
- <%= form_tag paypal_refund_admin_order_payment_path(@order, @payment) do %>
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">
@@ -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.paypal_refund_admin_order_payment_path(@order, payment), icon: 'money' %>
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,3 +1,3 @@
1
1
  module SpreePaypalApiCheckout
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  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.6"
3
+ s.version = "0.0.7"
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/_paypal_complete.html.erb".freeze, "app/views/spree/admin/payments/paypal_refund.html.erb".freeze, "app/views/spree/admin/payments/source_forms/_paypal.html.erb".freeze, "app/views/spree/admin/payments/source_views/_paypal.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]
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.6
4
+ version: 0.0.7
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/_paypal_complete.html.erb
367
- - app/views/spree/admin/payments/paypal_refund.html.erb
368
- - app/views/spree/admin/payments/source_forms/_paypal.html.erb
369
- - app/views/spree/admin/payments/source_views/_paypal.html.erb
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