Class: Spree::Admin::PaymentPaywayQueriersController

Inherits:
PaymentPaywayBaseController show all
Includes:
Backend::Callbacks
Defined in:
app/controllers/spree/admin/payment_payway_queriers_controller.rb

Instance Method Summary collapse

Methods inherited from PaymentPaywayBaseController

#load_payment, #model_class, #validate_order

Instance Method Details

#showObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/admin/payment_payway_queriers_controller.rb', line 7

def show
  tran_status = transaction_status_service.new(@payment)
  tran_status.call

  if tran_status.success?
    @payment.update_column(:gateway_status, true)
    flash[:success] =
      Spree.t('vpago.payments.payment_found_with_result', result: tran_status.json_response)
  else
    flash[:error] = Spree.t('vpago.payments.payment_not_found_with_error', error: tran_status.error_message)
  end

  redirect_to admin_order_payment_path(order_id: @payment.order.number, id: @payment.number)
end

#transaction_status_serviceObject



22
23
24
25
26
27
28
# File 'app/controllers/spree/admin/payment_payway_queriers_controller.rb', line 22

def transaction_status_service
  if @payment.payment_method.type_payway_v2?
    Vpago::PaywayV2::TransactionStatus
  elsif @payment.payment_method.type_payway?
    Vpago::Payway::TransactionStatus
  end
end