Skip to content

mpesa-rails-express #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Annastacia-dev
Copy link
Collaborator

@Annastacia-dev Annastacia-dev commented May 16, 2024

What

This PR introduces mpesa-rails-express app in templates as the base template for mpesa express product for a rails app.

This templates uses ruby 3.2.2 and rails 7.1.3 as the default versions. Aside from the default gem dependencies it has 2 gem dependencies gem 'dotenv' to help load variables defined in a .env file and gem 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 under app/controllers/concerns/example/stk.rb and app/controller/concerns/exaple/callback.rb respectively.

example_controller.rb contains methods shared between all products

  • load_variables - loads required values from .env file and saves them to a variable.
  • generate_access_token_request, retrieve_access_token and send_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 and callback.rb for checking the status of the stk push.

Responses are in JSON format.

Screenshots

Screenshot from 2024-05-27 11-30-51
Screenshot from 2024-05-27 11-30-35

@Annastacia-dev Annastacia-dev marked this pull request as draft May 16, 2024 13:22
@Annastacia-dev Annastacia-dev changed the title [WIP]: mpesa-rails-express mpesa-rails-express May 27, 2024
@Annastacia-dev Annastacia-dev marked this pull request as ready for review May 27, 2024 08:08
@thecodeinfluencer thecodeinfluencer self-assigned this Jun 3, 2024
@thecodeinfluencer thecodeinfluencer merged commit 07cb1d3 into thecodeinfluencer:main Jun 3, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants