Skip to content

feat: standardize exception handling, settlement approval, and key ro… - #609

Merged
martinzhames merged 2 commits into
dupdab:mainfrom
kelvin1john0901-blip:feat/standardize-exception-handling-and-settlement-workflow
Oct 23, 2026
Merged

martinzhames merged 2 commits into
dupdab:mainfrom
kelvin1john0901-blip:feat/standardize-exception-handling-and-settlement-workflow

Conversation

@kelvin1john0901-blip

Copy link
Copy Markdown
Contributor

#442 Standardize exception handling

  • Add custom business-logic exception hierarchy (BusinessLogicException, PaymentExpiredException, InsufficientFundsException) in src/common/exceptions
  • Replace service-layer throw new Error() with NestJS HTTP exceptions (BadRequestException/NotFoundException/ConflictException) so clients receive 400/404 instead of 500
  • Implement global AllExceptionsFilter that logs all unhandled errors to Sentry and returns sanitized, stable error contracts; register it globally via APP_FILTER

#444 Encryption key rotation for Stellar wallet keys

  • Add keyVersion column to blockchain_wallets (+ migration)
  • Support ENCRYPTION_KEY_PREVIOUS fallback decryption and re-encryption in EncryptionService; new wallets are provisioned with current keyVersion
  • Add re-encryptWallets() to BlockchainWalletService
  • Add POST /api/v1/admin/encryption/rotate-key (SUPERADMIN) with audit log
  • Document rotation procedure in RECOVERY_DRILL.md

#445 Settlement approval workflow for large settlements

  • Implement SettlementsService.approveSettlement() / rejectSettlement() with audit log entry and merchant email notification on every decision
  • Add POST /admin/settlements/:id/approve and /reject (SUPERADMIN only)
  • Add paginated GET /admin/settlements list endpoint with Swagger docs

#446 Admin cron job management endpoints

  • CronJobRegistry now tracks schedules; listJobs returns name, schedule, next run, and last run; getHistory returns paginated run logs (status, duration) persisted in CronJobLog; Swagger docs present

Closes #442
Closes #444
Closes #445
Closes #446

kelvin1john0901-blip and others added 2 commits October 22, 2026 16:30
…tation (dupdab#442 dupdab#444 dupdab#445 dupdab#446)

dupdab#442 Standardize exception handling
- Add custom business-logic exception hierarchy (BusinessLogicException,
  PaymentExpiredException, InsufficientFundsException) in src/common/exceptions
- Replace service-layer throw new Error() with NestJS HTTP exceptions
  (BadRequestException/NotFoundException/ConflictException) so clients
  receive 400/404 instead of 500
- Implement global AllExceptionsFilter that logs all unhandled errors to
  Sentry and returns sanitized, stable error contracts; register it globally
  via APP_FILTER

dupdab#444 Encryption key rotation for Stellar wallet keys
- Add keyVersion column to blockchain_wallets (+ migration)
- Support ENCRYPTION_KEY_PREVIOUS fallback decryption and re-encryption in
  EncryptionService; new wallets are provisioned with current keyVersion
- Add re-encryptWallets() to BlockchainWalletService
- Add POST /api/v1/admin/encryption/rotate-key (SUPERADMIN) with audit log
- Document rotation procedure in RECOVERY_DRILL.md

dupdab#445 Settlement approval workflow for large settlements
- Implement SettlementsService.approveSettlement() / rejectSettlement()
  with audit log entry and merchant email notification on every decision
- Add POST /admin/settlements/:id/approve and /reject (SUPERADMIN only)
- Add paginated GET /admin/settlements list endpoint with Swagger docs

dupdab#446 Admin cron job management endpoints
- CronJobRegistry now tracks schedules; listJobs returns name, schedule,
  next run, and last run; getHistory returns paginated run logs (status,
  duration) persisted in CronJobLog; Swagger docs present

Closes dupdab#442
Closes dupdab#444
Closes dupdab#445
Closes dupdab#446
…ception-handling-and-settlement-workflow

# Conflicts:
#	src/app.module.ts
@martinzhames
martinzhames merged commit 8620bc9 into dupdab:main Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants