Skip to content

Commit

Permalink
fix: 결제 상태 확인 로직 수정
Browse files Browse the repository at this point in the history
- payments 전체가 SUCCESS인 경우만 결제 완료로 처리하던 로직을 수정
- 하나의 payment라도 SUCCESS인 경우 결제 완료로 처리하도록 변경
  • Loading branch information
23tae committed Dec 6, 2024
1 parent 0859112 commit f916a28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class MatchedDao(private val queryFactory: JPAQueryFactory) {
.mapValues { (_, userTeams) ->
userTeams.all { userTeam ->
val payments = userTeam.team.payments
payments?.isNotEmpty() == true &&
payments.all { it.status == PaymentStatus.SUCCESS }
payments?.any { it.status == PaymentStatus.SUCCESS } ?: false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class MatchingService(
?: throw MeetingTeamNotFoundException()
val meetingTeam = userTeam.team

val hasInvalidPayment =
meetingTeam.payments?.any { payment -> payment.status != PaymentStatus.SUCCESS }
val hasValidPayment =
meetingTeam.payments?.any { payment -> payment.status == PaymentStatus.SUCCESS }
?: false
if (hasInvalidPayment) {
if (!hasValidPayment) {
throw PaymentNotFoundException()
}

Expand Down

0 comments on commit f916a28

Please sign in to comment.