4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/spree/admin/stock_locations_controller_decorator.rb', line 4
def delhivery_pickup
@stock_location = Spree::StockLocation.find(params[:id])
count = params[:count].to_i
count = 1 if count <= 0
date = params[:pickup_date] time = params[:pickup_time]
service = SpreeDelhivery::PickupService.new(
@stock_location,
date: date,
time: time,
count: count
)
result = service.call
if result.success?
flash[:success] = result.message
else
flash[:error] = "Delhivery Error: #{result.message}"
end
redirect_to edit_admin_stock_location_path(@stock_location)
end
|