Class: Peperusha::CustomerPayViaTill
- Inherits:
-
Object
- Object
- Peperusha::CustomerPayViaTill
- Includes:
- Interactor
- Defined in:
- lib/peperusha/customer_pay_via_till.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/peperusha/customer_pay_via_till.rb', line 18 def call path = 'mpesa/c2b/v1/simulate' response = Peperusha::Client.invoke_post_request(token, path, attributes) if response.status == 200 data = JSON.parse(response.body) context.body = data else client_errors = Peperusha::Client.build_errors_collection(response) context.fail!(errors: client_errors) end end |