Sha256: c62ac8fe60bf8003728f9cf2e4a80e96c895d31e15bb6910872a7d01e0f41ef2
Contents?: true
Size: 656 Bytes
Versions: 3
Compression:
Stored size: 656 Bytes
Contents
class TbCommerce::Api::TransactionsController < TbCommerce::Api::BaseController before_action :load_cart def create @transaction = tb_commerce_current_cart().order.transactions.new() if @transaction.save() && @transaction.capture!(transaction_params[:token]) render 'show' else render :text => @transaction.errors.full_messages.first, :status => 422 end end private def transaction_params params.require(:tb_commerce_transaction).permit(:token) end def load_cart @cart = tb_commerce_current_cart if @cart.blank? || @cart.cart_is_empty? raise Spud::NotFoundError.new('cart') end end end
Version data entries
3 entries across 3 versions & 1 rubygems