Class: Payhere::Outpayments
- Defined in:
- lib/payhere-sdk/outpayments.rb
Instance Method Summary collapse
- #get_transaction_status(transaction_id) ⇒ Object
-
#transfer(phone_number, amount, processing_number = '', narration = '') ⇒ Object
The transfer operation is used to transfer an amount from the payer’s account to a payee account.
Methods inherited from Client
#create_connection, #get_credentials, #handle_error, #interpret_response, #send_request
Instance Method Details
#get_transaction_status(transaction_id) ⇒ Object
10 11 12 13 |
# File 'lib/payhere-sdk/outpayments.rb', line 10 def get_transaction_status(transaction_id) path = "/outpayments/#{transaction_id}" super(path) end |
#transfer(phone_number, amount, processing_number = '', narration = '') ⇒ Object
The transfer operation is used to transfer an amount from the payer’s account to a payee account. The status of the transaction can be validated by using ‘get_transation_status`
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/payhere-sdk/outpayments.rb', line 19 def transfer(phone_number, amount, processing_number = '', narration = '') Payhere::Validate.new.validate(phone_number, amount) processing_number = SecureRandom.uuid unless processing_number.blank? body = { "msisdn": phone_number, "narration": narration, "processingNumber": processing_number, "amount": amount.to_i } path = '/outpayments' send_request('post', path, body) { processing_number: processing_number } end |