ecommerce-package
An ecommerce site package for the Core boilerplate: catalog
with filtering, cart, checkout/orders with PDF invoices, a wallet, a
pluggable payment gateway (mock by default — no real gateway credentials
exist for this project), a support-ticket system, and three panels: client,
seller, and super-admin. It depends on core-package for auth
(including OTP login — see Core's apps/core/sms.py and
apps/users/services.py), RBAC, and the shared User model — it never
defines its own user/account model.
Single-store or multi-vendor — one setting, one codebase
ECOMMERCE_MULTI_VENDOR (env-driven, see ecommerce/conf.py) switches the
whole package between:
- Multi-vendor (default): any authenticated user can
POST /sellers/apply; an admin approves (POST /admin/sellers/{id}/approval) before they can list products. ManySellerrows can exist. - Single-store:
POST /sellers/applyis disabled (403), and exactly oneSellerrow is auto-provisioned on first access (services.sellers.get_default_seller,user=None— nobody individually owns it) that admins manage directly through the admin-panel endpoints.
Every model/service/endpoint is identical either way — single-store is the
multi-vendor model with exactly one seller, not a second code path. Set it
in the host's .env:
ECOMMERCE_MULTI_VENDOR=True
ECOMMERCE_PAYMENT_GATEWAY=mock
ECOMMERCE_DEFAULT_COMMISSION_RATE=10.00
Payments
No real gateway credentials exist for this project, so the only backend
shipped is MockPaymentGateway (ecommerce/gateways.py) — it "succeeds"
immediately with a fake reference, so wallet top-up and order payment work
end-to-end in dev/tests with zero external accounts. A real gateway
(Zarinpal, Stripe, ...) plugs in as a second PaymentGateway subclass
registered in get_gateway(), selected via ECOMMERCE_PAYMENT_GATEWAY —
nothing else in this package changes. POST /payments/{id}/callback is
where a real (redirect-based) gateway posts back; the mock backend never
needs it since it resolves synchronously.
Wallet
One Wallet per user — both clients (top up, pay for orders, receive
refunds) and sellers (receive sale proceeds minus commission, request
payouts) use the same model. Wallet.balance is a materialized total kept
in sync with the WalletTransaction ledger, the actual audit trail
(services.wallet.apply_transaction, atomic via an F() expression).
Invoices
Generated on demand as a PDF (ecommerce/pdf.py, via reportlab — same
pure-Python choice as the company package's CV generator, no system
libraries needed) from the Invoice row + OrderItem snapshots, never
stored as a file — always in sync, can't go stale.
See Core's AGENT.md §10 ("Package architecture") for the full contract this
package follows.
Install
pip install ecommerce-package
Requires Python 3.10+ and Django 5.2 (via core-package).
Local development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
Installing into a Core-based project
pip install ecommerce-packageinto the host project's venv.- Add
"ecommerce"toINSTALLED_APPSunder# site packages. - Mount its router in
config/api.py:from ecommerce.api import router as ecommerce_router ... api.add_router("/shop", ecommerce_router)
- Add
ECOMMERCE_MULTI_VENDOR/ECOMMERCE_PAYMENT_GATEWAY/ECOMMERCE_DEFAULT_COMMISSION_RATEto.env(see above; all have safe defaults if omitted). python manage.py migrate.
Endpoints
Mounted at whatever prefix the host chooses (/shop in the example above).
Catalog (public reads; category/attribute writes admin-only)
GET /categories,GET /attributesGET /products— paginated, filterable:?category=,?seller_id=,?search=,?min_price=/?max_price=,?in_stock=,?attributes=color:red,size:l,?sort=newest|price_asc|price_desc|nameGET /products/by-slug/{slug}POST/PATCH/DELETE /categories,POST /attributes— admin-only
Cart (logged in)
GET /cart,POST /cart/items,PATCH /cart/items/{product_id},DELETE /cart/items/{product_id},DELETE /cart
Orders (logged in, own orders only)
POST /orders/checkout— splits the cart into one order per sellerGET /orders,GET /orders/{id}POST /orders/{id}/pay-with-wallet,POST /orders/{id}/cancelGET /orders/{id}/invoice— PDF download, only once paid
Wallet / Payments (logged in)
GET /wallet,GET /wallet/transactionsPOST /payments/wallet/topup,POST /payments/orders/{order_id}POST /payments/{payment_id}/callback—auth=None(gateway calls this)
Tickets (logged in, own tickets only)
POST /tickets,GET /tickets,GET /tickets/{id},POST /tickets/{id}/messages,POST /tickets/{id}/close
Seller panel (POST /sellers/apply needs only login; everything else
under /sellers/* needs an approved Seller, via the require_seller
decorator in ecommerce/permissions.py)
POST /sellers/apply,GET/PATCH /sellers/me,PUT /sellers/me/translations/{language},POST /sellers/me/logoGET/POST /sellers/products,PATCH/DELETE /sellers/products/{id},PUT /sellers/products/{id}/translations/{language},PUT /sellers/products/{id}/attributes/{attribute_id}GET /sellers/orders,GET /sellers/orders/{id},POST /sellers/orders/{id}/status,POST /sellers/orders/{id}/refundGET /sellers/wallet,GET /sellers/wallet/transactions,POST /sellers/wallet/payout
Super-admin panel (require_role("admin"), from Core — every route)
GET /admin/sellers,POST /admin/sellers/{id}/approvalGET /admin/products,POST /admin/sellers/{seller_id}/products,PATCH/DELETE /admin/products/{id}GET /admin/orders,GET /admin/orders/{id},POST /admin/orders/{id}/status,POST /admin/orders/{id}/refundGET /admin/payments(read-only oversight)GET /admin/tickets,GET /admin/tickets/{id},POST /admin/tickets/{id}/messages,POST /admin/tickets/{id}/assign,POST /admin/tickets/{id}/close
Known simplifications (deliberate, not oversights)
- Single-SKU products only — no size/color variant matrix with per-variant
stock;
ProductAttribute/ProductAttributeValueare filterable metadata, not inventory-affecting combinations. - No shipping-cost calculation or tax engine —
Order.totalis the item subtotal only. - No coupon/discount-code system.
- Stock is decremented at checkout (order creation), not at payment —
placing an order reserves inventory;
cancel_orderrestores it, but there's no automatic expiry/release for an order left unpaid forever. - Refunds reverse the client's full payment and the seller's net proceeds,
but not the commission line separately (documented in
services.orders.refund_order). - Invoice numbering has a narrow race under concurrent checkouts on the
same day (documented in
services.orders._issue_invoice) — fine for this boilerplate's scope, not something to trust under real concurrent load without backing it with a DB sequence.
Metadata
Release files for ecommerce-package 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ecommerce_package-0.1.0.tar.gz | 35.3 kB | With provenance | Details for ecommerce_package-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ecommerce_package-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ecommerce_package-0.1.0-py3-none-any.whl |
Total release size: 82.3 kB
Release files / ecommerce_package-0.1.0.tar.gz
| Download URL | ecommerce_package-0.1.0.tar.gz |
|---|---|
| Size | 35.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81e77ad25bb1c38ae93257c4fa26e559c03f09602098d7428bf6a3dfc7fedf2d
|
|
BLAKE2b-256 checksum How to use checksums |
3530c748ab051fa2004938737e8b82e0ae37511bdef8cc96ff66db38afe3c37a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / ecommerce_package-0.1.0-py3-none-any.whl
| Download URL | ecommerce_package-0.1.0-py3-none-any.whl |
|---|---|
| Size | 47.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d42ec8d0b73a600d3eabc40897141d24a1f00b68c728750af2035b92bcc2376
|
|
BLAKE2b-256 checksum How to use checksums |
d2984f362e2819ad8b9e788f64054f2df7d12ccbea6cd7b0463918f41f381d14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for ecommerce-package 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ecommerce_package-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.