class OffsitePayments::Integrations::Nochex::Notification
Parser and handler for incoming Automatic Payment Confirmations from Nochex.
def acknowledge(authcode = nil)
... log possible hacking attempt ...
else
... process order ... if notify.complete?
if notify.acknowledge
notify = NochexNotification.new(request.raw_post)
def nochex_ipn
Example:
ok or a fail. This is very similar to the PayPal IPN scheme.
apc arrives. Nochex will verify that all the information we received are correct and will return a
Acknowledge the transaction to Nochex. This method has to be called after a new
def acknowledge(authcode = nil) payload = raw response = ssl_post(Nochex.notification_confirmation_url, payload, 'Content-Length' => "#{payload.size}", 'User-Agent' => "Active Merchant -- http://activemerchant.org", 'Content-Type' => "application/x-www-form-urlencoded" ) raise StandardError.new("Faulty Nochex result: #{response}") unless ["AUTHORISED", "DECLINED"].include?(response) response == "AUTHORISED" end
def complete?
def complete? status == 'Completed' end
def currency
def currency 'GBP' end
def gross
def gross sprintf("%.2f", params['amount'].to_f) end
def item_id
def item_id params['order_id'] end
def payer_email
def payer_email params['from_email'] end
def received_at
def received_at # U.K. Format: 27/09/2006 22:30:54 return if params['transaction_date'].blank? time = params['transaction_date'].scan(/\d+/) Time.utc(time[2], time[1], time[0], time[3], time[4], time[5]) end
def receiver_email
def receiver_email params['to_email'] end
def security_key
def security_key params['security_key'] end
def status
def status 'Completed' end
def test?
def test? params['status'] == 'test' end
def transaction_id
def transaction_id params['transaction_id'] end