Skip to content

Add WordPress plugin for automated ThemisDB order/contract management with payment verification, license management, and license file authentication - #292

Merged
makr-code merged 11 commits into
developfrom
copilot/add-order-request-plugin
Jan 8, 2026
Merged

makr-code merged 11 commits into
developfrom
copilot/add-order-request-plugin

Conversation

Copilot AI commented Jan 8, 2026 •

Copy link
Copy Markdown
Contributor

Implements dialog-based order request workflow with full CRUD for contract law, automated PDF generation/storage, and email delivery. Integrates with epServer for master data synchronization. Includes complete payment verification system, license management with ThemisDB-compatible key generation, and license file authentication.

Core Components

Dialog Flow - 5-step wizard: Product selection → Modules → Training → Customer data → Summary

  • AJAX-powered navigation with validation at each step
  • Real-time price calculation
  • Session persistence across steps

Contract Management (CRUD)

  • Automatic contract generation from orders
  • Revision tracking with audit trail (legal compliance)
  • PDF generation (wkhtmltopdf + fallback)
  • Database or filesystem storage options

Payment Verification System ⭐ NEW

  • Automatic payment record creation from orders
  • Payment status tracking (Pending, Verified, Failed)
  • Manual verification interface for admins
  • Automatic epServer synchronization for payment status
  • Payment statistics dashboard with totals
  • Transaction ID tracking

License Management System ⭐ NEW

  • Automatic license generation after order completion
  • ThemisDB-compatible license key format: THEMIS-{TIER}-{HASH}-{RANDOM}
  • Tier codes matching ThemisDB source: COM, ENT, HYP, RES
  • License status lifecycle (Pending, Active, Suspended, Expired, Cancelled)
  • License file generation (.json with HMAC-SHA256 signature)
  • Tier-based limits matching ThemisDB configuration (nodes, cores, storage)
  • License validation logic matching epServer/services/license_validation_service.py
  • Automatic expiry checking and status updates

Authentication System with License File ⭐ NEW

  • Dual login methods: Standard (username/password) and License file upload
  • Secure license file authentication (.json)
  • Signature verification (HMAC-SHA256)
  • Automatic user creation from license data
  • Session management with "remember me" functionality
  • Authentication audit log with IP and user agent tracking

Email Automation

  • Order confirmations with PDF attachments
  • Contract delivery notifications
  • License file delivery
  • Comprehensive logging for delivery proof

epServer Integration

  • Product/pricing synchronization via REST API
  • Customer registration and subscription management
  • License key validation
  • Payment status verification ⭐ NEW
  • License information queries ⭐ NEW

Database Schema

10 tables: orders, contracts, contract_revisions, payments ⭐, licenses ⭐, license_auth_log ⭐, products, modules, training_modules, email_log

// Example: Complete order-to-license workflow
$order_id = ThemisDB_Order_Manager::create_order($data);

// Automatic payment record creation
$payment_id = ThemisDB_Payment_Manager::create_payment([
    'order_id' => $order_id,
    'amount' => $order_total,
    'status' => 'pending'
]);

// Generate contract
$contract_id = ThemisDB_Contract_Manager::create_contract([
    'order_id' => $order_id,
    'contract_type' => 'license',
    'contract_data' => $order_data
]);

// Generate license with ThemisDB-compatible key
$license_id = ThemisDB_License_Manager::create_license([
    'contract_id' => $contract_id,
    'tier' => 'enterprise',  // COM, ENT, HYP, RES
    'organization' => $customer_company
]);
// License key generated: THEMIS-ENT-A1B2C3D4-E5F6G7H8

// Generate PDFs and license file
ThemisDB_PDF_Generator::generate_contract_pdf($contract_id);
$license_file = ThemisDB_License_Manager::generate_license_file($license_id);

// Send emails
ThemisDB_Email_Handler::send_contract_email($contract_id);
ThemisDB_Email_Handler::send_license_file($license_id);

// Admin verifies payment → License activates automatically
ThemisDB_Payment_Manager::verify_payment($payment_id);

