flowcommerce_spree 0.0.15 → 0.0.16
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 +4 -4
- data/app/models/spree/gateway/flow_io.rb +15 -6
- data/lib/flowcommerce_spree/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c9cb2032b50a1392231cb88c7ef6549e623ac604bcdcfecc8d8224e9f8558c4
|
4
|
+
data.tar.gz: 1564b9412b0be89b38ff6a7feb86397311ebe400614618c13c495c58c90059f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f39ac40b274fbcbf29de37a461b14b7aca12d0496d20c89ba27eeee63d3013c776631737cc1f5b154ffe2f67c812aed6aac850d49584853b4063ef81c85acb
|
7
|
+
data.tar.gz: f085428b7616287640093de5cb1635dd6a7e8d63b77b64991f88062fa8c2ef271dc0763a7bc21b5331b2348a822485f496716b4ce7f5db7e6147584f56c2735c
|
@@ -61,13 +61,17 @@ module Spree
|
|
61
61
|
ActiveMerchant::Billing::Response.new(false, e.to_s, {}, {})
|
62
62
|
end
|
63
63
|
|
64
|
-
def void(authorization_id,
|
64
|
+
def void(authorization_id, options = {})
|
65
65
|
amount = (options[:subtotal] + options[:shipping]) * 0.01
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
order = Spree::Order.find_by(number: options[:order_id].split('-').first)
|
67
|
+
refund_form = Io::Flow::V0::Models::RefundForm.new(order_number: order.number,
|
68
|
+
amount: amount,
|
69
|
+
currency: options[:currency],
|
70
|
+
authorization_id: authorization_id)
|
71
|
+
response = FlowcommerceSpree.client.refunds.post(FlowcommerceSpree::ORGANIZATION, refund_form)
|
72
|
+
validate_flow_refund_response(response, order)
|
73
|
+
|
74
|
+
ActiveMerchant::Billing::Response.new(true, 'flow-payment-void', {}, {})
|
71
75
|
end
|
72
76
|
|
73
77
|
def create_profile(payment)
|
@@ -91,6 +95,11 @@ module Spree
|
|
91
95
|
amount: amount,
|
92
96
|
currency: order.currency)
|
93
97
|
response = FlowcommerceSpree.client.refunds.post(FlowcommerceSpree::ORGANIZATION, refund_form)
|
98
|
+
result = validate_flow_refund_response(response, order)
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
def validate_flow_refund_response(response, order)
|
94
103
|
response_status = response.status.value
|
95
104
|
if REFUND_VALID_STATES.include? response_status
|
96
105
|
add_refund_to_order(response, order)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowcommerce_spree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurel Branzeanu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-09-
|
12
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_model_serializers
|
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
requirements: []
|
288
|
-
rubygems_version: 3.0.
|
288
|
+
rubygems_version: 3.0.3
|
289
289
|
signing_key:
|
290
290
|
specification_version: 4
|
291
291
|
summary: Integration of Spree with Flow API
|