Sha256: 026f83dfaab3083bc9c35c81b790850579f543118aceaaadf52d8c4486457e4d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'net/http'
require 'digest/sha1'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Dwolla
        class Notification < ActiveMerchant::Billing::Integrations::Notification
          include Common

          def complete?
            (status == "Completed")
          end

          def status
            params["Status"]
          end

          def transaction_id
            params['TransactionId']
          end

          def item_id
            params['OrderId']
          end

          def currency
            "USD"
          end

          def gross
            params['Amount']
          end

          def error
            params['Error']
          end

          def test?
            params['TestMode']
          end

          def acknowledge
            true
          end

          private

          def parse(post)
            @raw = post.to_s
            json_post = JSON.parse(post)
            verify_signature(json_post['CheckoutId'], json_post['Amount'], json_post['Signature'], @options[:credential3])

            params.merge!(json_post)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activemerchant-1.33.0 lib/active_merchant/billing/integrations/dwolla/notification.rb