solidus_nexio 0.4.0 → 0.4.1

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: 30a0a8caecebecbaed158c6c195072fdad67eed7308658d91d4fd8ee39bbc07b
4
- data.tar.gz: 2baa67ea4406dd56ca2caaee620fe36c6ff8ba191b68c8c34ef998e5972905d3
3
+ metadata.gz: c824e5f041c3632fed6eee4f0b6b16a87edbc939e4ce4b4a022cfad1099c7355
4
+ data.tar.gz: bb652b85568a70d550fdaab690a61f2ef103d5eaec22fdd11d53e49a22778a19
5
5
  SHA512:
6
- metadata.gz: 56da292a0a75cea5dcea99eaae7ad90f4619cfa542f4afdc5dbef53f2735c0d9b7f8b472fb08167d20a01acbb263534dec993712df3bc4c18207ce55178c5cf9
7
- data.tar.gz: 35e3c3b56afca1e4f4b6b4e8ebaa53e2267f5a184e49e33629cdb48ec93561914a772c94346ced58ecd9822ad01370ada3f2f24212eb256772286b67310ecf65
6
+ metadata.gz: '084bc6e66e4e6690b2932280af94932bbe80fe2f7eee9d9150660e01052897ddab09d647bcfc07f5a463a57c6db5817e4e0a5dfe6d6affef2bd8113f41b29fc1'
7
+ data.tar.gz: 5f90d10aa5c547180d5c6d204dd7cc5fbf041c1709ca0ff9fd980fde43d635f9563abcc435095f66234785887cd5bd5e20fe532d4df514b26830858f736e4837
@@ -8,9 +8,13 @@ module SolidusNexio
8
8
 
9
9
  def capture
10
10
  payment_method = PaymentMethod.find(params[:payment_method_id])
11
- payment = payment_method.payments.find(params[:payment_id])
12
- @result = payment_method.capture_order_payment(payment, params[:id], params[:status])
13
- render :capture, layout: false
11
+ payment = payment_method.payments.find_by(number: params[:payment_id])
12
+ if payment
13
+ @result = payment_method.capture_order_payment(payment, params[:id], params[:status])
14
+ render :capture, layout: false
15
+ else
16
+ head 404
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -4,7 +4,7 @@ module SolidusNexio
4
4
  if update_order
5
5
  payment_method = PaymentMethod.find(params[:payment_method_id])
6
6
  result = payment_method.process_order_payment(@order) do |payment|
7
- capture_payment_method_payment_state_url(payment_method, payment)
7
+ capture_payment_method_payment_state_url(payment_method, payment.number)
8
8
  end
9
9
  render json: result
10
10
  else
@@ -41,7 +41,7 @@ module SolidusNexio
41
41
  def capture_order_payment(payment, id, status)
42
42
  return ProcessResult.new(:invalid, nil) unless payment.checkout?
43
43
 
44
- if success_payment_status?(payment, id, status)
44
+ if id.present? && %w[pending authOnly].include?(status)
45
45
  payment.response_code = id
46
46
  auto_capture? ? payment.complete! : payment.pend!
47
47
  ProcessResult.new(:success, nil)
@@ -113,14 +113,5 @@ module SolidusNexio
113
113
 
114
114
  resp.params['redirectUrl'] if resp.params['status'] == 'redirect'
115
115
  end
116
-
117
- def success_payment_status?(payment, id, status)
118
- return false unless id.present? && %w[pending authOnly].include?(status)
119
-
120
- data = gateway.get_transaction(id)
121
- return false unless data
122
-
123
- data.fetch('plugin', {})['orderNumber'] == payment.order.number
124
- end
125
116
  end
126
117
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusNexio
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_nexio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Whitespectre