class Mpesa::Stk
Constants
- PATH
Public Instance Methods
body()
click to toggle source
# File lib/mpesa/resources/stk.rb, line 11 def body { 'BusinessShortCode': args[:shortcode] || client.shortcode, 'Password': password, 'Timestamp': timestamp.to_s, 'TransactionType': 'CustomerPayBillOnline', 'Amount': args[:amount], 'PartyA': args[:phone], 'PartyB': args[:shortcode] || client.shortcode, 'PhoneNumber': args[:phone], 'CallBackURL': args[:callback_url], 'AccountReference': args[:reference], 'TransactionDesc': args[:trans_desc] } end
call()
click to toggle source
# File lib/mpesa/resources/stk.rb, line 7 def call Object.new post_request(url: PATH, body: body).body end
password()
click to toggle source
# File lib/mpesa/resources/stk.rb, line 27 def password Base64.strict_encode64("#{args[:shortcode]}#{client.pass_key || args[:pass_key]}#{timestamp}") end
timestamp()
click to toggle source
# File lib/mpesa/resources/stk.rb, line 31 def timestamp Time.now.strftime('%Y%m%d%H%M%S').to_i end