mpesa-rails-express #2
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR introduces
mpesa-rails-express
app intemplates
as the base template for mpesa express product for a rails app.This templates uses
ruby 3.2.2
andrails 7.1.3
as the default versions. Aside from the default gem dependencies it has 2 gem dependenciesgem 'dotenv'
to help load variables defined in a.env
file andgem rest-client
to make http requests.The logic is defined in
app/controllers/api/example_controller.rb
which includes two concern files stk and callback defined underapp/controllers/concerns/example/stk.rb
andapp/controller/concerns/exaple/callback.rb
respectively.example_controller.rb
contains methods shared between all productsload_variables
- loads required values from.env
file and saves them to a variable.generate_access_token_request
,retrieve_access_token
andsend_access_token_request
are used to send and retrieve for the tokens required for authenticating your API calls.The concerns are defined separately to give them a single responsibility,
stk.rb
for stk push request andcallback.rb
for checking the status of the stk push.Responses are in
JSON
format.Screenshots