dscf-marketplace 0.9.5 → 0.9.7
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 +15 -0
- data/app/services/dscf/marketplace/order_splitting_service.rb +14 -0
- data/app/services/dscf/marketplace/order_validation_service.rb +8 -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: 0707e9c3f1aee47d4403629222fd56a4a643e581c5e15e7e578db9b2457c93db
|
|
4
|
+
data.tar.gz: 21bd1451f5ed9da67e7fd1e703cdb780b70ffdfc092841bbf0f9e04440c79716
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73d08aab0d6e61e2bb3c3e07051c8edab5a6b36021ab25461cea3e7bf1fd2bf35e4130f3376f8ec56c54804c8ed4fb8443e5cc153b391fef647a1f0ff8202d3f
|
|
7
|
+
data.tar.gz: b52aecc0d699d73c06a800c2a20badcb4c7f0e8cacfbd2cb43e1cbea0a5c2b1b8f96264a763ea4a403b5a7379b4452e5fcec7aa29aaa2bc31b4532586fe0f29c
|
|
@@ -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
|
|
@@ -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
|
|
@@ -18,6 +18,14 @@ module Dscf
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def self.validate_item(item)
|
|
21
|
+
# Don't re-flag an item the aggregator has already resolved. Re-running
|
|
22
|
+
# validation would otherwise compare the live listing price against the
|
|
23
|
+
# untouched order unit_price and reopen the same issue forever.
|
|
24
|
+
# A resolved item is "validated" but RETAINS its validation_note; an item
|
|
25
|
+
# that was never flagged is "validated" with a nil note (set in the else
|
|
26
|
+
# branch below), so the retained note cleanly distinguishes the two.
|
|
27
|
+
return item if item.validation_status == "validated" && item.validation_note.present?
|
|
28
|
+
|
|
21
29
|
current_listing = find_current_active_listing(item)
|
|
22
30
|
return mark_no_longer_listed(item) unless current_listing
|
|
23
31
|
|
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.7
|
|
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
|