Sha256: 4b69b333d8e196ede79c7a68824bbbe97434de4280ff78795a57fee02169ae57

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

module Payanyway
  module Request
    class Pay < Base
      @@_params = {
        'MNT_ID'             => :moneta_id,
        'MNT_TRANSACTION_ID' => :transaction_id,
        'MNT_OPERATION_ID'   => :operation_id,
        'MNT_AMOUNT'         => :amount,
        'MNT_CURRENCY_CODE'  => :currency,
        'MNT_SUBSCRIBER_ID'  => :subscriber_id,
        'MNT_TEST_MODE'      => :test_mode,
        'MNT_SIGNATURE'      => :signature,
        'MNT_USER'           => :user,
        'MNT_CORRACCOUNT'    => :corraccount,
        'MNT_CUSTOM1'        => :custom1,
        'MNT_CUSTOM2'        => :custom2,
        'MNT_CUSTOM3'        => :custom3
      }.invert.to_settings

      def initialize(params)
        super
        @valid_signature = (@pretty_params[:signature] == Payanyway::Helpers::SignatureGenerate.for_pay(@params))
      end

      def success?
        @valid_signature
      end

      def response
        @valid_signature ? 'SUCCESS' : 'FAIL'
      end

      private

      def signature
        Payanyway::Helpers::SignatureGenerate.for_pay(@params)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
payanyway-2.3.1 lib/payanyway/request/pay.rb
payanyway-2.3.0 lib/payanyway/request/pay.rb
payanyway-2.2.2 lib/payanyway/request/pay.rb
payanyway-2.2.1 lib/payanyway/request/pay.rb
payanyway-2.2.0 lib/payanyway/request/pay.rb
payanyway-2.1.0 lib/payanyway/request/pay.rb
payanyway-2.0.2 lib/payanyway/request/pay.rb
payanyway-2.0.1 lib/payanyway/request/pay.rb
payanyway-2.0.0 lib/payanyway/request/pay.rb