카드 매입 승인 경로 Spring Boot 3 전환 (ACX-E2E-1785394564819)
Some checks are pending
Verify / source-contract (push) Waiting to run
Some checks are pending
Verify / source-contract (push) Waiting to run
This commit is contained in:
parent
469d153f80
commit
851f7c1658
1 changed files with 94 additions and 0 deletions
94
src/main/java/com/acquirex/approval/CardAcquisition.java
Normal file
94
src/main/java/com/acquirex/approval/CardAcquisition.java
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.acquirex.approval;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 카드 매입 도메인 엔티티.
|
||||||
|
* Spring Boot 3 전환: javax.persistence → jakarta.persistence
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "card_acquisitions")
|
||||||
|
public class CardAcquisition {
|
||||||
|
|
||||||
|
public enum ApprovalStatus {
|
||||||
|
PENDING, APPROVED, REJECTED, CANCELLED
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "card_number", nullable = false, length = 20)
|
||||||
|
private String cardNumber;
|
||||||
|
|
||||||
|
@Column(name = "merchant_id", nullable = false, length = 20)
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
@Column(name = "amount", nullable = false, precision = 15, scale = 2)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "status", nullable = false, length = 20)
|
||||||
|
private ApprovalStatus status = ApprovalStatus.PENDING;
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Column(name = "updated_at")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Column(name = "approved_by", length = 100)
|
||||||
|
private String approvedBy;
|
||||||
|
|
||||||
|
@Column(name = "rejection_reason", length = 500)
|
||||||
|
private String rejectionReason;
|
||||||
|
|
||||||
|
public CardAcquisition() {
|
||||||
|
this.createdAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CardAcquisition(String cardNumber, String merchantId, BigDecimal amount) {
|
||||||
|
this();
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() { return id; }
|
||||||
|
public void setId(Long id) { this.id = id; }
|
||||||
|
public String getCardNumber() { return cardNumber; }
|
||||||
|
public void setCardNumber(String cardNumber) { this.cardNumber = cardNumber; }
|
||||||
|
public String getMerchantId() { return merchantId; }
|
||||||
|
public void setMerchantId(String merchantId) { this.merchantId = merchantId; }
|
||||||
|
public BigDecimal getAmount() { return amount; }
|
||||||
|
public void setAmount(BigDecimal amount) { this.amount = amount; }
|
||||||
|
public ApprovalStatus getStatus() { return status; }
|
||||||
|
public void setStatus(ApprovalStatus status) { this.status = status; }
|
||||||
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||||
|
public LocalDateTime getUpdatedAt() { return updatedAt; }
|
||||||
|
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
|
||||||
|
public String getApprovedBy() { return approvedBy; }
|
||||||
|
public void setApprovedBy(String approvedBy) { this.approvedBy = approvedBy; }
|
||||||
|
public String getRejectionReason() { return rejectionReason; }
|
||||||
|
public void setRejectionReason(String rejectionReason) { this.rejectionReason = rejectionReason; }
|
||||||
|
|
||||||
|
public void approve(String approver) {
|
||||||
|
this.status = ApprovalStatus.APPROVED;
|
||||||
|
this.approvedBy = approver;
|
||||||
|
this.updatedAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reject(String reason) {
|
||||||
|
this.status = ApprovalStatus.REJECTED;
|
||||||
|
this.rejectionReason = reason;
|
||||||
|
this.updatedAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancel() {
|
||||||
|
this.status = ApprovalStatus.CANCELLED;
|
||||||
|
this.updatedAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue