class OffsitePayments::Integrations::Latipay::Notification

Public Class Methods

new(params, credentials = {}) click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 205
def initialize(params, credentials = {})
  token = params.fetch('Token') { params.fetch('token') }
  @params = QueryInterface.new(credentials.fetch(:api_key), credentials.fetch(:user_id)).call(token)
end

Public Instance Methods

acknowledge(authcode = nil) click to toggle source

Acknowledge the transaction to Latipay. This method has to be called after a new apc arrives. Latipay will verify that all the information we received are correct and will return a ok or a fail.

Example:

def ipn
  notify = LatipayNotification.new(request.raw_post)

  if notify.acknowledge
    ... process order ... if notify.complete?
  else
    ... log possible hacking attempt ...
  end
# File lib/offsite_payments/integrations/latipay.rb, line 241
def acknowledge(authcode = nil)
  true
end
complete?() click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 210
def complete?
  params['status'] == 'paid'
end
gross() click to toggle source

the money amount we received in X.2 decimal.

# File lib/offsite_payments/integrations/latipay.rb, line 219
def gross
  params['amount']
end
status() click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 223
def status
  params['status']
end
transaction_id() click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 214
def transaction_id
  params['order_id']
end