Class: Mpesa::StkQuery
Constant Summary
collapse
- PATH =
'mpesa/stkpushquery/v1/query'
Instance Attribute Summary
Attributes inherited from Resource
#args, #client
Instance Method Summary
collapse
Methods inherited from Resource
#format_phone, #get_request, #handle_response, #initialize, #post_request
Instance Method Details
13
14
15
16
17
18
19
20
|
# File 'lib/mpesa/resources/stk_query.rb', line 13
def body
{
'BusinessShortCode': shortcode,
'Password': password,
'Timestamp': timestamp,
'CheckoutRequestID': args[:checkout_request_id]
}
end
|
9
10
11
|
# File 'lib/mpesa/resources/stk_query.rb', line 9
def call
Object.new post_request(url: PATH, body: body).body
end
|
22
23
24
|
# File 'lib/mpesa/resources/stk_query.rb', line 22
def password
Base64.strict_encode64("#{shortcode}#{args[:pass_key] || client.pass_key}#{timestamp}")
end
|
#shortcode ⇒ Object
30
31
32
|
# File 'lib/mpesa/resources/stk_query.rb', line 30
def shortcode
args[:shortcode] || client.shortcode
end
|
#timestamp ⇒ Object
26
27
28
|
# File 'lib/mpesa/resources/stk_query.rb', line 26
def timestamp
Time.now.strftime('%Y%m%d%H%M%S')
end
|