Class: ActiveMerchant::Billing::Integrations::Ogone::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/active_merchant_ogone/notification.rb

Constant Summary collapse

STATUS_MAPPING =

params on a successfull payment

orderID=order_342
currency=EUR
amount=50
PM=CreditCard
ACCEPTANCE=test123
STATUS=9
CARDNO=XXXXXXXXXXXX1111
PAYID=2396925
NCERROR=0
BRAND=VISA
IPCTY=BE
CCCTY=US
ECI=7
CVCCheck=NO
AAVCheck=NO
VC=NO
SHASIGN=FE220C6F4492165533488E35F47F231D6BC357FC
IP=82.146.99.233
{
  0  => 'Incomplete or invalid',
  1  => 'Cancelled by client',
  2  => 'Authorization refused',
  4  => 'Order stored',
  41 => 'Waiting client payment',
  5  => 'Authorized',
  51 => 'Authorization waiting',
  52 => 'Authorization not known',
  55 => 'Stand-by',
  59 => 'Authoriz. to get manually',
  6  => 'Authorized and cancelled',
  61 => 'Author. deletion waiting',
  62 => 'Author. deletion uncertain',
  63 => 'Author. deletion refused',
  64 => 'Authorized and cancelled',
  7  => 'Payment deleted',
  71 => 'Payment deletion pending',
  72 => 'Payment deletion uncertain',
  73 => 'Payment deletion refused',
  74 => 'Payment deleted',
  75 => 'Deletion processed by merchant',
  8  => 'Refund',
  81 => 'Refund pending',
  82 => 'Refund uncertain',
  83 => 'Refund refused',
  84 => 'Payment declined by the acquirer',
  85 => 'Refund processed by merchant',
  9  => 'Payment requested',
  91 => 'Payment processing',
  92 => 'Payment uncertain',
  93 => 'Payment refused',
  94 => 'Refund declined by the acquirer',
  95 => 'Payment processed by merchant',
  99 => 'Being processed'
}
OK_STATUSSES =
[4,5,9]

Instance Method Summary collapse

Constructor Details

#initialize(post, options = {}) ⇒ Notification

Returns a new instance of Notification.



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/active_merchant_ogone/notification.rb', line 68

def initialize(post, options={})
  super

  unless params['STATUS'].match(/^\d+$/)
    raise OgoneError, "Faulty Ogone result: '#{params['STATUS']}'"
  end

  sign = Ogone::inbound_message_signature(params, options[:signature])
  unless params['SHASIGN'] == sign
    raise OgoneError, "Faulty Ogone SHA1 signature: '#{params['SHASIGN']}' != '#{sign}'"
  end
end

Instance Method Details

#acknowledgeObject



117
118
119
# File 'lib/active_merchant_ogone/notification.rb', line 117

def acknowledge
  true
end

#brandObject



109
110
111
# File 'lib/active_merchant_ogone/notification.rb', line 109

def brand
  params['BRAND']
end

#complete?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/active_merchant_ogone/notification.rb', line 93

def complete?
  status == 'Completed'
end

#currencyObject



113
114
115
# File 'lib/active_merchant_ogone/notification.rb', line 113

def currency
  params['currency']
end

#grossObject



89
90
91
# File 'lib/active_merchant_ogone/notification.rb', line 89

def gross
  params['amount'].to_f
end

#order_idObject



101
102
103
# File 'lib/active_merchant_ogone/notification.rb', line 101

def order_id
  params['orderID']
end

#payment_methodObject



97
98
99
# File 'lib/active_merchant_ogone/notification.rb', line 97

def payment_method
  params['PM']
end

#statusObject



81
82
83
# File 'lib/active_merchant_ogone/notification.rb', line 81

def status
  OK_STATUSSES.include?(params['STATUS'].to_i) ? 'Completed' : 'Failed'
end

#status_messageObject

needed?



85
86
87
# File 'lib/active_merchant_ogone/notification.rb', line 85

def status_message # needed?
  STATUS_MAPPING[params['STATUS'].to_i]
end

#transaction_idObject



105
106
107
# File 'lib/active_merchant_ogone/notification.rb', line 105

def transaction_id
  params['PAYID']
end