Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

💳 Spring Payment Processing System

A simple and modular Spring Framework-based payment processing application that demonstrates Dependency Injection (DI), loose coupling, and annotation-based configuration.


🚀 Features

  • ✅ Built using Spring Core (Annotations)

  • ✅ Demonstrates Dependency Injection (DI)

  • ✅ Supports multiple payment services:

    • Google Pay
    • Paytm
  • ✅ Clean architecture using interfaces

  • ✅ Easy to extend with new payment methods


🧱 Project Structure

com.nit
│
├── config
│   └── AppConfig.java
│
├── main
│   └── TestPaymentSystem.java
│
└── sbeans
    ├── PaymentService.java
    ├── PaymentProcessor.java
    ├── GooglePayService.java
    └── PaytmPaymentService.java

⚙️ Technologies Used

  • Java
  • Spring Framework (Core)
  • Annotation-based Configuration

📌 How It Works

  • Spring scans components using @ComponentScan
  • Payment services implement a common interface (PaymentService)
  • PaymentProcessor injects a specific implementation using @Qualifier
  • The main class initializes Spring container and triggers payment processing

🔑 Key Components

🔹 PaymentService (Interface)

Defines a contract for all payment implementations.

public interface PaymentService {
    public void pay(double amount);
}

🔹 GooglePayService

Implements payment using Google Pay


🔹 PaytmPaymentService

Implements payment using Paytm (currently active)


🔹 PaymentProcessor

Handles payment logic by delegating to the selected service.

@Autowired
@Qualifier("paytmPaymentService")
private PaymentService paymentService;

🔹 AppConfig

Spring configuration class enabling component scanning.


🔹 TestPaymentSystem

Main class used to run the application.

paymentProcessor.processPayment(154025);

▶️ How to Run

  1. Clone the repository:

    git clone https://github.com/your-username/payment-system.git
  2. Open the project in your IDE (Eclipse / IntelliJ)

  3. Run:

    TestPaymentSystem.java
    

🔄 Switching Payment Method

To change the payment service, update the qualifier in PaymentProcessor:

@Qualifier("googlePayService")

📈 Future Enhancements

  • Add more payment methods (PhonePe, Credit Card, etc.)
  • Convert to Spring Boot
  • Add REST APIs
  • Implement logging and validation
  • Add database integration

🤝 Contributing

Contributions are welcome! Feel free to fork the repo and submit pull requests.


📄 License

This project is open-source and free to use.


💡 Author

Developed using Java & Spring Framework 🚀

About

A lightweight Spring Core application that demonstrates dependency injection and loose coupling through a flexible payment processing system. It showcases how multiple payment services can be easily integrated and switched using annotations and interface-based design

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages