Skip to content

A spring application that generates the invoice for the products purchased.

License

Notifications You must be signed in to change notification settings

nevinmathew/Invoice-system-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

Invoice System

The Invoice System is a Java-based Spring Boot application designed to manage and generate invoices for products bought by users. It utilizes CockroachDB for database management, Redis for caching, and integrates GraphQL for querying data.

Table of Contents

  1. Languages and Tools
  2. Dependencies
  3. Configuration
  4. License

Languages and Tools:

java

spring cockroachdb graphql redis docker

Dependencies

  • Spring Boot
  • CockroachDB
  • Redis
  • GraphQL
  • Lombok
  • OpenPDF

CockroachDB:

Click here to install CockroachDB.

Open powershell and run the following command -

C:\Users\Admin\Downloads> cockroach start-single-node --insecure `
>> --listen-addr=localhost:26257 `
>> --http-addr=localhost:8080

Redis:

Install WSL, enable the necessary features, and restart the system.

Install Ubuntu distros for windows.

Launch Ubuntu and install the Redis server

Run the following command to run redis server:

redis-server

Run redis-cli and run the command ‘ping’. If you get the response ’pong’ then redis is running.

Click here to install RedisInsight in your windows system to view the data in Redis.

GraphQL:

Url: http://localhost:8080/api/graphql

The GraphQL queries for the APIs in the application:

{
    getAllInvoices
    {
        products{
            id
            name
            price
            quantity
            totalPrice
            transactionId
        }
        paymentStatus
        amount
    }
}
{
    getInvoice(id: "3f31fda3-9e28-4798-8766-2b6e40634dcb")
    {
        products{
            id
            name
            price
            quantity
            totalPrice
            transactionId
        }
        paymentStatus
        amount
    }
}
mutation{
    saveInvoice(prods: [{name:" ",price: 14.0,quantity:4,totalPrice: null,transactionId: id"}],payment: true)
    {
        id
        products{
            id
            name
            price
            quantity
            totalPrice
            transactionId
        }
        createdDate
        createdTime
        paymentStatus
        amount
    }
}
mutation{
    updateInvoice(prods: [{id:"id",name:" ",price: 14.0,quantity:4,totalPrice: 56.0,transactionId: "id"}],id: "id",payment: true)
    {
        id
        products{
            id
            name
            price
            quantity
            totalPrice
            transactionId
        }
        createdDate
        createdTime
        paymentStatus
        amount
    }
}
mutation{
    deleteInvoice(id: "d4ce58dc-bd3d-4205-b929-43b1835498e4")
}

Docker Setup:

The project includes Dockerfiles and a docker-compose.yml file for easy deployment using Docker. Follow the steps in the Docker Setup section above.

To download the images from the docker repository:

docker pull nevin1m/invoice-system -a

Lombok

Lombok is a Java library that helps to reduce boilerplate code in your Spring Boot application. It provides a set of annotations that automatically generate common code during compilation, making your code more concise and readable. Start using Lombok annotations in your code to reduce verbosity and improve code readability.

Key Features

  1. @Getter and @Setter: Automatically generate getter and setter methods for your classes.

  2. @NoArgsConstructor, @AllArgsConstructor, and @RequiredArgsConstructor: Generate constructors without the need for boilerplate code.

  3. @EqualsAndHashCode: Automatically generate equals and hashCode methods based on the fields of your class.

  4. @ToString: Automatically generate a meaningful toString method.

To integrate Lombok into your project, add the Lombok dependency to your build configuration.

OpenPDF

The Invoice System leverages OpenPDF, an open-source PDF generation library for Java, to dynamically create and manage PDF documents. OpenPDF simplifies the process of generating professional-looking invoices.

Key Features:

  • Text Formatting: Precise control over text formatting ensures polished and professional PDF content.

  • Image Embedding: Supports embedding images into PDFs, facilitating the inclusion of logos and graphical elements.

  • Page Manipulation: Functionality for manipulating pages enhances organization and structure within generated documents.

Integration in Invoice System:

OpenPDF seamlessly integrates with the Spring Boot application, enhancing user experience by delivering well-designed and visually appealing invoices.

Configuration

application.properties: Configure database connections, GraphQL, and other application properties.

License

This project is licensed under the MPL License - see the LICENSE.md file for details.

About

A spring application that generates the invoice for the products purchased.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published