-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#46] 경매 상품 결제(포인트) 기능 추가 #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생 많으셨습니다 ~
피드백 확인 부탁드려요 ~
} | ||
|
||
// 포인트 사용 | ||
@PostMapping("/deduct") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거는 말씀하신거처럼 배치에서 낙찰자 판단하고 거기서 차감하는게 맞지 않을까 싶네요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 그러네요!! 필요없는 API네용.. 삭제하겠습니다!
|
||
} | ||
|
||
private static void validateDeductPoint(PointAmount pointAmount, User user, Point point) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
배치에서 차감을 한다고 할 때, 이 사람이 다른 경매도 참여해서 실제 결제시에는 포인트가 부족할 수도 있겠네요!
그거에 대한 생각도 해보면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
경매 입찰 시도할때 가격만큼 포인트에서 차감을 시킨 다음에 낙찰받지 못하면 다시 포인트 돌려주는 방식으로 포인트 부족 문제를 해결할 수 있을꺼같은데 이 방식은 어떤지 궁금합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요건 저번 멘토링때 얘기 나눴던 것 같네요! 전 좋은 방법 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 감사합니다!
} | ||
|
||
// 포인트 충전 | ||
public int chargePoint(CustomUserDetails userDetails, PointAmount pointAmount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
트랜잭션이 안 걸린 것 같아요 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 자꾸... ㅠㅠ
추가하도록 하겠습니다!
@@ -77,8 +77,7 @@ private Long processBid(CustomUserDetails user, BidRequest bidRequest, Long prod | |||
throw new BiddingFailException(user.getUser().getUserId(), bidRequest.getBiddingPrice(), productId); | |||
} | |||
// 포인트 돌려주기 | |||
PointAmount pointAmount = new PointAmount(userIdAndCurrentPrice.getSecond().intValue()); | |||
pointService.chargePoint(user, pointAmount); | |||
pointService.rollbackPoint(userIdAndCurrentPrice.getFirst(), userIdAndCurrentPrice.getSecond().intValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis 최고가 정보 변경 전에 포인트를 롤백해주도록 추가했습니다.
이러면 실제 결제 시 포인트 부족 문제를 해결할 수 있을 것 같습니다!
혹시 제가 놓치고 있는 부분이 있을까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금은 괜찮아보여요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 감사합니다~!
@@ -83,6 +86,9 @@ private void isBiddingAvailable(CustomUserDetails user, BidRequest bidRequest, L | |||
if (biddingRequestTime.isAfter(product.getCloseDate())) { | |||
throw new BiddingFailException(user.getUser().getUserId(), bidRequest.getBiddingPrice(), productId); | |||
} | |||
|
|||
PointAmount pointAmount = new PointAmount(bidRequest.getBiddingPrice()); | |||
pointService.deductPoint(user, pointAmount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
경매 입찰이 가능한지 검증하는 메서드쪽에 포인트 차감하는 코드를 추가했습니다
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생 많으셨습니다 ~ 이번 PR은 머지하도록 할게요!
경매 상품 결제(포인트) 기능 추가