Class: Kaui::TransactionsController

Inherits:
EngineController show all
Defined in:
app/controllers/kaui/transactions_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user

Instance Method Details

#createObject



12
13
14
15
16
17
# File 'app/controllers/kaui/transactions_controller.rb', line 12

def create
  transaction = Kaui::Transaction.new(params[:transaction].delete_if { |key, value| value.blank? })

  payment = transaction.create(params.require(:account_id), params[:payment_method_id], current_user.kb_username, params[:reason], params[:comment], options_for_klient)
  redirect_to kaui_engine.(payment., payment.payment_id), :notice => 'Transaction successfully created'
end

#newObject



3
4
5
6
7
8
9
10
# File 'app/controllers/kaui/transactions_controller.rb', line 3

def new
  @account_id = params[:account_id]
  @payment_method_id = params[:payment_method_id]
  @transaction = Kaui::Transaction.new(:payment_id => params[:payment_id],
                                       :amount => params[:amount],
                                       :currency => params[:currency],
                                       :transaction_type => params[:transaction_type])
end