-
Notifications
You must be signed in to change notification settings - Fork 272
Description
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
- Ask for
- Modify the Dividends page to show such computations^ and allow admin to confirm it
- Finalizing the round should create the
Dividend
records from theDividendComputation
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 theInvestorDividendRound
records and calls#send_dividend_issued_email
)
- Finalizing the round should create the
- 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:
- 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. - Admin can review and finalize the
DividendComputation
which would create the dividends/dividend_round and trigerr a fund pull - 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) - 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:
-
dividend_computation = DividendComputationGeneration.new(...).process
-
Ensure nothing seems off in CSVs generated by
dividend_computation.to_csv
,dividend_computation.to_per_investor_csv
, anddividend_computation.to_final_csv
-
dividend_computation.generate_dividends
-
Step 1 should be run when a new dividend computation request is issued from the UI.
-
Step 2 should be run to show the amounts investors would get based on the dividend creation inputs.
-
Step 3 should be run in the backend when the dividend computation is approved/finalized.