Sha256: 1617a66e729cd8088d2255d01aa0fa9c71eac83b99c77e634f2286e0b0380ec9

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 Bytes

Contents

module Spree
  class PaymentsController < Spree::StoreController
    before_filter :authenticate_spree_user!
    before_filter :find_payment

    def update
      payment_details = PaymentDetails.new(@payment, payment_params)
      if payment_details.save
        flash[:notice] = Spree.t(:payment_successfully_updated)
      else
        flash[:error] = payment_details.errors.to_sentence
      end
      redirect_to :back
    end

    def find_payment
      @payment = spree_current_user.payments.where(:id => params[:id]).first
      unless @payment
        flash[:error] = Spree.t(:payment_not_found)
        redirect_to :back
      end
    end
    
    private
      def payment_params
        params.require(:payment).permit(:deposited_on, :bank_name, :account_no, :transaction_reference_no)
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree-bank-transfer-2.3.0 app/controllers/spree/payments_controller.rb
spree-bank-transfer-2.2.5 app/controllers/spree/payments_controller.rb