spree_paypal_api_checkout 0.1.2 → 0.1.3

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: ac381ac7aa6843029df5f451f7d1808a637e0b830157b66459d946cb79788d15
4
- data.tar.gz: dacb44b1f3407eec37c1b181361c946511811c423a0e0f01ce90c70e9f88f8f2
3
+ metadata.gz: b79612956a0c2a85e4e971f5967be818be56d438b7034f7cc7b7bef83a01178d
4
+ data.tar.gz: f0ef4e1ea934c9c0309401707474219acb71a99a7471ec59a0da91eb29749eae
5
5
  SHA512:
6
- metadata.gz: 833dac68e15e27afc15f50babc6c334020db77d5c76e72efb4663d36b1b814ba785b070e342a1a573a4c8197fbab9e67b7dd366881f1dc833676e0c94fecd438
7
- data.tar.gz: '0678f4ca959ade6bf86e26f3540ab73ada30bb5e3b87bd855b9cb6582712a955938dab9b66f4cabbf0f8d8ed96115aa659a51e5816e886a183451c733bed6122'
6
+ metadata.gz: a3a8b3c4673d8ce405272ee20010636c0d3ded18eccf5c446cb2ad3a4f386bd5fa696e1f9d5783de6dcf12f0ce684668c9f62f7f36d07fce46fbb7a9678bb5f8
7
+ data.tar.gz: 2fb57d527e37a19d25b92a2e9f97f7f5143294e77b12f5b369d19e96a0b5670fc6dff7e11a30f1b03af9714e4ae6726bc393cec629f681c0aa5a3b6db5af782e
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.1.2'
7
+ gem 'spree_paypal_api_checkout', '~> 0.1.3'
8
8
 
9
9
  2. Install the gem using Bundler:
10
10
 
@@ -3,7 +3,7 @@
3
3
  SpreePaypalCheckout = {
4
4
  hideSettings: function(paymentMethod) {
5
5
  if (SpreePaypalCheckout.paymentMethodID && paymentMethod.val() == SpreePaypalCheckout.paymentMethodID) {
6
- $('.payment-method-settings').children().hide();
6
+ // $('.payment-method-settings').children().hide();
7
7
  $('#payment_amount').prop('disabled', 'disabled');
8
8
  $('button[type="submit"]').prop('disabled', 'disabled');
9
9
  $('#paypal-warning').show();
@@ -84,6 +84,7 @@ module Spree
84
84
  intent: 'CAPTURE',
85
85
  purchase_units: [
86
86
  {
87
+ invoice_id: current_order.number,
87
88
  amount: {
88
89
  currency_code: current_order.currency,
89
90
  value: order.total,
@@ -0,0 +1,22 @@
1
+ module Spree
2
+ module LogEntryDecorator
3
+ def parsed_details
4
+ @details ||= YAML.safe_load(details, [ActiveMerchant::Billing::Response, Net::HTTPCreated, URI::HTTPS, URI::RFC3986_Parser, Symbol, Regexp, Object])
5
+ end
6
+
7
+ def success_parsed_details?
8
+ if parsed_details.is_a?(Net::HTTPCreated)
9
+ parsed_paypal_entry == 'COMPLETED'
10
+ elsif parsed_details.is_a?(ActiveMerchant::Billing::Response)
11
+ parsed_details.success?
12
+ else
13
+ true
14
+ end
15
+ end
16
+
17
+ def parsed_paypal_entry
18
+ JSON.parse(parsed_details.read_body)['status'] rescue parsed_details.to_json
19
+ end
20
+ end
21
+ end
22
+ ::Spree::LogEntry.prepend(Spree::LogEntryDecorator)
@@ -0,0 +1,8 @@
1
+ <% currency = ::Money::Currency.new(entry.source.currency) %>
2
+ <tr>
3
+ <td><b><%= Spree.t('paypal.status').capitalize %></b></td>
4
+ <td><%= entry.source.amount.negative? ? entry.source.source.source.state : entry.source.state %></td>
5
+ <td><%= entry.parsed_paypal_entry %></td>
6
+ <td><%= currency.symbol %><%= entry.source.amount %></td>
7
+ <td><%= entry.source.response_code %></td>
8
+ </tr>
@@ -0,0 +1,27 @@
1
+ <%= render :partial => 'spree/admin/shared/order_tabs', locals: { current: 'Payments' }%>
2
+
3
+ <% content_for :page_title do %>
4
+ <i class="icon-arrow-right"></i>
5
+ <%= I18n.t(:one, scope: "activerecord.models.spree/payment") %>
6
+ <i class="icon-arrow-right"></i>
7
+ <%= Spree.t(:log_entries) %>
8
+ <% end %>
9
+
10
+ <% content_for :page_actions do %>
11
+ <%= button_link_to Spree.t(:logs), spree.admin_order_payment_log_entries_url(@order, @payment), icon: 'file.svg' %>
12
+ <% end %>
13
+
14
+ <table class='table table-striped' id='listing_log_entries'>
15
+ <% @log_entries.each do |entry| %>
16
+ <thead>
17
+ <tr class="log_entry <%= entry.success_parsed_details? ? 'success' : 'fail' %>">
18
+ <td colspan='2'>
19
+ <i class='icon icon-<%= entry.success_parsed_details? ? 'ok-circle' : 'remove-sign' %>'></i> <%= pretty_time(entry.created_at) %>
20
+ </td>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <%= render "spree/admin/log_entries/#{@payment.payment_method.method_type.gsub(' ', '').underscore}", entry: entry %>
25
+ </tbody>
26
+ <% end %>
27
+ </table>
@@ -1,4 +1,4 @@
1
- <div id='paypal-warning' style="display:none">
1
+ <div id='paypal-warning'>
2
2
  <strong><%= Spree.t('no_payment_via_admin_backend', :scope => 'paypal') %></strong>
3
3
  </div>
4
4
  <script>
@@ -1,3 +1,3 @@
1
1
  module SpreePaypalApiCheckout
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
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.1.2"
3
+ s.version = "0.1.3"
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_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]
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/models/spree/log_entry_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, "app/views/spree/admin/log_entries/_paypal_checkout.html.erb".freeze, "app/views/spree/admin/log_entries/index.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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spree Commerce
@@ -362,7 +362,10 @@ files:
362
362
  - app/controllers/spree/admin/paypal_checkout_payments_controller.rb
363
363
  - app/controllers/spree/paypal_checkout_controller.rb
364
364
  - app/models/spree/gateway/pay_pal_checkout.rb
365
+ - app/models/spree/log_entry_decorator.rb
365
366
  - app/models/spree/paypal_api_checkout.rb
367
+ - app/views/spree/admin/log_entries/_paypal_checkout.html.erb
368
+ - app/views/spree/admin/log_entries/index.html.erb
366
369
  - app/views/spree/admin/payments/_paypal_checkout_complete.html.erb
367
370
  - app/views/spree/admin/payments/paypal_checkout_refund.html.erb
368
371
  - app/views/spree/admin/payments/source_forms/_paypal_checkout.html.erb