Sha256: 38d4a0dce8612828f7a763a97e06544b27efcb6fb51fdde8f7c4c2d76ceba508

Contents?: true

Size: 1017 Bytes

Versions: 2

Compression:

Stored size: 1017 Bytes

Contents

module Pesapal

  module Status

    # set parameters required by the QueryPaymentStatus & QueryPaymentStatusByMerchantRef calls
    def Status.set_parameters(consumer_key, merchant_reference, transaction_tracking_id = nil)

      # parameters required by the QueryPaymentStatus call (excludes
      # oauth_signature parameter as per the instructions here
      # http://developer.pesapal.com/how-to-integrate/api-reference)

      timestamp = Time.now.to_i.to_s

      params = { :oauth_consumer_key => consumer_key,
                 :oauth_nonce => "#{timestamp}" + Pesapal::Oauth.generate_nonce(12),
                 :oauth_signature_method => 'HMAC-SHA1',
                 :oauth_timestamp => "#{timestamp}",
                 :oauth_version => '1.0',
                 :pesapal_merchant_reference => merchant_reference
              }

      unless transaction_tracking_id.nil? # do, if not true
        params[:pesapal_transaction_tracking_id] = transaction_tracking_id
      end

      params
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pesapal-1.3.0 lib/pesapal/merchant/status.rb
pesapal-1.2.2 lib/pesapal/merchant/status.rb