Compare commits

..

6 commits

6 changed files with 58 additions and 50 deletions

View file

@ -0,0 +1,3 @@
# SPRING-ARC-REF-FINAL-1783833422-attempt-1
Forge 이슈 작업 브랜치 `forge/SPRING-ARC-REF-FINAL-1783833422-attempt-1`.

View file

@ -1,3 +0,0 @@
# iss-5a912ed79baf-attempt-3
Forge 이슈 작업 브랜치 `forge/iss-5a912ed79baf-attempt-3`.

View file

@ -1,3 +0,0 @@
# iss-87190c9836ac-attempt-1
Forge 이슈 작업 브랜치 `forge/iss-87190c9836ac-attempt-1`.

View file

@ -0,0 +1,23 @@
# Architecture Decision Record for Payment Boundary
## Context
In the context of our ongoing project, we are focused on defining clear boundaries for the payment services. This is crucial to ensure that our architecture remains clean, modular, and maintainable. We need to outline the responsibilities and interactions of various components involved in payment processing.
## Decision
To establish a clear payment boundary, we will:
1. Define the payment service as a separate module.
2. Use REST APIs for communication between the payment service and other microservices.
3. Ensure that any sensitive operations, like payment processing, are encapsulated within the payment service and not exposed directly to clients.
4. Implement service-level security to protect payment information.
## Alternatives
- **Monolithic Approach**: Keeping all payment processing logic within a single application. This is easier to manage initially but leads to tight coupling.
- **Event-Driven Architecture**: Using a messaging system for inter-service communication. This would add complexity in terms of managing events and message reliability, but would result in a more decoupled system.
## Consequences
By defining clear boundaries for payment processing:
- We achieve separation of concerns, which improves maintainability.
- We can independently scale the payment service based on demand.
- Security risks are minimized as sensitive operations are isolated.
This decision will guide the development and integration efforts moving forward, especially when considering transaction management and error handling.

View file

@ -1,9 +1,7 @@
# Package Responsibility Map
| Package | Responsibility | Forbidden Dependencies |
|----------------|------------------------------------------------|------------------------|
| controller | Handles user input and orchestrates payment | domain |
| service | Contains business logic for payment processing | integration |
| repository | Data access layer for payment records | service |
| domain | Defines the core domain models and business rules| controller |
| integration | Communicates with external payment gateways | domain, service |
| 패키지 | 책임 | 금지 의존성 |
|------------|---------------------------------------|------------------|
| controller | 사용자 요청 처리 및 응답 반환 | domain, repository |
| service | 비즈니스 로직 처리 및 트랜잭션 관리 | repository |
| repository | 데이터베이스와의 상호작용 | domain |
| domain | 비즈니스 규칙 및 도메인 모델 정의 | integration |
| integration | 외부 시스템과의 통신 및 데이터 변환 | domain |

View file

@ -1,38 +1,28 @@
```mermaid
sequenceDiagram
participant User
participant PaymentService
participant PaymentGateway
participant Database
participant Controller
participant Service
participant Repository
participant ExternalGateway
%% Normal Flow
User->>PaymentService: Initiate Payment
PaymentService->>Database: Store Transaction
Database-->>PaymentService: Transaction Stored
PaymentService->>PaymentGateway: Process Payment
PaymentGateway-->>PaymentService: Payment Success
PaymentService->>Database: Update Transaction Status
Database-->>PaymentService: Transaction Updated
PaymentService-->>User: Payment Success
%% External Failure Flow
User->>PaymentService: Initiate Payment
PaymentService->>Database: Store Transaction
Database-->>PaymentService: Transaction Stored
PaymentService->>PaymentGateway: Process Payment
PaymentGateway-->>PaymentService: Payment Failure
PaymentService->>Database: Rollback Transaction
Database-->>PaymentService: Transaction Rolled Back
PaymentService-->>User: Payment Failure
%% DB Failure Flow
User->>PaymentService: Initiate Payment
PaymentService->>Database: Store Transaction
Database-->>PaymentService: Transaction Store Failure
PaymentService-->>User: Payment Failure
%% Commit & Rollback
Note over User, PaymentService:
commit --> PaymentService
rollback --> PaymentService
```
User->>Controller: 결제 요청
Controller->>Service: 결제 처리 요청
Service->>Repository: 트랜잭션 시작
Service->>ExternalGateway: 결제 요청
alt 결제 성공
ExternalGateway-->>Service: 결제 성공 응답
Service->>Repository: 트랜잭션 커밋
Repository-->>Service: 커밋 완료
Service-->>Controller: 결제 완료 응답
Controller-->>User: 결제 완료
else 외부 실패
ExternalGateway-->>Service: 결제 실패 응답
Service->>Repository: 트랜잭션 롤백
Repository-->>Service: 롤백 완료
Service-->>Controller: 결제 실패 응답
Controller-->>User: 결제 실패
else DB 실패
Service->>Repository: 트랜잭션 롤백
Repository-->>Service: 롤백 완료
Service-->>Controller: DB 오류 응답
Controller-->>User: DB 오류