Solutech Engineering
Innovations/Add-on Services

Business Flow

Complete business processes and workflows in the Add-on Services system

Complete Business Flow

The Add-on Services system operates on a comprehensive credit-based model with multiple interconnected workflows.

High-Level Business Process

graph TD
    A[User Views Services Dashboard] --> B{Service Status Check}
    B -->|Service Disabled| C[Display Disabled Message]
    B -->|Service Active| D[Show Current Credits & Threshold]
    D --> E{Credit Level Check}
    E -->|Healthy| F[Allow Service Usage]
    E -->|Low/Empty| G[Show Top-up Warning]
    G --> H[Navigate to Pricing Plans]
    H --> I[Select Pricing Plan]
    I --> J[Generate Invoice]
    J --> K[Choose Payment Method]
    K -->|MPesa| L[STK Push Payment]
    K -->|Card| M[Card Gateway Payment]
    K -->|Complimentary| N[Admin Credit Grant]
    L --> O[Payment Verification]
    M --> O
    N --> P[Credits Added to Account]
    O -->|Success| P
    O -->|Failed| Q[Payment Failed]
    P --> R[User Consumes Service]
    R --> S[Credits Deducted]
    S --> T{Threshold Check}
    T -->|Below Threshold| U[Send Low Credit Alert]
    T -->|Above Threshold| V[Continue Normal Usage]
    U --> G
    V --> R
    F --> R

Detailed Workflow Stages

0. Create Service and Pricing Plans/Rates on Portal

Product Item:

  1. Create product item on Portal (e.g.SMSs, EvaDocs pages) https://portal.solutechlabs.com/billing/product-items/list
  2. Create product item (pricing) plan for the product item just created https://portal.solutechlabs.com/billing/product-item-plans/list
  3. Sync product item to a client

1. Service Discovery & Status Check

User Journey:

  1. User accesses add-on services dashboard
  2. System displays available services with current status
  3. Real-time credit balances and threshold indicators shown
  4. Services can be temporarily disabled via configuration

System Actions:

  • Query active service subscriptions
  • Check service disable configuration
  • Calculate current credit balances
  • Evaluate threshold status for each service
  • Display service cards with status indicators

2. Credit Purchase Flow

Step-by-Step Process:

Plan Selection

  1. User selects service requiring credits
  2. System shows available pricing plans (bundles or rates)
  3. User chooses between:
    • Bundle Plans: Fixed quantity for fixed price (e.g., 100 SMS for KES 500)
    • Rate Plans: Pay-per-use with transparent unit costs (e.g., KES 5 per SMS)

Invoice Generation

  1. System validates selected plan
  2. Creates proforma invoice
  3. Generates PDF document
  4. Stores invoice record with "Pending" status

Payment Processing

  1. User selects payment method:

    • MPesa: STK push to mobile phone
  2. Payment gateway processes transaction

  3. System receives payment confirmation

  4. Invoice status updated to "Closed"

Credit Allocation

  1. Payment verification completed
  2. Credits added to user's service account
  3. Invoice marked as paid
  4. User notified of successful credit purchase

3. Service Consumption Pattern

Credit Usage Flow:

Pre-consumption Validation

// Example: SMS service consumption
$check = (new CheckCreditsAddOnServiceService('SMS Messaging', $sms_count))->handle();

if (!$check['status']) {
    throw new InsufficientCreditsException();
}

Credit Hold Mechanism

For services requiring confirmation (like SMS delivery):

  1. Hold Credits: Reserve credits for pending operations
  2. Execute Service: Perform the actual service (send SMS, process document)
  3. Confirm or Release:
    • Success: Convert held credits to consumed credits
    • Failure: Release held credits back to available balance

FIFO Credit Consumption

Credits are consumed on a First-In-First-Out basis:

  1. Oldest purchased credits are used first
  2. Prevents credit expiration issues
  3. Maintains fair usage across multiple purchases

4. Threshold Monitoring & Alerts

Continuous Monitoring:

  • Real-time monitoring during credit consumption
  • Scheduled threshold checks via cron jobs
  • Configurable threshold values per service

Alert Triggers:

  1. Real-time: When credits are consumed and fall below threshold
  2. Scheduled: Cron job checks all accounts every 15 minutes
  3. Manual: Admin-initiated threshold checks

Notification Levels:

  • Healthy: Credits above threshold
  • Low: Credits at or below threshold but greater than zero
  • Empty: No credits remaining

Business Rules & Constraints

Service Enable/Disable Logic

Services can be disabled per service type via configuration:

// Service disable check in CheckCreditsAddOnServiceService
public function disable(): bool
{
    $service_key = str_replace(' ', '_', strtolower($this->addon_service_key));
    $general_setting = config("settings.disable_addons_for_{$service_key}");

    return !is_null($general_setting) && $general_setting == 'yes';
}

// Examples:
// disable_addons_for_sms_messaging = 'yes'
// disable_addons_for_eva_docs = 'yes'

When Service is Disabled:

  • Users can view existing credit balances
  • Credit purchases remain allowed
  • Credit consumption is blocked with appropriate messaging
  • Service appears in interface but marked as disabled

Credit Hold & Release Mechanism

Hold Credits (Async Operations):

// Hold credits for SMS sending
(new RemoveCreditsFromAddOnServiceService(
        addon_service_key: $service_key, 
        credits_to_remove: $sms_count, 
        hold: true
))->handle();

Release Credits (Failure):

// Return held credits to available balance
(new RemoveCreditsFromAddOnServiceService(
    addon_service_key: $service_key, 
    credits_to_remove: $sms_count
))->release();

Pricing Plan Types

Bundle Plans (rate_type = 'pricing_plan')

  • Fixed quantity for fixed price
  • Example: 100 SMS for KES 500
  • Popular for bulk usage scenarios
  • Often marked as "Recommended"

Rate Plans (rate_type = 'rate')

  • Pay-per-use with transparent unit costs
  • Example: KES 5 per SMS
  • Flexible for variable usage
  • Dynamic quantity selection

Error Handling in Business Flow

Payment Failures

  1. STK Push Timeout: User prompted to retry or contact support
  2. Payments Error: User notified of error and allowed to try again

Credit Consumption Failures

  1. Insufficient Credits: User redirected to purchase more credits
  2. Service Disabled: Clear messaging with alternative options
  3. System Errors: Credits held are automatically released #

This comprehensive business flow ensures smooth operation of the Add-on Services system while providing flexibility for various business scenarios and maintaining excellent user experience.