This file provides context for AI coding assistants working with this repository.
This repository contains the Magento 2 Forter Fraud Detection Module. It integrates Forter's fraud prevention capabilities into Magento 2 e-commerce platforms.
Tech Stack: PHP, HTML, JavaScript
The project uses Magento 2's build system. Key commands include:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
-
Install via composer (recommended):
composer require forter/magento2-module-forter -
Or install manually:
- Place contents under
{MAGENTO2-ROOT-DIR}/app/code/Forter/Forter
- Place contents under
-
Run setup commands:
php bin/magento maintenance:enable php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento maintenance:disable php bin/magento cache:flush
- Make changes in the appropriate directories (e.g.,
Block,Controller,Model) - Run compilation and deployment commands
- Test changes thoroughly
- Flush cache
No specific test commands are provided in the given context. Follow Magento 2 testing best practices.
π Block/ # View-related classes
π Adminhtml/ # Admin-specific blocks
π Widget/ # Custom widgets
π Controller/ # Request handling
π Callback/
π Index/
π Cron/ # Scheduled tasks
π Helper/ # Utility classes
π Logger/ # Custom logging
π Model/ # Business logic and data
π ActionsHandler/ # Handling approve/decline actions
π Config/
π Mappers/ # Payment gateway mappers
π Order/
π RequestBuilder/ # Building Forter API requests
π ResourceModel/ # Database interactions
π RmaFactory/
π ThirdParty/ # Integrations with 3rd party services
π Observer/ # Event observers
π Plugin/ # Magento plugins for various components
- Use of Mappers (
Model/Mappers/) for different payment gateways - Request builders (
Model/RequestBuilder/) for constructing API calls - Observers (
Observer/) for various Magento events - Custom logging implementation (
Logger/) - Cron jobs for queue processing and post-decision actions
- Ensure proper error handling in API interactions
- Be cautious with payment gateway integrations
- Handle cron jobs efficiently to avoid performance issues
- Properly sanitize and validate all inputs, especially in controllers
Must Follow:
- β NEVER hardcode secrets, API keys, or credentials
- β NEVER log sensitive data (PII, tokens, passwords)
- β NEVER commit .env files or secrets
- β Use environment variables for all secrets
- β Validate and sanitize all user inputs
- β Follow the principle of least privilege
Additional Guidelines:
- Ensure all API calls use HTTPS
- Implement proper access controls for admin functionality
- Regularly update dependencies to patch security vulnerabilities
- Run Magento 2 code sniffer
- Ensure all new code has appropriate unit tests
- Verify that no sensitive information is being logged
- Run full Magento 2 test suite if available
- Perform manual testing on key workflows
Generated by Forter AI Platform