Skip to content

Emzzy241/Irene-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Irene API

A Robust Payment API

made by Emmanuel Mojiboye

Technologies Used

  • Version Control: Git
  • Backend: ASP.NET Core, C#
  • Frontend: SwaggerUI
  • Database: MySQL
  • ORM: Entity Framework Core
  • Architecture: Layered (3-tier) Architecture
  • ASP.NET Core RESTful APIs
  • JSON
  • Authentication: JSON Web Tokens(J-W-T)

IreneAPI - A Robust Payment Gateway API

IreneAPI is a secure, scalable, and fully functional payment gateway API designed to streamline the processing of online payments. Built using C#, .NET 6, and MySQL, the API offers essential payment processing services while adhering to modern software development standards like JWT authentication, layered architecture, and robust security protocols. Inspired by industry-leading solutions like Stripe and PayStack, IreneAPI aims to provide a flexible and easy-to-integrate payment system for developers and businesses alike.

  • Key Features:
  1. Secure Payment Processing: IreneAPI provides essential payment functionalities, including card payments, transaction management, and payment authentication, with a focus on security and ease of use.
  2. JWT Authentication: To ensure safe and authorized access, IreneAPI incorporates JSON Web Token (JWT) authentication, ensuring that all payment-related actions are restricted to authenticated users. Plans for implementing refresh tokens further enhance security by efficiently managing token expiration.
  3. Layered Architecture: The API is structured using a 3-tier architecture (Presentation, Business, Data layers), making the system scalable, maintainable, and easy to extend.
  4. Entity Framework Integration: Built with Entity Framework Core, the API uses MySQL for efficient database management and operations, providing seamless data handling and storage for payments and transactions.
  5. RESTful API Design: IreneAPI follows RESTful principles, offering standardized and predictable endpoints for integration with other applications. The API is also easy to consume for web and mobile clients.
  6. Robust Error Handling: Designed with fault tolerance in mind, IreneAPI gracefully handles errors, ensuring that failures do not compromise the overall system functionality.
  7. Hackathon-Driven Development: Originally developed as part of the Concordia University Hackathon, the project aims to balance speed and innovation with strong architectural principles, providing a complex and reliable payment solution.
  8. Extended User Roles and Permissions: To enhance system security, IreneAPI plans to integrate custom user roles with permissions tailored for different levels of access (e.g., Admin, Merchant, Customer).
  • Tech Stack:
  1. Languages/Frameworks: C#, .NET 6, ASP.NET Core
  2. Database: MySQL with Pomelo.EntityFrameworkCore.MySql
  3. Authentication: Microsoft.AspNetCore.Authentication.JwtBearer, System.IdentityModel.Tokens.Jwt
  4. Design Pattern: 3-Tier Architecture
  5. Tools: GitHub for version control, Visual Studio Code (VSCode), Git Bash for terminal operations
  • Planned Features:
  1. Real-time Transaction Monitoring: Implementation of real-time updates and notifications for successful or failed transactions.

  2. Mobile Integration: Future versions will focus on seamless mobile integration, providing SDKs for iOS and Android platforms to extend its reach beyond web-based applications.

  • Use Cases:
  1. Small to medium-sized businesses looking for a customizable payment gateway solution.
  2. Developers seeking a reliable API for integrating payment functionalities into their web or mobile applications.
  3. FinTech startups in need of a scalable, secure, and easy-to-use payment processing engine.
  4. IreneAPI is continually evolving, with a focus on providing developers with the tools they need to
  5. implement secure and efficient payment systems. Whether you're building an e-commerce platform or a subscription-based service, IreneAPI can power your transactions with minimal effort and maximum security.

Project Architecture

The project follows a Layered (3-tier) Architecture pattern, which facilitates separation of concerns and improves scalability. The main components of the project are described below:

  • Presentation Layer: Implements the API endpoints, handling HTTP requests and responses. This layer interacts with the client and communicates with the business logic layer.

  • Business Logic Layer: Contains the core business logic and validation. It processes data coming from the presentation layer and interacts with the data access layer to perform CRUD operations.

  • Data Access Layer: Represents the database entities and handles all interactions with the MySQL database using Entity Framework Core. This layer abstracts the database logic from the other layers.

Project Structure

