spree_mollie_gateway 3.2.1 → 4.0.0

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: 4e2cca6790b23f484d63d21c1a4fd7b2bf0395669451747997ea74defc395bb1
4
- data.tar.gz: b72b07e1cd8f1031778836a93921bd7051b3a8342cff0fad5391b3251421f85b
3
+ metadata.gz: 7670b2cbf5bea5087da07d54d0ca3136e0d64429bf83afeb09030c1fe4533c0f
4
+ data.tar.gz: 4524d823f88e2c1de00c6fe57988f5e9b6d505dfa7bd3d8acdc126e5d527f7f7
5
5
  SHA512:
6
- metadata.gz: 496d9da85c83ccaae696231b382595e9967a8ee78c9e5a2e5fc6181aec5d5ff789e636123265e80f2d5bf3d6758d4e3c7d15d2004aab2df6c80811740cae2a47
7
- data.tar.gz: c46c73fccbd1f90d853bb7ddcdcc6637911e52bd99338d7376cfad33397df95c47bd6fa0b30096130e706400360b4ca379df240d53eae60a591f5f804c794ecf
6
+ metadata.gz: 2036af6da07847e7816c807163a3c61a1f6d755f6538e697ddaea6ea6db856028f4945aee0d7dafdcc25064e99991ee7f82e5e9a6f14a65854acf5f34851d9a3
7
+ data.tar.gz: a6273f54097c37d9e14d9ef43121046ea3c25a55e1b9e25a75b3dcc8356c3c8a1330117621466788344c423f53457b1c133c07410a145c8a483d5da0c975d543
data/.travis.yml CHANGED
@@ -4,25 +4,20 @@ language: ruby
4
4
  cache: bundler
5
5
 
6
6
  rvm:
7
- - 2.3.8
8
- - 2.4.4
9
7
  - 2.5.1
8
+ - 2.6.5
10
9
 
11
10
  gemfile:
12
11
  - gemfiles/spree_3_5.gemfile
13
12
  - gemfiles/spree_3_6.gemfile
14
13
  - gemfiles/spree_3_7.gemfile
14
+ - gemfiles/spree_4_0.gemfile
15
15
 
16
16
  # Use legacy bundler (1.x) when using Ruby 2.3.x
17
17
  before_install:
18
18
  - if [ "USE_LEGACY_BUNDLER" != "false" ]; then gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true; fi
19
19
  - if [ "USE_LEGACY_BUNDLER" != "false" ]; then gem install bundler -v '< 2'; fi
20
20
 
21
- # Allow failing tests against Spree 3.7.x for now
22
- matrix:
23
- allow_failures:
24
- - gemfile: gemfiles/spree_3_7.gemfile
25
-
26
21
  script:
27
22
  - bundle exec rake test_app
28
23
  - bundle exec rake spec
data/Appraisals CHANGED
@@ -10,4 +10,10 @@ end
10
10
 
11
11
  appraise 'spree-3-7' do
12
12
  gem 'spree', '~> 3.7.2'
13
+ end
14
+
15
+ appraise 'spree-4-0' do
16
+ gem 'spree', '~> 4.0.3'
17
+ gem 'spree_api', '~> 4.0.3'
18
+ gem 'rails', '~> 6.0.0'
13
19
  end
@@ -1,4 +1,4 @@
1
- Spree::Api::V1::ShipmentsController.class_eval do
1
+ module Spree::Api::V1::ShipmentsControllerDecorator
2
2
  def ship
3
3
  unless @shipment.tracking.present?
4
4
  # We should enforce entering tracking details, otherwise shipments cannot
@@ -10,3 +10,5 @@ Spree::Api::V1::ShipmentsController.class_eval do
10
10
  respond_with(@shipment, default_template: :show)
11
11
  end
12
12
  end
13
+
14
+ Spree::Api::V1::ShipmentsController.prepend(Spree::Api::V1::ShipmentsControllerDecorator)
@@ -20,11 +20,7 @@ module Spree
20
20
  end
21
21
  end
22
22
 
23
- CheckoutController.class_eval do
24
- prepend CheckoutWithMollie
25
-
26
- private
27
-
23
+ module CheckoutControllerDecorator
28
24
  def payment_method_id_param
