Class: LolitaBankLink::TransactionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lolita_bank_link/transactions_controller.rb

Instance Method Summary collapse

Instance Method Details

#answerObject

This action is called twice

- after client returns from BankLink server
- bank sends another confirmation and add's VK_AUTO=Y to params


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/lolita_bank_link/transactions_controller.rb', line 19

def answer
  response = LolitaBankLink::Response.new(response_params)
  if response.update_transaction
    if bank_auto_response?
      render nothing: true
    else
      redirect_to response.return_path
    end
  else
    LolitaBankLink.logger.error("[#{session_id}][#{response.paymentable_id}][answer] #{response.error}")
    render text: I18n.t("bank_link.wrong_request"), status: 400
  end
ensure
  if response
    LolitaBankLink.logger.info("[#{session_id}][#{response.paymentable_id}][answer] #{response.params}")
  end
end

#checkoutObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/lolita_bank_link/transactions_controller.rb', line 6

def checkout
  transaction = LolitaBankLink::Transaction.add(@payment, request)
  @payment_request = LolitaBankLink::Request.new(@payment, transaction)
  render "lolita_bank_link/payment_form"
ensure
  if @payment && @payment_request
    LolitaBankLink.logger.info("[#{session_id}][#{@payment.id}][checkout] #{@payment_request.build_form_data}")
  end
end