dscf-marketplace 0.9.6 → 0.9.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 +4 -4
- data/app/controllers/dscf/marketplace/orders_controller.rb +16 -1
- data/app/models/dscf/marketplace/agent.rb +2 -2
- data/app/models/dscf/marketplace/delivery_order_item.rb +2 -0
- data/app/models/dscf/marketplace/product.rb +1 -1
- data/app/models/dscf/marketplace/quotation_item.rb +2 -0
- data/app/models/dscf/marketplace/rfq_item.rb +2 -0
- data/app/models/dscf/marketplace/supplier.rb +1 -1
- data/app/serializers/dscf/marketplace/delivery_order_item_serializer.rb +2 -1
- data/app/serializers/dscf/marketplace/product_inclusion_request_serializer.rb +1 -1
- data/app/serializers/dscf/marketplace/quotation_item_serializer.rb +1 -1
- data/app/serializers/dscf/marketplace/rfq_item_serializer.rb +2 -1
- data/app/serializers/dscf/marketplace/sub_supplier_serializer.rb +1 -1
- data/app/services/dscf/marketplace/order_splitting_service.rb +14 -0
- data/config/routes.rb +1 -0
- data/lib/dscf/marketplace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96faa437c564d4a08d4df63b8e1143c8e69da546d8e576e03d30bd2c99443e50
|
|
4
|
+
data.tar.gz: 58eeb5fed2f4afea0a88dd25f55d2bfc791a7d7f488a7be46357fcc4b79597fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd51195fca94e7f6018aca92c64620f1f686a5b1584858add1afb1ceb0ee8a34b09e90fd27e9681dadbaef3a514741109c5a293aee3aa57c905f11df962cda4f
|
|
7
|
+
data.tar.gz: c9bc4eefa1acdd394eb3d23ae3a57f60126ccdb5dd698e64050c4ca8f48d2364a99c06266aff03b9d84b90a9d45ea2881e847d98a2b58a51335ee2751f245230
|
|
@@ -85,7 +85,7 @@ module Dscf
|
|
|
85
85
|
authorize @obj, :show?
|
|
86
86
|
invoice = @obj.order_invoice
|
|
87
87
|
if invoice&.pdf_file&.attached?
|
|
88
|
-
redirect_to
|
|
88
|
+
redirect_to rails_storage_proxy_url(invoice.pdf_file, disposition: "attachment")
|
|
89
89
|
else
|
|
90
90
|
render_error("orders.errors.no_invoice")
|
|
91
91
|
end
|
|
@@ -179,6 +179,21 @@ module Dscf
|
|
|
179
179
|
render_error(errors: e.message, status: :unprocessable_entity)
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
+
def confirm_item
|
|
183
|
+
obj = find_record
|
|
184
|
+
authorize obj, :supplier_confirm?
|
|
185
|
+
|
|
186
|
+
item = obj.order_items.find(params[:order_item_id])
|
|
187
|
+
confirmed = params[:confirmed] != false
|
|
188
|
+
reason = params[:reason]
|
|
189
|
+
Dscf::Marketplace::OrderSplittingService.confirm_item(obj, item, confirmed: confirmed, reason: reason)
|
|
190
|
+
|
|
191
|
+
create_notification_for_order(obj, confirmed ? :supplier_confirmed : :supplier_rejected, reason: reason)
|
|
192
|
+
render_success(data: obj.reload, serializer_options: { include: default_serializer_includes[:show] || [] })
|
|
193
|
+
rescue => e
|
|
194
|
+
render_error(errors: e.message, status: :unprocessable_entity)
|
|
195
|
+
end
|
|
196
|
+
|
|
182
197
|
def retailer_confirm
|
|
183
198
|
obj = find_record
|
|
184
199
|
authorize obj, :confirm? # reuse existing or add specific
|
|
@@ -46,13 +46,13 @@ module Dscf::Marketplace
|
|
|
46
46
|
def photo_url
|
|
47
47
|
return nil unless photo.attached?
|
|
48
48
|
|
|
49
|
-
Rails.application.routes.url_helpers.
|
|
49
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(photo, only_path: true)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def national_id_url
|
|
53
53
|
return nil unless national_id.attached?
|
|
54
54
|
|
|
55
|
-
Rails.application.routes.url_helpers.
|
|
55
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(national_id, only_path: true)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
private
|
|
@@ -8,6 +8,8 @@ module Dscf::Marketplace
|
|
|
8
8
|
belongs_to :pickup_address, class_name: "Dscf::Core::Address"
|
|
9
9
|
belongs_to :dropoff_address, class_name: "Dscf::Core::Address"
|
|
10
10
|
|
|
11
|
+
delegate :thumbnail_url, :images_urls, to: :order_item, allow_nil: true
|
|
12
|
+
|
|
11
13
|
validates :delivery_order_id, presence: true
|
|
12
14
|
validates :order_item_id, presence: true
|
|
13
15
|
validates :quantity, presence: true, numericality: {greater_than: 0}
|
|
@@ -69,7 +69,7 @@ module Dscf
|
|
|
69
69
|
return unless attachment.present?
|
|
70
70
|
return if attachment.respond_to?(:attached?) && !attachment.attached?
|
|
71
71
|
|
|
72
|
-
Rails.application.routes.url_helpers.
|
|
72
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(attachment, **active_storage_url_options)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def active_storage_url_options
|
|
@@ -6,6 +6,8 @@ module Dscf
|
|
|
6
6
|
belongs_to :product, class_name: "Dscf::Marketplace::Product"
|
|
7
7
|
belongs_to :unit, class_name: "Dscf::Marketplace::Unit"
|
|
8
8
|
|
|
9
|
+
delegate :thumbnail_url, :images_urls, to: :product, allow_nil: true
|
|
10
|
+
|
|
9
11
|
validates :product_id, presence: true
|
|
10
12
|
validates :quantity, presence: true, numericality: {greater_than: 0}
|
|
11
13
|
validates :unit_id, presence: true
|
|
@@ -7,6 +7,8 @@ module Dscf
|
|
|
7
7
|
|
|
8
8
|
has_many :quotation_items, class_name: "Dscf::Marketplace::QuotationItem", dependent: :destroy
|
|
9
9
|
|
|
10
|
+
delegate :thumbnail_url, :images_urls, to: :product, allow_nil: true
|
|
11
|
+
|
|
10
12
|
validates :quantity, presence: true, numericality: {greater_than: 0}
|
|
11
13
|
validates :notes, length: {maximum: 1000}, allow_blank: true
|
|
12
14
|
|
|
@@ -81,7 +81,7 @@ module Dscf::Marketplace
|
|
|
81
81
|
return [] unless documents.attached?
|
|
82
82
|
|
|
83
83
|
documents.map do |doc|
|
|
84
|
-
Rails.application.routes.url_helpers.
|
|
84
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(doc, only_path: true)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -6,7 +6,8 @@ module Dscf
|
|
|
6
6
|
:damaged_quantity, :missing_quantity, :receiver_confirmed_by,
|
|
7
7
|
:receiver_confirmed_at, :receiver_notes, :handoff_checklist_completed,
|
|
8
8
|
:created_at, :updated_at, :product_name, :unit_name, :verification_complete?,
|
|
9
|
-
:has_discrepancy?, :discrepancy_amount, :requires_resolution
|
|
9
|
+
:has_discrepancy?, :discrepancy_amount, :requires_resolution?,
|
|
10
|
+
:thumbnail_url, :images_urls
|
|
10
11
|
|
|
11
12
|
belongs_to :delivery_order
|
|
12
13
|
belongs_to :order_item
|
|
@@ -14,7 +14,7 @@ module Dscf
|
|
|
14
14
|
|
|
15
15
|
url_options = Rails.application.config.x.active_storage_url_options || {}
|
|
16
16
|
object.product_images.map do |image|
|
|
17
|
-
Rails.application.routes.url_helpers.
|
|
17
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(image, **url_options)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -5,7 +5,7 @@ module Dscf
|
|
|
5
5
|
:unit_price, :subtotal, :created_at, :updated_at, :product_name,
|
|
6
6
|
:product_sku, :unit_name, :unit_code, :rfq_requested_quantity,
|
|
7
7
|
:quantity_difference, :quantity_difference_percentage, :price_per_base_unit,
|
|
8
|
-
:matches_rfq_request?, :can_create_order
|
|
8
|
+
:matches_rfq_request?, :can_create_order?, :thumbnail_url, :images_urls
|
|
9
9
|
|
|
10
10
|
belongs_to :quotation
|
|
11
11
|
belongs_to :rfq_item
|
|
@@ -3,7 +3,8 @@ module Dscf
|
|
|
3
3
|
class RfqItemSerializer < ActiveModel::Serializer
|
|
4
4
|
attributes :id, :request_for_quotation_id, :product_id, :unit_id, :quantity, :notes,
|
|
5
5
|
:created_at, :updated_at, :product_name, :product_sku, :unit_name,
|
|
6
|
-
:unit_code, :quotation_count, :has_quotations?, :quoted_price_range
|
|
6
|
+
:unit_code, :quotation_count, :has_quotations?, :quoted_price_range,
|
|
7
|
+
:thumbnail_url, :images_urls
|
|
7
8
|
|
|
8
9
|
belongs_to :request_for_quotation
|
|
9
10
|
belongs_to :product
|
|
@@ -8,7 +8,7 @@ module Dscf
|
|
|
8
8
|
def business_license_url
|
|
9
9
|
return nil unless object.business_license.attached?
|
|
10
10
|
|
|
11
|
-
Rails.application.routes.url_helpers.
|
|
11
|
+
Rails.application.routes.url_helpers.rails_storage_proxy_url(object.business_license, only_path: true)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -43,6 +43,20 @@ module Dscf
|
|
|
43
43
|
end
|
|
44
44
|
order
|
|
45
45
|
end
|
|
46
|
+
|
|
47
|
+
# Per-source confirmation (requirements doc: "Supplier and aggregator order
|
|
48
|
+
# confirmation"). The aggregator confirms each sub-supplier / aggregator-store
|
|
49
|
+
# allocation individually; other-supplier items are confirmed by that supplier.
|
|
50
|
+
# Once every item has responded (confirmed or cancelled), the order advances
|
|
51
|
+
# to retailer confirmation.
|
|
52
|
+
def self.confirm_item(order, order_item, confirmed: true, reason: nil)
|
|
53
|
+
order_item.status = confirmed ? :confirmed : :cancelled
|
|
54
|
+
order_item.save!
|
|
55
|
+
|
|
56
|
+
order.reload
|
|
57
|
+
order.mark_waiting_retailer_confirmation! if order.supplier_confirmation_complete?
|
|
58
|
+
order_item
|
|
59
|
+
end
|
|
46
60
|
end
|
|
47
61
|
end
|
|
48
62
|
end
|
data/config/routes.rb
CHANGED
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.9.
|
|
4
|
+
version: 0.9.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Asrat
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-30 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|