fix: reset project completed status when order expires or refunds#185
Merged
yyg-max merged 5 commits intoJun 23, 2026
Merged
Conversation
Issue: When all items are reserved but users don't complete payment, the project gets marked as completed even after orders expire and items are returned to stock. Changes: - Add resetProjectCompletedStatus in tasks.go to check and reset IsCompleted flag when expired orders return items - Add resetProjectCompletedStatusAfterRefund in service.go to handle refund scenarios - Reset IsCompleted when Redis has stock but project is marked as completed - Applied to both order expiration cleanup and refund success paths This ensures projects become available again after reserved items are released back to inventory.
Contributor
Author
|
看起来 在 LDC 系统中 支付过期时间是 5 分钟 为什么这里 15 分钟才回放() |
yyg-max
reviewed
Jun 16, 2026
…ct method - Merge resetProjectCompletedStatusAfterRefund and resetProjectCompletedStatus into single method - Add Project.ResetCompletedStatusIfHasStock() in utils.go - Remove 65 lines of duplicate code across service.go and tasks.go - Maintain original code style without logging
6f1cfc8 to
ce443c2
Compare
…ansaction - Move method from utils.go to models.go per maintainer feedback - Wrap logic in db.Transaction() for atomicity - Add error handling at all call sites (tasks.go and service.go) - Log errors when reset fails for better observability
yyg-max
reviewed
Jun 17, 2026
5044c87 to
74e4719
Compare
yyg-max
reviewed
Jun 18, 2026
74e4719 to
142d440
Compare
yyg-max
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When users reserve paid CDK items but don't complete payment, the following issue occurs:
IsCompleted=trueIsCompletedremainstrueeven though Redis has stock again例行检查
Root Cause
FulfillForReceiver()setsIsCompleted=truewhen Redis stock is 0expireOrder()returns items to Redis but doesn't resetIsCompletedis_completedfield and disables the claim buttonIsReceivable(), notIsCompletedSolution
Added logic to check and reset
IsCompletedwhen items are returned to inventory:Changes
tasks.go: Added
resetProjectCompletedStatus()expireOrder()returns items to RedisIsCompleted=truebut Redis has stockIsCompleted=falseif condition metservice.go: Added
resetProjectCompletedStatusAfterRefund()Testing
Impact
Fixes the issue where legitimate users cannot claim items that become available after order expiration.