spree_mollie_gateway 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71d084e9ddf7c9ea20337e7732131f2504c06977dca49702a0ca83e7e14b7296
4
- data.tar.gz: 56894306ec84acbc11d1a544148cff982002ae96757192c6933101d979dad658
3
+ metadata.gz: 2c3104359f48abe0dcb7db00826c17206542222d6d80b62d2d0ef8081eead29f
4
+ data.tar.gz: 58910be28e0110c2a44d45bac658c5bec286b012b5de0210430c579463300a52
5
5
  SHA512:
6
- metadata.gz: e73b25400439bb8d9a0ac2cf7f1510eabd80fc19f7bf80878bacdffc421c41a12fb2982d7b64724c8e981a25468bf1305de1907e61964298d3376fe4f6bef92a
7
- data.tar.gz: f1d89f1cc697ef9763d0258623a78a8b562a5e2d494cb1a26ce1d8677b67c5078da6ec61fa6326be6c6c430ae7f38dc534411a52fd80a4d904ad9b730f2bd253
6
+ metadata.gz: 77c93445e60c74a96fed738943d6a74e1c3e40af4f8ffe8f4abf341e76d25bf4bc1bee1e114e6e845dd578059fd22bb58522ff73df341512868467bafc62da70
7
+ data.tar.gz: 85b2c58031bc8f588d9eb55b85f136990daaadabacc84db745af0ae4e327d86e377ba09aeb9b736700068d0b904800778db7d20fb81bfb54320ecf7781464361
@@ -1,5 +1,23 @@
1
1
  Spree::Payment::Processing.module_eval do
2
2
  def process!(amount = nil)
3
+ if payment_method.is_a? Spree::Gateway::MollieGateway
4
+ process_with_mollie
5
+ else
6
+ process_with_spree
7
+ end
8
+ end
9
+
10
+ private
11
+
12
+ def process_with_spree
13
+ if payment_method && payment_method.auto_capture?
14
+ purchase!
15
+ else
16
+ authorize!
17
+ end
18
+ end
19
+
20
+ def process_with_mollie
3
21
  amount ||= money.money.cents
4
22
  started_processing!
5
23
  response = payment_method.create_transaction(
@@ -9,4 +27,4 @@ Spree::Payment::Processing.module_eval do
9
27
  )
10
28
  handle_response(response, :pend, :failure)
11
29
  end
12
- end
30
+ end
@@ -5,6 +5,7 @@ Spree.user_class.class_eval do
5
5
  # Don't create Mollie customers if spree_auth_devise is not installed.
6
6
  return unless defined? Spree::User
7
7
  mollie_gateway = Spree::PaymentMethod.find_by_type 'Spree::Gateway::MollieGateway'
8
+ return unless mollie_gateway.present?
8
9
  mollie_customer = mollie_gateway.create_customer(self)
9
10
  update mollie_customer_id: mollie_customer.id
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module SpreeMollieGateway
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
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: 1.0.5
4
+ version: 1.0.6
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: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core