From 33c469025df57d9c7eb0eab60e5dce0d012f15c5 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Thu, 30 Jul 2026 11:07:07 +0000 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=EB=93=9C=20=EB=A7=A4=EC=9E=85=20?= =?UTF-8?q?=EC=8A=B9=EC=9D=B8=20=EA=B2=BD=EB=A1=9C=20Spring=20Boot=203=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20(ACX-E2E-1785394564819)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/acquirex/dto/AcquisitionDto.java | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/main/java/com/acquirex/dto/AcquisitionDto.java diff --git a/src/main/java/com/acquirex/dto/AcquisitionDto.java b/src/main/java/com/acquirex/dto/AcquisitionDto.java new file mode 100644 index 0000000..4cf27a8 --- /dev/null +++ b/src/main/java/com/acquirex/dto/AcquisitionDto.java @@ -0,0 +1,88 @@ +package com.acquirex.dto; + +import jakarta.validation.constraints.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 카드 매입 요청/응답 DTO + * Spring Boot 3: javax.validation → jakarta.validation + */ +public class AcquisitionDto { + + // ========== Request DTO ========== + public static class Request { + @NotBlank(message = "카드번호는 필수입니다") + @Size(min = 13, max = 19, message = "카드번호 길이가 올바르지 않습니다") + private String cardNumber; + + @NotBlank(message = "가맹점ID는 필수입니다") + private String merchantId; + + @NotNull(message = "금액은 필수입니다") + @DecimalMin(value = "0.01", message = "금액은 0보다 커야 합니다") + @Digits(integer = 13, fraction = 2, message = "금액 형식이 올바르지 않습니다") + private BigDecimal amount; + + @NotBlank(message = "통화는 필수입니다") + @Size(min = 3, max = 3, message = "통화 코드는 3자리입니다") + private String currency; + + 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; } + } + + // ========== Response DTO ========== + public static class Response { + private Long id; + private String approvalCode; + private String status; + private String message; + private BigDecimal amount; + private String currency; + private LocalDateTime approvalTime; + + public Response() {} + + public static Response success(Long id, String approvalCode, BigDecimal amount, String currency) { + Response response = new Response(); + response.setId(id); + response.setApprovalCode(approvalCode); + response.setStatus("APPROVED"); + response.setMessage("매입 승인이 완료되었습니다"); + response.setAmount(amount); + response.setCurrency(currency); + response.setApprovalTime(LocalDateTime.now()); + return response; + } + + public static Response rejected(Long id, String reason) { + Response response = new Response(); + response.setId(id); + response.setStatus("REJECTED"); + response.setMessage(reason); + return response; + } + + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + public String getApprovalCode() { return approvalCode; } + public void setApprovalCode(String approvalCode) { this.approvalCode = approvalCode; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + 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 LocalDateTime getApprovalTime() { return approvalTime; } + public void setApprovalTime(LocalDateTime approvalTime) { this.approvalTime = approvalTime; } + } +} \ No newline at end of file