fix(loyalty): correct stamp accumulation, one-per-day guard, and test coverage
- Handler: apply existing redemption BEFORE incrementing stamps (was creating
and applying redemption to same booking)
- Handler: guard stamp increment behind bookingTotal > 0 (free bookings don't
earn stamps)
- Handler: fix global milestone off-by-one (globalCount already includes
current booking since status updated before discount logic)
- Schema: chk_milestone constraint only requires milestone_unit for anniversary
type, not per_user_booking_count or global_booking_count
- Tests: rewrite from scratch with 12 focused tests:
- FullCycle, ExistingRedemptionApplies, OneStampPerDay, ZeroTotalNoStamp,
CycleRepeats, TimeBasedCampaign, PerUserMilestone, GlobalMilestone,
AnniversaryMilestone, LoyaltyPriority, NoDiscountOnZeroTotal,
CampaignMaxRedemptions
- Tests: fix path parameter extraction in makeProgressRequest
- Vendor: go mod tidy + vendor for testify dependency
This commit is contained in:
@@ -11,6 +11,7 @@ require (
|
||||
github.com/kovidgoyal/imaging v1.8.19
|
||||
github.com/lib/pq v1.11.2
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/stretchr/testify v1.11.1
|
||||
golang.org/x/text v0.34.0
|
||||
)
|
||||
|
||||
@@ -30,16 +31,21 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect
|
||||
github.com/aws/smithy-go v1.24.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
|
||||
github.com/kovidgoyal/go-shm v1.0.0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
|
||||
golang.org/x/image v0.36.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
Reference in New Issue
Block a user