Repository navigation
feat: spend a loopkit reward at qkit checkout for a single-use code - #292
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
customer_join now carries active_vouchers per card (stamp-card rewards were never listed). A voucher already spent for a qkit code stays listed with a Show code button; the RPC is idempotent so it returns the same code. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ation The pgTAP stub now mirrors qkit 0129 argument checks and is only created when the real function is absent. The vendor value is limited to two decimals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md # package.json
Staging's 0072 is qkit_earn_free; this migration does not touch qkit_earn_resolve_program. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md # package.json
# Conflicts: # CHANGELOG.md # src/features/card-check/components/README.md
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…P voucher lookup order-independent Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Stryker finds no tests for them and failed the job with no tests executed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…o 0074 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
What
A customer can pick "Use at qkit checkout" on a reward on /c. loopkit marks the voucher redeemed and gets a single-use
LK-code fromqkit.issue_reward_codein one transaction (migration 0072,loopkit.customer_use_voucher_at_qkit, service role only, card-token proof). The code is shown with a copy button. A retry returns the same code (idempotent onloopkit:<voucher id>), so a spent reward stays on /c as "qkit code issued" with a "Show code" button.Vendors set what the code is worth (percent or dollars off) in Profile under "qkit reward code". Free, no Pro gate.
Decisions
vendor_notify_settings(vendor level, free, owner-RLS upsert already exists).qkit_earn_configis Pro-gated in the UI, so it was not reused.customer_joinis redefined in 0072:vendor_join_cardscarries noactive_vouchers, so /c never listed any reward vouchers, stamp-card rewards included. Each card now carries active vouchers plus those spent for a qkit code.qkit.issue_reward_codebecause CI has no qkit schema.Deploy order
qkit
0129_discount_codes(qkit.issue_reward_code) must be applied before this migration. It already is on prod and staging.The code expires with the voucher (
expires_atis passed through).Tests
pgTAP (
supabase/tests/qkit-reward-code.test.sql), vitest for the action, button, settings form and card-status mapping.pnpm run checkand the full vitest run pass locally.🤖 Generated with Claude Code