Class: PaynetEasy::PaynetEasyApi::Callback::CallbackPrototype
- Inherits:
-
Object
- Object
- PaynetEasy::PaynetEasyApi::Callback::CallbackPrototype
- Includes:
- Error, PaymentData, Transport, Util
- Defined in:
- lib/paynet_easy/paynet_easy_api/callback/callback_prototype.rb
Direct Known Subclasses
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Make instance variables available in child classes.
Instance Method Summary collapse
-
#initialize(callback_type) ⇒ CallbackPrototype
constructor
A new instance of CallbackPrototype.
-
#process_callback(payment_transaction, callback_response) ⇒ CallbackResponse
Process API gateway Response and update Payment transaction.
Constructor Details
permalink #initialize(callback_type) ⇒ CallbackPrototype
Returns a new instance of CallbackPrototype.
45 46 47 48 |
# File 'lib/paynet_easy/paynet_easy_api/callback/callback_prototype.rb', line 45 def initialize(callback_type) @callback_type = callback_type validate_callback_definition end |
Class Method Details
permalink .inherited(subclass) ⇒ Object
Make instance variables available in child classes
169 170 171 172 173 |
# File 'lib/paynet_easy/paynet_easy_api/callback/callback_prototype.rb', line 169 def inherited(subclass) instance_variables.each do |variable_name| subclass.instance_variable_set variable_name, instance_variable_get(variable_name) end end |
Instance Method Details
permalink #process_callback(payment_transaction, callback_response) ⇒ CallbackResponse
Process API gateway Response and update Payment transaction
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 |