acquire-core-x/README.md

79 lines
2.3 KiB
Markdown

# proj-acquirex - Card Acquisition Approval System
## Spring Boot 3 Migration
### Migration Summary
| Component | Before (SB 2.x) | After (SB 3.x) |
|-----------|-----------------|----------------|
| Java Version | 8/11 | 17 |
| EE Namespace | `javax.*` | `jakarta.*` |
| Validation | javax.validation | jakarta.validation |
| Spring Boot | 2.7.x | 3.2.5 |
### Migration Scope
- **CardAcquisitionApprovalService**: Core approval business logic
- **CardAcquisitionApprovalController**: REST API endpoint (`/api/v1/approvals`)
- **ApprovalRequest/ApprovalResponse**: DTOs with Jakarta Validation
- **Domain entities**: CardAcquisitionApproval, ApprovalStatus
### Key Changes
1. **Package Migration**: All `javax.*` imports replaced with `jakarta.*`
2. **Validation Annotations**: `@NotNull`, `@NotBlank`, `@DecimalMin` use `jakarta.validation`
3. **Java 17 Features**: Switch expressions, records-ready structure
### Verification Procedures
```bash
# Build and test
mvn clean verify
# Run application
mvn spring-boot:run
# Test endpoint
curl -X POST http://localhost:8080/api/v1/approvals \
-H "Content-Type: application/json" \
-d '{"requestId":"REQ-001","cardNumber":"4111111111111111","merchantId":"MERCHANT-001","amount":100.00}'
```
### Test Coverage (15 tests)
| Category | Tests | Description |
|----------|-------|-------------|
| Service: processApproval | 3 | Approval, pending, rejection logic |
| Service: validateRequest | 2 | Card number, merchant ID validation |
| Service: determineApprovalStatus | 3 | Status determination by amount |
| Service: maskCardNumber | 3 | Card number masking |
| Controller | 4 | HTTP 200/202/400 responses |
### API Specification
**POST /api/v1/approvals**
Request:
```json
{"requestId":"REQ-001","cardNumber":"4111111111111111","merchantId":"MERCHANT-001","amount":100.00}
```
Response (200 OK):
```json
{"id":1,"requestId":"REQ-001","status":"APPROVED","amount":100.00,"processedAt":"...","message":"Card acquisition approved successfully"}
```
### Dependencies
| Dependency | Version | Purpose |
|------------|---------|---------|
| spring-boot-starter-web | 3.2.5 | REST API |
| spring-boot-starter-validation | 3.2.5 | Jakarta Validation |
| spring-boot-starter-test | 3.2.5 | JUnit 5, Mockito |
### Build Status
- Java 17 required
- Spring Boot 3.2.5
- Jakarta EE 9+ compatible
- All 15 tests passing