Skip to content

Dividends via UI #10

@ershad

Description

@ershad

What

Allow new Flexile company administrators to generate dividend computations and distribute dividends.

Note: minimize any back-end changes / new features; focus on productionizing our existing manual process.

  • Create dividend from Dividends page
    • Ask for
      • Dividend date (default today)
      • Amount to dividend
      • Is this a return of capital? (default to no)
      • Is there an investor release form?
      • If so, rich text area / modal to add w/ variables for investor information and payout amount
    • Run code to generate a DividendComputation and show the list of all investors that would get money as a result with their amounts
  • Modify the Dividends page to show such computations^ and allow admin to confirm it
    • Finalizing the round should create the Dividend records from the DividendComputation record
    • Pull money from the customer to cover Dividend amount + fees (show in UI)
    • After the pull^ succeeds, run Stripe::Payout.create(...) to move money from Stripe to Wise
    • After the pull^ succeeds, send dividend issuance email to investors in the dividend round (see code in RemindOrPayDividends that creates the InvestorDividendRound records and calls #send_dividend_issued_email)
  • On the "dividend issuance date", which must be 10+ days in the future, Mark the dividend round as ready_for_payment (boolean flag) so the code attempts to pay dividends every day automatically
  • Pull funds from Stripe as soon as the dividend is finalized
  • Pull funds from Stripe to Wise automatically (new code needs to be written for this)

Suggested approach via PRs:

  1. Admin can create a DividendComputation from the UI and see estimated payouts per investor (separating FE and BE MAY be fine, but keeping them together will help the reviewer unless the diff gets huge). Keep it behind a feature flag so we can iterate on the feature and make it GA after the feature is complete.
  2. Admin can review and finalize the DividendComputation which would create the dividends/dividend_round and trigerr a fund pull
  3. Money is moved from Stripe to Wise after the fund pull^ succeeds, dividend issuance emails are sent, ready_for_payment is set on the correct date (which will automate the payments)
  4. The money pulled for these dividends is surfaced in a consolidated invoice

Notes

The current flow to generate a dividend computation and then dividends from it is:

  1. dividend_computation = DividendComputationGeneration.new(...).process

  2. Ensure nothing seems off in CSVs generated by dividend_computation.to_csv, dividend_computation.to_per_investor_csv, and dividend_computation.to_final_csv

  3. dividend_computation.generate_dividends

  4. Step 1 should be run when a new dividend computation request is issued from the UI.

  5. Step 2 should be run to show the amounts investors would get based on the dividend creation inputs.

  6. Step 3 should be run in the backend when the dividend computation is approved/finalized.

Additional references (see PDF in comments)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Building needed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions