Class: OffsitePayments::Integrations::Molpay::Notification

Inherits:
Notification
  • Object
show all
Includes:
ActiveUtils::PostsData
Defined in:
lib/offsite_payments/integrations/molpay.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

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

#accountObject


101
102
103
# File 'lib/offsite_payments/integrations/molpay.rb', line 101

def 
  params["domain"]
end

#acknowledge(authcode = nil) ⇒ Object


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

def acknowledge(authcode = nil)
  payload = raw + '&treq=1'
  ssl_post(Molpay.acknowledge_url, payload,
    'Content-Length' => "#{payload.size}",
    'User-Agent'     => "Shopify/OffsitePayments"
  )

  status == 'Completed' && security_key == generate_signature
end

#auth_codeObject


123
124
125
# File 'lib/offsite_payments/integrations/molpay.rb', line 123

def auth_code
  params['appcode']
end

#channelObject


114
115
116
# File 'lib/offsite_payments/integrations/molpay.rb', line 114

def channel
  params['channel']
end

#complete?Boolean

Returns:

  • (Boolean)

89
90
91
# File 'lib/offsite_payments/integrations/molpay.rb', line 89

def complete?
  status == 'Completed'
end

#currencyObject


110
111
112
# File 'lib/offsite_payments/integrations/molpay.rb', line 110

def currency
  params['currency']
end

#error_codeObject


127
128
129
# File 'lib/offsite_payments/integrations/molpay.rb', line 127

def error_code
  params['error_code']
end

#error_descObject


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

def error_desc
  params['error_desc']
end

#grossObject

the money amount we received in X.2 decimal.


106
107
108
# File 'lib/offsite_payments/integrations/molpay.rb', line 106

def gross
  params['amount']
end

#item_idObject


93
94
95
# File 'lib/offsite_payments/integrations/molpay.rb', line 93

def item_id
  params['orderid']
end

#received_atObject

When was this payment received by the client.


119
120
121
# File 'lib/offsite_payments/integrations/molpay.rb', line 119

def received_at
  params['paydate']
end

#security_keyObject


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

def security_key
  params['skey']
end

#statusObject


147
148
149
# File 'lib/offsite_payments/integrations/molpay.rb', line 147

def status
  params['status'] == '00' ? 'Completed' : 'Failed'
end

#status_origObject


143
144
145
# File 'lib/offsite_payments/integrations/molpay.rb', line 143

def status_orig
  params['status']
end

#test?Boolean

Returns:

  • (Boolean)

139
140
141
# File 'lib/offsite_payments/integrations/molpay.rb', line 139

def test?
  gross.blank? && auth_code.blank? && error_code.blank? && error_desc.blank? && security_key.blank?
end

#transaction_idObject


97
98
99
# File 'lib/offsite_payments/integrations/molpay.rb', line 97

def transaction_id
  params['tranID']
end