Skip to content

Add integration test for the settlement endpoint distributing returns to all investors and updating invoice status to settled #183

Description

@Chucks1093

Summary

The settlement endpoint should calculate each investor's pro-rata return, transfer the amounts via Soroban, and transition the invoice status to settled. An integration test should fund an invoice with multiple investors and verify all returns are distributed and the final status is correct.

Scope

  • Seed a funded invoice (face value 9000) with three equal investors (3000 each)
  • Call the settlement endpoint as the seller
  • Assert each investor's return record shows 3000 (equal split, no remainder)
  • Assert the invoice status is settled after the call
  • Assert calling settlement a second time returns 409 with invoice_already_settled

Acceptance Criteria

  • Each investor receives correct pro-rata return
  • Invoice status transitions to settled
  • Second settlement attempt returns 409 with invoice_already_settled
  • Seller cannot settle an invoice they do not own (403)

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions