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



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

def 
  params["domain"]
end

#acknowledge(authcode = nil) ⇒ Object



159
160
161
162
163
164
165
166
167
# File 'lib/offsite_payments/integrations/molpay.rb', line 159

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



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

def auth_code
  params['appcode']
end

#channelObject



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

def channel
  params['channel']
end

#complete?Boolean

Returns:

  • (Boolean)


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

def complete?
  status == 'Completed'
end

#currencyObject



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

def currency
  params['currency']
end

#error_codeObject



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

def error_code
  params['error_code']
end

#error_descObject



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

def error_desc
  params['error_desc']
end

#grossObject

the money amount we received in X.2 decimal.



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

def gross
  params['amount']
end

#item_idObject



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

def item_id
  params['orderid']
end

#received_atObject

When was this payment received by the client.



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

def received_at
  params['paydate']
end

#security_keyObject



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

def security_key
  params['skey']
end

#statusObject



90
91
92
93
94
95
96
97
98
99
# File 'lib/offsite_payments/integrations/molpay.rb', line 90

def status
  case params['status']
    when '00'
      'Completed'
    when '11'
      'Failed'
    when '22'
      'Pending'
  end
end

#status_origObject



155
156
157
# File 'lib/offsite_payments/integrations/molpay.rb', line 155

def status_orig
  params['status']
end

#test?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/offsite_payments/integrations/molpay.rb', line 151

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

#transaction_idObject



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

def transaction_id
  params['tranID']
end