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



161
162
163
# File 'lib/offsite_payments/integrations/gestpay.rb', line 161

def acknowledge(authcode = nil)
  true
end

#complete?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/offsite_payments/integrations/gestpay.rb', line 124

def complete?
  status == 'Completed'
end

#currencyObject



142
143
144
145
146
# File 'lib/offsite_payments/integrations/gestpay.rb', line 142

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.



138
139
140
# File 'lib/offsite_payments/integrations/gestpay.rb', line 138

def gross
  params['PAY1_AMOUNT']
end

#item_idObject

The important param



129
130
131
# File 'lib/offsite_payments/integrations/gestpay.rb', line 129

def item_id
  params['PAY1_SHOPTRANSACTIONID']
end

#statusObject



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

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

#test?Boolean

Returns:

  • (Boolean)


148
149
150
# File 'lib/offsite_payments/integrations/gestpay.rb', line 148

def test?
  false
end

#transaction_idObject



133
134
135
# File 'lib/offsite_payments/integrations/gestpay.rb', line 133

def transaction_id
  params['PAY1_BANKTRANSACTIONID']
end