class Admin::PaymentsController

Public Instance Methods

balanced_payment_event() click to toggle source

Find and updating the transaction.

# File app/controllers/admin/payments_controller.rb, line 47
def balanced_payment_event
  event_entity = params['entity']
  event_entity_type = event_entity['_type']
  payment = Payment.find_by(transaction_id: event_entity['id'])
  payment.reload_from_balanced_payments! if payment.present?
  render :nothing => true
end
index() click to toggle source

Retrieves basic information to be displayed on payment page.

# File app/controllers/admin/payments_controller.rb, line 8
def index
  respond_to do |format|
    format.json { render json: data_table }
    format.html {}
  end
end
resend() click to toggle source

Method to reprocess the payment.

# File app/controllers/admin/payments_controller.rb, line 39
def resend
  @payment = Payment.find(params[:id])
  @payment.resend!
  flash[:notice] = "Marked payment for reprocessing. And this payment will be considered by the PaymentEngine in next 10 minutes"
  redirect_to request.referer || admin_payments_path
end
update() click to toggle source

Update the payment information.

# File app/controllers/admin/payments_controller.rb, line 16
  def update
    @payment = Payment.find(params[:id])
#    begin
      if @payment.credit?
        transaction = Balanced::Credit.find(@payment.uri)
      else
        transaction = Balanced::Debit.find(@payment.uri)
      end
      @payment.balanced_transaction = transaction
      respond_to do |format|
        if @payment.save!
          @message = "Synchronized payment with BalancedPayments database."
          format.js { render 'referesh_datatable' }
          format.html {}
        else
          @message = "Unable to Synchronized payment with BalancedPayments database."
          format.js { render 'referesh_datatable' }
          format.html {}
        end
      end
  end