Class: Trade::Admin::RefundsController
- Inherits:
-
BaseController
- Object
- BaseController
- Trade::Admin::RefundsController
- Defined in:
- app/controllers/trade/admin/refunds_controller.rb
Instance Method Summary collapse
- #confirm ⇒ Object
- #create ⇒ Object
- #deny ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#confirm ⇒ Object
34 35 36 37 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 34 def confirm @refund.do_refund(operator_id: current_user.id, operator_type: current_user.class.name) redirect_to admin_refunds_url(order_id: @refund.order_id) end |
#create ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 18 def create @refund = Refund.new(refund_params) unless @refund.save render :new, locals: { model: @refund }, status: :unprocessable_entity end end |
#deny ⇒ Object
39 40 41 42 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 39 def deny @refund.deny_refund(operator_id: current_user.id, operator_type: current_user.class.name) redirect_to admin_refunds_url(order_id: @refund.order_id) end |
#destroy ⇒ Object
44 45 46 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 44 def destroy @refund.destroy end |
#edit ⇒ Object
15 16 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 15 def edit end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 4 def index @refunds = Refund.includes(:order, :payment).default_where(params.permit(:order_id, :payment_id)).page(params[:page]) end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 11 def new @refund = @payment.refunds.build end |
#show ⇒ Object
8 9 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 8 def show end |
#update ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/controllers/trade/admin/refunds_controller.rb', line 26 def update @refund.assign_attributes(refund_params) unless @refund.save render :new, locals: { model: @refund }, status: :unprocessable_entity end end |