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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f2d362666e0acf723037a83305a0d8abb7390b9450bdb70ca8edb2917023062
4
- data.tar.gz: a9582919b75d433be885f5bd4f58b7fe45f4b49778627cbd1d66152d346c7a02
3
+ metadata.gz: 39a6e715f6426c191252405f88190416509e68dde1d99c87b8ee74d3ad964229
4
+ data.tar.gz: 3ae553d987297ad48d27d3b0812b230c9a552a31f40594212de5016da19ed7ba
5
5
  SHA512:
6
- metadata.gz: de9920886821096194b4ee8b07ee2a643994e3daa4c726173cb354de7a0b044b74ca28d51deda550857e52f9166fb539cd6484f0eb5b3149c5d353a3f6fb76ca
7
- data.tar.gz: 302f8062e198841746e462b589946f8fbd4b1bc52744e1f493402889db788739069708d9cc5729513a12cbfeae6c3c2551e945f470b3ce5c3942b6b88bc2d67a
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
- def initialize(environment: nil, api_token: nil, currency: nil, brand_color: nil)
14
- self.environment = environment || EffectiveOrders.helcim.fetch(:environment)
15
- self.api_token = api_token || EffectiveOrders.helcim.fetch(:api_token)
16
- self.currency = currency || EffectiveOrders.helcim.fetch(:currency)
17
- self.brand_color = brand_color || EffectiveOrders.helcim.fetch(:brand_color)
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
- { "Accept": "application/json", "Content-Type": "application/json", 'api-token': api_token }
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.27.0'.freeze
2
+ VERSION = '6.27.1'.freeze
3
3
  end
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.0
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-07-31 00:00:00.000000000 Z
11
+ date: 2025-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails