Class: ActiveMerchant::Billing::Integrations::Adyen::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/adyen/notification.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross_cents, #initialize, #valid_sender?

Constructor Details

This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification

Instance Method Details

#acknowledgeObject

Acknowledge the transaction to Adyen. This method has to be called after a new apc arrives. Adyen will verify that all the information we received are correct and will return a ok or a fail.

Example:

def ipn
  notify = AdyenNotification.new(request.raw_post)

  if notify.acknowledge
    ... process order ... if notify.complete?
  else
    ... log possible hacking attempt ...
  end


73
74
75
76
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 73

def acknowledge
  # this is a stub because Adyen does not support this feature, as of 2009-10-12
  true
end

#complete?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 8

def complete?
  ((params['eventCode'] == 'AUTHORISATION') and (params['success'] == 'true'))
end

#currencyObject



55
56
57
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 55

def currency
  params['currency']
end

#event_codeObject



12
13
14
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 12

def event_code
  params['eventCode']
end

#grossObject

the money amount we received in X.2 decimal.



42
43
44
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 42

def gross
  params['value']
end

#item_idObject



16
17
18
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 16

def item_id
  params['merchantReference']
end

#payer_emailObject



29
30
31
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 29

def payer_email
  ''#params['']
end

#received_atObject

When was this payment received by the client.



25
26
27
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 25

def received_at
  params['eventDate']
end

#receiver_emailObject



33
34
35
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 33

def receiver_email
  ''#params['']
end

#security_keyObject



37
38
39
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 37

def security_key
  ''#params['']
end

#statusObject



51
52
53
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 51

def status
  params['success']
end

#test?Boolean

Was this a test transaction?

Returns:

  • (Boolean)


47
48
49
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 47

def test?
  params['live'] == 'false'
end

#transaction_idObject



20
21
22
# File 'lib/active_merchant/billing/integrations/adyen/notification.rb', line 20

def transaction_id
  params['pspReference']
end