Skip to main content

Business Processes Overview

This document provides a comprehensive overview of all business processes supported by SureMSA, including customer onboarding, subscription management, order processing, and financial workflows.

Core Business Entities​

SureMSA operates with interconnected business entities that form the foundation of all processes:


1. Customer Lifecycle Process​

The customer lifecycle tracks the journey from prospect to active customer with subscriptions and licenses.

Customer Creation API​

  • Endpoint: POST /customers
  • Auto-generates: customerCode from fullName
  • External Systems: Optional (Salesforce, QuickBooks)
  • Channel: INTERNAL, SALESFORCE, WOO_COMMERCE, QUICKBOOKS

2. Shopping Cart & Order Flow​

The Cart is the central object for creating orders, subscriptions, and handling product purchases.

Cart Stages Explained​

StageDescriptionNext Stages
DRAFTInitial cart creation, adding/removing productsPLACED, CANCELED
PLACEDCart submitted for processing, payment pendingPAYMENT_IN_PROGRESS, AWAITING_ACCEPT, CANCELED
PAYMENT_IN_PROGRESSPayment processing via Stripe/GatewayPAYMENT_COMPLETED, CANCELED
AWAITING_PAYMENTWaiting for credit payment confirmationPAYMENT_COMPLETED, CANCELED
PAYMENT_COMPLETEDPayment successful, order creation in progressCOMPLETED
AWAITING_ACCEPTWaiting for manual acceptance/approvalCOMPLETED, CANCELED
COMPLETEDOrder created, licenses provisioned-
CANCELEDCart canceled or payment failed-

3. Financial Transaction Workflows​

SureMSA supports three main financial document types: Quotes, Orders, and Invoices.

3.1 Quote → Order → Invoice Flow​

3.2 Quote Workflow Statuses​

3.3 Order Processing Statuses​

3.4 Invoice Statuses​


4. Subscription & License Management​

Subscription Transaction Types​

TypeDescriptionCart Stage Trigger
NEWNew subscription creationCOMPLETED (no existing subscription)
UPGRADEAdd products/users to existing subscriptionCOMPLETED (modify existing)
RENEWSubscription renewalCOMPLETED (extend dates)
DOWNGRADERemove products/usersCOMPLETED (reduce scope)
CANCELTerminate subscriptionCANCELED

5. Payment Methods & Processing​


6. Credit Balance System​

SureMSA supports a multi-level credit balance system for prepaid/credit-based payments.


7. External System Integrations​


API Endpoints by Process​

Customer Management​

  • POST /customers - Create customer
  • GET /customers/{id} - Get customer details
  • GET /customers?code={code} - Get by customer code

Cart Management​

  • POST /cart - Create/update cart
  • GET /cart/{id} - Get cart
  • POST /cart/set/placed/{id} - Place cart
  • POST /cart/set/completed/{id} - Complete cart
  • POST /cart/set/canceled/{id} - Cancel cart

Order Processing​

  • POST /orders - Create order
  • GET /orders/{id} - Get order
  • Orders auto-created from completed carts

Quote Management​

  • POST /quotes - Create quote
  • PUT /quotes/{id}/status - Update quote status
  • POST /quotes/{id}/convert-to-cart - Convert to cart

Subscription Management​

  • POST /subscriptions - Create subscription
  • GET /subscriptions/{id} - Get subscription
  • GET /subscriptions?billingProjectId={id} - Get by billing project ID

License Management​

  • POST /licenses - Create license
  • GET /licenses/{id} - Get license
  • POST /licenses/{id}/activate - Activate license

Payment Processing​

  • POST /payments - Create payment
  • GET /payments/{id} - Get payment status
  • Stripe webhooks handle async updates

Key Business Rules​

Customer Code Generation​

  • Source: Customer's fullName
  • Format: First 9 characters, lowercase, alphanumeric
  • Uniqueness: Auto-increments if duplicate (sterlingb1, sterlingb2)

Billing Project ID Generation​

  • Source: {customerCode}-{subscriptionName}
  • Format: Lowercase, hyphen-separated, max 10 chars from subscription name
  • Example: sterlingb-enterprise or acme-trial1

Payment Hierarchy​

  1. License-level credits (if available)
  2. Subscription-level credits (if license insufficient)
  3. Customer-level credits (if subscription insufficient)
  4. External payment (Stripe, Invoice) if no credits

Cart to Order Conversion​

  • Cart COMPLETED → Order PAYMENT_COMPLETED
  • Cart products → Order items
  • Auto-creates subscription if needed
  • Provisions licenses automatically

Summary​

SureMSA's business processes are designed around a flexible Cart-based commerce system that supports:

✅ Multiple sales channels: Internal, Salesforce, WooCommerce, QuickBooks
✅ Flexible payment methods: Stripe, Credits, Invoices, External gateways
✅ Comprehensive workflow: Quote → Cart → Order → Invoice → Fulfillment
✅ Automated provisioning: Subscriptions and licenses created automatically
✅ External integrations: Seamless sync with CRM and accounting systems

All processes are exposed via REST APIs and can be automated or integrated with external systems.