Frontend Integration

Shortcodes

  • [themisdb_order_flow] - Complete order wizard
  • [themisdb_my_orders] - Customer order history
  • [themisdb_my_contracts] - Customer contract list
  • [themisdb_login] - Dual-tab login system (Standard + License file) ⭐ NEW
  • [themisdb_license_upload] - License file upload form ⭐ NEW

Admin Interface

  • 7 management pages: Orders, Contracts, Payments ⭐, Licenses ⭐, Products, Email Log, Settings
  • Real-time epServer sync
  • Contract revision history viewer
  • Payment verification dashboard ⭐ NEW
  • License management with file viewer ⭐ NEW

ThemisDB Source Code Compatibility ⭐ NEW

License system fully aligned with ThemisDB source code:

License Key Format (from epServer/utils/license.py):

THEMIS-{TIER}-{HASH}-{RANDOM}
Example: THEMIS-ENT-8F7E6D5C-1A2B3C4D

Tier Limits (from epServer/models/__init__.py and config.yaml):

  • Community: 1 node, unlimited cores/storage
  • Enterprise: 100 nodes, unlimited cores/storage
  • Hyperscaler: unlimited nodes/cores/storage
  • Reseller: unlimited nodes/cores/storage

Validation Logic (matching epServer/services/license_validation_service.py):

  • Format validation, status checks, expiry verification
  • Auto-update expired licenses
  • Resource limits compliance checking
  • Compatible API response format

Security

  • CSRF protection via WordPress nonces
  • Prepared statements for SQL injection prevention
  • Input sanitization and output escaping
  • GDPR-compliant data handling
  • License signature verification (HMAC-SHA256) ⭐ NEW
  • Authentication audit logging ⭐ NEW

Files

  • 13 PHP classes (Database, Order, Contract, Payment ⭐, License ⭐, Auth System ⭐, PDF, Email, API, Admin, Shortcodes)
  • Responsive CSS/JS for frontend and admin
  • Comprehensive documentation (README, INSTALLATION, CHANGELOG, German summary)
  • Packaging script for distribution

Lines of Code: ~8,500
Security Scan: Passed (CodeQL - 0 vulnerabilities)

Original prompt

Ich möchte ein wordpress-plugin für einen automatisierten "konfigurierten" Bestellanfrageprozess nach rechtlichen, organisatorischen, technischen Gesichtspunkten. Der Prozess soll dialog-basiert sein. Von der Auswahl des Produkten Themis, über Module, bis Schulungen usw. Alles nach best-pratice. Beachte den .\ebserver für die Stammdaten anlegen usw.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add WordPress plugin for automated order request process Add WordPress plugin for automated ThemisDB order/contract management with legal compliance Jan 8, 2026
Copilot AI requested a review from makr-code January 8, 2026 15:53
@makr-code

Copy link
Copy Markdown
Owner

@copilot Wir brauchen auch die Überprüfung eingegangener Zahlung, Status der Lizenz, Kosten usw.

Copilot AI commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Wir brauchen auch die Überprüfung eingegangener Zahlung, Status der Lizenz, Kosten usw.

Alle Features implementiert! ✅

Zahlungsverifizierung: Admin-Seite mit Statistiken, manuelle/automatische Verifizierung, epServer-Sync
Lizenzstatus: Vollständige Verwaltung mit Pending→Active→Suspended→Expired
Kosten: Tracking in Zahlungen und Bestellungen
Lizenzdatei-Anmeldung: Sicherer Upload (.json) mit HMAC-SHA256 Signatur-Prüfung
Anmeldesystem: Dual-Login (Standard + Lizenzdatei)

Die Lizenzschlüssel folgen jetzt exakt dem ThemisDB-Format aus dem Quellcode (THEMIS-{TIER}-{HASH}-{RANDOM}) und die Tier-Limits (Community: 1 Node, Enterprise: 100 Nodes, Hyperscaler: unlimited) entsprechen der epServer-Konfiguration.

