dscf-marketplace 0.13.6 → 0.13.8
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 41a9dcd1ca1d3229c9f74bc40ed5b2b0813108348f28b52a667bff5109c7169a
|
|
4
|
+
data.tar.gz: 4c370bed0af3b391d58e574ce1d17a5ad6cc13523de64fd666f255f19adb645a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b41084c0c19ed13fcc4f4be329758ee2b88b9ad665e4bf9c68d6b7f5cb83c1ecff2b619faa64f632c77267780aafacb31448dd3f1c58bff324d9091bb526dd67
|
|
7
|
+
data.tar.gz: 27e1aabb04b76390501c595a54227d1fcc8a6bcdddfdb4b7fd0600a0be49b5d1dc63a8e638eb09f7c82b2c213d27e63ea1fa5b8cc0ab364a81b9b8260526c02c
|
|
@@ -14,16 +14,27 @@ module Dscf
|
|
|
14
14
|
password_confirmation: registration_params[:password_confirmation]
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
+
# `authenticate_user` is skipped for this action so self-service
|
|
18
|
+
# registration stays public, but `current_user` still resolves
|
|
19
|
+
# whatever Bearer token was sent — an agent onboarding a retailer
|
|
20
|
+
# on their behalf attaches their own token, so we derive the
|
|
21
|
+
# onboarding agent from it rather than trusting a client-supplied
|
|
22
|
+
# agent_id.
|
|
23
|
+
onboarding_agent = Dscf::Marketplace::Agent.find_by(user_id: current_user&.id)
|
|
24
|
+
|
|
17
25
|
retailer = Dscf::Marketplace::Retailer.new(
|
|
18
26
|
name: registration_params[:name],
|
|
19
27
|
phone: registration_params[:phone],
|
|
20
28
|
tin_number: registration_params[:tin_number],
|
|
21
29
|
location: registration_params[:location],
|
|
22
|
-
status: :active
|
|
30
|
+
status: :active,
|
|
31
|
+
agent: onboarding_agent,
|
|
32
|
+
onboarded_at: (Time.current if onboarding_agent)
|
|
23
33
|
)
|
|
24
34
|
|
|
25
35
|
user.save!
|
|
26
36
|
assign_default_role(user, "RETAILER")
|
|
37
|
+
retailer.user = user
|
|
27
38
|
retailer.save!
|
|
28
39
|
|
|
29
40
|
render_success("retailers.success.register", data: retailer, status: :created)
|
|
@@ -34,8 +45,9 @@ module Dscf
|
|
|
34
45
|
end
|
|
35
46
|
|
|
36
47
|
def my_retailers
|
|
37
|
-
authorize @clazz.new, :
|
|
38
|
-
|
|
48
|
+
authorize @clazz.new, :my_retailers?
|
|
49
|
+
service = MyResourceService.new(current_user)
|
|
50
|
+
retailers = service.my_retailers(params)
|
|
39
51
|
|
|
40
52
|
options = {
|
|
41
53
|
include: default_serializer_includes[:index] || [],
|
|
@@ -2,7 +2,7 @@ module Dscf
|
|
|
2
2
|
module Marketplace
|
|
3
3
|
class SupplierSerializer < ActiveModel::Serializer
|
|
4
4
|
attributes :id, :name, :code, :address, :contact_phone, :business_type,
|
|
5
|
-
:business_id, :review_status, :document_urls, :created_at, :updated_at
|
|
5
|
+
:business_id, :review_status, :review_reason, :document_urls, :created_at, :updated_at
|
|
6
6
|
|
|
7
7
|
belongs_to :business
|
|
8
8
|
has_many :addresses
|
|
@@ -11,6 +11,15 @@ module Dscf
|
|
|
11
11
|
object.review_status
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
# Reason the admin gave on the latest review (modification request or
|
|
15
|
+
# rejection). Lives in the Review's jsonb `feedback` as {reason: "..."}.
|
|
16
|
+
# nil for approved/pending/draft. Lets the mobile "changes requested"
|
|
17
|
+
# screen show the admin's note without a push notification.
|
|
18
|
+
def review_reason
|
|
19
|
+
feedback = object.current_review_for(:default)&.feedback
|
|
20
|
+
feedback && (feedback["reason"] || feedback[:reason])
|
|
21
|
+
end
|
|
22
|
+
|
|
14
23
|
def document_urls
|
|
15
24
|
object.document_urls
|
|
16
25
|
end
|
|
@@ -35,6 +35,13 @@ module Dscf
|
|
|
35
35
|
apply_filters(listings, params)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def my_retailers(params = {})
|
|
39
|
+
agent = Dscf::Marketplace::Agent.find_by(user_id: @current_user.id)
|
|
40
|
+
retailers = agent ? Dscf::Marketplace::Retailer.where(agent_id: agent.id) : Dscf::Marketplace::Retailer.none
|
|
41
|
+
|
|
42
|
+
apply_filters(retailers, params)
|
|
43
|
+
end
|
|
44
|
+
|
|
38
45
|
def my_products(params = {})
|
|
39
46
|
products = Dscf::Marketplace::SupplierProduct.joins(:business)
|
|
40
47
|
.where(dscf_core_businesses: {user_id: @current_user.id})
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dscf-marketplace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.13.
|
|
4
|
+
version: 0.13.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Asrat
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-07-
|
|
10
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|