flowcommerce_spree 0.0.6 → 0.0.7
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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6aa92dd937ce7ff2ac430c684e76eaf18f80dc165191b5452407b73a51f6cc59
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 83270c61b581abf426a1e19d65c63d6c43ea4c766ba3bf67c3fc334cb234e6f6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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( 
     | 
| 
      
 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( 
     | 
| 
       9 
     | 
    
         
            -
                  instance = new( 
     | 
| 
      
 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( 
     | 
| 
       15 
     | 
    
         
            -
                   
     | 
| 
       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 = {  
     | 
| 
      
 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
         
     | 
    
        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.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- 
     | 
| 
      
 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. 
     | 
| 
      
 283 
     | 
    
         
            +
            rubygems_version: 3.0.8
         
     | 
| 
       285 
284 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       286 
285 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       287 
286 
     | 
    
         
             
            summary: Integration of Spree with Flow API
         
     |