dscf-marketplace 0.13.0 → 0.13.2
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: d4c6eb6ecbebefdc74c7654b87e674fba61abc1e8dcbb670510435f31fbd0e32
|
|
4
|
+
data.tar.gz: a7b235e3a3334082c5fd21915736348646b505fdf96b26b96225a68e8da46b73
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 731973225dec8bcd3fb8ebdf4be9596967d3e48fb987f96e175b0deef38d5532c7839caa09661799308e83fe5f6e541fc87891aa787f57d72853d42b730ebeae
|
|
7
|
+
data.tar.gz: 5636304d389272d790ca33aab6e0c336a907e88f79243ec298f6d1a8e6f094839c60c6ac7c29ab2dac139853bdfd5a2b4fb73b53beee384bc8b1b277b36ea983
|
|
@@ -19,6 +19,10 @@ module Dscf
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def source_name
|
|
22
|
+
# object.source (a polymorphic belongs_to) constantizes source_type
|
|
23
|
+
# internally and raises on anything that isn't a real class name —
|
|
24
|
+
# guard against legacy/bad data instead of 500ing the whole response.
|
|
25
|
+
return nil if object.source_type.present? && object.source_type.safe_constantize.nil?
|
|
22
26
|
return nil unless object.source
|
|
23
27
|
case object.source_type
|
|
24
28
|
when 'Dscf::Marketplace::AggregatorListing'
|
|
@@ -3,7 +3,7 @@ module Dscf
|
|
|
3
3
|
class OrderSerializer < ActiveModel::Serializer
|
|
4
4
|
attributes :id, :quotation_id, :listing_id, :user_id, :ordered_by_id, :ordered_to_id, :delivery_order_id, :dropoff_address_id,
|
|
5
5
|
:order_type, :status, :workflow_status, :has_validation_issues, :fulfillment_type, :payment_method, :received_bank_name, :transaction_reference, :total_amount,
|
|
6
|
-
:buyer_phone, :buyer_email, :seller_name, :seller_phone, :seller_email,
|
|
6
|
+
:buyer_name, :buyer_phone, :buyer_email, :seller_name, :seller_phone, :seller_email,
|
|
7
7
|
:created_at, :updated_at
|
|
8
8
|
|
|
9
9
|
belongs_to :quotation
|
|
@@ -15,6 +15,13 @@ module Dscf
|
|
|
15
15
|
belongs_to :dropoff_address
|
|
16
16
|
has_many :order_items
|
|
17
17
|
|
|
18
|
+
# Retailer's registered display name (users have no name field of their
|
|
19
|
+
# own — only email/phone) so admin can see who placed the order, per
|
|
20
|
+
# the requirements doc ("Retailer name" on the order lists).
|
|
21
|
+
def buyer_name
|
|
22
|
+
Dscf::Marketplace::Retailer.find_by(user_id: object.ordered_by_id)&.name
|
|
23
|
+
end
|
|
24
|
+
|
|
18
25
|
def buyer_phone
|
|
19
26
|
object.ordered_by&.phone
|
|
20
27
|
end
|
|
@@ -8,8 +8,19 @@ module Dscf
|
|
|
8
8
|
# - Other supplier
|
|
9
9
|
|
|
10
10
|
def self.assign_source(order_item, source_type:, source_id:)
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
# "self" is the frontend SourcePicker's sentinel for "the aggregator
|
|
12
|
+
# fulfils it directly" — it is not a real polymorphic class name, so
|
|
13
|
+
# storing it literally corrupts the source association (any later
|
|
14
|
+
# read of order_item.source tries "self".constantize and crashes).
|
|
15
|
+
# A self-fulfilled line has no external source at all: clear it,
|
|
16
|
+
# matching the frontend's own isAggregatorManaged check (!source_type).
|
|
17
|
+
if source_type.to_s == "self"
|
|
18
|
+
order_item.source_type = nil
|
|
19
|
+
order_item.source_id = nil
|
|
20
|
+
else
|
|
21
|
+
order_item.source_type = source_type
|
|
22
|
+
order_item.source_id = source_id
|
|
23
|
+
end
|
|
13
24
|
order_item.save!
|
|
14
25
|
order_item
|
|
15
26
|
end
|
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.2
|
|
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-04 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|