29
25
  params[:order][:payments_attributes].first[:payment_method_id]
30
26
  end
@@ -38,4 +34,8 @@ module Spree
38
34
  (params[:state] === 'payment') && params[:order][:payments_attributes]
39
35
  end
40
36
  end
37
+
38
+ CheckoutController.prepend(CheckoutWithMollie)
39
+ CheckoutController.prepend(CheckoutControllerDecorator)
40
+
41
41
  end
@@ -1,4 +1,4 @@
1
- Mollie::Client.class_eval do
1
+ module Mollie::ClientDecorator
2
2
  attr_accessor :version_strings
3
3
 
4
4
  def initialize(api_key = nil)
@@ -11,3 +11,5 @@ Mollie::Client.class_eval do
11
11
  add_version_string OpenSSL::OPENSSL_VERSION.split(' ').slice(0, 2).join '/'
12
12
  end
13
13
  end
14
+
15
+ Mollie::Client.prepend(Mollie::ClientDecorator)
@@ -1,4 +1,4 @@
1
- Spree::Address.class_eval do
1
+ module Spree::AddressDecorator
2
2
  def active_merchant_hash
3
3
  {
4
4
  name: full_name,
@@ -14,3 +14,5 @@ Spree::Address.class_eval do
14
14
  }
15
15
  end
16
16
  end
17
+
18
+ Spree::Address.prepend(Spree::AddressDecorator)
@@ -1,4 +1,5 @@
1
- Spree::LineItem.class_eval do
1
+ module Spree::LineItemDecorator
2
+ extend Spree::DisplayMoney
2
3
  money_methods :discount_amount, :vat_amount
3
4
 
4
5
  def discount_amount
@@ -27,3 +28,5 @@ Spree::LineItem.class_eval do
27
28
  end
28
29
  end
29
30
  end
31
+
32
+ Spree::LineItem.prepend(Spree::LineItemDecorator)
@@ -52,7 +52,7 @@ module Spree
52
52
 
53
53
  def transition_to_failed!
54
54
  @spree_payment.failure! unless @spree_payment.failed?
55
- @spree_payment.order.update_attributes(state: 'payment', completed_at: nil) unless @spree_payment.order.paid_or_authorized?
55
+ @spree_payment.order.update(state: 'payment', completed_at: nil) unless @spree_payment.order.paid_or_authorized?
56
56
  MollieLogger.debug("Mollie order is #{@mollie_order.status} and will be marked as failed")
57
57
  end
58
58
 
@@ -1,4 +1,5 @@
1
- Spree::Order.class_eval do
1
+ module Spree::OrderDecorator
2
+ extend Spree::DisplayMoney
2
3
  money_methods :order_adjustment_total, :shipping_discount
3
4
 
4
5
  # Make sure the order confirmation is delivered when the order has been paid for.
@@ -58,3 +59,5 @@ Spree::Order.class_eval do
58
59
  order_adjustment_total.abs > 0
59
60
  end
60
61
  end
62
+
63
+ Spree::Order.prepend(Spree::OrderDecorator)
@@ -1,4 +1,4 @@
1
- Spree::Payment::GatewayOptions.class_eval do
1
+ module Spree::Payment::GatewayOptionsDecorator
2
2
  def hash_methods
3
3
  %i[
4
4
  email
@@ -17,3 +17,5 @@ Spree::Payment::GatewayOptions.class_eval do
17
17
  ]
18
18
  end
19
19
  end
20
+
21
+ Spree::Payment::GatewayOptions.prepend(Spree::Payment::GatewayOptionsDecorator)
@@ -1,9 +1,10 @@
1
- Spree::Payment::Processing.module_eval do
2
- def process!(_amount = nil)
1
+ module Spree::Payment::ProcessingDecorator
2
+
3
+ def process!
3
4
  if payment_method.is_a? Spree::Gateway::MollieGateway
4
5
  process_with_mollie
5
6
  else
6
- process_with_spree
7
+ super
7
8
  end
8
9
  end
9
10
 
