class OffsitePayments::Integrations::Molpay::Notification

Public Instance Methods

account() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 113
def account
  params["domain"]
end
acknowledge(authcode = nil) click to toggle source
# 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_code() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 135
def auth_code
  params['appcode']
end
channel() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 126
def channel
  params['channel']
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 101
def complete?
  status == 'Completed'
end
currency() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 122
def currency
  params['currency']
end
error_code() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 139
def error_code
  params['error_code']
end
error_desc() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 143
def error_desc
  params['error_desc']
end
gross() click to toggle source

the money amount we received in X.2 decimal.

# File lib/offsite_payments/integrations/molpay.rb, line 118
def gross
  params['amount']
end
item_id() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 105
def item_id
  params['orderid']
end
received_at() click to toggle source

When was this payment received by the client.

# File lib/offsite_payments/integrations/molpay.rb, line 131
def received_at
  params['paydate']
end
security_key() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 147
def security_key
  params['skey']
end
status() click to toggle source
# 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_orig() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 155
def status_orig
  params['status']
end
test?() click to toggle source
# 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_id() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 109
def transaction_id
  params['tranID']
end

Protected Instance Methods

generate_signature() click to toggle source
# File lib/offsite_payments/integrations/molpay.rb, line 171
def generate_signature
  key0 = Digest::MD5.hexdigest("#{transaction_id}#{item_id}#{status_orig}#{account}#{gross}#{currency}")
  Digest::MD5.hexdigest("#{received_at}#{account}#{key0}#{auth_code}#{@options[:credential2]}")
end