Class: Spree::Api::Returnly::RefundsController

Inherits:
ApiController
  • Object
show all
Includes:
Solidus::Returnly::RefundsConfiguration
Defined in:
app/controllers/spree/api/returnly/refunds_controller.rb

Instance Method Summary collapse

Methods included from Solidus::Returnly::RefundsConfiguration

#refund_calculator_class, #refunder_class, #return_item_amount_calculator_class, #return_item_restock_policy_class

Methods inherited from ApiController

#set_headers

Instance Method Details

#create ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/api/returnly/refunds_controller.rb', line 12

def create
  authorize! :create, Order

  refunds = refunder_class.new order: order,
                               line_items: line_items_params,
                               restock: refund_restock_param,
                               transactions: transactions_params
  render json: refunds.proceed!
end

#estimate ⇒ Object



7
8
9
10
# File 'app/controllers/spree/api/returnly/refunds_controller.rb', line 7

def estimate
  authorize! :create, Order
  render json: refund_calculator_class.process(order, line_items_params)
end