Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#199, #198] 환불 API 작성, Payment 도메인 수정 #200

Merged
merged 29 commits into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c55af3b
refactor: PaymentSaveResponse -> PaymentPendingResponse 네이밍 변경, Payme…
Joyykim Jul 29, 2021
78efff0
feat: Payment 환불 도메인 로직 작성
Joyykim Jul 29, 2021
5bc76ae
feat: Payment 환불 컨트롤러,서비스 로직 작성
Joyykim Jul 29, 2021
dd89c27
feat: 환불API js코드예시 작성
Joyykim Jul 29, 2021
4f191a1
Merge branch 'develop-server' of https://github.com/woowacourse-teams…
Joyykim Jul 29, 2021
d0a756b
refactor: PaymentService#cancelPayment의 불필요한 로직 정리
Joyykim Jul 29, 2021
1f48d36
refactor: PaymentCancelRequest의 환불금액 필드 제거
Joyykim Jul 29, 2021
6e3d048
test: Payment 도메인 테스트 작성
Joyykim Jul 29, 2021
8b397ce
feat: Payment의 id 타입을 UUID로 변경
Joyykim Jul 29, 2021
6611c32
feat: Payment 관련 DTO의 merchantUid 타입을 UUID로 변경, 더이상 사용되지 않는 DonationR…
Joyykim Jul 29, 2021
e79a835
Merge branch 'develop-server' of https://github.com/woowacourse-teams…
Joyykim Jul 29, 2021
fe9121f
fix: request dto에서 UUID를 받지 못하는 이슈 해결
Joyykim Jul 29, 2021
8c57263
fix: PaymentNotFoundException 메시지/에러코드 수정, 사용되지 않는 PaymentRequestExce…
Joyykim Jul 30, 2021
6c4c108
refactor: IllegalPaymentInfoException 예외메시지 수정
Joyykim Jul 30, 2021
a3f1bcc
fix: 환불요청dto 유효성검사 실패시 PaymentCancelRequestException 발생하도록 변경
Joyykim Jul 30, 2021
b83ca46
test: Payment 컨트롤러 테스트케이스 추가
Joyykim Jul 30, 2021
049e8e1
refactor: convertToPaymentInfo 수정
Joyykim Jul 30, 2021
50f6f00
feat: Payment id타입 Long으로 변경, merchantUid UUID타입 컬럼 추가
Joyykim Jul 30, 2021
625bb3a
Merge branch 'develop-server' into feature/iamport-cancel-payment-api
DWL5 Jul 30, 2021
3847a07
Merge branch 'develop-server' of https://github.com/woowacourse-teams…
Joyykim Jul 30, 2021
2a674e2
Merge remote-tracking branch 'origin/feature/iamport-cancel-payment-a…
Joyykim Jul 30, 2021
155311f
style: 리포매팅
Joyykim Jul 30, 2021
a9ad935
refactor: PaymentRequest -> PaymentCompleteRequest 리네임
Joyykim Jul 30, 2021
8242c01
refactor: 사용되지 않는 클래스 제거
Joyykim Jul 30, 2021
2638b42
refactor: 환불요청 dto의 merchantUid 타입 UUID로 변경
Joyykim Jul 30, 2021
f31567f
feat: Payment의 merchantUid 컬럼 nullable=false 추가
Joyykim Jul 30, 2021
8e94396
feat: UUID 커스텀 Validator 생성, DTO의 merchantUid를 String타입으로 변경
Joyykim Jul 30, 2021
05a161b
refactor: 스네이크케이스 -> 카멜케이스로 변경
Joyykim Jul 31, 2021
49fcdac
feat: UUIDValidator null 검증 추가, 테스트작성
Joyykim Jul 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/securityKey
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.example.tyfserver.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.util.Base64;
import com.example.tyfserver.common.exception.S3FileNotFoundException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.example.tyfserver.donation.exception.DonationMessageRequestException;
import com.example.tyfserver.donation.exception.DonationRequestException;
import com.example.tyfserver.donation.service.DonationService;
import com.example.tyfserver.payment.dto.PaymentRequest;
import com.example.tyfserver.payment.dto.PaymentCompleteRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
Expand All @@ -25,11 +25,11 @@ public class DonationController {
private final DonationService donationService;

@PostMapping
public ResponseEntity<DonationResponse> createDonation(@Valid @RequestBody PaymentRequest paymentRequest, BindingResult result) {
public ResponseEntity<DonationResponse> createDonation(@Valid @RequestBody PaymentCompleteRequest paymentCompleteRequest, BindingResult result) {
if (result.hasErrors()) {
throw new DonationRequestException();
}
return ResponseEntity.status(HttpStatus.CREATED).body(donationService.createDonation(paymentRequest));
return ResponseEntity.status(HttpStatus.CREATED).body(donationService.createDonation(paymentCompleteRequest));
}

@PostMapping("/{donationId}/messages")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.example.tyfserver.member.exception.MemberNotFoundException;
import com.example.tyfserver.member.repository.MemberRepository;
import com.example.tyfserver.payment.domain.Payment;
import com.example.tyfserver.payment.dto.PaymentRequest;
import com.example.tyfserver.payment.dto.PaymentCompleteRequest;
import com.example.tyfserver.payment.service.PaymentService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
Expand All @@ -28,8 +28,8 @@ public class DonationService {
private final MemberRepository memberRepository;
private final PaymentService paymentService;

public DonationResponse createDonation(PaymentRequest paymentRequest) {
Payment payment = paymentService.completePayment(paymentRequest);
public DonationResponse createDonation(PaymentCompleteRequest paymentCompleteRequest) {
Payment payment = paymentService.completePayment(paymentCompleteRequest);
Donation donation = new Donation(payment);
Member member = memberRepository.findByPageName(payment.getPageName())
.orElseThrow(MemberNotFoundException::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.example.tyfserver.member.exception.PageNameValidationRequestException;
import com.example.tyfserver.member.service.MemberService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void updateNickName(LoginMember loginMember, String nickName) {

private Member findMember(Long id) {
return memberRepository.findById(id)
.orElseThrow(MemberNotFoundException::new);
.orElseThrow(MemberNotFoundException::new);
}

private void deleteProfile(Member member) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.example.tyfserver.payment.controller;

import com.example.tyfserver.payment.dto.PaymentSaveRequest;
import com.example.tyfserver.payment.dto.PaymentSaveResponse;
import com.example.tyfserver.payment.exception.PaymentRequestException;
import com.example.tyfserver.payment.exception.PaymentSaveRequestException;
import com.example.tyfserver.payment.dto.PaymentCancelRequest;
import com.example.tyfserver.payment.dto.PaymentCancelResponse;
import com.example.tyfserver.payment.dto.PaymentPendingRequest;
import com.example.tyfserver.payment.dto.PaymentPendingResponse;
import com.example.tyfserver.payment.exception.PaymentCancelRequestException;
import com.example.tyfserver.payment.exception.PaymentPendingRequestException;
import com.example.tyfserver.payment.service.PaymentService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand All @@ -23,13 +25,23 @@ public class PaymentController {
private final PaymentService paymentService;

@PostMapping
public ResponseEntity<PaymentSaveResponse> payment(@Valid @RequestBody PaymentSaveRequest paymentSaveRequest, BindingResult result) {
public ResponseEntity<PaymentPendingResponse> payment(@Valid @RequestBody PaymentPendingRequest paymentPendingRequest, BindingResult result) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PayementStatus에 Pending 상태로 저장되니까
PayemntPendingRequest 좋은것 같아!

if (result.hasErrors()) {
throw new PaymentPendingRequestException();
}

PaymentPendingResponse response = paymentService.createPayment(paymentPendingRequest);
return ResponseEntity.ok(response);
}

// todo 환불시 이메일 인증 필요
@PostMapping("/cancel")
public ResponseEntity<PaymentCancelResponse> cancelPayment(@Valid @RequestBody PaymentCancelRequest paymentCancelRequest, BindingResult result) {
if (result.hasErrors()) {
throw new PaymentSaveRequestException();
throw new PaymentCancelRequestException();
}

PaymentSaveResponse response = paymentService.createPayment(paymentSaveRequest);
PaymentCancelResponse response = paymentService.cancelPayment(paymentCancelRequest);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.example.tyfserver.common.domain.BaseTimeEntity;
import com.example.tyfserver.payment.exception.IllegalPaymentInfoException;
import com.example.tyfserver.payment.exception.PaymentRequestException;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.UUID;

import static com.example.tyfserver.payment.exception.PaymentRequestException.*;
import static com.example.tyfserver.payment.exception.IllegalPaymentInfoException.*;

@Entity
@Getter
Expand All @@ -33,15 +33,35 @@ public class Payment extends BaseTimeEntity {

private String impUid;

public Payment(Long id, Long amount, String email, String pageName) {
private UUID merchantUid;

@PrePersist
protected void onCreate() {
merchantUid = UUID.randomUUID();
}

public Payment(Long id, Long amount, String email, String pageName, UUID merchantUid) {
this.id = id;
this.amount = amount;
this.email = email;
this.pageName = pageName;
this.merchantUid = merchantUid;
}

public Payment(Long amount, String email, String pageName, UUID merchantUid) {
this(null, amount, email, pageName, merchantUid);
}

public Payment(Long id, Long amount, String email, String pageName) {
this(id, amount, email, pageName, null);
}

public Payment(Long amount, String email, String pageName) {
this(null, amount, email, pageName);
this(null, amount, email, pageName, null);
}

public void updateStatus(PaymentStatus paymentStatus) {
this.status = paymentStatus;
}

public void complete(PaymentInfo paymentInfo) {
Expand All @@ -50,21 +70,32 @@ public void complete(PaymentInfo paymentInfo) {
this.status = PaymentStatus.PAID;
}

public void updateStatus(PaymentStatus paymentStatus) {
this.status = paymentStatus;
}

private void validatePaymentComplete(PaymentInfo paymentInfo) {
if (!PaymentStatus.isPaid(paymentInfo.getStatus())) {
updateStatus(paymentInfo.getStatus());
throw IllegalPaymentInfoException.from(IllegalPaymentInfoException.ERROR_CODE_NOT_PAID, paymentInfo.getModule());
throw IllegalPaymentInfoException.from(ERROR_CODE_NOT_PAID, paymentInfo.getModule());
}

validatePaymentInfo(paymentInfo);
}

public void cancel(PaymentInfo paymentInfo) {
validatePaymentCancel(paymentInfo);
this.impUid = paymentInfo.getImpUid();
this.status = PaymentStatus.CANCELLED;
}
Comment on lines +83 to +87
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cancel 메서드 내부에서 호출되는 private 메서드 validatePaymentCancel이 cancel() 메서드보다 상단에 위치하는 것 같은데, 이 위치를 바꾸는게 어떨까?

관련자료: 클린코드5 형식 맞추기 - 종속 함수 부분

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엥 이미 하단인데? 혹시 커밋별로 보느라 옛날걸 보고있어서 그런건가!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이부분은 내가 이전껄 봤나봐 👀


private void validatePaymentCancel(PaymentInfo paymentInfo) {
if (!PaymentStatus.isCancelled(paymentInfo.getStatus())) {
updateStatus(paymentInfo.getStatus());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cancel이 아니라면 그냥 그대로 결제된 상태일테지만 확실히 하기위해서 update 해주는거야?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞아 혹시몰라서 다시 동기화를 시켜주려고

throw IllegalPaymentInfoException.from(ERROR_CODE_NOT_CANCELLED, paymentInfo.getModule());
}

validatePaymentInfo(paymentInfo);
}

private void validatePaymentInfo(PaymentInfo paymentInfo) {
if (!id.equals(paymentInfo.getMerchantId())) {
if (!merchantUid.equals(paymentInfo.getMerchantUid())) {
updateStatus(PaymentStatus.INVALID);
throw IllegalPaymentInfoException.from(ERROR_CODE_INVALID_MERCHANT_ID, paymentInfo.getModule());
}
Expand All @@ -76,7 +107,7 @@ private void validatePaymentInfo(PaymentInfo paymentInfo) {

if (!pageName.equals(paymentInfo.getPageName())) {
updateStatus(PaymentStatus.INVALID);
throw IllegalPaymentInfoException.from(ERROR_INVALID_CREATOR, paymentInfo.getModule());
throw IllegalPaymentInfoException.from(ERROR_CODE_INVALID_CREATOR, paymentInfo.getModule());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.example.tyfserver.payment.domain;

import com.example.tyfserver.payment.util.IamPortPaymentServiceConnector;
import lombok.Getter;

import java.util.UUID;

@Getter
public class PaymentInfo {
private Long merchantId;
private UUID merchantUid;
private PaymentStatus status;
private Long amount;
private String pageName;
private String impUid;
private String module;

public PaymentInfo(Long merchantId, PaymentStatus status, Long amount, String pageName, String impUid, String module) {
this.merchantId = merchantId;
public PaymentInfo(UUID merchantUid, PaymentStatus status, Long amount, String pageName, String impUid, String module) {
this.merchantUid = merchantUid;
this.status = status;
this.amount = amount;
this.pageName = pageName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.example.tyfserver.payment.domain;

import com.example.tyfserver.payment.dto.PaymentRequest;
import java.util.UUID;

public interface PaymentServiceConnector {
PaymentInfo requestPaymentInfo(PaymentRequest paymentRequest);

PaymentInfo requestPaymentInfo(UUID merchantUid);

PaymentInfo requestPaymentCancel(UUID merchantUid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public enum PaymentStatus {
}

public static boolean isPaid(PaymentStatus paymentStatus) {
if (paymentStatus.equals(PAID)) {
return true;
}
return false;
return paymentStatus.equals(PAID);
}

public static boolean isCancelled(PaymentStatus paymentStatus) {
return paymentStatus.equals(CANCELLED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IamPortPaymentInfo {
public IamPortPaymentInfo(Response response) {
this.response = response;
}

@NoArgsConstructor
@Getter
public class Response {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.tyfserver.payment.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class PaymentCancelRequest {

@NotBlank
@JsonDeserialize
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 어떤 이슈가 있어서 붙여진건지 궁금~!
PaymentRequest와 더불어서

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RequsetBody로 받을 때 UUID타입으로 받으려면 저걸 붙여줘야 하더라고!
근데 지금 에러를 확인해보니 UUID형식이 아닐때 발생하는 에러는 우리가 BindingResult로 잡을 수가 없어서 어떻게 해야하나 고민중이었어ㅠㅠ

Copy link
Collaborator

@Be-poz Be-poz Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 프론트에서도 merchant_id를 String으로 쏠 것 같은데 아닌가 ?
커밋 내용 보니깐 String을 UUID로 변경했던데 만약 프론트가 String으로 보낸다면 BindingResult이슈도 해결?!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

샤워하면서 생각하면서 이해했다! 기존에 나는 어 String을 왜 다시 UUID로 바꿨지 String이 더 낫지 않나 했는데 String으로 할 경우에 Request타입에서 UUID인지 확인하기가 힘들다는 거구나!! String으로 하면 장점이 음.. @JsonDeserialize 를 안해줘도 된다? 정도 ..?? 그리고 아마 UUID를 했는데 String으로 들어왔을 경우에 던져지는 Error는 우리가 어노테이션으로 걸어준 valid에 대한 에러가 아니어서 MethodArgumentNotValidException이 아니라 다른 예외가 던져지고 있겠구나.. 사실 뭐가 던져지든 잡아서 우리의 커스텀 예외로 던지니깐 상관없긴 하겠지만!!

UUID로 받아오는 것이 좋아보이긴 한데 내 우려는 프론트가 이거 String으로 던질 것 같단 말이야?? 아마도 높은확률로?? UUID 형식과 똑같은 String으로 던졌을 때에 저 Request가 잘 받아오냐 이게 관건인 것 같은데 이 부분에 대한 테스트가 없어서 아직 확인이 불가능하긴하네. 그리고 아직 환불에 대한 정확한 틀이 안짜여져있긴한데, 영수증에는 imp_uid가 적혀져있어서 merchant_uid가 아닌 imp_uid로 찾는 경우로 변경될 수도 있다는 점!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imp_uid도 결국엔 String이고 UUID는 아닐 것 같은데, 우리가 기본적으로 이 RequestDto에 대해서 String xxxId 라는 필드로 둔다면 imp_uid로 결정이되든 merchant_uid로 결정이되든 추후에 변경하지 않아도 돼서 속편할 것 같긴하다! 백 입장에서는 UUID로 처리하는게 더 편하긴 하지만. .!

Copy link
Collaborator Author

@Joyykim Joyykim Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나중에 imp_uid로 변경될 것도 고려하긴 해야지. 근데 어차피 Payment 타입이 UUID라서 DB 조회를 하려면 UUID 변환을 하긴 해야해. 만약 imp_uid로 변경된다고 하면 지금 String이든 UUID이든 어차피 갈아엎어야 해서 딱히 변경을 위해 String으로 만드는건 별로인것 같아.

지금상태에서 UUID가 아닌 형식으로 오면 org.springframework.http.converter.HttpMessageNotReadableException라는 예외가 발생하거든? 이건 BindingResult로 못받으니까 우리가 Validator를 하나 만들어주면 될듯! 검색해보니까 UUID Validator는 제공되는건 없는데 금방 만들거같아.
근데 이러면 결국 dto에선 String을 쓰게 되겠네ㅋㅋ

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

응 어차피 DB 조회에서는 UUID 써야하니깐 dto로 String으로 미리받고(imp_uid, merchant_uid 둘 다 받을 수 있으니) UUID가 필요한 곳에서 UUID.fromString으로 변환해서 사용하자는 뜻이었어!

  1. imp_uid로 오는경우, UUID가 아니라 String이니 String으로 써야함
  2. merchant_uid로 오는경우 어차피 프론트에서 String 타입으로 보내줄거니깐 String으로 써야함.
    DB 조회 등에서 UUID를 쓰긴하지만 이건 여기서 바꿔주면 되니깐!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿굿 String으로 바꾸고 커스텀 Validator 붙일게!
근데 1번은 알겠는데, 2번을 잘 모르겠네? 프론트에서는 똑같이 UUID형식의 문자열을 보내주는거고, 백단 DTO에서 어떤 타입으로 받을지를 결정하는 문제라 API나 프론트는 전혀 이슈될게 없는데??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나는 requestDto에 대한 필드가 UUID일 경우의 프론트 이슈를 말한거였어!! 지금 String으로 변경됐으니 아무 문제없을듯!

private String merchantUid;

public PaymentCancelRequest(String merchantUid) {
this.merchantUid = merchantUid;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 UUID로 다시 바꾸었구나!

UUID를 사용할때, UUID아닌 형식이 오면 org.springframework.http.converter.HttpMessageNotReadableException 이렇게 와서 우리가 커스텀 예외로 처리가 불가능 하니

String 으로 변경해서 Validator를 만든다는 거지??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

근데 프론트에서 String으로 보낼 것 같은뒤

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러게... 프론트에서는 String라고 생각하고 보낼거 같은데 🤔 (아임포트에 String으로 명시돼 있었으니까..?)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.tyfserver.payment.dto;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.UUID;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class PaymentCancelResponse {

private UUID merchantUid;

public PaymentCancelResponse(UUID merchantUid) {
this.merchantUid = merchantUid;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
package com.example.tyfserver.payment.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.UUID;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class PaymentRequest {
public class PaymentCompleteRequest {

@NotBlank
private String impUid;

@NotNull
private Long merchantUid;
@JsonDeserialize
private UUID merchantUid;

public PaymentRequest(String impUid, Long merchantUid) {
public PaymentCompleteRequest(String impUid, UUID merchantUid) {
this.impUid = impUid;
this.merchantUid = merchantUid;
}
Expand Down