Sha256: 1c8676c01f0398ba5c879d11b71d11f3000f1cab1fc395c6bb867e17829b8473
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module SolidusNexio class PaymentsController < Spree::CheckoutController def create if update_order payment_method = PaymentMethod.find(params[:payment_method_id]) result = payment_method.process_order_payment(@order) render json: result else render json: { error: :invalid_order, details: @order.errors.to_h }, status: 422 end end def show payment_method = PaymentMethod.find(params[:payment_method_id]) payment = payment_method.payments.find(params[:payment_id]) render json: { data: { state: payment.state } } end def capture payment_method = PaymentMethod.find(params[:payment_method_id]) payment = payment_method.payments.find(params[:payment_id]) @result = payment_method.capture_order_payment(payment, params[:id], params[:status]) render :capture, layout: false end private def update_params massaged_params.require(:order).permit(permitted_checkout_payment_attributes) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_nexio-0.2.2 | app/controllers/solidus_nexio/payments_controller.rb |