Class: ActiveMerchant::Billing::Integrations::WirecardCheckoutPage::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::WirecardCheckoutPage::Notification
- Includes:
- Common
- Defined in:
- lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.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, #valid_sender?
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args) ⇒ Object
83 84 85 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 83 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, options)
if notify.acknowledge
... process order ... if notify.complete?
else
... log possible hacking attempt ...
end
71 72 73 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 71 def acknowledge verify_response(params, @options[:secret]) end |
#complete? ⇒ Boolean
10 11 12 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 10 def complete? @paymentstate == 'SUCCESS' end |
#gross ⇒ Object
the money amount we received in X.2 decimal.
28 29 30 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 28 def gross params['amount'] end |
#item_id ⇒ Object
14 15 16 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 14 def item_id params['xActiveMerchantOrderId'] end |
#received_at ⇒ Object
When was this payment received by the client.
23 24 25 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 23 def received_at nil end |
#response(umessage = nil) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 75 def response( = nil) if @message || '<QPAY-CONFIRMATION-RESPONSE result="NOK" message="' + CGI.escapeHTML( ? : @message) + '"/>' else '<QPAY-CONFIRMATION-RESPONSE result="OK"/>' end end |
#status ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 37 def status case @paymentstate when 'SUCCESS' 'Completed' when 'PENDING' 'Pending' when 'CANCEL' 'Cancelled' when 'FAILURE' 'Failed' else 'Error' end end |
#status_code ⇒ Object
52 53 54 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 52 def status_code @paymentstate end |
#test? ⇒ Boolean
Was this a test transaction?
33 34 35 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 33 def test? false end |
#transaction_id ⇒ Object
18 19 20 |
# File 'lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb', line 18 def transaction_id params['orderNumber'] end |