계정/정산 업무 규칙과 전환 불변식 추출 #3
1 changed files with 121 additions and 0 deletions
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.payman.account.migration.entity;
|
||||||
|
|
||||||
|
import com.payman.account.migration.entity.enums.SettlementStatus;
|
||||||
|
import com.payman.account.migration.entity.enums.DisputeStatus;
|
||||||
|
import com.payman.account.migration.entity.enums.PayoutStatus;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "settlements")
|
||||||
|
class Settlement {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private UUID id;
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(nullable = false)
|
||||||
|
private SettlementStatus status;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private BigDecimal amount;
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
@Column(name = "updated_at")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
@Column(name = "creator_id")
|
||||||
|
private UUID creatorId;
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() { createdAt = LocalDateTime.now(); }
|
||||||
|
@PreUpdate
|
||||||
|
protected void onUpdate() { updatedAt = LocalDateTime.now(); }
|
||||||
|
public UUID getId() { return id; }
|
||||||
|
public void setId(UUID id) { this.id = id; }
|
||||||
|
public SettlementStatus getStatus() { return status; }
|
||||||
|
public void setStatus(SettlementStatus status) { this.status = status; }
|
||||||
|
public BigDecimal getAmount() { return amount; }
|
||||||
|
public void setAmount(BigDecimal amount) { this.amount = amount; }
|
||||||
|
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 UUID getCreatorId() { return creatorId; }
|
||||||
|
public void setCreatorId(UUID creatorId) { this.creatorId = creatorId; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "disputes")
|
||||||
|
class Dispute {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private UUID id;
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(nullable = false)
|
||||||
|
private DisputeStatus status;
|
||||||
|
@Column(name = "settlement_id", nullable = false)
|
||||||
|
private UUID settlementId;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private BigDecimal amount;
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
@Column(name = "response_deadline")
|
||||||
|
private LocalDateTime responseDeadline;
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() {
|
||||||
|
createdAt = LocalDateTime.now();
|
||||||
|
responseDeadline = createdAt.plusDays(7);
|
||||||
|
}
|
||||||
|
public UUID getId() { return id; }
|
||||||
|
public void setId(UUID id) { this.id = id; }
|
||||||
|
public DisputeStatus getStatus() { return status; }
|
||||||
|
public void setStatus(DisputeStatus status) { this.status = status; }
|
||||||
|
public UUID getSettlementId() { return settlementId; }
|
||||||
|
public void setSettlementId(UUID settlementId) { this.settlementId = settlementId; }
|
||||||
|
public BigDecimal getAmount() { return amount; }
|
||||||
|
public void setAmount(BigDecimal amount) { this.amount = amount; }
|
||||||
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||||
|
public LocalDateTime getResponseDeadline() { return responseDeadline; }
|
||||||
|
public void setResponseDeadline(LocalDateTime responseDeadline) { this.responseDeadline = responseDeadline; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "payouts")
|
||||||
|
class Payout {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.UUID)
|
||||||
|
private UUID id;
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Column(nullable = false)
|
||||||
|
private PayoutStatus status;
|
||||||
|
@Column(name = "account_id", nullable = false)
|
||||||
|
private UUID accountId;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private BigDecimal amount;
|
||||||
|
@Column(name = "currency", nullable = false)
|
||||||
|
private String currency;
|
||||||
|
@Column(name = "bank_account_verified")
|
||||||
|
private boolean bankAccountVerified;
|
||||||
|
@Column(name = "kyc_status")
|
||||||
|
private String kycStatus;
|
||||||
|
@Column(name = "created_at", nullable = false)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() { createdAt = LocalDateTime.now(); }
|
||||||
|
public UUID getId() { return id; }
|
||||||
|
public void setId(UUID id) { this.id = id; }
|
||||||
|
public PayoutStatus getStatus() { return status; }
|
||||||
|
public void setStatus(PayoutStatus status) { this.status = status; }
|
||||||
|
public UUID getAccountId() { return accountId; }
|
||||||
|
public void setAccountId(UUID accountId) { this.accountId = accountId; }
|
||||||
|
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 boolean isBankAccountVerified() { return bankAccountVerified; }
|
||||||
|
public void setBankAccountVerified(boolean bankAccountVerified) { this.bankAccountVerified = bankAccountVerified; }
|
||||||
|
public String getKycStatus() { return kycStatus; }
|
||||||
|
public void setKycStatus(String kycStatus) { this.kycStatus = kycStatus; }
|
||||||
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue