Sha256: b2ad9955fe539fc5d584aa9069641f4bb62cc0f163611536bd7336cc5451bda2
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module Spree module Api module Returnly class RefundsController < ApiController def estimate authorize! :create, Order render json: Solidus::Returnly::Calculator.process(order, line_items_params) end def create authorize! :create, Order refunds = Solidus::Returnly::Refunds.new order: order, line_items: line_items_params, restock: refund_restock_param, transactions: transactions_params render json: refunds.proceed! end private def line_items_params params.require(:line_items) end def transactions_params params.require(:transactions) end def refund_restock_param params.require(:restock) == 'true' end def order @order ||= Spree::Order.find_by(number: params[:order_id]) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus-returnly-0.2.0 | app/controllers/spree/api/returnly/refunds_controller.rb |