Sha256: f8bcbe0a3496b3e32cea52d4b018f8316084a19dcebef70554763dc9ac43ce29

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module Dwolla
        module Common
          def verify_signature(checkoutId, amount, notification_signature, secret)
            if secret.nil?
              raise ArgumentError, "You need to provide the Application secret as the option :credential3 to verify that the notification originated from Dwolla"
            end

            expected_signature = Digest::SHA1.hexdigest(secret + ('%s&%.2f' % [checkoutId, amount]))

            if notification_signature != expected_signature
              raise StandardError, "Dwolla signature verification failed."
            end
          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/common.rb