Class: SpreeCmCommissioner::Transit::RouteOrderCountIncrementerService

Inherits:
Object
  • Object
show all
Includes:
Spree::ServiceModule::Base
Defined in:
app/services/spree_cm_commissioner/transit/route_order_count_incrementer_service.rb

Instance Method Summary collapse

Instance Method Details

#call(order:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/spree_cm_commissioner/transit/route_order_count_incrementer_service.rb', line 6

def call(order:)
  return failure(nil, 'Order not found') unless order

  SpreeCmCommissioner::Transit::BaseRouteOrderMetricsUpdater
    .new(order: order, attribute: :order_count)
    .call

  success(order: order)
rescue StandardError => e
  failure(nil, e.message)
end