Class: OffsitePayments::Integrations::Gestpay::Notification

Inherits:
Notification
  • Object
show all
Includes:
Common
Defined in:
lib/offsite_payments/integrations/gestpay.rb

Constant Summary

Constants included from Common

Common::CURRENCY_MAPPING, Common::DECRYPTION_PATH, Common::DELIMITER, Common::ENCRYPTION_PATH, Common::GestpayEncryptionResponseError, Common::VERSION

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods included from Common

#parse_response, #ssl_get

Methods inherited from Notification

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

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#acknowledge(authcode = nil) ⇒ Object


163
164
165
# File 'lib/offsite_payments/integrations/gestpay.rb', line 163

def acknowledge(authcode = nil)
  true
end

#complete?Boolean


126
127
128
# File 'lib/offsite_payments/integrations/gestpay.rb', line 126

def complete?
  status == 'Completed'
end

#currencyObject


144
145
146
147
148
# File 'lib/offsite_payments/integrations/gestpay.rb', line 144

def currency
  # Ruby 1.9 compat
  method = CURRENCY_MAPPING.respond_to?(:key) ? :key : :index
  CURRENCY_MAPPING.send(method, params['PAY1_UICCODE'])
end

#grossObject

the money amount we received in X.2 decimal.


140
141
142
# File 'lib/offsite_payments/integrations/gestpay.rb', line 140

def gross
  params['PAY1_AMOUNT']
end

#item_idObject

The important param


131
132
133
# File 'lib/offsite_payments/integrations/gestpay.rb', line 131

def item_id
  params['PAY1_SHOPTRANSACTIONID']
end

#statusObject


154
155
156
157
158
159
160
161
# File 'lib/offsite_payments/integrations/gestpay.rb', line 154

def status
  case params['PAY1_TRANSACTIONRESULT']
  when 'OK'
    'Completed'
  else
    'Failed'
  end
end

#test?Boolean


150
151
152
# File 'lib/offsite_payments/integrations/gestpay.rb', line 150

def test?
  false
end

#transaction_idObject


135
136
137
# File 'lib/offsite_payments/integrations/gestpay.rb', line 135

def transaction_id
  params['PAY1_BANKTRANSACTIONID']
end