Skip to content

Commit

Permalink
Merge pull request #270 from Team-BC-1/refactor/remove-redundant-hand…
Browse files Browse the repository at this point in the history
…le-tosspay

TossPaymentEventListener 사용자 충전 로직 삭제
  • Loading branch information
vanillacake369 authored Mar 8, 2024
2 parents 2cde498 + 8f183fc commit 58fdb18
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ private static TossPaymentSuccessResponseDto sendFinalRequest(RestTemplate rest,
return responseDto;
}

private static void updateUserPointByPaymentStatus(TossPaymentSuccessEvent event, TossPaymentSuccessResponseDto responseDto) {
private static void checkPaymentStatus(TossPaymentSuccessEvent event, TossPaymentSuccessResponseDto responseDto) {
assert responseDto != null;
if (responseDto.status().equals("DONE")) {
User user = event.getTossPayment().getUser();
user.increasePoint(event.getTossPayment().getAmount());
event.getCallback().handle(responseDto);
} else {
throw new GlobalException(ResultCase.TOSS_FINAL_REQUEST_FAIL);
Expand Down Expand Up @@ -67,6 +65,6 @@ public void handleTossPaymentSuccess(TossPaymentSuccessEvent event) {

TossPaymentSuccessResponseDto responseDto = sendFinalRequest(rest, headers, param);

updateUserPointByPaymentStatus(event, responseDto);
checkPaymentStatus(event, responseDto);
}
}

0 comments on commit 58fdb18

Please sign in to comment.