Skip to content

add withdrawal request API with penalty calculation#503

Merged
Devsol-01 merged 6 commits intoDevsol-01:mainfrom
Joewizy:feat/request-withdrawal-api
Mar 29, 2026
Merged

add withdrawal request API with penalty calculation#503
Devsol-01 merged 6 commits intoDevsol-01:mainfrom
Joewizy:feat/request-withdrawal-api

Conversation

@Joewizy
Copy link
Copy Markdown
Contributor

@Joewizy Joewizy commented Mar 29, 2026

Closes #460

Summary

  • Add POST /savings/withdraw endpoint with subscription ID, amount, and optional reason
  • Calculate 5% early withdrawal penalty for locked (FIXED) products; no penalty for flexible or matured subscriptions
  • Create WithdrawalRequest entity with full status tracking (PENDING → PROCESSING → COMPLETED/FAILED)
  • Record withdrawals in transaction ledger, update subscription balance, and cancel subscription if fully withdrawn
  • Send email + in-app notification on withdrawal completion via withdrawal.completed event

Test plan

  • POST /savings/withdraw with valid subscription returns correct penalty/netAmount
  • Early withdrawal from FIXED product applies 5% penalty
  • Withdrawal from FLEXIBLE product has zero penalty
  • Withdrawal from matured FIXED product has zero penalty
  • Withdrawal exceeding balance returns 400
  • Withdrawal from non-owned subscription returns 404
  • Withdrawal from cancelled subscription returns 400
  • Transaction ledger entry created with correct metadata
  • Subscription amount decremented after withdrawal
  • Email notification sent on completion

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nestera Ready Ready Preview, Comment Mar 29, 2026 5:10pm

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@Joewizy 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! 🚀

Learn more about application limits

@Devsol-01 Devsol-01 merged commit 1f297d2 into Devsol-01:main Mar 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Withdrawal Request API with Penalty Calculation

2 participants