Method: PaynetEasy::PaynetEasyApi::Callback::CallbackPrototype#process_callback

Defined in:
lib/paynet_easy/paynet_easy_api/callback/callback_prototype.rb

#process_callback(payment_transaction, callback_response) ⇒ CallbackResponse

Process API gateway Response and update Payment transaction

Parameters:

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/paynet_easy/paynet_easy_api/callback/callback_prototype.rb', line 56

def process_callback(payment_transaction, callback_response)
  begin
    validate_callback payment_transaction, callback_response
  rescue Exception => error
    payment_transaction.add_error error
    payment_transaction.status = PaymentTransaction::STATUS_ERROR

    raise error
  end

  update_payment_transaction payment_transaction, callback_response

  if callback_response.error?
    raise callback_response.error
  end

  callback_response
end