@@ -11,30 +12,17 @@ Spree::Payment::Processing.module_eval do
11
12
  if payment_method.is_a? Spree::Gateway::MollieGateway
12
13
  cancel_with_mollie
13
14
  else
14
- cancel_with_spree
15
+ super
15
16
  end
16
17
  end
17
18
 
18
19
  private
19
20
 
20
- def cancel_with_spree
21
- response = payment_method.cancel(response_code)
22
- handle_response(response, :void, :failure)
23
- end
24
-
25
21
  def cancel_with_mollie
26
22
  response = payment_method.cancel(transaction_id)
27
23
  handle_response(response, :void, :failure)
28
24
  end
29
25
 
30
- def process_with_spree
31
- if payment_method && payment_method.auto_capture?
32
- purchase!
33
- else
34
- authorize!
35
- end
36
- end
37
-
38
26
  def process_with_mollie
39
27
  amount ||= money.money
40
28
  started_processing!
@@ -46,3 +34,5 @@ Spree::Payment::Processing.module_eval do
46
34
  handle_response(response, :started_processing, :failure)
47
35
  end
48
36
  end
37
+
38
+ Spree::Payment.include(Spree::Payment::ProcessingDecorator)
@@ -1,4 +1,4 @@
1
- Spree::Payment.class_eval do
1
+ module Spree::PaymentDecorator
2
2
  def transaction_id
3
3
  if payment_method.is_a? Spree::Gateway::MollieGateway
4
4
  source.transaction_id
@@ -37,3 +37,5 @@ Spree::Payment.class_eval do
37
37
  end
38
38
  end
39
39
  end
40
+
41
+ Spree::Payment.prepend(Spree::PaymentDecorator)
@@ -1,5 +1,7 @@
1
- Spree::PaymentMethod.class_eval do
1
+ module Spree::PaymentMethodDecorator
2
2
  def gateways(_options = {})
3
3
  []
4
4
  end
5
5
  end
6
+
7
+ Spree::PaymentMethod.prepend(Spree::PaymentMethodDecorator)
@@ -1,5 +1,9 @@
1
- Spree.user_class.class_eval do
2
- after_create :create_mollie_customer
1
+ module Spree::UserDecorator
2
+
3
+ def self.prepended(base)
4
+ base.after_create :create_mollie_customer
5
+ end
6
+
3
7
 
4
8
  def create_mollie_customer
5
9
  # Don't create Mollie customers if spree_auth_devise is not installed.
@@ -12,3 +16,5 @@ Spree.user_class.class_eval do
12
16
  update mollie_customer_id: mollie_customer.id
13
17
  end
14
18
  end
19
+
20
+ Spree.user_class.prepend(Spree::UserDecorator)
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mollie-api-ruby", "~> 4.2.0"
6
+ gem "spree", "~> 4.0.3"
7
+ gem "spree_api", "~> 4.0.3"
8
+ gem "rails", "~> 6.0.0"
9
+
10
+ gemspec path: "../"
@@ -1,3 +1,4 @@
1
+ module SpreeMollieGateway::Factories; end
1
2
  FactoryBot.define do
2
3
  # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
3
4
  #
@@ -1,3 +1,3 @@
1
1
  module SpreeMollieGateway
2
- VERSION = '3.2.1'.freeze
2
+ VERSION = '4.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_mollie_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vernon de Goede
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2020-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_backend
@@ -373,6 +373,7 @@ files:
373
373
  - gemfiles/spree_3_5.gemfile
374
374
  - gemfiles/spree_3_6.gemfile
375
375
  - gemfiles/spree_3_7.gemfile
376
+ - gemfiles/spree_4_0.gemfile
376
377
  - lib/generators/spree_mollie_gateway/install/install_generator.rb
377
378
  - lib/spree_mollie_gateway.rb
378
379
  - lib/spree_mollie_gateway/engine.rb
@@ -399,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
400
  - !ruby/object:Gem::Version
400
401
  version: '0'
401
402
  requirements: []
402
- rubygems_version: 3.0.6
403
+ rubygems_version: 3.1.2
403
404
  signing_key:
404
405
  specification_version: 4
405
406
  summary: Mollie payments for Spree Commerce.