Add micro-deposit verification, role-based onboarding checklist, API usage daily view, and backup integrity verification - #664
Open
david87131 wants to merge 2 commits into
Conversation
…e tracking, and backup integrity checks Fixes Smartdevs17#633 Fixes Smartdevs17#632 Fixes Smartdevs17#631 Fixes Smartdevs17#630
|
@david87131 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@david87131 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…-631-630 # Conflicts: # backend/prisma/schema.prisma
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.
This PR implements a small, real, working slice of each of four epic issues. Each is a large epic in the issue description; only the scoped slice below is implemented here, with the rest explicitly deferred as noted.
PaymentMethodPrisma model (pending/verified/failed/locked status, two pending deposit amounts, attempt counter, attempt limit). AddedMicroDepositVerificationServicewithissueMicroDeposits()(generates two random 1-99 cent amounts) andverifyMicroDeposits()(order-independent match, increments attempts on mismatch, locks out after the configured limit). Wired toPOST /api/v1/payment-methods,POST /api/v1/payment-methods/:id/micro-deposits,POST /api/v1/payment-methods/:id/verify. Deferred: verification notifications, verification analytics/reporting.OnboardingChecklistPrisma model reusing the existingWorkspaceRoleenum (owner/admin/member/viewer). AddedOnboardingChecklistServicewith a small hardcoded per-role task template,getOrCreateChecklist(),completeTask(), and completion-percentage computation. Wired toGET /api/v1/onboarding-checklist/checklist?role=...andPOST /api/v1/onboarding-checklist/checklist/tasks/:taskId/complete(kept separate from the existing merchant-KYConboarding.tsrouter, which is a different feature). Deferred: automated cross-team task assignment, onboarding analytics, notifications, completion incentives.ApiKey/ApiKeyUsage/ApiKeyQuotamodel set, anapiUsageTrackermiddleware wired into/api/v1/developers/api-keys, and a usage-summary endpoint (from a prior issue). Added the specific piece this issue calls for that was missing: a per-day usage breakdown —getDailyUsage(keyId, days)inquota-manager.tsandGET /api/v1/developers/api-keys/:keyId/usage/daily?days=N. Deferred: dashboard UI, forecasting/trending, threshold alerts, cross-key comparison tools.scripts/backup.shalready computed and stored a.sha256checksum at backup time, butverify_backup_integrity()/do_verify_allonly rangunzip -tand never compared it. Fixedverify_backup_integrity()to recompute the sha256 of the backup file and compare it against the stored.sha256file, failing verification if the checksum file is missing or the digest doesn't match (in addition to the existing gzip check). Also added a standalonebackend/src/utils/backup-integrity.tswithcomputeChecksum(),verifyChecksum(),parseChecksumFile(), andverifyBackupFile()plus unit tests, since programmatic backup handling may live in the app later. Deferred: scheduling, S3 restore-time verification, alerting.Test plan
npx vitest runon the three new test files — 23/23 passing (micro-deposit verification, onboarding checklist, backup integrity utils)bash -n scripts/backup.sh— syntax validnpx tsc --noEmitscoped to changed/new files — no new errors introduced (two pre-existingreq.paramstyping errors remain untouched inapi-keys.ts; the full-repotscrun has ~1000 pre-existing errors fromprisma generatecurrently failing on an unrelated duplicateSubscriptionStatusenum definition already onmain— confirmed by stashing this branch's changes and reproducing the same failure — and from missingsocket.iotypes, both out of scope for this PR)Fixes #633
Fixes #632
Fixes #631
Fixes #630