flowcommerce_spree 0.0.6 → 0.0.7

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: ff1a7f69451b03b52d6422015450255988ac45f664a1bee62559e238e45f0a6b
4
- data.tar.gz: d9fab8b6b5091b70235cde18b88dd0dc0988ed0d38946571236d9a828b0e6750
3
+ metadata.gz: 6aa92dd937ce7ff2ac430c684e76eaf18f80dc165191b5452407b73a51f6cc59
4
+ data.tar.gz: 83270c61b581abf426a1e19d65c63d6c43ea4c766ba3bf67c3fc334cb234e6f6
5
5
  SHA512:
6
- metadata.gz: 73f135866d3644fc4b9a92bc8003d88c28bdf220612e4823d2d1f04e190f3e0888f00c995e215b7efc9ebfa81bd9720b47b00e8f796bdad6b68391bb1852ec59
7
- data.tar.gz: 8b2c6fe4c1d2987f4c467fb2f33afee8d0b4e15b7b6a12dddb44b28ab57c538e8c1dd9608604deca5170d70adfc011b0299ba00c7ba33c5b966a959878355a79
6
+ metadata.gz: c45520286feb21871014953ccaa0dd8d18d27520db9b31f05ef062f2e45d3d9b7b4de98807f46d3b4e0ec6acf63ed98e472fe0d37d4290f1b9bcd36ec21363db
7
+ data.tar.gz: 37f630c22db5e978c4325ee6a5029cfe5c45940d817b537fd80f3bb750e63fd50d235796d078b0a6ac028136ab3075703b78030edd3a392c35f87e8bd2327740
@@ -31,16 +31,9 @@ CurrentZoneLoader.module_eval do
31
31
  .where("meta -> 'flow_data' ->> 'country' = ?",
32
32
  ISO3166::Country[request_iso_code]&.alpha3).exists?
33
33
 
34
- request_ip = if Rails.env.production?
35
- request.ip
36
- else
37
- Spree::Config[:debug_request_ip_address] || request.ip
38
- # Germany ip: 85.214.132.117, Sweden ip: 62.20.0.196, Moldova ip: 89.41.76.29
39
- end
40
-
41
34
  # This will issue a session creation request to flow.io. The response will contain the Flow Experience key and
42
35
  # the session_id
43
- flow_io_session = FlowcommerceSpree::Session.create(ip: request_ip, visitor: visitor_id_for_flow_io)
36
+ flow_io_session = FlowcommerceSpree::Session.create(country: request_iso_code, visitor: visitor_id_for_flow_io)
44
37
 
45
38
  if (zone = Spree::Zones::Product.active.find_by(name: flow_io_session.experience&.key&.titleize))
46
39
  session['flow_session_id'] = flow_io_session.id
@@ -5,16 +5,14 @@ module FlowcommerceSpree
5
5
  class Session
6
6
  attr_accessor :session, :localized, :visitor
7
7
 
8
- def self.create(ip:, visitor:, experience: nil)
9
- instance = new(ip: ip, visitor: visitor, experience: experience)
8
+ def self.create(country:, visitor:, experience: nil)
9
+ instance = new(country: country, visitor: visitor, experience: experience)
10
10
  instance.create
11
11
  instance
12
12
  end
13
13
 
14
- def initialize(ip:, visitor:, experience: nil)
15
- ip = '127.0.0.1' if ip == '::1'
16
-
17
- @ip = ip
14
+ def initialize(country:, visitor:, experience: nil)
15
+ @country = country
18
16
  @visitor = visitor
19
17
  @experience = experience
20
18
  end
@@ -22,7 +20,7 @@ module FlowcommerceSpree
22
20
  # create session without or with experience (the latter is useful for creating a new session with the order's
23
21
  # experience on refreshing the checkout_token)
24
22
  def create
25
- data = { ip: @ip,
23
+ data = { country: @country,
26
24
  visit: { id: @visitor,
27
25
  expires_at: (Time.now + 30.minutes).iso8601 } }
28
26
  data[:experience] = @experience if @experience
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlowcommerceSpree
4
- VERSION = '0.0.6'
4
+ VERSION = '0.0.7'
5
5
  end
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.6
4
+ version: 0.0.7
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-04-13 00:00:00.000000000 Z
12
+ date: 2021-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_model_serializers
@@ -210,7 +210,6 @@ files:
210
210
  - app/helpers/spree/core/controller_helpers/flow_io_order_helper_decorator.rb
211
211
  - app/models/flowcommerce_spree/settings.rb
212
212
  - app/models/spree/address_decorator.rb
213
- - app/models/spree/app_configuration_decorator.rb
214
213
  - app/models/spree/calculator/flow_io.rb
215
214
  - app/models/spree/calculator/shipping/flow_io.rb
216
215
  - app/models/spree/flow_io_credit_card_decorator.rb
@@ -281,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
280
  - !ruby/object:Gem::Version
282
281
  version: '0'
283
282
  requirements: []
284
- rubygems_version: 3.1.2
283
+ rubygems_version: 3.0.8
285
284
  signing_key:
286
285
  specification_version: 4
287
286
  summary: Integration of Spree with Flow API
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- AppConfiguration.class_eval do
5
- preference :debug_request_ip_address, :string
6
- end
7
- end