Compare commits

..

6 commits

6 changed files with 42 additions and 35 deletions

View file

@ -0,0 +1,3 @@
# SPRING-ARC-REFERENCE-1783832425-attempt-2
Forge 이슈 작업 브랜치 `forge/SPRING-ARC-REFERENCE-1783832425-attempt-2`.

View file

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

View file

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

View file

@ -0,0 +1,15 @@
# Architecture Decision Record: Payment Boundary
## Context
In the context of transitioning to a new payment system, we need to define clear boundaries within our architecture to ensure proper integration and maintainability. This decision will outline the approach we take to isolate the payment processing components from other parts of the application.
## Decision
We decide to encapsulate all payment-related operations within a dedicated Payment Service. This service will handle transactions, manage payment methods, and interact with third-party payment gateways. The service will expose a RESTful API to other services that require payment processing.
## Alternatives
1. **Integrate payment processing directly within existing services**: This would lead to tightly coupled code with potential for increased complexity and difficulty in maintenance.
2. **Use a microservices approach for every payment operation**: While this increases modularity, it may also introduce excessive complexity and communication overhead between services.
## Consequences
- **Pros**: Clear boundaries will improve maintainability, making it easier to reason about the payment process as a distinct component. This separation allows for independent scaling and potential future integration with different payment systems.
- **Cons**: Requires an initial investment in creating the boundary and service infrastructure, potentially increasing the upfront complexity during the migration phase.

View file

@ -1,9 +1,10 @@
# Package Responsibility and Forbidden Dependencies
# 패키지 책임 및 금지 의존성 매핑
| 패키지 | 책임 | 금지 의존성 |
| -------------- | ------------------------------- | ------------------------------ |
| controller | HTTP 요청 및 응답 처리 | service |
| service | 비즈니스 로직 처리 및 유효성 검사| repository |
| repository | 데이터베이스와의 상호작용 | integration |
| domain | 도메인 객체와 비즈니스 규칙 | controller, integration |
| integration | 외부 시스템과의 통합 | service |
| Package | Responsibility | Forbidden Dependencies |
|------------------|------------------------------------------------------|--------------------------|
| controller | Handle user requests, validate inputs, and respond | domain |
| service | Contain business logic and orchestration | repository |
| repository | Manage data access and persistence | service |
| domain | Define core business models and rules | integration |
| integration | Interface with external systems (e.g. payment gateways) | domain, service |

View file

@ -7,35 +7,29 @@ sequenceDiagram
%% 정상 흐름
User->>PaymentService: 결제 요청
PaymentService->>Database: 거래 데이터 저장
Database-->>PaymentService: 저장 완료
PaymentService->>PaymentGateway: 결제 요청
PaymentGateway-->>PaymentService: 결제 성공
PaymentService->>Database: 거래 완료 상태 업데이트
Database-->>PaymentService: 상태 업데이트 완료
PaymentService-->>User: 결제 성공 응답
PaymentGateway-->>PaymentService: 결제 결과
PaymentService->>Database: 거래 정보 저장
Database-->>PaymentService: 저장 확인
%% 외부 실패 흐름
User->>PaymentService: 결제 요청
PaymentService->>Database: 거래 데이터 저장
Database-->>PaymentService: 저장 완료
PaymentService->>PaymentGateway: 결제 요청
PaymentGateway-->>PaymentService: 결제 실패
PaymentService->>Database: 거래 실패 상태 업데이트
Database-->>PaymentService: 상태 업데이트 완료
PaymentService-->>User: 결제 실패 응답
PaymentService->>User: 오류 메시지 전송
%% DB 실패 흐름
User->>PaymentService: 결제 요청
PaymentService->>Database: 거래 데이터 저장
Database-->>PaymentService: 저장 실패
PaymentService-->>User: 결제 실패 응답
PaymentService->>PaymentGateway: 결제 요청
PaymentGateway-->>PaymentService: 결제 결과
PaymentService->>Database: 거래 정보 저장
Database-->>PaymentService: 저장 오류
PaymentService->>User: 오류 메시지 전송
%% commit 흐름
PaymentService->>Database: 커밋
Database-->>PaymentService: 커밋 완료
%% rollback 흐름
PaymentService->>Database: 롤백
Database-->>PaymentService: 롤백 완료
%% commit과 rollback 경계
PaymentService->>Database: 거래 정보 커밋
PaymentGateway-->>PaymentService: 결제 완료
activate PaymentService
PaymentService-->>Database: 롤백 요청
deactivate PaymentService
```