|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
| 3 | +# Base implementation of the MTN API client |
| 4 | + |
| 5 | +# Includes methods common to collections, disbursements and remittances |
| 6 | + |
3 | 7 | require 'faraday' |
4 | 8 |
|
5 | 9 | require 'momoapi-ruby/config' |
@@ -38,6 +42,8 @@ def handle_error(response_body, response_code) |
38 | 42 | raise Error::APIError.new(response_body, response_code) |
39 | 43 | end |
40 | 44 |
|
| 45 | + # Create an access token which can then be used to |
| 46 | + # authorize and authenticate towards the other end-points of the API |
41 | 47 | def get_auth_token(path, subscription_key) |
42 | 48 | headers = { |
43 | 49 | "Ocp-Apim-Subscription-Key": subscription_key |
@@ -65,14 +71,17 @@ def prepare_get_request(path, subscription_key) |
65 | 71 | send_request('get', path, headers) |
66 | 72 | end |
67 | 73 |
|
| 74 | + # get the balance on an account |
68 | 75 | def get_balance(path, subscription_key) |
69 | 76 | prepare_get_request(path, subscription_key) |
70 | 77 | end |
71 | 78 |
|
| 79 | + # retrieve transaction information, for transfer and payments |
72 | 80 | def get_transaction_status(path, subscription_key) |
73 | 81 | prepare_get_request(path, subscription_key) |
74 | 82 | end |
75 | 83 |
|
| 84 | + # check if an account holder is registered and active in the system |
76 | 85 | def is_user_active(path, subscription_key) |
77 | 86 | prepare_get_request(path, subscription_key) |
78 | 87 | end |
|
0 commit comments