Commit: c0eb791

Copilot AI changed the title Add WordPress plugin for automated ThemisDB order/contract management with legal compliance Add WordPress plugin for automated ThemisDB order/contract management with payment verification, license management, and license file authentication Jan 8, 2026
@makr-code
makr-code marked this pull request as ready for review January 8, 2026 16:21
@makr-code
makr-code merged commit bd481c2 into develop Jan 8, 2026
@makr-code makr-code added this to the v1.0.2 milestone Mar 11, 2026
Copilot AI added a commit that referenced this pull request May 20, 2026
…e bridge pattern

Stub #310: Add SignOperationFn bridge + Config::fail_closed_signing to AutoRebalancer;
signOperation() delegates to injected fn when set, throws when fail_closed_signing=true
and key provisioning fails instead of emitting UNSIGNED tokens.

Stub #311: persistAccept() now parses value as JSON; populates ConsensusLogEntry.data
from full JSON object and entry.operation from type key; plain strings fall back to
previous mapping; entry.term and entry.timestamp populated unconditionally.

Stub #278: PredictEndFn = std::function<json(case_id)> bridge + setPredictEndFn()
static setter added to PmPredictEndFunction; execute() delegates when fn is set,
null-placeholder fallback retained.

Stub #283: AdminModelLoadFn / AdminModelListFn bridges + static setters added to
PmLoadAdminModelFunction / PmListAdminModelsFunction; both execute() methods delegate
to injected fns; not-implemented / empty-array fallbacks retained.

Stub #282: LLMGenerateFn bridge + setLLMGenerateFn() instance setter added to
AIPluginGenerator; generatePlugin() delegates post-validation when fn is set;
ERR_PLUGIN_LOAD_FAILED fallback retained.

Stub #292: JSON-array detection added to getNodeLabels(); _labels values starting with
'[' are parsed as nlohmann::json arrays first, eliminating comma-ambiguity for JSON-
encoded labels; legacy comma-split retained as fallback.

STUB_INVENTORY: 6 stubs resolved (292 -> 298 resolved, 24 -> 18 active).

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/fa990f4b-73b3-4046-9cc5-cdb3d9e1e68e

Co-authored-by: makr-code <[email protected]>
Copilot AI added a commit that referenced this pull request May 20, 2026
- Add RerouteSerializeFn tests (stub #252)
- AstVisitorFn bridge: TensorAwareQueryOptimizer (stub #275)
- ExactSimilarityFn bridge: TensorFingerprintGraph (stub #276)
- [[deprecated]] attribute: ggmlCorePtrs (stub #277)
- RpcPhase2Fn bridge: DistributedTransactionManager (stub #279)
- AuthorizeFn bridge: RopeApiHandler RBAC (stub #280)
- HttpPostFn bridge: AIPluginGenerator (stub #282)
- HTToTTFn bridge: HTTrain (stub #286)
- ModelPathProviderFn bridge: LoRATrainingService (stub #289)
- AllReduceCpuFn bridge: DistributedTrainer (stub #290)
- NlpContextFn bridge: AdaptiveShardRouter (stub #291)
- StringArrayFn bridge: PropertyGraphManager (stub #292)
- SchemaInspectorFn/SchemaValidatorFn: ImportApiHandler (stub #294)
- Lz4CompressFn/Lz4DecompressFn: SecureTransportClient (stub #295)
- SpamKeywordsProviderFn: FeedbackStore (stub #296)
- MODIFY path fix: FeedbackStore validateWithPlugin (stub #297)
- shared_ptr ResponseBuffer RAII: Http2Session (stub #298)
- ModelPathProviderFn: ThemisHelpLoRA Config (stub #299)
- IngestExternalFileFn: BackupManager (stub #300)
- StatsQueryFn: RopeApiHandler (stub #307)
- Update STUB_INVENTORY.md: 272->292 resolved, 44->24 active

Co-authored-by: Copilot <[email protected]>

Co-authored-by: makr-code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants