lib/pesapal/helper/post.rb in pesapal-1.5.6 vs lib/pesapal/helper/post.rb in pesapal-1.6.0

- old
+ new

@@ -80,19 +80,19 @@ # # It typically looks like this: # # ``` # order_details = { - # :amount => 1000, - # :description => 'this is the transaction description', - # :type => 'MERCHANT', - # :reference => '808-707-606', - # :first_name => 'Swaleh', - # :last_name => 'Mdoe', - # :email => 'user@example.com', - # :phonenumber => '+254722222222', - # :currency => 'KES' + # amount: 1000, + # description: 'this is the transaction description', + # type: 'MERCHANT', + # reference: '808-707-606', + # first_name: 'Swaleh', + # last_name: 'Mdoe', + # email: 'user@example.com', + # phonenumber: '+254722222222', + # currency: 'KES' # } # ``` # # See {Pesapal::Merchant#order_details}. # @@ -122,11 +122,11 @@ post_xml.concat "Currency=\"#{details[:currency]}\" " post_xml.concat 'xmlns="http://www.pesapal.com" />' # Encode the XML encoder = HTMLEntities.new(:xhtml1) - post_xml = encoder.encode post_xml + encoder.encode post_xml end # Prepares parameters to be used during the PostPesapalDirectOrderV4 oAuth 1.0 call. # # The PostPesapalDirectOrderV4 oAuth 1.0 call requires the following parameters; @@ -161,16 +161,16 @@ # @param post_xml [String] encoded XML formated order data. Generated by {generate_post_xml} # # @return [Hash] parameters to be used in generating the oAuth 1.0 URL query parameters and the `oauth_signature` itself. def self.set_parameters(callback_url, consumer_key, post_xml) timestamp = Time.now.to_i.to_s - { :oauth_callback => callback_url, - :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_request_data => post_xml + { oauth_callback: callback_url, + 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_request_data: post_xml } end end end end