카드 매입 승인 경로 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
ed60901b36
commit
52468c0679
1 changed files with 90 additions and 0 deletions
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.acquirex.approval.domain;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Positive;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "approval_requests")
|
||||||
|
public class ApprovalRequest {
|
||||||
|
|
||||||
|
public enum ApprovalStatus {
|
||||||
|
PENDING, APPROVED, DECLINED, CANCELLED, ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Column(name = "card_number", length = 19)
|
||||||
|
private String cardNumber;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Column(name = "merchant_id", length = 15)
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Positive
|
||||||
|
@Column(name = "amount", precision = 15, scale = 2)
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@Column(name = "currency", length = 3)
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(name = "status", length = 20)
|
||||||
|
private ApprovalStatus status;
|
||||||
|
|
||||||
|
@Column(name = "approval_code", length = 10)
|
||||||
|
private String approvalCode;
|
||||||
|
|
||||||
|
@Column(name = "created_at")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Column(name = "updated_at")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
public ApprovalRequest() {}
|
||||||
|
|
||||||
|
public ApprovalRequest(String cardNumber, String merchantId, BigDecimal amount, String currency) {
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
this.amount = amount;
|
||||||
|
this.currency = currency;
|
||||||
|
this.status = ApprovalStatus.PENDING;
|
||||||
|
this.createdAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() {
|
||||||
|
createdAt = LocalDateTime.now();
|
||||||
|
updatedAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreUpdate
|
||||||
|
protected void onUpdate() {
|
||||||
|
updatedAt = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String getCurrency() { return currency; }
|
||||||
|
public void setCurrency(String currency) { this.currency = currency; }
|
||||||
|
public ApprovalStatus getStatus() { return status; }
|
||||||
|
public void setStatus(ApprovalStatus status) { this.status = status; }
|
||||||
|
public String getApprovalCode() { return approvalCode; }
|
||||||
|
public void setApprovalCode(String approvalCode) { this.approvalCode = approvalCode; }
|
||||||
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||||
|
public LocalDateTime getUpdatedAt() { return updatedAt; }
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue