effective_orders 6.27.0 → 6.27.1
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/effective/helcim_api.rb +28 -9
- data/config/effective_orders.rb +3 -1
- 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: 39a6e715f6426c191252405f88190416509e68dde1d99c87b8ee74d3ad964229
|
4
|
+
data.tar.gz: 3ae553d987297ad48d27d3b0812b230c9a552a31f40594212de5016da19ed7ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89704423cf419e8dfe32e75ccfd391a6eff02b9f5406f83e1f061584d4575df50a3936807204a2a38a23180323f7f0f5adef2dc45fbd9625fa88d704d9f1ff75
|
7
|
+
data.tar.gz: 0a508f033517b13d781b0cdf72d3f4c5ec40f58a369008e94e1e84106a9fc54c9cdcedad5faeb7207087cea6c64e31c8feaebc0b20b99e45abcc295a48c9330a
|
@@ -5,16 +5,21 @@ module Effective
|
|
5
5
|
# All required
|
6
6
|
attr_accessor :environment
|
7
7
|
attr_accessor :api_token
|
8
|
+
attr_accessor :partner_token
|
8
9
|
attr_accessor :currency
|
9
10
|
attr_accessor :brand_color
|
11
|
+
attr_accessor :fee_saver
|
10
12
|
|
11
13
|
attr_accessor :read_timeout
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
self.
|
16
|
-
self.
|
17
|
-
self.
|
14
|
+
attr_accessor :last_response
|
15
|
+
|
16
|
+
def initialize(environment: nil)
|
17
|
+
self.environment = EffectiveOrders.helcim.fetch(:environment)
|
18
|
+
self.api_token = EffectiveOrders.helcim.fetch(:api_token)
|
19
|
+
self.partner_token = EffectiveOrders.helcim.fetch(:partner_token)
|
20
|
+
self.currency = EffectiveOrders.helcim.fetch(:currency)
|
21
|
+
self.brand_color = EffectiveOrders.helcim.fetch(:brand_color)
|
22
|
+
self.fee_saver = EffectiveOrders.helcim.fetch(:fee_saver)
|
18
23
|
end
|
19
24
|
|
20
25
|
def health_check
|
@@ -31,10 +36,10 @@ module Effective
|
|
31
36
|
params = {
|
32
37
|
amount: ('%.2f' % order.total_to_f),
|
33
38
|
currency: currency,
|
34
|
-
paymentMethod: 'cc',
|
35
39
|
paymentType: 'purchase', # purchase, preauth, verify
|
40
|
+
paymentMethod: (fee_saver ? 'cc-ach' : 'cc'),
|
41
|
+
hasConvenienceFee: (fee_saver ? 1 : 0),
|
36
42
|
allowPartial: 0,
|
37
|
-
hasConvenienceFee: 0,
|
38
43
|
taxAmount: ('%.2f' % order.tax_to_f if order.tax.to_i > 0),
|
39
44
|
hideExistingPaymentDetails: 0,
|
40
45
|
setAsDefaultPaymentMethod: 1,
|
@@ -176,6 +181,8 @@ module Effective
|
|
176
181
|
http.read_timeout = (read_timeout || 30)
|
177
182
|
http.use_ssl = true
|
178
183
|
|
184
|
+
self.last_response = nil
|
185
|
+
|
179
186
|
result = with_retries do
|
180
187
|
puts "[GET] #{uri}" if Rails.env.development?
|
181
188
|
|
@@ -185,6 +192,8 @@ module Effective
|
|
185
192
|
response
|
186
193
|
end
|
187
194
|
|
195
|
+
self.last_response = result
|
196
|
+
|
188
197
|
JSON.parse(result.body)
|
189
198
|
end
|
190
199
|
|
@@ -195,11 +204,15 @@ module Effective
|
|
195
204
|
http.read_timeout = (read_timeout || 30)
|
196
205
|
http.use_ssl = true
|
197
206
|
|
207
|
+
self.last_response = nil
|
208
|
+
|
198
209
|
puts "[POST] #{uri} #{params}" if Rails.env.development?
|
199
210
|
|
200
211
|
response = http.post(uri.path, params.to_json, headers)
|
201
212
|
raise Exception.new("#{response.code} #{response.body}") unless response.code == '200'
|
202
213
|
|
214
|
+
self.last_response = response
|
215
|
+
|
203
216
|
JSON.parse(response.body)
|
204
217
|
end
|
205
218
|
|
@@ -246,7 +259,13 @@ module Effective
|
|
246
259
|
private
|
247
260
|
|
248
261
|
def headers
|
249
|
-
{
|
262
|
+
{
|
263
|
+
"Accept": "application/json",
|
264
|
+
"Content-Type":
|
265
|
+
"application/json",
|
266
|
+
'api-token': api_token,
|
267
|
+
'partner-token': partner_token.presence,
|
268
|
+
}.compact
|
250
269
|
end
|
251
270
|
|
252
271
|
def api_url
|
data/config/effective_orders.rb
CHANGED
@@ -172,8 +172,10 @@ EffectiveOrders.setup do |config|
|
|
172
172
|
# config.helcim = {
|
173
173
|
# environment: (Rails.env.production? ? 'production' : 'sandbox'),
|
174
174
|
# api_token: '',
|
175
|
+
# partner_token: '',
|
175
176
|
# currency: 'CAD',
|
176
|
-
# brand_color: '815AF0' # 6-digit hex color without any # sign
|
177
|
+
# brand_color: '815AF0', # 6-digit hex color without any # sign
|
178
|
+
# fee_saver: false
|
177
179
|
# }
|
178
180
|
|
179
181
|
# Moneris
|
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.27.
|
4
|
+
version: 6.27.1
|
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: 2025-
|
11
|
+
date: 2025-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|