Arvan Reseller؛ افزونه فروشندگان ابر آروان
Independent WordPress plugin for reselling ArvanCloud services (Cloud Server, CDN, Object Storage) with prepaid wallet billing (hackathon submission)
by Team Arvan Reseller · github.com/mmte/arvancloud-reseller-plugin
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mmte/arvancloud-reseller-plugin/archive/refs/heads/main.zipReadme
Arvan Reseller — افزونه فروشندگان ابر آروان
An independent WordPress plugin that lets an ArvanCloud reseller sell Cloud Servers, CDN and Object Storage on their own site: display, ordering, provisioning through the ArvanCloud APIs, hourly metering, prepaid-wallet billing, and automatic service suspension/termination that mirrors ArvanCloud's documented policy per product.
Repository: https://github.com/MMTE/arvancloud-reseller-plugin
Zero dependencies: no WooCommerce, no ACF, no theme requirements, no Composer at runtime. Vanilla PHP (7.4+/8.x), core-bundled Sodium for secret storage, WP REST API, vanilla JS/CSS (Sorkhab design system, Persian RTL native).
Status (2026-08-22): all three categories (سرور ابری، شبکه توزیع محتوا (CDN)، فضای ابری (Object Storage)) are implemented end-to-end. Every interface is locked in
docs/CONTRACTS.md; every decision is traced indocs/adr/DECISIONS.md. This README ships final facts only: see CHANGELOG for live progress.
What it does
| Capability | Detail |
|---|---|
| Storefront | Persian RTL pages for سرور ابری / شبکه توزیع محتوا / فضای ابری (Object Storage); plan cards + calculator; two selectable templates (Sorkhab design system) |
| Ordering | 5-step checkout (حساب → سرویس → قیمتگذاری → کیف پول → بازبینی) with per-category configuration (server region/flavor/image، CDN domain + plan، OBS bucket + region + ACL + plan) and transparent base/margin/final pricing |
| Provisioning | ArvanCloud ECC (napi.arvancloud.ir/ecc/v1), CDN (napi.arvancloud.ir/cdn/v4.0) and S3-style Object Storage drivers, each with sandbox + live modes; resource ID mapped to the customer and wallet; retry queue + idempotency |
| Wallets | Custom-table ledger (append-only, balance-after invariant); mock gateway + receipt registration; payment records track pending/success/failed |
| Billing | Hourly cron: usage → cost (+ reseller margin ≤ 20%, pre-VAT) → exact wallet debit; daily invoices; cloud-server traffic tiered per customer-month + IPv4 monthly; CDN/OBS wallet-native plan fees (price ÷ 720 per hour) + PAYG excess |
| Enforcement | Per-product ladders mirroring ArvanCloud's documented policy (below); threshold warning emails; manual restart after recharge (as documented) |
| Settlement | Daily aggregation + mock settlement API simulation |
| Reseller panel | Onboarding wizard (Machine-User key + hackathon-token gate), org info, template picker, financial rules, per-product connection tests, customers/orders/services/finance dashboards |
| Security | Encrypted secrets (Sodium), hashed token allow-list (hash_equals), nonce+capability+ownership on every route, rate limiting, prepared statements, full escaping |
Product coverage — end-to-end per category [D-036]
| Product | Chain | Metering (hourly pass) | Suspend / terminate ladder |
|---|---|---|---|
| سرور ابری (Elastic Compute) | display → order → provision → meter → suspend → terminate | flavor hours (powered-off = disk + IPv4 only) + egress on tier curves per customer-month | 0h lock → 2h network cut → 48h power-off (storage still billed) → 168h permanent delete |
| شبکه توزیع محتوا (CDN) | display → order → provision → meter → suspend → terminate | plan fee (monthly price ÷ 720) + egress above the plan fair-use cap + edge requests on tier curves + DNS requests above plan quota | 0h settings-lock → 24h cloud-icon hold (proxy off) → 336h DNS off; restore = unhold |
| فضای ابری (Object Storage) | display → order → provision → meter → suspend → terminate | plan fee (price ÷ 720) + storage GB-hours above plan quota + egress + read/write requests above plan quotas | 0h panel-lock → 24h write-cut → 48h read-cut → 720h bucket + files purged |
Metering honesty [D-039]: live OBS storage is exact (x-rgw-bytes-used); egress and requests are billed only on plugin-proxied traffic because the S3 API exposes no per-bucket counters — nothing is estimated. CDN fair-use caps are reseller-set defaults (ArvanCloud publishes no number).
Extensibility — REST first
«رابط REST سطح توسعهپذیری است؛ صفحات تنها یک مصرفکنندهاند.» The shipped storefront and account pages are one consumer of the arvan/v1 REST surface; any theme or custom frontend can drive the same journeys through Products::checkout_url( $category, $params ) deep links plus the REST contract (GET /catalog, POST /me/orders, GET /me/services, …). No cart and no SKU abstraction are layered on top: the order/configuration model is the commerce layer.
Install
- Copy
arvan-reseller/intowp-content/plugins/and activate — no other plugin, theme change, or core modification needed. - The onboarding wizard starts: Machine-User access key (+ optional extra keys per purpose) → hackathon access token (validated against the embedded allow-list) → organization info → storefront template → financial rules.
- Pages are generated automatically (فروشگاه، سرور ابری، CDN، Object Storage، کیف پول، داشبورد، فاکتورها، …).
- Driver mode:
sandbox(deterministic, demo-safe) orlive(real ArvanCloud API). Sandbox is default.
Dev quick-start (Local by Flywheel): the repo symlinks into the site; bin/wp wraps wp-cli with the Local PHP/MySQL environment.
Documentation map
| Doc | What |
|---|---|
docs/adr/DECISIONS.md |
Every decision (D-001…D-024) traced to challenge.md lines + ArvanCloud source URLs |
docs/CONTRACTS.md |
Operative interfaces: REST routes, options, driver shapes, enums, lifecycle |
docs/2026-08-21-arvan-reseller-spec.md |
Full system spec |
docs/2026-08-21-arvan-reseller-plan.md |
Build plan + streams |
docs/plans/STREAM-BRIEFS.md |
Per-stream dispatch briefs |
docs/demo/DEMO-SCRIPT.md |
Timed demo script + judging coverage |
docs/research/ |
Verified ArvanCloud API/policy/pricing facts (fetched 2026-08-21) |
Scope (per the challenge)
All three categories — Cloud Server, CDN and Object Storage — are implemented end-to-end [D-036]: product pages, checkout, provisioning, hourly metering, per-product suspension ladders and settlement. Real payment integration is out of scope (mock gateway + receipt registration). GPU flavors, volumes/snapshots UI, VNC are out of scope. Live S3 keys for external clients are a reseller manual step (the S3 API provisions none); live OBS egress/request metering is plugin-proxy-only [D-039].
License
GPL-2.0-or-later.
Demo quick-start (local)
bin/wp arvan seed --reset: demo customers (ali.demo/sara.demo/reza.demo,Passw0rd!, dev-only), wallets, services, history. ali.demo owns one service per category: cloud-serversbx-seed-ali, CDN domainshop-cdn.ir(بسته رشد), OBS bucketali-media(growth, ~80 GiB incl.banner.png); the storefront, account panes and reseller panel all render this state immediately.bin/wp arvan test-driver— per-product connection test rows (cloud-server / cdn / object-storage) against the active driver mode; live read-only validation uses the stored keys (Authorization: Apikey …, S3 pair).- Re-run the onboarding wizard on camera:
bin/wp option update arvan_onboarding_complete 0 && bin/wp option update arvan_wizard_skipped 0→ wp-admin → فروشندگان آروان (sidebar label; full brand «افزونه فروشندگان ابر آروان» on the page title). - Mailpit (emails): http://localhost:10000 — Persian RTL threshold/negative/ladder mails (incl. the per-product CDN hold/DNS-off and OBS write-cut/read-cut/purge templates).
- Sandbox driver default; live read-only validated (
Authorization: Apikey <key>). Cron manual:bin/wp arvan cron arvan_billing— one pass bills all three categories (flavor hours, CDN plan fee + egress/requests, OBS plan fee + storage). - CDN demo journey: storefront → شبکه توزیع محتوا → domain + بسته رشد → checkout → fund → order → active detail (CNAME guidance) → cron → plan-fee + egress + requests rows in the ledger.
- OBS demo journey: storefront → فضای ابری → bucket (growth, ir-thr-at1) → checkout → order → credentials «نمایش یکباره» → object browser (list/upload/download/delete on the seeded
ali-mediafiles) → cron → plan-fee + storage rows. - Site: http://localhost:10003 (admin/mahdi1234).
Security note: seeded demo accounts use a fixed dev password (
Passw0rd!) — local/dev environments only; rotate or disable seeding on any public site. Live credentials live only in~/.arvan-creds.jsonand the encryptedwp_arvan_api_keysrow; the repo contains no secrets.
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| submission-2026-08-22 | Aug 22, 2026 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.