Skip to content

feat(transactions): Add Transaction Fees Calculation (#358)#500

Open
solomonokeke012-bot wants to merge 2 commits intoMettaChain:mainfrom
solomonokeke012-bot:feature/358-transaction-fees-calculation
Open

feat(transactions): Add Transaction Fees Calculation (#358)#500
solomonokeke012-bot wants to merge 2 commits intoMettaChain:mainfrom
solomonokeke012-bot:feature/358-transaction-fees-calculation

Conversation

@solomonokeke012-bot
Copy link
Copy Markdown

Summary

Implements transaction fees calculation as required by issue #358.

What's included

  • TransactionFeesService — pure fee calculation logic:

    • Platform fee: 1.5% of transaction amount
    • Agent commission: 3% (configurable per-request)
    • Tax: 8% applied on amount + platform fee + agent commission
    • Returns a full FeeBreakdown with all rates and totals
  • TransactionsController — REST endpoints:

    Method Path Description
    POST /transactions/fees/calculate Calculate fees without creating a transaction
    POST /transactions Create a transaction (JWT required)
    GET /transactions List all transactions (ADMIN only)
    GET /transactions/:id Get transaction by ID (JWT required)
    GET /transactions/:id/fees Get transaction with fee breakdown (JWT required)
  • TransactionsModule registered in AppModule

Tests

4 unit tests covering:

  • Standard fee calculation
  • Custom agent commission rate override
  • Zero-amount edge case
  • Decimal rounding precision

Tested

  • ✅ All 4 unit tests pass
  • npm run build succeeds with no TypeScript errors

Closes #358

- Add TransactionFeesService: platform fee (1.5%), agent commission (3%), tax (8%)
- Add fee breakdown endpoint: POST /transactions/fees/calculate
- Add GET /transactions/:id/fees to fetch a transaction with its fee breakdown
- Add TransactionsController and TransactionsService with CRUD endpoints
- Register TransactionsModule in AppModule
- 4 unit tests covering standard, custom rate, zero amount, and rounding
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@solomonokeke012-bot 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

@LaGodxy
Copy link
Copy Markdown
Contributor

LaGodxy commented Apr 29, 2026

@solomonokeke012-bot please check the CI.

@LaGodxy
Copy link
Copy Markdown
Contributor

LaGodxy commented Apr 29, 2026

@solomonokeke012-bot

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 Transaction Fees Calculation

2 participants