-
Notifications
You must be signed in to change notification settings - Fork 2
prod : 환불 후속 처리 (결제 엔티티 제거) #294
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
Changes from all commits
ee528cf
195f97e
3bc3eef
b7d6fb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,15 +2,17 @@ | |
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import life.mosu.mosuserver.domain.payment.projection.PaymentWithLunchProjection; | ||
| import life.mosu.mosuserver.domain.payment.entity.PaymentJpaEntity; | ||
| import life.mosu.mosuserver.domain.payment.projection.PaymentWithLunchProjection; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| public interface PaymentJpaRepository extends JpaRepository<PaymentJpaEntity, Long>, | ||
| PaymentJpaRepositoryCustom { | ||
|
|
||
| void deleteByExamApplicationId(Long examApplicationId); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two concerns with this method:
|
||
|
|
||
| // TODO:인덱스 처리 필요(풀스캔 위험) | ||
| boolean existsByOrderId(String orderId); | ||
|
|
||
|
|
||
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.
The operations within
afterCommitHandlerare not atomic. IfpaymentJpaRepository.deleteByExamApplicationId()fails, thequotaSyncService.sync()operation that already succeeded will not be rolled back. This can leave the system in an inconsistent state where the application quota is decreased, but the corresponding payment record still exists.To prevent this, you should implement a compensation mechanism by catching exceptions from the delete operation and calling a compensating action on
quotaSyncServiceto revert the quota change.Additionally, please see my comment on
PaymentJpaRepository.javaregarding potential issues with thedeleteByExamApplicationIdmethod itself (hard vs. soft delete and performance).