dscf-core 0.3.5 → 0.3.6
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 +4 -4
- data/app/controllers/dscf/core/auth_controller.rb +37 -0
- data/lib/dscf/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c79b0bd46b44ace100520a0a873e5a6dce32e9f13caf6c72c5ea7a729e1db870
|
|
4
|
+
data.tar.gz: 6715fc56d379b5600c71a4a78cccd4991a381f9a9a5d8ab0a80d5bc78b4c468d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8b2df9c292d42b1331e30f05af007a2e45d416b4af9863fba943e329130a8705951cbf407c96fe014d0d2d4c9112abcafca38be10a47d8b24ac9e48ccdcce7e
|
|
7
|
+
data.tar.gz: 8268c64be459eacf7f1afa2c0f80b6b5370fcaad0d2f95f9744fde90c7e7e70add2a5f345fd70b53bf5eb1f1852f01f7261576ea623dee23308f2230c61623bc
|
|
@@ -48,6 +48,11 @@ module Dscf
|
|
|
48
48
|
ActiveRecord::Base.transaction do
|
|
49
49
|
if user.save
|
|
50
50
|
assign_default_role(user)
|
|
51
|
+
|
|
52
|
+
# Optionally create marketplace records when onboarding via mobile app
|
|
53
|
+
create_agent_from_signup! if params[:agent].present?
|
|
54
|
+
create_retailer_from_signup! if params[:retailer].present?
|
|
55
|
+
|
|
51
56
|
user_with_includes = User.includes(roles: :permissions, user_profile: {}).find(user.id)
|
|
52
57
|
render_success(
|
|
53
58
|
"auth.success.signup",
|
|
@@ -124,6 +129,38 @@ module Dscf
|
|
|
124
129
|
def refresh_params
|
|
125
130
|
params.permit(:refresh_token)
|
|
126
131
|
end
|
|
132
|
+
|
|
133
|
+
# Creates an Agent record when included in signup request (mobile onboarding)
|
|
134
|
+
def create_agent_from_signup!
|
|
135
|
+
return unless defined?(Dscf::Marketplace::Agent)
|
|
136
|
+
|
|
137
|
+
Dscf::Marketplace::Agent.create!(
|
|
138
|
+
name: agent_signup_params[:name],
|
|
139
|
+
phone: agent_signup_params[:phone],
|
|
140
|
+
service_area: agent_signup_params[:service_area],
|
|
141
|
+
fayda_number: agent_signup_params[:fayda_number]
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Creates a Retailer record when included in signup request (mobile onboarding)
|
|
146
|
+
def create_retailer_from_signup!
|
|
147
|
+
return unless defined?(Dscf::Marketplace::Retailer)
|
|
148
|
+
|
|
149
|
+
Dscf::Marketplace::Retailer.create!(
|
|
150
|
+
name: retailer_signup_params[:name],
|
|
151
|
+
phone: retailer_signup_params[:phone],
|
|
152
|
+
tin_number: retailer_signup_params[:tin_number],
|
|
153
|
+
location: retailer_signup_params[:location]
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def agent_signup_params
|
|
158
|
+
params.fetch(:agent, {}).permit(:name, :phone, :service_area, :fayda_number)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def retailer_signup_params
|
|
162
|
+
params.fetch(:retailer, {}).permit(:name, :phone, :tin_number, :location)
|
|
163
|
+
end
|
|
127
164
|
end
|
|
128
165
|
end
|
|
129
166
|
end
|
data/lib/dscf/core/version.rb
CHANGED