Class: Dscf::Marketplace::DisputeService

Inherits:
Object
  • Object
show all
Defined in:
app/services/dscf/marketplace/dispute_service.rb

Instance Method Summary collapse

Instance Method Details

#raise_dispute(delivery_stop, reason, reported_by) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/services/dscf/marketplace/dispute_service.rb', line 3

def raise_dispute(delivery_stop, reason, reported_by)
  return false unless delivery_stop
  
  delivery_stop.update!(status: :failed, notes: reason)
  
  delivery_stop.delivery_order_items.each do |item|
    item.dispute_delivery!(reason, reported_by)
  end
  
  DeliveryNotificationService.new.notify_dispute(delivery_stop)
  
  true
end