dscf-core 0.3.11 → 0.3.12

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: ae14559d5450c625ee0af53712926aebe5e64c9546c00af6db600139e4e51050
4
- data.tar.gz: 1bc97e393a0c8f08015c242e206e1a958fbb76a3f3cc618286c02e9809fb825c
3
+ metadata.gz: 3d5c9ec3fc1c7652890999a1d4a0a51c803c5a76048a2ae19e618eed764bfeaa
4
+ data.tar.gz: 774c4fe39b0d823b1c76445ef8a6ad3908cc4a7c2042265fe97c3e23641a957d
5
5
  SHA512:
6
- metadata.gz: bd27090cc7d4e607e5e91e5dfbd2a0a4d0edbc7cf4a190ab15dc79d0353298264c8ccdf0cc3e87e8905e45f598605fb8bd2727a9f3c54323dc1c799e2ee02be2
7
- data.tar.gz: c53701558a0481c533df3e3e548349ed510148ec175b609f41fdf5643721c3e23c676e3a6117bf289261b7c1780bf43faca656c8af920b018d950b161042affa
6
+ metadata.gz: 95e7d2bf92eb2630122b13d92983636e0b616fcd09752f513ea00a4ed828f40defb83246d6ddbfb34613241009ba43f113ddff366fdda258f85a7b034527cfb9
7
+ data.tar.gz: 1a9ca7f46e79f9a04434ccafe465a947d0c26334ed00bbd02733dda7e8d62287c561236aeef8479cf7283d1ac5bfc264d568bc329109c98dbb72e3118016aa1e
@@ -154,12 +154,25 @@ module Dscf
154
154
  def create_retailer_from_signup!(user)
155
155
  return unless defined?(Dscf::Marketplace::Retailer)
156
156
 
157
+ # `authenticate_user` is skipped for this action so self-service
158
+ # signup stays public, but `current_user` still resolves whatever
159
+ # Bearer token was sent — an agent onboarding a retailer on their
160
+ # behalf attaches their own token, so we derive the onboarding
161
+ # agent from it rather than trusting a client-supplied agent_id
162
+ # (there is none in this params shape today, but this keeps the
163
+ # same trust model as the rest of the agent-assisted flows).
164
+ onboarding_agent = if defined?(Dscf::Marketplace::Agent)
165
+ Dscf::Marketplace::Agent.find_by(user_id: current_user&.id)
166
+ end
167
+
157
168
  retailer = Dscf::Marketplace::Retailer.create!(
158
169
  name: retailer_signup_params[:name],
159
170
  phone: retailer_signup_params[:phone],
160
171
  tin_number: retailer_signup_params[:tin_number],
161
172
  location: retailer_signup_params[:location],
162
- user: user
173
+ user: user,
174
+ agent: onboarding_agent,
175
+ onboarded_at: (Time.current if onboarding_agent)
163
176
  )
164
177
 
165
178
  if retailer.location.present? && defined?(Dscf::Core::Address)
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Core
3
- VERSION = "0.3.11".freeze
3
+ VERSION = "0.3.12".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat