Module: Pesapal::Helper::Details
- Defined in:
- lib/pesapal/helper/details.rb
Overview
Contains helper methods relating to any queries for payment details. See Merchant#query_payment_details source.
Class Method Summary collapse
-
.set_parameters(consumer_key, merchant_reference, transaction_tracking_id) ⇒ Hash
Prepares parameters to be used during the QueryPaymentDetails oAuth 1.0 call.
Class Method Details
.set_parameters(consumer_key, merchant_reference, transaction_tracking_id) ⇒ Hash
Prepares parameters to be used during the QueryPaymentDetails oAuth 1.0 call.
The QueryPaymentDetails oAuth 1.0 call requires the following parameters;
oauth_consumer_key
- your Pesapal consumer key sent to you via email or obtained from the dashboardoauth_nonce
- a random string, uniquely generated for each request. See section 8 of the oAuth 1.0 specoauth_signature
- the signature as defined in the oAuth 1.0 spec under section 9 of the oAuth 1.0 specoauth_signature_method
-HMAC-SHA1
(do not change). See section 9.2 of the oAuth 1.0 specoauth_timestamp
- number of seconds since January 1, 1970 00:00:00 GMT, also known as Unix Time. See section 8 of the oAuth 1.0 specoauth_version
-1.0
(do not change)pesapal_merchant_reference
- the transaction merchant reference (same asmerchant_reference
defined below)pesapal_transaction_tracking_id
- the transaction tracking id (same astransaction_tracking_id
defined below)
This method generates all the above except the oauth_signature
which is generated later by Oauth.generate_oauth_signature
since generation of this oauth_signature
requires these parameters as
inputs anyway. See section 9.2.1 of the oAuth 1.0 spec for more
details.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pesapal/helper/details.rb', line 44 def self.set_parameters(consumer_key, merchant_reference, transaction_tracking_id) = Time.now.to_i.to_s { oauth_consumer_key: consumer_key, oauth_nonce: "#{}" + Pesapal::Oauth.generate_nonce(12), oauth_signature_method: 'HMAC-SHA1', oauth_timestamp: "#{}", oauth_version: '1.0', pesapal_merchant_reference: merchant_reference, pesapal_transaction_tracking_id: transaction_tracking_id } end |