Class: Spree::Admin::PaymentWingSdkQueriersController

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

Instance Method Summary collapse

Methods inherited from PaymentWingSdkBaseController

#load_payment, #validate_order

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/admin/payment_wing_sdk_queriers_controller.rb', line 6

def show
  tran_status = Vpago::WingSdk::TransactionStatusChecker.new(@payment)
  tran_status.call

  if tran_status.success?
    flash[:success] = Spree.t('vpago.payments.payment_found_with_result', result: tran_status.result)
  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