# saaqeb/itt-enterprise-sandbox architecture

> Architecture diagram of the GitHub repository saaqeb/itt-enterprise-sandbox, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saaqeb/itt-enterprise-sandbox
- Repository: https://github.com/saaqeb/itt-enterprise-sandbox

## Overview

1. This is a PHP, Apache-hosted travel commerce monolith rather than a single app. The repository is split into three major runtime surfaces: `CoreEngine_ServiceAPI` for backend API/services, `b2b_application` for the partner/admin web portal, and `OnlinePaymentGateway` for payment processing. A fourth area, `AdminAPI`, sits inside `CoreEngine_ServiceAPI` and exposes admin-oriented operations.

2. The core domain is travel booking and fulfillment. The backend supports flights, hotels, cars, tours, transfers, visas, train, insurance, and eSIM. Each domain has its own endpoint set for search, validation, booking creation, booking details, cancellation, update, and ticket/voucher issuance.

3. The code is organized in a classic layered PHP style: thin endpoint scripts call shared domain classes under `class/`, which then talk to supplier adapters, the database, and notification/payment services. This pattern repeats across the API and portal, so architecture diagrams should show many page/controller entrypoints feeding into shared business logic, not a single central framework router.

4. Supplier integration is a major subsystem. The `class/*_supplier_class` directories contain adapters for many third-party providers, especially for flights and hotels, plus eSIM, insurance, transfer, train, and tour suppliers. These adapters are used by search and booking flows to translate internal requests into supplier-specific APIs or GDS commands.

5. Booking lifecycle processing is stateful and crosses multiple subsystems. Typical flow is: search or quote → validate availability/price → create booking/order → optionally pay → issue ticket/voucher/confirmation → later cancel/reissue/refund/void if needed. The same lifecycle is reflected in both customer-facing endpoints and management tools.

6. Payments are isolated into `OnlinePaymentGateway`, which behaves like a standalone gateway host. It contains per-provider handlers and webhooks for providers such as bKash, Nagad, SSLCommerz, Stripe, PayPal, PayFast, and others. The payment layer feeds back into booking and finance status updates through callbacks/IPN/webhook-style entrypoints.

7. The `b2b_application` directory is the operational portal for partners and internal staff. It is heavily page-based with AJAX endpoints for flight/hotel booking, finance, reports, partner management, supplier configuration, support tickets, and subscription management. The portal also owns a large static UI asset bundle under `resources/` for charts, calendars, editors, forms, and booking widgets.

8. Finance is a first-class subsystem and is split between booking records and accounting views. There are ledgers, invoices, payment requests, refunds, partial payments, reconciliation, and balance summaries in both the API and the portal. This suggests a shared financial model backing operational booking events and partner settlement workflows.

9. Reporting and analytics are broad and operationally important. There are dedicated report classes and report pages for sales, top-up, refunds, issue/reissue, booking failure, login activity, supplier activity, and partner performance. Many of these reports are read-only views over the same transactional data used by bookings and finance.

10. Background processing is handled through extensive cron job directories. Scheduled jobs cover hold auto-cancellation, currency rate updates, campaign sending, log uploads, payment verification, accounting corrections, report generation, PNR/booking synchronization, and supplier-specific maintenance. In an architecture diagram, these should be shown as asynchronous workers reading/writing the same core data stores as the web/API layer.

11. Webhooks are another boundary into the system. There are webhook endpoints for suppliers and messaging services, including eSIM notifications and payment-related callbacks. These endpoints update booking state or operational logs without direct user interaction.

12. Authentication and authorization are shared concerns across the portal and APIs. The repo includes login, secure login/OTP, Google Authenticator/2FA, token validation, and user/team/permission management. Partner and admin users are treated as distinct surfaces, with separate login paths and session handling.

13. Content and engagement features are embedded alongside transactional flows. Articles, widgets, banners, marquee messages, newsletters, push messaging, and email templates are managed through both API and portal modules. These features are powered by shared media/config assets and are used to drive marketing and homepage content.

