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: 16b43241cc7e4a81527b02646b620a5d89ff4836aa1f14877d80a8c20e8b8b69
4
- data.tar.gz: 9cf97a1241386f95e9af9088d740cbbf4a69734b40d1f29218d50e002775f20f
3
+ metadata.gz: d4c6eb6ecbebefdc74c7654b87e674fba61abc1e8dcbb670510435f31fbd0e32
4
+ data.tar.gz: a7b235e3a3334082c5fd21915736348646b505fdf96b26b96225a68e8da46b73
5
5
  SHA512:
6
- metadata.gz: 906229d9cc272a399446d8d997ee880b7b66a1ca404eca3ea0ee6f23ab51ade9c45dfe517a04129cf09c6f1660a3d241637d8ba22405ac4d4ea952bdd959674e
7
- data.tar.gz: 64e5345ccf614806d09b410be755e16e8a33ec58793443715f669bdcc934f034da085f78642e2b70638e75c2002df322bc099ce516a53ca6b0a2a470a3be656b
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
- order_item.source_type = source_type
12
- order_item.source_id = source_id
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
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.13.0".freeze
3
+ VERSION = "0.13.2".freeze
4
4
  end
5
5
  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.0
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-03 00:00:00.000000000 Z
10
+ date: 2026-07-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails