Class: OffsitePayments::Integrations::WirecardCheckoutPage::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::WirecardCheckoutPage::Notification
- Includes:
- Common
- Defined in:
- lib/offsite_payments/integrations/wirecard_checkout_page.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge ⇒ Object
Acknowledge the transaction to WirecardCheckoutPage.
- #complete? ⇒ Boolean
-
#gross ⇒ Object
the money amount we received in X.2 decimal.
- #item_id ⇒ Object
- #method_missing(method_id, *args) ⇒ Object
-
#received_at ⇒ Object
When was this payment received by the client.
- #response(umessage = nil) ⇒ Object
- #status ⇒ Object
- #status_code ⇒ Object
-
#test? ⇒ Boolean
Was this a test transaction?.
- #transaction_id ⇒ Object
Methods included from Common
Methods inherited from Notification
#amount, #empty!, #gross_cents, #initialize, #iso_currency, #valid_sender?
Constructor Details
This class inherits a constructor from OffsitePayments::Notification
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args) ⇒ Object
316 317 318 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 316 def method_missing(method_id, *args) return params[method_id.to_s] if params.has_key?(method_id.to_s) end |
Instance Method Details
#acknowledge ⇒ Object
Acknowledge the transaction to WirecardCheckoutPage. This method has to be called after a new apc arrives. WirecardCheckoutPage will verify that all the information we received are correct and will return a ok or a fail.
Example:
def ipn
notify = WirecardCheckoutPageNotification.new(request.raw_post, )
if notify.acknowledge
... process order ... if notify.complete?
else
... log possible hacking attempt ...
end
304 305 306 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 304 def acknowledge verify_response(params, [:secret]) end |
#complete? ⇒ Boolean
244 245 246 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 244 def complete? @paymentstate == 'SUCCESS' end |
#gross ⇒ Object
the money amount we received in X.2 decimal.
262 263 264 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 262 def gross params['amount'] end |
#item_id ⇒ Object
248 249 250 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 248 def item_id params['xActiveMerchantOrderId'] end |
#received_at ⇒ Object
When was this payment received by the client.
257 258 259 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 257 def received_at nil end |
#response(umessage = nil) ⇒ Object
308 309 310 311 312 313 314 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 308 def response( = nil) if || '<QPAY-CONFIRMATION-RESPONSE result="NOK" message="' + CGI.escapeHTML( ? : ) + '"/>' else '<QPAY-CONFIRMATION-RESPONSE result="OK"/>' end end |
#status ⇒ Object
271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 271 def status case @paymentstate when 'SUCCESS' 'Completed' when 'PENDING' 'Pending' when 'CANCEL' 'Cancelled' when 'FAILURE' 'Failed' else 'Error' end end |
#status_code ⇒ Object
286 287 288 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 286 def status_code @paymentstate end |
#test? ⇒ Boolean
Was this a test transaction?
267 268 269 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 267 def test? false end |
#transaction_id ⇒ Object
252 253 254 |
# File 'lib/offsite_payments/integrations/wirecard_checkout_page.rb', line 252 def transaction_id params['orderNumber'] end |