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 +4 -4
- data/app/controllers/concerns/current_zone_loader_decorator.rb +6 -4
- data/app/controllers/flowcommerce_spree/orders_controller.rb +3 -1
- data/app/models/spree/zones/flow_io_product_zone_decorator.rb +4 -0
- data/app/services/flowcommerce_spree/order_updater.rb +3 -1
- data/lib/flowcommerce_spree/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: ff1a7f69451b03b52d6422015450255988ac45f664a1bee62559e238e45f0a6b
|
4
|
+
data.tar.gz: d9fab8b6b5091b70235cde18b88dd0dc0988ed0d38946571236d9a828b0e6750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
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.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-
|
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
|