IreneAPI/ │ ├── Controllers/ # API Controllers for handling requests | ├── Models/ # Database entities and DTOs | ├── Services/ #Business logic implementation | ├── Repositories/ # Data access layer implementation | ├── Data/ # Database context and migrations ├── wwwroot/ # Static files (if any) | ├── appSettings.json # Configuration file for connection strings and JWT settings | ├── README.md # Documentation of the project └── Program.cs # Main entry point of the application

API Endpoints

* GET http://localhost:5000/api/payments/
* GET http://localhost:5000/api/payments/{id}
* POST http://localhost:5000/api/payments
* PUT http://localhost:5000/api/payments{id}
* DELETE http://localhost:5000/api/payments/{id}

Optional Query String Parameters for GET Requests

Example Queries

  1. The following query will return all payments with a firstname value of Dynasty i.e search for all payments that are Dynasty's:
GET http:localhost:5000/api/payments?firstname=Dynasty
  1. The following query will return all payments with the lastname Matilda:
GET http:localhost:5000/api/payments?lastname=matilda
  1. The following query will return all payments that exceed a $1000 amount:
    GET http:localhost:5000/api/payments?minimum=1000
  1. Its possible to combine multiple queries with &. The following query will return all payments with specie Dynasty, that exceed a $1000 amount:
    GET http:localhost/5000/api/payments?name=Dynasty&minimum=1000

Additional Requirement when making a POST request

  • When making a POST request to http://localhost:5000/api/payments/ you need to include a body. Please do not add in the id when making a POST i.e when creating an animal, the database will help out with that. Here is an example body in JSON:
{
  "lastname": "Tyrannosaurus Rex",
  "firstname": "Elizabeth",
  "amount": 1000
}

Additional Requirement when making a PUT request

  • When making a PUT request to http://localhost:5000/api/payments/{id} you need to include a body that includes the paymentId property. A PUT request is to edit, please add in the id of the animal that you want to edit.Here's an example body in JSON:
{
  "paymentId": 1,
  "lastname": "Tyrannosaurus Rex",
  "firstname": "Elizabeth",
  "amount": 1000
}

Do not include $ to your amount, the application already did that for you And here is the PUT request we would send the previous body to:

    http://localhost:5000/api/payments/1

Notice that the value of paymentId needs to match the id number in the URL in this example, they are both 1

Setup/Installation

  1. Clone the Repository: Open your Git Bash terminal and run the following command to clone the project:

    git clone _REPOSITORY_NAME_
  2. Install .NET 6.0 Framework: Ensure you have the .NET 6.0 Framework installed (used .NET 6.0.402 for this application) on your PC. Make sure you have completed the essential steps to write C# code in the C# REPL Terminal.

  3. Create appSettings.json: After cloning the repository, you need to create an appSettings.json file in the root directory of the project. Be sure to create it in the production directory of your project (IreneAPI.Solution/IreneAPI/appSettings.json). Use the following template for your appSettings.json:

    {
      "ConnectionStrings": {
        "DefaultConnection": "Server=localhost;Port=3306;database=irene_api;uid=[YOUR-USERNAME-HERE];pwd=[YOUR-PASSWORD-HERE];"
      }
    }

    Replace [YOUR-USERNAME-HERE] and [YOUR-PASSWORD-HERE] with your actual MySQL username and password.

  4. Build and Run the Application:

    • If you're not interested in seeing the build messages, run the following command to build and run the application:

      dotnet run

      This command builds and runs the application for you.

    • If you are interested in seeing the build messages, follow these steps:

      1. Build the Project: Run the following command to build the project and add the essential directories to execute the application:

        dotnet build
      2. Run the Project: After building the application, run the following command to see all of the results outputted into the console:

        dotnet run

        Copy the link where the project is hosted on git bash or nay other terminal window you are use and paste the link in a browser

      3. Run the Project with watch run: This is the one we really recommend because it opens up the Swagger UI on your default browser, and there you can carry out all the API requests that have been defined inside the controller. Run the code below:

          dotnet watch run

      With the watch run, developers are able to simultaneously update the application's code and also build the project.

Detected Bugs/ Issues

  • No detected bugs

License

Licensed under the GNU General Public License

Contact Info

  • Email: emzzyoluwole@gmail.com
  • Instagram @Emmanuel.9944
  • Twitter: @Emzzy241 and Profile Name: Dynasty
  • Github Username: Emzzy241

About

A Payment API for processing payments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages