Commit Graph
11 Commits
Author SHA1 Message Date
popertots 7439fa86c1 Fix payment review round 3: saved-card idempotency, stale-pending sweep, webhook fail-closed
R1/R4: saved_card branch in CreateTerminalPayment now mirrors CreateTipPayment
- advisory lock (crussell:payment:<bookingID>) serializes concurrent double-clicks
- deterministic key bookingID-sc-type-amount-cardID (<=45 chars) so a lost-response
  retry derives the same key and dedups instead of double-charging
- idempotency switch inside the lock: completed -> dedup, pending -> reuse with
  pence amount-guard, failed -> clean 409
- success response includes card_brand/card_last4 (frontend already reads them)

R2: add 'failed' case to all four retry switches (tip, booking, gift card, till)
- a swept/definitively-rejected record returns 409 instead of 500-ing on the
  idempotency_key UNIQUE constraint

R3: extend SweepStalePendingPayments to till_sales card rows
- sweeps pending till_sales (online_square/in_person_card) past Square's ~24h
  key retention, closing the double-charge window for till sales
- swept rows logged with the same CRITICAL manual-reconciliation marker as the
  refund sweep

Webhook fail-closed: reject 503 when SQUARE_WEBHOOK_SIGNATURE_KEY unset, 403 on
bad signature (was: skip verification in dev)

Refund status resolution: refunds now resolve by Square status
(COMPLETED/PENDING/FAILED/REJECTED) instead of assuming completed; real error
codes (REFUND_AMOUNT_INVALID, PAYMENT_NOT_REFUNDABLE, REFUND_ALREADY_PENDING)
added to the definitive/processed classification

HTTP client: CreateCard key truncated to <=45 chars, device_options always sent
(env SQUARE_TERMINAL_DEVICE_ID fallback), processing_fee reads amount_money,
ListCards cursor loop, refund keys hashed to <=45 chars

Other fixes: payment/till/gift-card advisory-lock + FOR UPDATE asymmetries,
GetPaymentByID NULL scans, loyalty redemption lock, card upsert on conflict,
mock ccof: prefix parity, IsValidSquareCheckoutID for real Square IDs,
isAdminRequest defense-in-depth on all 6 admin payment handlers, webhook
signature docs, M8/L5 debug markers removed

Docs: README/FC/TM/Overview updated (22 jobs, 20 CRITICAL sites, 23-section
GDPR export, sweep jobs, webhook fail-closed); P11 plan marks remaining items
(sandbox smoke test, M-8 customer_id, saved-card key dedup trade-off) as
deferred with rationale; gap backlog pruned of completed items
2026-08-22 00:34:49 +01:00
popertots 64d4b65083 Implement P11: Square Web Payments SDK new-card tokenization
Re-enable new-card entry across all 8 flows via Square Web Payments SDK
cnon: nonces (backend was already P11-ready):
- Add square.ts SDK loader (env-gated on VITE_SQUARE_APPLICATION_ID/LOCATION_ID,
  sandbox vs prod URL auto-derived from app-ID prefix) + SquareCardInput.svelte
  (tokenize() via bind:this, onReady state, CardEntryUnavailable fallback)
- CardSelection.svelte: replace newCardDisabled gate with new-card toggle +
  SquareCardInput; expose tokenize() for parent flows
- Wire new-card mode into tip x3, booking payment (UserPaymentModal), deposit
  (BookingFlow incl. guest), Buy a Gift Card + Add a Card (account), and admin
  till online_square (GiftCardsManagement create/topup)
- Retry-safe: each flow caches the one-shot nonce and reuses it on retry so the
  backend idempotency key dedups instead of re-tokenizing
- Docs: README, Gap Backlog P11, Feature Catalog, Technical Manual, P11 plan
2026-08-22 00:34:49 +01:00
popertots b3729c8a5a docs: add DAV_SKIP_INIT to .env.example
CI / Nginx config check (push) Failing after 1s
CI / Docker compose check (push) Successful in 34s
CI / Env docs check (push) Successful in 35s
CI / Frontend deps check (push) Successful in 38s
CI / Frontend major deps (push) Successful in 40s
CI / Go build (push) Successful in 41s
CI / Staticcheck (dev) (push) Failing after 1s
CI / Frontend build (push) Successful in 46s
CI / Secrets scan (push) Successful in 47s
CI / Security scan (prod) (push) Failing after 1s
CI / go mod tidy (push) Failing after 0s
CI / Go vulnerabilities (push) Failing after 1s
CI / Knip (push) Successful in 45s
CI / Frontend QC (typecheck) (push) Failing after 0s
CI / Frontend QC (lint) (push) Failing after 0s
CI / Frontend QC (audit) (push) Successful in 41s
CI / Svelte strict check (push) Has been skipped
CI / Go vet (prod) (push) Successful in 1m29s
CI / Frontend a11y check (push) Successful in 1m52s
CI / Go vet (dev) (push) Successful in 1m51s
CI / Staticcheck (prod) (push) Successful in 2m1s
CI / golangci-lint (push) Successful in 2m30s
CI / Security scan (dev) (push) Successful in 2m54s
CI / Tests (prod) (push) Has been skipped
CI / Tests (dev) (push) Has been skipped
CI / Race (prod) (push) Has been skipped
CI / Race (dev) (push) Has been skipped
2026-07-11 15:25:44 +01:00
popertotsandSisyphus 85c043ad7f fix: add golangci-lint to pre-commit hook, clarify R2_ENDPOINT in env example
Pre-commit now runs golangci-lint (3m timeout) after go vet, before staticcheck. R2_ENDPOINT comment updated to clarify it is prod-only and local dev uses S3_* vars.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-07-11 14:12:28 +01:00
popertots 9e3c9323c3 ci: fix nginx config check cp path, add R2_ENDPOINT to .env.example
CI / Nginx config check (push) Failing after 11s
CI / Docker compose check (push) Successful in 11s
CI / Env docs check (push) Successful in 12s
CI / Frontend deps check (push) Failing after 24s
CI / Knip (push) Has been skipped
CI / Frontend a11y check (push) Has been skipped
CI / Secrets scan (push) Successful in 38s
CI / Go build (push) Successful in 39s
CI / go mod tidy (push) Successful in 21s
CI / Frontend build (push) Successful in 1m25s
CI / Svelte strict check (push) Has been skipped
CI / Frontend QC (audit) (push) Has been skipped
CI / Frontend QC (typecheck) (push) Has been skipped
CI / Frontend QC (lint) (push) Has been skipped
CI / Go vulnerabilities (push) Successful in 1m38s
CI / Go vet (push) Successful in 1m40s
CI / Staticcheck (push) Failing after 2m19s
CI / golangci-lint (push) Successful in 2m30s
CI / Security scan (gosec) (push) Failing after 2m51s
CI / Tests (prod) (push) Has been skipped
CI / Tests (dev) (push) Has been skipped
CI / Race (prod) (push) Has been skipped
CI / Race (dev) (push) Has been skipped
- nginx-check: cp needs trailing filename when copying to a directory
- .env.example: uncomment R2_ENDPOINT as an active variable so the
  env-docs-check script detects it as documented
2026-07-10 10:33:33 +01:00
popertotsandSisyphus 49ee167d69 chore: add missing env vars to .env.example
Add 11 previously undocumented env vars: TEST_DB_HOST, TEST_DB_DSN, GO_TESTING, SQUARE_WEBHOOK_NOTIFICATION_URL, DAV_BASE_URL, DAV_ADMIN_PASSWORD, NO_COLOR, VITE_BACKEND_URL, RUSTFS_*

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-07-10 09:31:28 +01:00
popertots 2e1ab9d745 feat: Square payment integration, booking flow redesign, and timezone/weekday fixes
- Add Square payment integration (mock + handlers + UI): terminal/online payments,
  refunds, tips, saved cards, webhooks. Build-tagged dev/prod clients.
- Redesign booking flow: Step 4 conditional (deposit only), Step 5 confirmation
  screen with booking ID, auto-submit on transition.
- Redesign schedule modal: 2x3 button grid with Pay Deposit/Pay Early logic.
- Add deposit warning banner at Step 1 for users with outstanding deposits.
- Fix weekday conversion bug: Go 0=Sunday vs DB 0=Monday mismatch in 6 locations.
- Fix timezone bug: UTC vs London time in closing hours validation.
- Fix frontend error parsing: plain text backend errors now displayed correctly.
- Fix crypto.randomUUID fallback for environments without Web Crypto.
- Add 7 new regression tests: closing hours, advance check, active booking limit,
  weekday conversion, UTC/London, deposit snapshot, exceptional hours.
- Fix 3 flaky tests: dynamic dates instead of fixed, no-show timing.
2026-05-23 11:29:34 +01:00
popertots 970cc5554d feat: add email verification, profile pictures, deposits, and calendar
export
Backend:
- Add email verification code generation and verification endpoints
- Add profile picture upload with S3 storage and image processing
- Add deposit_required field to users with 48h advance booking
  requirement
- Add loyalty stamps that accumulate on completed bookings
- Auto-transition bookings: confirmed → in_progress → completed
- Add booking cancellation handler with no-show detection
- Add ICS calendar file download endpoint for bookings
- Sync bookings to CalDAV on confirmation
  Frontend:
- Add schedule page route
- Add avatar and image-cropper UI components
- Update shadcn-svelte components (button, dialog)
- Add "Add to Calendar" button in booking modal
  Database:
- Add verification_codes table
- Add profile_pic_url, loyalty_stamps, deposits_required to users
- Various schema updates
2026-02-21 18:48:29 +00:00
popertots 9259de9393 Portfolio: add filtering, URL sharing, and improved tag input
- Add category filters with dynamic counts that reduce as filters
  applied
- Add ?filter[category]=value URL params for filterable links
- Add ?img= timestamp param that bypasses filters to show specific image
- Update URL when opening/navigating/closing modal for shareable links
- Backend: add /api/portfolio/filters endpoint with filter logic
- Backend: add timestamp lookup fallback for GetImage endpoint
  Frontend:
- Portfolio page: filter dropdowns, keyboard nav, mobile improvements
- ImageUpload: live tag suggestions from API, arrow/Tab navigation,
  confirmation modal before upload, mobile-optimized touch targets
- Add scrollbar-hide utility and fix filter dropdown overflow
- Move Clear all button, add vertical separator on desktop
2026-02-20 00:32:09 +00:00
popertots dfd552b02f feat(storage): add S3/R2 abstraction with local Rustfs dev
- Add backend/internal/s3/ with build-tag pattern (dev vs prod)
- Dev: Uses local Rustfs container (S3-compatible)
- Prod: Stub for R2 Cloudflare (add AWS SDK to implement)
- Add S3 env vars to .env.example and .env
- Add Rustfs service to compose.yml
- Add Rustfs reset to local-dev-2.sh (wipes data on each run)
2026-02-17 22:47:38 +00:00
popertots 28815d3b25 Update readme 2025-11-06 16:05:33 +00:00