Compare commits

..

6 commits

6 changed files with 58 additions and 49 deletions

View file

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

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,28 @@
# Context
The goal of this architectural decision is to define the boundaries for the payment processing component within our application. This includes how it interacts with other components and external systems, as well as the responsibilities it holds in the system overall.
# Decision
The payment processing component will be isolated as a microservice that communicates with other parts of the application through a well-defined API. It will handle all operations related to payment processing, including but not limited to:
- Payment authorization
- Payment capture
- Payment refunds
This microservice will interact with external payment gateways and handle communication securely, ensuring compliance with payment standards and regulations.
# Alternatives
1. **Monolithic Payment Handling**
- Integrating payment processing directly into a monolithic application.
- ***Pros:*** Simplicity in deployment and potential performance gains.
- ***Cons:*** Difficult to maintain and scale, potential bottlenecks.
2. **Serverless Payment Functions**
- Using serverless functions to handle payment events.
- ***Pros:*** Scalability and reduced management overhead.
- ***Cons:*** Complexity in managing state and possibly higher latency.
# Consequences
- A clearly defined payment processing service allows for scalability and flexibility in handling various payment methods.
- The decision to isolate payments into a microservice compels adherence to the principles of microservices architecture, ensuring better maintainability and the ability to adopt alternative payment solutions in the future.
- Potentially increases initial complexity due to inter-service communication needs and requires thorough testing to ensure reliability.

View file

@ -1,9 +1,7 @@
# Package Responsibility and Forbidden Dependencies | 패키지 | 책임 | 금지 의존성 |
|------------|-----------------------------------------|--------------------|
| Package | Responsibility | Forbidden Dependencies | | controller | 사용자 요청을 처리하고 응답을 반환함 | service, repository |
|------------------|------------------------------------------------------|--------------------------| | service | 비즈니스 로직을 처리하고 트랜잭션을 관리함 | repository |
| controller | Handle user requests, validate inputs, and respond | domain | | repository | 데이터베이스와의 상호작용을 담당함 | domain |
| service | Contain business logic and orchestration | repository | | domain | 도메인 모델과 비즈니스 규칙을 정의함 | integration |
| repository | Manage data access and persistence | service | | integration | 외부 시스템과의 통신을 처리함 | domain |
| domain | Define core business models and rules | integration |
| integration | Interface with external systems (e.g. payment gateways) | domain, service |

View file

@ -1,41 +1,27 @@
```mermaid ```mermaid
sequenceDiagram sequenceDiagram
participant User participant User
participant PaymentService participant Controller
participant PaymentGateway participant Service
participant Database participant Repository
participant ExternalGateway
%% 정상 흐름 User->>Controller: 결제 요청
User->>PaymentService: 결제 요청 Controller->>Service: 결제 처리 요청
PaymentService->>Database: 거래 데이터 저장 Service->>Repository: 결제 정보 저장
Database-->>PaymentService: 저장 완료 Repository-->>Service: 저장 완료
PaymentService->>PaymentGateway: 결제 요청 Service->>ExternalGateway: 결제 요청
PaymentGateway-->>PaymentService: 결제 성공 ExternalGateway-->>Service: 결제 성공
PaymentService->>Database: 거래 완료 상태 업데이트 Service-->>Controller: 결제 완료
Database-->>PaymentService: 상태 업데이트 완료 Controller-->>User: 결제 성공 응답
PaymentService-->>User: 결제 성공 응답
%% 외부 실패 흐름 Note over Service: DB 실패 시
User->>PaymentService: 결제 요청 Service->>Repository: 롤백 요청
PaymentService->>Database: 거래 데이터 저장 Repository-->>Service: 롤백 완료
Database-->>PaymentService: 저장 완료 Service-->>Controller: 결제 실패
PaymentService->>PaymentGateway: 결제 요청 Controller-->>User: 결제 실패 응답
PaymentGateway-->>PaymentService: 결제 실패
PaymentService->>Database: 거래 실패 상태 업데이트
Database-->>PaymentService: 상태 업데이트 완료
PaymentService-->>User: 결제 실패 응답
%% DB 실패 흐름 Note over Service: 외부 실패 시
User->>PaymentService: 결제 요청 Service->>Controller: 결제 실패
PaymentService->>Database: 거래 데이터 저장 Controller-->>User: 결제 실패 응답
Database-->>PaymentService: 저장 실패
PaymentService-->>User: 결제 실패 응답
%% commit 흐름
PaymentService->>Database: 커밋
Database-->>PaymentService: 커밋 완료
%% rollback 흐름
PaymentService->>Database: 롤백
Database-->>PaymentService: 롤백 완료
``` ```