# wallace-stev/selcom-push-wp architecture

> Architecture diagram of the GitHub repository wallace-stev/selcom-push-wp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wallace-stev/selcom-push-wp
- Repository: https://github.com/wallace-stev/selcom-push-wp

## Overview

This WordPress/WooCommerce plugin adds Selcom USSD wallet payments to checkout. A customer submits checkout; the gateway creates a minimal Selcom order, requests a mobile push, and updates the WooCommerce order while payment is pending. Selcom’s callback later drives the final order status and stock update. The source excerpts support the payment, signing/transport, and callback paths; some gateway code is omitted, so further checkout details are not mapped.

Main entry points: [`epush.php`](https://github.com/wallace-stev/selcom-push-wp/blob/main/epush.php) (Payment gateway), [`apiController.php`](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php) (Order status handling), [`apiconnect.php`](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiconnect.php) (Request signing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_checkout["Checkout"]
  node_gateway["Payment gateway<br/>[epush.php]"]
  node_woo["WooCommerce"]
end

subgraph group_selcom["Selcom API"]
  node_minimal_order["Minimal order request<br/>[apiController.php]"]
  node_ussd_push["USSD push request<br/>[apiController.php]"]
  node_signature["Request signing<br/>[apiconnect.php]"]
  node_http_transport["HTTP transport<br/>[apiconnect.php]"]
end

subgraph group_orders["Orders and callbacks"]
  node_callback_route["Callback endpoint<br/>[apiController.php]"]
  node_order_status["Order status handling<br/>[apiController.php]"]
  node_inventory["Stock updates<br/>[apiController.php]"]
end

node_customer(("Customer"))
node_merchant_admin(("Merchant admin"))
node_selcom_service["Selcom service"]

node_customer -->|"submits checkout"| node_gateway
node_merchant_admin -->|"configures credentials"| node_gateway
node_gateway -->|"creates and updates orders"| node_woo
node_gateway -->|"requests order creation"| node_minimal_order
node_gateway -->|"requests payment push"| node_ussd_push
node_minimal_order -->|"signs request"| node_signature
node_ussd_push -->|"signs request"| node_signature
node_signature -->|"provides digest"| node_http_transport
node_http_transport -->|"sends API request"| node_selcom_service
node_selcom_service -->|"returns response"| node_http_transport
node_selcom_service -->|"posts payment callback"| node_callback_route
node_callback_route -->|"handles callback"| node_order_status
node_order_status -->|"loads and updates order"| node_woo
node_order_status -->|"reduces stock on success"| node_inventory
node_inventory -->|"updates inventory"| node_woo

click node_gateway "https://github.com/wallace-stev/selcom-push-wp/blob/main/epush.php"
click node_minimal_order "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php"
click node_ussd_push "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php"
click node_signature "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiconnect.php"
click node_http_transport "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiconnect.php"
click node_callback_route "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php"
click node_order_status "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php"
click node_inventory "https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway,node_woo toneBlue
class node_minimal_order,node_ussd_push,node_signature,node_http_transport toneAmber
class node_callback_route,node_order_status,node_inventory toneMint
class node_customer,node_merchant_admin,node_selcom_service toneIndigo
```

## Components

### Checkout

- [Payment gateway](https://github.com/wallace-stev/selcom-push-wp/blob/main/epush.php): `epush.php`
- **WooCommerce**

### Selcom API

- [Minimal order request](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php): `apiController.php`
- [USSD push request](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php): `apiController.php`
- [Request signing](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiconnect.php): `apiconnect.php`
- [HTTP transport](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiconnect.php): `apiconnect.php`

### Orders and callbacks

- [Callback endpoint](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php): `apiController.php`
- [Order status handling](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php): `apiController.php`
- [Stock updates](https://github.com/wallace-stev/selcom-push-wp/blob/main/apiController.php): `apiController.php`

### Other components

- **Customer**
- **Merchant admin**
- **Selcom service**

## Connections

- Customer → Payment gateway: submits checkout
- Merchant admin → Payment gateway: configures credentials
- Payment gateway → WooCommerce: creates and updates orders
- Payment gateway → Minimal order request: requests order creation
- Payment gateway → USSD push request: requests payment push
- Minimal order request → Request signing: signs request
- USSD push request → Request signing: signs request
- Request signing → HTTP transport: provides digest
- HTTP transport → Selcom service: sends API request
- Selcom service → HTTP transport: returns response
- Selcom service → Callback endpoint: posts payment callback
- Callback endpoint → Order status handling: handles callback
- Order status handling → WooCommerce: loads and updates order
- Order status handling → Stock updates: reduces stock on success
- Stock updates → WooCommerce: updates inventory
