How psairam32/stayease-payment-service works
StayEase Payment Service owns the booking platform’s financial transaction lifecycle. A client or Booking Service request enters the payment API, which delegates payment operations to domain services; those services coordinate Razorpay, booking status, and persisted transaction state. Separate paths cover refunds, receipts/history, webhook callbacks, expiry, and audit. The README documents monitoring and resilient gateway capabilities. Source excerpts show controller delegation and Razorpay gateway calls; most implementations are unsampled, so internal service-to-storage and scheduled-job links are documented rather than inferred from names.
Main entry points: PaymentServiceImpl.java Payment operations · PaymentController.java Payment API · RefundServiceImpl.java Refund lifecycle · PaymentOrderRepository.java Payment repository
Components 23
API and security
- Payment API
src/main/java/com/stayease/payment_service/controller/PaymentController.java - Request security
src/main/java/com/stayease/payment_service/security - Error handling
src/main/java/com/stayease/payment_service/exception/GlobalExceptionHandler.java
Payment lifecycle
- Payment operations
src/main/java/com/stayease/payment_service/service/PaymentServiceImpl.java - Gateway order service
src/main/java/com/stayease/payment_service/service/RazorpayOrderServiceImpl.java - Payment verification
src/main/java/com/stayease/payment_service/service/RazorpayVerificationServiceImpl.java - Refund lifecycle
src/main/java/com/stayease/payment_service/service/RefundServiceImpl.java - Payment contracts
src/main/java/com/stayease/payment_service/dto
External integrations
- Booking gateway
src/main/java/com/stayease/payment_service/integrations/BookingServiceGateway.java - Booking client
src/main/java/com/stayease/payment_service/config/BookingServiceClient.java - Razorpay gateway
src/main/java/com/stayease/payment_service/integrations/RazorpayServiceGateway.java - Razorpay client
src/main/java/com/stayease/payment_service/config/RazorpayClient.java
Transaction state
- Payment records
src/main/java/com/stayease/payment_service/entity - Payment repository
src/main/java/com/stayease/payment_service/repository/PaymentOrderRepository.java - Refund repository
src/main/java/com/stayease/payment_service/repository/RefundTransactionRepository.java
Operations and audit
- Audit logging
src/main/java/com/stayease/payment_service/service/AuditService.java - Audit repository
src/main/java/com/stayease/payment_service/repository/AuditLogRepository.java - Payment expiry
src/main/java/com/stayease/payment_service/service/PaymentExpiryScheduler.java - Health and metrics
src/main/java/com/stayease/payment_service
Other components
- Client / Booking Service
- Razorpay API
- Booking Service
- MySQL
Connections 22
- Client / Booking Service → Payment API: calls
- Payment API → Payment operations: delegates
src/main/java/com/stayease/payment_service/controller/PaymentController.java - Payment API → Refund lifecycle: delegates
src/main/java/com/stayease/payment_service/controller/PaymentController.java - Payment operations → Gateway order service: creates orders
- Payment operations → Payment verification: verifies payments
- Payment operations → Booking gateway: coordinates bookings
- Refund lifecycle → Razorpay gateway: requests refunds
- Razorpay gateway → Razorpay client: calls
src/main/java/com/stayease/payment_service/integrations/RazorpayServiceGateway.java - Razorpay client → Razorpay API: requests
src/main/java/com/stayease/payment_service/config/RazorpayClient.java - Booking gateway → Booking client: uses client
- Booking client → Booking Service: updates bookings
src/main/java/com/stayease/payment_service/config/BookingServiceClient.java - Payment operations → Payment repository: persists payments
- Refund lifecycle → Refund repository: persists refunds
- Payment repository → Payment records: stores records
- Refund repository → Payment records: stores records
src/main/java/com/stayease/payment_service/repository/RefundTransactionRepository.java - Payment repository → MySQL: reads and writes
- Refund repository → MySQL: reads and writes
- Payment operations → Audit logging: records events
- Audit logging → Audit repository: saves logs
src/main/java/com/stayease/payment_service/service/AuditService.java - Audit repository → MySQL: stores logs
- Payment expiry → Payment operations: expires pending
- Request security → Payment API: protects requests