카드 매입 승인 경로 Spring Boot 3 전환 #2
1 changed files with 82 additions and 0 deletions
82
src/main/java/com/acquirex/approval/dto/DtoClasses.java
Normal file
82
src/main/java/com/acquirex/approval/dto/DtoClasses.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
package com.acquirex.approval.dto;
|
||||
|
||||
import com.acquirex.approval.domain.ApprovalStatus;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* DTO for card acquisition approval request.
|
||||
* Uses Jakarta Validation annotations (Spring Boot 3 requirement).
|
||||
*/
|
||||
public class ApprovalRequest {
|
||||
@NotBlank(message = "Request ID is required")
|
||||
private String requestId;
|
||||
|
||||
@NotBlank(message = "Card number is required")
|
||||
private String cardNumber;
|
||||
|
||||
@NotBlank(message = "Merchant ID is required")
|
||||
private String merchantId;
|
||||
|
||||
@NotNull(message = "Amount is required")
|
||||
@DecimalMin(value = "0.01", message = "Amount must be greater than zero")
|
||||
private BigDecimal amount;
|
||||
|
||||
public ApprovalRequest() {}
|
||||
|
||||
public ApprovalRequest(String requestId, String cardNumber, String merchantId, BigDecimal amount) {
|
||||
this.requestId = requestId;
|
||||
this.cardNumber = cardNumber;
|
||||
this.merchantId = merchantId;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getRequestId() { return requestId; }
|
||||
public void setRequestId(String requestId) { this.requestId = requestId; }
|
||||
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; }
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO for card acquisition approval response.
|
||||
*/
|
||||
class ApprovalResponse {
|
||||
private Long id;
|
||||
private String requestId;
|
||||
private ApprovalStatus status;
|
||||
private BigDecimal amount;
|
||||
private LocalDateTime processedAt;
|
||||
private String message;
|
||||
|
||||
public ApprovalResponse() {}
|
||||
|
||||
public ApprovalResponse(Long id, String requestId, ApprovalStatus status,
|
||||
BigDecimal amount, LocalDateTime processedAt, String message) {
|
||||
this.id = id;
|
||||
this.requestId = requestId;
|
||||
this.status = status;
|
||||
this.amount = amount;
|
||||
this.processedAt = processedAt;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
public String getRequestId() { return requestId; }
|
||||
public void setRequestId(String requestId) { this.requestId = requestId; }
|
||||
public ApprovalStatus getStatus() { return status; }
|
||||
public void setStatus(ApprovalStatus status) { this.status = status; }
|
||||
public BigDecimal getAmount() { return amount; }
|
||||
public void setAmount(BigDecimal amount) { this.amount = amount; }
|
||||
public LocalDateTime getProcessedAt() { return processedAt; }
|
||||
public void setProcessedAt(LocalDateTime processedAt) { this.processedAt = processedAt; }
|
||||
public String getMessage() { return message; }
|
||||
public void setMessage(String message) { this.message = message; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue