Sha256: 74743607f8e98c3d38b501dc64f76d454c678f1e2c6ea1542f42820f1e4ce988

Contents?: true

Size: 1.35 KB

Versions: 28

Compression:

Stored size: 1.35 KB

Contents

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

          def initialize(data, options)
            if options[:credential2].nil?
              raise ArgumentError, "You need to provide the md5 secret as the option :credential2 to verify that the notification originated from EasyPay"
            end

            super
          end

          def self.recognizes?(params)
            params.has_key?('order_mer_code') && params.has_key?('sum')
          end

          def complete?
            true
          end

          def amount
            BigDecimal.new(gross)
          end

          def item_id
            params['order_mer_code']
          end

          def security_key
            params[ActiveMerchant::Billing::Integrations::EasyPay.notify_signature_parameter_name]
          end

          def gross
            params['sum']
          end

          def status
            'Completed'
          end

          def secret
            @options[:credential2]
          end

          def acknowledge
            security_key == generate_signature(:notify)
          end

          def success_response(*args)
            { :nothing => true }
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.38.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.38.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.37.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.36.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.35.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.35.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.34.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.34.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.33.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.32.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.32.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.31.1 lib/active_merchant/billing/integrations/easy_pay/notification.rb
activemerchant-1.31.0 lib/active_merchant/billing/integrations/easy_pay/notification.rb