14. Supporting infrastructure is file-based and conventional for legacy PHP hosting: `.htaccess` routing, `includes/dbconfig.php` for database access, static JSON/config files for some supplier credentials and lookup data, and bundled third-party libraries such as Google2FA, CKEditor, FullCalendar, ApexCharts, and payment SDKs. The repository also includes GitHub workflow files for deployment, indicating CI/CD around this monolith rather than service-by-service deployment.

Main entry points: [`CoreEngine_ServiceAPI/class`](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/class) (Booking engine), [`CoreEngine_ServiceAPI/AdminAPI`](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/AdminAPI) (Admin API), [`CoreEngine_ServiceAPI/finance`](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/finance) (Finance API), [`CoreEngine_ServiceAPI`](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI) (API entrypoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core_api["CoreEngine API"]
  node_core_entrypoints["API entrypoints<br/>PHP endpoints"]
  node_core_adminapi["Admin API<br/>admin endpoints"]
  node_core_booking_engine["Booking engine<br/>domain services"]
  node_core_finance["Finance API<br/>billing & ledger"]
  node_core_reports["Reports API<br/>analytics views"]
  node_core_users["User auth<br/>identity & access"]
  node_core_payments_hooks["Webhooks<br/>callbacks"]
  node_core_crons["Cron jobs<br/>async workers"]
  node_core_content_widgets["Content APIs<br/>CMS-ish modules"]
end

subgraph group_portal["B2B Portal"]
  node_portal_entrypoints["Portal pages<br/>web portal"]
  node_portal_ajax["Portal AJAX<br/>page actions"]
  node_portal_management["Management console<br/>ops portal"]
  node_portal_payment_ui["Checkout UI<br/>payment front-end"]
  node_portal_finance["Portal finance<br/>ledger views"]
end

subgraph group_gateway["Payment Gateway"]
  node_gateway_entrypoints["Gateway entrypoints<br/>payment host"]
  node_gateway_handlers["Provider handlers<br/>payment adapters"]
end

subgraph group_shared["Shared Layer"]
  node_core_supplier_adapters["Supplier adapters<br/>integration layer"]
  node_shared_auth_config["Auth & config<br/>legacy infra"]
  node_shared_resources["Static assets<br/>ui assets"]
end

node_core_entrypoints -->|"calls"| node_core_booking_engine
node_core_entrypoints -->|"integrates"| node_core_supplier_adapters
node_core_entrypoints -->|"uses"| node_core_finance
node_core_entrypoints -->|"authenticates"| node_core_users
node_core_adminapi -->|"administers"| node_core_booking_engine
node_core_adminapi -->|"configures"| node_core_supplier_adapters
node_core_adminapi -->|"operates"| node_core_finance
node_core_adminapi -->|"reads"| node_core_reports
node_core_adminapi -->|"manages"| node_core_users
node_core_adminapi -->|"publishes"| node_core_content_widgets
node_core_booking_engine -->|"delegates"| node_core_supplier_adapters
node_core_booking_engine -->|"posts"| node_core_finance
node_core_booking_engine -->|"updates via"| node_core_payments_hooks
node_core_crons -->|"synchronizes"| node_core_booking_engine
node_core_crons -->|"reconciles"| node_core_finance
node_core_payments_hooks -->|"confirms"| node_core_booking_engine
node_core_payments_hooks -->|"settles"| node_core_finance
node_portal_entrypoints -->|"drives"| node_portal_ajax
node_portal_entrypoints -->|"consumes"| node_core_entrypoints
node_portal_management -->|"uses"| node_core_adminapi
node_portal_management -->|"interacts via"| node_portal_ajax
node_portal_payment_ui -->|"redirects to"| node_gateway_entrypoints
node_portal_payment_ui -->|"tracks"| node_core_finance
node_gateway_entrypoints -->|"dispatches"| node_gateway_handlers
node_gateway_entrypoints -->|"notifies"| node_core_finance
node_gateway_entrypoints -->|"updates"| node_core_booking_engine
node_shared_auth_config -->|"supports"| node_core_entrypoints
node_shared_auth_config -->|"supports"| node_portal_entrypoints
node_shared_auth_config -->|"supports"| node_gateway_entrypoints
node_shared_resources -->|"powers"| node_portal_entrypoints
node_shared_resources -->|"feeds"| node_core_content_widgets

click node_core_entrypoints "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI"
click node_core_adminapi "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/AdminAPI"
click node_core_booking_engine "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/class"
click node_core_supplier_adapters "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/class"
click node_core_finance "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/finance"
click node_core_reports "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/reports"
click node_core_users "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/user"
click node_core_payments_hooks "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/webhook"
click node_core_crons "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/cronjobs"
click node_core_content_widgets "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/widget"
click node_portal_entrypoints "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application"
click node_portal_ajax "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/ajax"
click node_portal_management "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/management"
click node_portal_payment_ui "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/checkout"
click node_portal_finance "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/finance"
click node_gateway_entrypoints "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/OnlinePaymentGateway"
click node_gateway_handlers "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/OnlinePaymentGateway/class"
click node_shared_auth_config "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/includes"
click node_shared_resources "https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/resources"

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_core_entrypoints,node_core_adminapi,node_core_booking_engine,node_core_finance,node_core_reports,node_core_users,node_core_payments_hooks,node_core_crons,node_core_content_widgets toneBlue
class node_portal_entrypoints,node_portal_ajax,node_portal_management,node_portal_payment_ui,node_portal_finance toneAmber
class node_gateway_entrypoints,node_gateway_handlers toneMint
class node_core_supplier_adapters,node_shared_auth_config,node_shared_resources toneRose
```

## Components

### CoreEngine API

Backend service surface for booking, finance, admin, cron, and webhooks.

- [API entrypoints](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI): PHP endpoints · Thin HTTP scripts for search, validation, booking, finance, reports, users, widgets, and content APIs. · `CoreEngine_ServiceAPI`
- [Admin API](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/AdminAPI): admin endpoints · Admin-oriented operations for bookings, finance, suppliers, reports, settings, widgets, and partner management. · `CoreEngine_ServiceAPI/AdminAPI`
- [Booking engine](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/class): domain services · Stateful booking lifecycle handling across search, validate, create, issue, cancel, refund, and sync flows. · `CoreEngine_ServiceAPI/class`
- [Finance API](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/finance): billing & ledger · Invoices, payment requests, reconciliation, refunds, partial pay, and balance summaries. · `CoreEngine_ServiceAPI/finance`
- [Reports API](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/reports): analytics views · Operational sales, purchase, top-up, transaction, supplier, and service-status reporting. · `CoreEngine_ServiceAPI/reports`
- [User auth](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/user): identity & access · Login, secure login, OTP, password reset, SSO, profiles, team members, and permissions. · `CoreEngine_ServiceAPI/user`
- [Webhooks](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/webhook): callbacks · Inbound supplier and messaging callbacks that update booking state or logs asynchronously. · `CoreEngine_ServiceAPI/webhook`
- [Cron jobs](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/cronjobs): async workers · Scheduled jobs for auto-cancel, payment verification, currency updates, reporting, sync, and maintenance. · `CoreEngine_ServiceAPI/cronjobs`
- [Content APIs](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/widget): CMS-ish modules · Articles, marketing content, widgets, banners, marquee messages, newsletters, and push/email helpers. · `CoreEngine_ServiceAPI/widget`

### B2B Portal

Partner and staff web portal with booking, operations, reporting, and management.

- [Portal pages](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application): web portal · Partner and internal staff portal pages for booking, finance, reports, suppliers, settings, and management. · `b2b_application`
- [Portal AJAX](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/ajax): page actions · Page-level AJAX endpoints that drive searches, booking actions, operational edits, and grid updates. · `b2b_application/ajax`
- [Management console](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/management): ops portal · Staff console for bookings, suppliers, finance, reports, articles, marketing, support, settings, and user management. · `b2b_application/management`
- [Checkout UI](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/checkout): payment front-end · Portal payment pages that hand off to provider-specific checkout and IPN flows. · `b2b_application/checkout`
- [Portal finance](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/finance): ledger views · Ledger, invoices, payments, refunds, and partner payment slip workflows in the portal. · `b2b_application/finance`

### Payment Gateway

Standalone online payment host with provider handlers and callbacks.

- [Gateway entrypoints](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/OnlinePaymentGateway): payment host · Public payment scripts for provider checkout, validation, refund, void, review, and webhooks. · `OnlinePaymentGateway`
- [Provider handlers](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/OnlinePaymentGateway/class): payment adapters · Provider-specific gateway classes for bKash, Nagad, SSLCommerz, Stripe, PayPal, PayFast, and others. · `OnlinePaymentGateway/class`

### Shared Layer

Common domain logic, supplier adapters, auth, config, and assets used across surfaces.

- [Supplier adapters](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/class): integration layer · Per-domain adapters for flight, hotel, car, tour, transfer, train, insurance, activity, and eSIM providers. · `CoreEngine_ServiceAPI/class`
- [Auth & config](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/CoreEngine_ServiceAPI/includes): legacy infra · Shared dbconfig, auth, htaccess routing, and file-based credential/config assets. · `CoreEngine_ServiceAPI/includes`
- [Static assets](https://github.com/saaqeb/itt-enterprise-sandbox/tree/main/b2b_application/resources): ui assets · Bundled UI libraries, charts, editors, calendars, JSON lookup data, and voucher assets. · `b2b_application/resources`

## Connections

- API entrypoints → Booking engine: calls · API scripts invoke shared booking logic.
- API entrypoints → Supplier adapters: integrates · Search and booking endpoints translate into supplier APIs.
- API entrypoints → Finance API: uses · Booking and customer APIs read/write financial state.
- API entrypoints → User auth: authenticates · User-facing endpoints share login and access control.
- Admin API → Booking engine: administers · Admin operations manage booking lifecycle state.
- Admin API → Supplier adapters: configures · Supplier setup, firewall, queue, and credential management.
- Admin API → Finance API: operates · Admin finance pages update ledgers, gateways, invoices, and refunds.
- Admin API → Reports API: reads · Admin reporting views are built on transactional data.
- Admin API → User auth: manages · AdminAPI includes staff, partner, and permission management.
- Admin API → Content APIs: publishes · Content, marketing, and widget management endpoints live here.
- Booking engine → Supplier adapters: delegates · Booking flows validate and fulfill through supplier-specific implementations.
- Booking engine → Finance API: posts · Bookings create invoices, payment requests, refunds, and settlement records.
- Booking engine → Webhooks: updates via · Booking state is finalized by inbound payment/webhook callbacks.
- Cron jobs → Booking engine: synchronizes · Scheduled jobs reconcile holds, ticketing, PNR sync, and cancellations.
- Cron jobs → Finance API: reconciles · Async jobs verify payments, correct accounting, and regenerate reports.
- Webhooks → Booking engine: confirms · Supplier and messaging callbacks update operational booking state.
- Webhooks → Finance API: settles · Payment callbacks mark transactions and refunds complete.
- Portal pages → Portal AJAX: drives · Portal pages rely on AJAX endpoints for interactive operations.
- Portal pages → API entrypoints: consumes · Customer-facing portal features call the service API.
- Management console → Admin API: uses · Operations console is largely a UI over AdminAPI.
- Management console → Portal AJAX: interacts via · Management pages use many local AJAX handlers.
- Checkout UI → Gateway entrypoints: redirects to · Checkout pages hand off payment to the gateway host.
- Checkout UI → Finance API: tracks · Portal checkout updates invoice and payment state.
- Gateway entrypoints → Provider handlers: dispatches · Gateway scripts delegate to provider-specific classes.
- Gateway entrypoints → Finance API: notifies · Payment completion feeds back to finance and booking records.
- Gateway entrypoints → Booking engine: updates · Gateway callbacks finalize booking payment and issuance state.
- Auth & config → API entrypoints: supports · Core API scripts share DB, auth, and routing infrastructure.
- Auth & config → Portal pages: supports · Portal pages use shared auth/config conventions.
- Auth & config → Gateway entrypoints: supports · Gateway host also uses shared database configuration.
- Static assets → Portal pages: powers · Portal pages use bundled JS, CSS, JSON, and UI libraries.
- Static assets → Content APIs: feeds · Content and widget APIs populate shared front-end assets.
