Order catalogue and checkout – system description

Item rules of the catalogue, the session cart, scheduling of plan changes, balance top-up, and the checkout preview and order placement.

Overview

A browsable tile list of plans, functions, products, services and add-on packages, with a cart, a plan-change bar and a plan matrix; the cart leads to checkout. Checkout has no menu item. Table names carry the installation's own prefix in the database.

Catalogue

  • Endpoints: catalog.list (page size 12, 24, 48, 96, all), catalog.matrix, catalog.matrixblock, catalog.planblock, catalog.cartadd, cartremove, cartclear.
  • Items shown: active plans (with their definition link), functions only with access_type = 'SUBSCRIPTION' and list_price > 0, active products and services, active priced add-on packages. With a store selected, only items assigned to it.
  • The cart lives in the session; item data is loaded by the server from the catalogue, not from the client.
  • catalog.order: error with an empty cart; without checkout view error_checkout_permission; otherwise redirect to checkout. catalog.topup: error below the minimum; Dlbtbilling::payInWallet(..., 'testpay') tops up the client's wallet and issues an invoice and a draft voucher.
  • catalog.changeplan: same plan → error; downgrade → schedulePlanChange() (at expiry, applied by subscription_lifecycle); upgrade → plan into the cart. catalog.cancelplan: deletes the pending change. The button is not shown to the super admin.

Checkout

  • checkout, checkout.recalc, checkout.cartedit: the client selector lists the companies within the user's content permission (default the home client); seller Dlbtorder::sellerClientId; summary Dlbtorder::preview() (items, rejected ones with reasons, payable, discounts).
  • checkout.place (client_id, payment_method, use_wallet, store_id, note): Dlbtorder::create() (beneficiary, billed and payer is the chosen client; Dlbtpricing recalculates the price), then Dlbtorder::pay(); redirect for card; provisioned on a successful charge, otherwise a proforma; ordered items leave the cart.

Permissions and limitations

  • Catalogue list: SYSTEM; order: BASE; changeplan, debug: not classified.
  • Checkout view and place: not classified and not in the old catalogue either, so canAction is false for non-super users until the scan adds them and they are assigned. clientAllowed() checks content permission.
Related topics: order plan permissions