Class: Mpesa::Reversal
Constant Summary
collapse
- PATH =
'mpesa/reversal/v1/request'
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
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/mpesa/resources/reversal.rb', line 11
def body
{
"Initiator": args[:initiator_username],
"SecurityCredential": credentials,
"CommandID": 'TransactionReversal',
"TransactionID": args[:transaction_id],
"Amount": args[:amount],
"ReceiverParty": args[:receiver],
"RecieverIdentifierType": args[:receiver_type],
"Remarks": args[:remarks] || 'check status',
"QueueTimeOutURL": args[:timeout_url],
"ResultURL": args[:result_url],
"Occasion": args[:occasion] || 'check status'
}
end
|
7
8
9
|
# File 'lib/mpesa/resources/reversal.rb', line 7
def call
Object.new post_request(url: PATH, body: body).body
end
|
#credentials ⇒ Object
27
28
29
|
# File 'lib/mpesa/resources/reversal.rb', line 27
def credentials
SecurityCred.new(args[:initiator_password], client.env).password_credential
end
|