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 +4 -4
- data/.travis.yml +2 -7
- data/Appraisals +6 -0
- data/app/controllers/spree/api/v1/shipments_controller_decorator.rb +3 -1
- data/app/controllers/spree/checkout_controller_decorator.rb +5 -5
- data/app/models/mollie/client_decorator.rb +3 -1
- data/app/models/spree/address_decorator.rb +3 -1
- data/app/models/spree/line_item_decorator.rb +4 -1
- data/app/models/spree/mollie/payment_state_updater.rb +1 -1
- data/app/models/spree/order_decorator.rb +4 -1
- data/app/models/spree/payment/gateway_options_decorator.rb +3 -1
- data/app/models/spree/payment/processing_decorator.rb +7 -17
- data/app/models/spree/payment_decorator.rb +3 -1
- data/app/models/spree/payment_method_decorator.rb +3 -1
- data/app/models/spree/user_decorator.rb +8 -2
- data/gemfiles/spree_4_0.gemfile +10 -0
- data/lib/spree_mollie_gateway/factories.rb +1 -0
- data/lib/spree_mollie_gateway/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7670b2cbf5bea5087da07d54d0ca3136e0d64429bf83afeb09030c1fe4533c0f
|
4
|
+
data.tar.gz: 4524d823f88e2c1de00c6fe57988f5e9b6d505dfa7bd3d8acdc126e5d527f7f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -1,4 +1,4 @@
|
|
1
|
-
Spree::Api::V1::
|
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
|
-
|
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::
|
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,5 @@
|
|
1
|
-
Spree::
|
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.
|
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::
|
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::
|
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::
|
2
|
-
|
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
|
-
|
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
|
-
|
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::
|
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,9 @@
|
|
1
|
-
Spree
|
2
|
-
|
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)
|
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:
|
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:
|
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.
|
403
|
+
rubygems_version: 3.1.2
|
403
404
|
signing_key:
|
404
405
|
specification_version: 4
|
405
406
|
summary: Mollie payments for Spree Commerce.
|