flowcommerce_spree 0.0.5 → 0.0.6

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: c3c70c6b82576ce2c4aa02c3b68a34c1c7b17360099ec14b59113d9fe59600d4
4
- data.tar.gz: 6350b688c98c72b9c4a63ac4b91e412cf33683739e710c49ea85b3d4e3b6234e
3
+ metadata.gz: ff1a7f69451b03b52d6422015450255988ac45f664a1bee62559e238e45f0a6b
4
+ data.tar.gz: d9fab8b6b5091b70235cde18b88dd0dc0988ed0d38946571236d9a828b0e6750
5
5
  SHA512:
6
- metadata.gz: 651de4bcd8137242f0f6b50d21ccc2971f4b862d8e486f2087b3df19635f62c4ab7d2c00162d7801b27bd17fff8cf16c0df902e3cd3feb84f40513937cd483ba
7
- data.tar.gz: c4ebc042ff007ccfc9fed580fd152f7be335eb3f4b899fc858511380a3bc6037bfb2d91ecfb28d9624731a433f49a25f8016a374de02602ad848ae88e27223cc
6
+ metadata.gz: 73f135866d3644fc4b9a92bc8003d88c28bdf220612e4823d2d1f04e190f3e0888f00c995e215b7efc9ebfa81bd9720b47b00e8f796bdad6b68391bb1852ec59
7
+ data.tar.gz: 8b2c6fe4c1d2987f4c467fb2f33afee8d0b4e15b7b6a12dddb44b28ab57c538e8c1dd9608604deca5170d70adfc011b0299ba00c7ba33c5b966a959878355a79
@@ -7,12 +7,14 @@ CurrentZoneLoader.module_eval do
7
7
  return @current_zone if defined?(@current_zone)
8
8
 
9
9
  @current_zone = if (session_region_name = session['region']&.[]('name'))
10
- Spree::Zones::Product.find_by(name: session_region_name)
11
- elsif request_iso_code.present?
12
- @current_zone = flow_zone
13
- @current_zone ||= Spree::Country.find_by(iso: request_iso_code)&.product_zones&.active&.first
10
+ Spree::Zones::Product.find_by(name: session_region_name, status: 'active')
14
11
  end
15
12
 
13
+ @current_zone ||= if request_iso_code.present?
14
+ @current_zone = flow_zone
15
+ @current_zone ||= Spree::Country.find_by(iso: request_iso_code)&.product_zones&.active&.first
16
+ end
17
+
16
18
  @current_zone ||= Spree::Zones::Product.find_by(name: 'International') ||
17
19
  Spree::Zones::Product.new(name: 'International', taxon_ids: [], currencies: %w[USD CAD])
18
20
 
@@ -9,7 +9,9 @@ module FlowcommerceSpree
9
9
  # proxy enpoint between flow and thankyou page.
10
10
  # /flow/order_completed endpoint
11
11
  def order_completed
12
- flow_updater = FlowcommerceSpree::OrderUpdater.new(order: current_order)
12
+ order = Spree::Order.find_by number: params[:order], guest_token: params[:t]
13
+
14
+ flow_updater = FlowcommerceSpree::OrderUpdater.new(order: order)
13
15
  flow_updater.complete_checkout
14
16
 
15
17
  redirect_to "/thankyou?order=#{params[:order]}&t=#{params[:t]}"
@@ -28,6 +28,10 @@ module Spree
28
28
  flow_data&.[]('key').present? && flow_data['status'] == 'active'
29
29
  end
30
30
 
31
+ def flow_io_active_or_archiving_experience?
32
+ flow_data&.[]('key').present? && %w[active archiving].include?(flow_data['status'])
33
+ end
34
+
31
35
  def update_on_flow; end
32
36
 
33
37
  def remove_on_flow_io
@@ -3,7 +3,9 @@
3
3
  module FlowcommerceSpree
4
4
  class OrderUpdater
5
5
  def initialize(order:)
6
- raise(ArgumentError, 'Experience not defined or not active') unless order&.zone&.flow_io_active_experience?
6
+ unless order&.zone&.flow_io_active_or_archiving_experience?
7
+ raise(ArgumentError, 'Experience not defined or not active')
8
+ end
7
9
 
8
10
  @experience = order.flow_io_experience_key
9
11
  @order = order
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FlowcommerceSpree
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
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.5
4
+ version: 0.0.6
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-07 00:00:00.000000000 Z
12
+ date: 2021-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: active_model_serializers