How dravasp/ccavenuepaymentgatewaymagentoseamless works
Project type and purpose
• This is a Magento 2 payment‐gateway integration module (dravasp/ccavenuepaymentgatewaymagentoseamless).
• It implements a new payment method “CCAvenue MCPG” in both the storefront checkout and admin configuration, handling all communication to/from the CCAvenue Internet Payment Gateway.
A. Magento Application
• Frontend (storefront)
– Controllers: Place.php, Redirect.php, ReturnUrl.php, SilentPost.php
– Blocks & Templates: view/frontend templates + view/frontend/web/js/… (KnockoutJS, RequireJS)
– UI ConfigProvider for checkout payment method
• Adminhtml (backend)
– System Configuration UI: etc/adminhtml/system.xml, CcavenuepayRules.php block
– Order view info: FraudDetails, other info blocks under Block/Adminhtml
– Admin controllers for module upload/update
• Business Logic & Service Layer
– Model/Method/Adapter for payment method configuration and behavior
– Model/TransactionService for order capture, void, refund
– Model/Session, Config, IframeConfigProvider
• Gateway Layer
– Gateway/Http/Client (real & mock), TransferFactory
– Gateway/Request (AuthorizationRequest, CaptureRequest, VoidRequest, MockDataRequest)
– Gateway/Response (TxnIdHandler, FraudHandler)
– Gateway/Validator/ResponseCodeValidator
– Factories to assemble/decode CCAvenue payloads
• Event/Observer Layer
– observers wired in etc/events.xml (e.g., DataAssignObserver, SaveOrderAfterSubmitObserver)
– listens for checkout and order events, enriches requests/responses
• Data persistence
– Magento database (orders, payment transactions, module config stored in core_config_data)
B. CCAvenue External Payment Gateway
– Endpoints:
• test.ccavenue.com/transaction.do?command=initiateTransaction
• secure.ccavenue.com/transaction.do?command=initiateTransaction
– Payload encryption/decryption (AES-256-CBC)
– Webhooks/Callbacks: ReturnUrl, SilentPost
Architectural patterns & design principles
• MVC (Controllers, Blocks as view‐models, PHTML templates)
• Gateway Pattern encapsulating HTTP transport, transfer objects
• Factory Pattern for Request/Response object creation
• Observer Pattern for reacting to Magento events
• Dependency Injection per di.xml
Key technologies, frameworks, libraries
• PHP 7.x, Magento 2.4.x (Composer-based)
• KnockoutJS & RequireJS for payment form UI (view/frontend/web/js)
• AES-256-CBC encryption in Helpers for payload security
• Magento’s Gateway/Http client or client mock for unit testing
• PHPUnit tests under Test/Unit