Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DepositSuccessEventHandler implements DepositEventHandler<DepositSu
public void handle(DepositSuccessEvent event) {
var log = virtualAccountLogService.updateVirtualAccountLog(
event.getOrderId(),
DepositStatus.CANCELED
DepositStatus.DONE
);
Comment on lines 24 to 27

Choose a reason for hiding this comment

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

medium

While this change correctly passes DepositStatus.DONE to fix the bug, the underlying updateVirtualAccountLog method in VirtualAccountLogService has a potential issue. It treats any status other than DONE as a failure, setting the status to CANCELED. This could lead to incorrect behavior if other statuses like WAITING are ever passed to it.

For better maintainability and to prevent future bugs, consider refactoring VirtualAccountLogService.updateVirtualAccountLog to handle all DepositStatus enum values explicitly, perhaps with a switch statement. Alternatively, creating more specific methods like markAsSuccess(orderId) and markAsFailure(orderId) in the service could make the intent clearer and the code less error-prone.

sendMail(log, event.getFormattedCreatedAt());
}
Expand Down