From fea5a2235e5e6b50277bba37fa61a4353402750f Mon Sep 17 00:00:00 2001 From: Aurel Branzeanu Date: Fri, 5 Mar 2021 19:08:41 +0200 Subject: [PATCH] [TEC-4931] Change client initialization in OrderSync to have the session_id specified in default headers This is a workaround for Missing Session AuthScema proposed by the flow.io dev - https://github.com/flowcommerce/ruby-sdk/pull/26#pullrequestreview-571847383 Allows to update flowcommerce gem, not depending on a fork. --- app/services/flowcommerce_spree/order_sync.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/flowcommerce_spree/order_sync.rb b/app/services/flowcommerce_spree/order_sync.rb index c89a05e8..571e3871 100644 --- a/app/services/flowcommerce_spree/order_sync.rb +++ b/app/services/flowcommerce_spree/order_sync.rb @@ -27,7 +27,10 @@ def initialize(order:, flow_session_id:) @experience = order.flow_io_experience_key @flow_session_id = flow_session_id @order = order - @client = FlowcommerceSpree.client(session_id: flow_session_id) + @client = FlowcommerceSpree.client( + default_headers: { "Authorization": "Session #{flow_session_id}" }, + authorization: nil + ) end # helper method to send complete order from Spree to flow.io