Module: Pesapal::Helper::Status
- Defined in:
- lib/pesapal/helper/status.rb
Overview
Contains helper methods relating to any queries for transaction payment status. See Merchant#query_payment_status source.
Class Method Summary collapse
-
.set_parameters(consumer_key, merchant_reference, transaction_tracking_id = nil) ⇒ Hash
Prepares parameters to be used during the QueryPaymentStatus and QueryPaymentStatusByMerchantRef oAuth 1.0 calls.
Class Method Details
.set_parameters(consumer_key, merchant_reference, transaction_tracking_id = nil) ⇒ Hash
Prepares parameters to be used during the QueryPaymentStatus and QueryPaymentStatusByMerchantRef oAuth 1.0 calls.
The QueryPaymentStatus and QueryPaymentStatusByMerchantRef oAuth 1.0 calls require 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_referencedefined below)pesapal_transaction_tracking_id- the transaction tracking id (same astransaction_tracking_iddefined 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.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/pesapal/helper/status.rb', line 40 def self.set_parameters(consumer_key, merchant_reference, transaction_tracking_id = nil) = Time.now.to_i.to_s params = { 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 } params[:pesapal_transaction_tracking_id] = transaction_tracking_id unless transaction_tracking_id.nil? params end |