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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0e91f63e7ff64555d501536f0a77dbf3942fd4ad5a72f9e546306141c1d5901
4
- data.tar.gz: 7b3826928b8f65fdaee4e448657b69bcf2e8eec33ec1c00498c679d52437b410
3
+ metadata.gz: 0707e9c3f1aee47d4403629222fd56a4a643e581c5e15e7e578db9b2457c93db
4
+ data.tar.gz: 21bd1451f5ed9da67e7fd1e703cdb780b70ffdfc092841bbf0f9e04440c79716
5
5
  SHA512:
6
- metadata.gz: 37ac177b888c28335a60d18ca44485a4748ea1f71b58850a85dc6a465e68873776fa61a87b63b21b4680c501266181de4d743211dc88009fb4cf88155f2e6c6c
7
- data.tar.gz: b42feafb45858e7f9d5e91826f32ea88469aeb2e7e55b9c8644f8dc7fc5d08f499f977b48ec2bfd9553665171d3f9a8b54878e6696946e8d452fa655f1baa9fb
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
@@ -130,6 +130,7 @@ Dscf::Marketplace::Engine.routes.draw do
130
130
  post "assign_source"
131
131
  post "split"
132
132
  post "supplier_confirm"
133
+ post "confirm_item"
133
134
  post "retailer_confirm"
134
135
  end
135
136
  collection do
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Marketplace
3
- VERSION = "0.9.5".freeze
3
+ VERSION = "0.9.7".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.9.5
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-28 00:00:00.000000000 Z
10
+ date: 2026-06-30 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails