Sha256: 8b3aa0f3e311dc36748c1f1b2b2dd4af49c7a4bee53dc0ad47ca4bac99755517

Contents?: true

Size: 1.13 KB

Versions: 18

Compression:

Stored size: 1.13 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(authcode = nil)
            security_key == generate_signature
          end

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
activemerchant-1.43.3 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.4 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.3 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.2 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.1 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.42.0 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.41.0 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.40.0 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.39.2 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.39.1 lib/active_merchant/billing/integrations/robokassa/notification.rb
activemerchant-1.39.0 lib/active_merchant/billing/integrations/robokassa/notification.rb