Install and enable
Turning the AI Investments addon on — the Extension Manager, the hourly settlement task, the fifteen permission keys, the KYC gate, the affiliate condition and the Super Admin the revenue side depends on.
AI Investments is installed from the Extension Manager like every other add-on:
activate the licence, install the release, finish it with pnpm updator, switch
it on. There is no archive to unpack by hand and no migration to run — the four
tables are created by the schema step of pnpm updator, the same sync that
creates the core schema. After that you confirm the scheduled task exists, hand
out the permissions and decide whether verification is required.
Do core install first. This addon assumes a working platform with wallets, a running cron process and a Super Admin.
Turn the extension on
Three things happen before the switch does anything, in this order: the licence is activated, the release is installed and applied, and only then is the product switched on.
-
Open the Extension Manager. Sign in as an administrator — you need the
edit.extensionpermission; Super Admin has it — and go to Admin → System → Extension Manager. On the Extensions tab (or by searching for AI Investments) find the AI Investments card — product ID35988984— and click it to open the product page. Until its licence is activated the card's chip reads Activate and its switch is disabled, with the tooltip Activate license first.- The AI Investments card — click it to open the product page
- Its switch stays disabled until the licence is activated
-
Activate the licence. On the product page press Activate License. Paste the purchase code from your MashDiv dashboard, optionally an email address for update notifications, and press Activate License. The screen confirms License Activated! and returns you to the product page a couple of seconds later. If the server has no outbound access, the License File tab on the same screen takes the licence certificate downloaded from your MashDiv dashboard instead.
- Paste the purchase code here
- Activate License — then wait for the redirect back to the product page
- The License File tab, for a server with no outbound access
-
Install the release. Back on the product page, now licensed, the Overview tab has a release panel. If it offers Install v…, press it; if it says Up to date on a product you have only just licensed, press Check for Updates once, then install whatever it offers. The Releases tab holds the notes for the version being offered — read them first.
Install downloads the release, verifies it and extracts it over the project root. It runs no migrations, builds nothing and restarts nothing, so finish it from a shell on the server:
pnpm updatorThat is the finalise chain — stop, dependencies, schema, seed data, frontend build, start — and it is what creates the addon's four tables and its routes. If the panel still says Up to date after the check there is nothing to download; go straight to the next step.
- Check for Updates, then Install v… when it is offered
- Releases — the notes for the version you are about to install
- The Enabled switch — step 4, not yet
-
Switch it on. Turn the Enabled switch on — in the product page heading, or on the card in the Extension Manager, which is usable now that the licence is verified. This is what makes the AI Investment entry appear under Extensions → Investment Products in the admin menu, what makes the AI Investment tab render in the trade order form, and what registers the hourly settlement task. It takes effect without a restart; reload the admin panel to see the menu entry.
The admin section is additionally wrapped in a licence gate keyed to the addon's
internal name, ai_investment. The header and footer render regardless, but the
content of every /admin/ai/investment page is held back until the licence
check for that name resolves — which is why the licence is activated before
anything else.
A switch that is greyed out is not a failure: its tooltip reads Activate license
first, and step 2 has not been done yet. A switch that goes on and then reverts
when you reload is — the backend refused the change. Check its log for
EXTENSION.
Confirm the scheduled task
Everything automatic in this product is one cron entry.
The task is registered as processAiInvestments under the ai_investment
category, with a period of one hour. Its title on screen is Process AI
Investments, described as "Processes active AI investments." It scans every
investment at ACTIVE, settles the ones whose term has expired, and leaves the
rest alone.
Go to /admin/system/cron and confirm Process AI Investments is listed. It
runs on the dedicated cron process (port 4001), not on the API process.
The registry follows the Enabled switch and re-syncs periodically, so switching the extension on schedules the job without a backend restart — and switching it off deregisters the job the same way.
Unusually for this platform, the hourly task is not the only settlement path. The
two user-facing read endpoints — the investment list and a single investment —
run the same settlement routine in-line for any matured ACTIVE investment
belonging to the caller before they return.
The practical consequence: with the cron stopped, a user who opens the AI Investments tab is paid, and a user who does not open it is not. Two people who bought the same plan on the same day can be settled days apart. Failures in the in-line path are swallowed deliberately so a broken settlement never blocks a page load, which means nothing on any screen will tell you the cron is down.
The task is safe to run repeatedly. Every payout is written through the wallet service with an idempotency key derived from the investment id and its outcome, the investment row is locked for update inside the settlement transaction, and an already-recorded payout is treated as proof the money was paid rather than as an error to retry.
Make sure a Super Admin exists
A LOSS settlement is revenue: the part of the principal the user does not get
back is credited to the wallet of the oldest user holding the Super Admin
role and recorded as platform profit.
If there is no Super Admin role, or the role exists with no users, the fee
collector logs [CRITICAL] Dropped platform fee — no Super Admin configured and
returns nothing. The settlement itself still completes — the user is paid the
correct amount — but the revenue leg is gone and there is no retry.
One more consequence worth knowing: when the investor is the Super Admin, the
revenue leg is skipped entirely rather than credited back to themselves. Testing
LOSS plans from the Super Admin account will show no platform revenue at all.
That is correct behaviour, not a bug.
WIN settlements are unaffected by any of this — they are recorded as a platform
loss and need no wallet credit.
Grant the permissions
- Open the role you are granting
Fifteen keys control the addon, in three families of five. Assign them at
/admin/crm/role.
| Key | Opens |
|---|---|
access.ai.investment |
The admin dashboard at /admin/ai/investment and its statistics endpoint |
view.ai.investment |
The Investment Logs table and a single investment |
create.ai.investment |
The raw investment-create endpoint |
edit.ai.investment |
The investment edit form and both status actions |
delete.ai.investment |
Deleting and restoring an investment |
access.ai.investment.plan |
The Plans screen |
view.ai.investment.plan |
The plan list and a single plan |
create.ai.investment.plan |
Creating a plan |
edit.ai.investment.plan |
Editing a plan and toggling its status |
delete.ai.investment.plan |
Deleting plans, single and bulk |
access.ai.investment.duration |
The Durations screen |
view.ai.investment.duration |
The duration list and the duration picker used by the plan form |
create.ai.investment.duration |
Creating a duration |
edit.ai.investment.duration |
Editing a duration |
delete.ai.investment.duration |
Deleting durations, single and bulk |
It looks like an edit key and it is not. The same permission gates the two status
actions, and setting an ACTIVE investment to COMPLETED pays out principal
plus profit while CANCELLED or REJECTED refunds the principal. The bulk
action does it for every row selected. Treat it as a finance-desk permission, not
a support one.
access.ai.investment.plan and access.ai.investment.duration gate the admin
pages in the frontend; the endpoints behind them check the view.* key. See
Permissions for how a key maps to an
admin path.
Set the KYC gate
One feature gate applies, enforced server-side:
| Feature | Blocks | Enforced on |
|---|---|---|
invest_ai |
Opening an investment | POST /api/ai/investment/log |
Nothing else in the addon is gated — browsing plans, reading your own investments and cancelling are all ungated.
To make the gate real you need two platform toggles, both under Admin → Settings → Features, Verification: KYC Verification on, and Enforce KYC Feature Access on. The second is off by default, so enabling verification alone changes nothing. Then tick AI Investments on each verification level that should be allowed to invest, in the level builder under Admin → CRM → KYC.
Before the 6.1.1 release AI investments carried no verification requirement at all. This is a new capability rather than a hole being closed, so switching enforcement on will lock out every user whose level does not have the feature ticked. Review every level before you do it.
The purchase panel reads the same gate client-side and replaces the form with an explanation of what is required, so a blocked user sees why rather than a failing submit.
- Open each level in turn
Affiliate rewards
Two referral conditions are seeded for this addon. They only do anything if the
mlm extension is enabled and the MLM system is configured.
AI_INVESTMENT— AI Managed Portfolio Bonus. Fires when a referred user opens an investment, calculated on the invested amount. Seeded at 2% with a minimum of 25, and enabled.AI_INVESTMENT_PROFIT— AI Investment Profit Share. Seeded at 1% with a minimum of 5, and disabled. Nothing in this addon fires it: settlement deliberately does not process rewards, to avoid paying the referrer twice for the same investment. Enabling it in the affiliate conditions screen will not make it pay out.
The reward is processed after the funding transaction commits and is best-effort — a failure there is logged and never rolls back the investment.
Notification templates
Three templates are seeded and can be edited at
/admin/system/notification/template:
| Template | Sent when | Placeholders |
|---|---|---|
NewAiInvestmentCreated |
An investment is opened | FIRSTNAME, PLAN_NAME, AMOUNT, CURRENCY, DURATION, TIMEFRAME, STATUS |
AiInvestmentCompleted |
An investment settles at maturity | FIRSTNAME, PLAN_NAME, AMOUNT, PROFIT, CURRENCY, STATUS |
AiInvestmentCanceled |
Never — see below | FIRSTNAME, PLAN_NAME, AMOUNT, CURRENCY |
AiInvestmentCanceled is seeded and the email helper accepts it, but no route in
the addon sends it. A user who cancels an investment gets their refund and no
message. Neither the admin status action nor the admin delete sends anything
either.
An in-app notification is created on creation and on completion, linking to
/ai/investment/{id}. That path does not exist as a page in this build, so the
notification's action button lands on a not-found screen. The notification text
itself is still the useful part.
Setting MAIL_DISABLED=true in .env stops the platform attempting any outbound
delivery, which is worth doing while you exercise these flows — settlement emits
one completion email per investment.
Verify the install
Work through this on a staging install before you publish a plan:
- The AI Investments card in Admin → System → Extension Manager reads Verified and its switch is on
- AI Investment appears under Extensions → Investment Products in the admin menu
- Process AI Investments is listed at
/admin/system/cron - A Super Admin user exists and is not the account you test with
- Your admin role holds at least
access.ai.investmentandview.ai.investment.plan -
/admin/ai/investmentloads and shows figures rather than an error card - At least one duration exists at
/admin/ai/investment/duration - At least one active plan exists at
/admin/ai/investment/plan, with durations attached - A test user sees the AI Investment tab in the order form on
/trade - A test investment on a 1 HOUR duration settles, and the wallet balance moves by the amount you expect
Then read Creating plans — two fields on the plan form decide what every investor is paid, three more are shown to users but never enter any calculation, and one of those three is a figure you have to keep accurate by hand.