Sha256: e3e67b6b88cd40269e6fc50d539bf28cd28319759e5b7bb9a4ef83a7397e06db

Contents?: true

Size: 1.95 KB

Versions: 18

Compression:

Stored size: 1.95 KB

Contents

require 'net/http'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module PayflowLink
        class Notification < ActiveMerchant::Billing::Integrations::Notification
          
          # Was the transaction complete?
          def complete?
            status == "Completed"
          end

          # When was this payment received by the client. 
          # sometimes it can happen that we get the notification much later. 
          # One possible scenario is that our web application was down. In this case paypal tries several 
          # times an hour to inform us about the notification
          def received_at
            DateTime.parse(params['TRANSTIME']) if params['TRANSTIME']
          rescue ArgumentError
            nil
          end

          def status
            params['RESPMSG']
          end

          # Id of this transaction (paypal number)
          def transaction_id
            params['PNREF']
          end

          # What type of transaction are we dealing with? 
          def type
            params['TYPE']
          end

          # the money amount we received in X.2 decimal.
          def gross
            params['AMT']
          end

          # What currency have we been dealing with
          def currency
            nil
          end

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

          # This is the item number which we submitted to paypal 
          def item_id
            params['USER1']
          end

          # This is the invoice which you passed to paypal 
          def invoice
            params['INVNUM']
          end   

          # Was this a test transaction?
          def test?
            params['USER2'] == 'true'
          end
          
          def account
            params["ACCT"]
          end

          def acknowledge(authcode = nil)
            true
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
activemerchant-1.43.3 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.4 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.3 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.2 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.1 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.42.0 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.41.0 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.40.0 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.39.2 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.39.1 lib/active_merchant/billing/integrations/payflow_link/notification.rb
activemerchant-1.39.0 lib/active_merchant/billing/integrations/payflow_link/notification.rb