effective_orders 6.13.1 → 6.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/deluxe_api.rb +23 -3
- data/lib/effective_orders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7823c5fb7e1f5de56c962426e8ac2f19dcf21eb3ee562652a086db304b1da18
|
4
|
+
data.tar.gz: f9487dfd15d7088bb70c96a865b8ef06e16fe67c986e25df209234e0f40344e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5385f2d84ac47da6a90f54dce6a7abde305a85637f1fa9c15686c5fee5e27f36f9ac20c65355c4e92225a02496cb26e7f009a09bc00a6ba8e3c0bd7423a5619
|
7
|
+
data.tar.gz: fca2f157ed9f4d30b716382b6161653c42867e4d229f14707b6e2f11edbd49eec1d2677ac7ed381d527f025817d1c050dcc27ff8a2127899a330f34abffdbbbf
|
@@ -86,6 +86,17 @@ module Effective
|
|
86
86
|
true
|
87
87
|
end
|
88
88
|
|
89
|
+
def purchase_free!(order)
|
90
|
+
raise('expected a free order') unless order.free?
|
91
|
+
|
92
|
+
self.purchase_response = nil
|
93
|
+
payment = { card: "none", details: "free order. no payment required."}
|
94
|
+
self.purchase_response = payment
|
95
|
+
|
96
|
+
# Free is always valid
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
89
100
|
# Create Payment
|
90
101
|
def create_payment(order, payment_intent)
|
91
102
|
response = post('/payments', params: create_payment_params(order, payment_intent))
|
@@ -128,10 +139,17 @@ module Effective
|
|
128
139
|
|
129
140
|
order.update_columns(delayed_payment_purchase_ran_at: now, delayed_payment_purchase_result: nil)
|
130
141
|
|
131
|
-
purchased =
|
132
|
-
|
142
|
+
purchased = if order.total.to_i > 0
|
143
|
+
purchase!(order, order.delayed_payment_intent)
|
144
|
+
elsif order.free?
|
145
|
+
purchase_free!(order)
|
146
|
+
else
|
147
|
+
raise("Unexpected order amount: #{order.total}")
|
148
|
+
end
|
149
|
+
|
150
|
+
provider = (order.free? ? 'free' : order.payment_provider)
|
133
151
|
payment = self.payment()
|
134
|
-
card = payment["card"]
|
152
|
+
card = payment["card"] || payment[:card]
|
135
153
|
|
136
154
|
if purchased
|
137
155
|
order.assign_attributes(delayed_payment_purchase_result: "success")
|
@@ -152,6 +170,8 @@ module Effective
|
|
152
170
|
ExceptionNotifier.notify_exception(e, data: { order_id: order.id }) if defined?(ExceptionNotifier)
|
153
171
|
|
154
172
|
puts "Error purchasing #{order.id}: #{e.message}"
|
173
|
+
|
174
|
+
raise(e) if Rails.env.development? || Rails.env.test?
|
155
175
|
end
|
156
176
|
end
|
157
177
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.13.
|
4
|
+
version: 6.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|