Sha256: fcb040eadcae867c8a5bf071f647da34abab3d862cc783120ecdf85b694fb001

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'net/http'

module AbtainBilling #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module HiTrust
        class Notification < AbtainBilling::Billing::Integrations::Notification
          SUCCESS = '00'
          
          self.production_ips = [ '203.75.242.8' ]
          
          def complete?
            status == 'Completed'
          end 

          def transaction_id
            params['authRRN']
          end
          
          def item_id
            params['ordernumber']
          end
          
          def received_at
            Time.parse(params['orderdate']) rescue nil
          end
          
          def currency
            params['currency']
          end

          def gross
            sprintf("%.2f", gross_cents.to_f / 100)
          end
          
          def gross_cents
            params['approveamount'].to_i
          end
          
          def account
            params['storeid']
          end

          def status
            params['retcode'] == SUCCESS ? 'Completed' : 'Failed'
          end
          
          def test?
            AbtainBilling::Billing::Base.integration_mode == :test
          end
    
          def acknowledge      
            true
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abtain_billing-1.03 lib/abtain_billing/billing/integrations/hi_trust/notification.rb
abtain_billing-1.02 lib/abtain_billing/billing/integrations/hi_trust/notification.rb