Skip to content

MamangRust/example-payment-gateway-springboot-new

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payment Gateway API

An API for a payment gateway system built using Java and Spring Boot. This project provides the backend functionality to manage users, merchants, transactions, balances, and more.

Features

  • Authentication: User registration and login using JWT.
  • User & Role Management: Manage users and their access rights.
  • Merchant Management: Create and manage merchant accounts.
  • Card Management: Add and manage user payment cards.
  • Balance Management: View and manage user balances.
  • Transactions: Make payments to merchants.
  • Top-up: Add funds to an account.
  • Transfer: Transfer funds between users.
  • Withdraw: Withdraw funds from an account.

Technologies Used

  • Java 21: The primary programming language.
  • Spring Boot: Framework for building the application.
  • Spring Security & JWT: For authentication and authorization.
  • Spring Data JPA: For database interaction.
  • PostgreSQL: Database management system.
  • Maven: Dependency management and build tool.
  • Springdoc OpenAPI (Swagger): For API documentation.

How to Run the Project

Prerequisites

  • Java Development Kit (JDK) 21 or higher.
  • Maven.
  • PostgreSQL.

Installation & Running

  1. Clone this repository:

    git clone https://github.com/MamangRust/example-payment-gateway-springboot-new.git
    
    cd example-payment-gateway-springboot-new
  2. Database Configuration: Open src/main/resources/application.properties and adjust your PostgreSQL database configuration.

    spring.datasource.url=jdbc:postgresql://localhost:5432/example-payment-gateway-springboot-new
    spring.datasource.username=postgres
    spring.datasource.password=postgres
    spring.jpa.hibernate.ddl-auto=update
  3. Build and run the application using the Maven Wrapper: For Linux/Mac:

    ./mvnw spring-boot:run

    For Windows:

    mvnw.cmd spring-boot:run
  4. The application will be running at http://localhost:8080.

API Documentation

Once the application is running, the interactive API documentation (Swagger UI) can be accessed at: http://localhost:8080/swagger-ui.html

Through the Swagger UI, you can see all available endpoints, data models, and try them out directly.

Preview

ERD

erDiagram
    %% Users, Roles, UserRoles
    USERS {
        Long user_id PK
        String username
        String firstname
        String lastname
        String email
        String password
    }

    ROLES {
        Long role_id PK
        String role_name
    }

    USER_ROLES {
        Long user_role_id PK
        Long user_id FK
        Long role_id FK
    }

    USERS ||--o{ USER_ROLES : has
    ROLES ||--o{ USER_ROLES : has
    USERS ||--o{ ROLES : many_to_many

    %% Refresh Tokens
    REFRESH_TOKENS {
        Long refresh_token_id PK
        Long user_id FK
        String token
        Timestamp expiration
    }

    USERS ||--o{ REFRESH_TOKENS : has

    %% Cards
    CARDS {
        Long card_id PK
        Long user_id FK
        String card_number
        String card_type
        Date expire_date
        String cvv
        String card_provider
    }

    USERS ||--o{ CARDS : has

    %% Merchants
    MERCHANTS {
        Long merchant_id PK
        UUID merchant_no
        String name
        String api_key
        Integer user_id FK
        Status status
    }

    USERS ||--o{ MERCHANTS : owns

    %% Saldo
    SALDOS {
        Long saldo_id PK
        String card_number
        Integer total_balance
        Integer withdraw_amount
        Timestamp withdraw_time
    }

    CARDS ||--o{ SALDOS : has

    %% Topups
    TOPUPS {
        Long topup_id PK
        UUID topup_no
        String card_number FK
        Integer topup_amount
        String topup_method
        Timestamp topup_time
        Status status
    }

    CARDS ||--o{ TOPUPS : has

    %% Withdraws
    WITHDRAWS {
        Long withdraw_id PK
        UUID withdraw_no
        String card_number FK
        Integer withdraw_amount
        Timestamp withdraw_time
        Status status
    }

    CARDS ||--o{ WITHDRAWS : has

    %% Transfers
    TRANSFERS {
        Long transfer_id PK
        UUID transfer_no
        String transfer_from
        String transfer_to
        Integer transfer_amount
        Timestamp transfer_time
        Status status
    }

    %% Transactions
    TRANSACTIONS {
        Long transaction_id PK
        UUID transaction_no
        String card_number FK
        Integer amount
        String payment_method
        Integer merchant_id FK
        Timestamp transaction_time
        Status status
    }

    CARDS ||--o{ TRANSACTIONS : made
    MERCHANTS ||--o{ TRANSACTIONS : receives
Loading

ApiDoc

apidoc

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages