Class: ActiveMerchant::Billing::Integrations::Ogone::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Ogone::Notification
- 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
- #acknowledge ⇒ Object
- #brand ⇒ Object
- #complete? ⇒ Boolean
- #currency ⇒ Object
- #gross ⇒ Object
-
#initialize(post, options = {}) ⇒ Notification
constructor
A new instance of Notification.
- #order_id ⇒ Object
- #payment_method ⇒ Object
- #scoring ⇒ Object
- #scoring_category ⇒ Object
- #status ⇒ Object
-
#status_message ⇒ Object
needed?.
- #transaction_id ⇒ Object
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, ={}) super unless params['STATUS'].match(/^\d+$/) raise OgoneError, "Faulty Ogone result: '#{params['STATUS']}'" end sign = Ogone::(params, [:signature]) unless params['SHASIGN'] == sign raise OgoneError, "Faulty Ogone SHA1 signature: '#{params['SHASIGN']}' != '#{sign}'" end end |
Instance Method Details
#acknowledge ⇒ Object
117 118 119 |
# File 'lib/active_merchant_ogone/notification.rb', line 117 def acknowledge true end |
#brand ⇒ Object
109 110 111 |
# File 'lib/active_merchant_ogone/notification.rb', line 109 def brand params['BRAND'] end |
#complete? ⇒ Boolean
93 94 95 |
# File 'lib/active_merchant_ogone/notification.rb', line 93 def complete? status == 'Completed' end |
#currency ⇒ Object
113 114 115 |
# File 'lib/active_merchant_ogone/notification.rb', line 113 def currency params['currency'] end |
#gross ⇒ Object
89 90 91 |
# File 'lib/active_merchant_ogone/notification.rb', line 89 def gross params['amount'].to_f end |
#order_id ⇒ Object
101 102 103 |
# File 'lib/active_merchant_ogone/notification.rb', line 101 def order_id params['orderID'] end |
#payment_method ⇒ Object
97 98 99 |
# File 'lib/active_merchant_ogone/notification.rb', line 97 def payment_method params['PM'] end |
#scoring ⇒ Object
121 122 123 |
# File 'lib/active_merchant_ogone/notification.rb', line 121 def scoring params['SCORING'].to_i if params['SCORING'] end |
#scoring_category ⇒ Object
125 126 127 128 129 130 131 132 |
# File 'lib/active_merchant_ogone/notification.rb', line 125 def scoring_category case params['SCO_CATEGORY'] when 'G' then :green when 'O' then :orange when 'R' then :red else nil end end |
#status ⇒ Object
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_message ⇒ Object
needed?
85 86 87 |
# File 'lib/active_merchant_ogone/notification.rb', line 85 def # needed? STATUS_MAPPING[params['STATUS'].to_i] end |
#transaction_id ⇒ Object
105 106 107 |
# File 'lib/active_merchant_ogone/notification.rb', line 105 def transaction_id params['PAYID'] end |