Sha256: f6f9cf7efcc31b373217b8ab81b36c620b65ed97648a8a78a27823cf4d77afbc

Contents?: true

Size: 1.12 KB

Versions: 40

Compression:

Stored size: 1.12 KB

Contents

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

          def self.recognizes?(params)
            params.has_key?('InvId') && params.has_key?('OutSum')
          end

          def complete?
            true
          end

          def amount
            BigDecimal.new(gross)
          end

          def item_id
            params['InvId']
          end

          def security_key
            params[ActiveMerchant::Billing::Integrations::Robokassa.signature_parameter_name].to_s.downcase
          end

          def gross
            params['OutSum']
          end

          def status
            'success'
          end

          def secret
            @options[:secret]
          end

          def main_params
            [gross, item_id]
          end

          def acknowledge
            security_key == generate_signature
          end

          def success_response(*args)
            "OK#{item_id}"
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 5 rubygems

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