Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

PayPal for WooCommerce (by Angell EYE) — a WordPress/WooCommerce payment gateway plugin supporting multiple PayPal products. Version 4.6.5, requires PHP 5.4+, WordPress 5.8+, WooCommerce 3.0+.

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Project overview still states a minimum PHP version of 5.4+, but this PR raises Composer’s PHP requirement to 8.1. Update this line to avoid misleading contributors/tools.

Suggested change
PayPal for WooCommerce (by Angell EYE) — a WordPress/WooCommerce payment gateway plugin supporting multiple PayPal products. Version 4.6.5, requires PHP 5.4+, WordPress 5.8+, WooCommerce 3.0+.
PayPal for WooCommerce (by Angell EYE) — a WordPress/WooCommerce payment gateway plugin supporting multiple PayPal products. Version 4.6.5, requires PHP 8.1+, WordPress 5.8+, WooCommerce 3.0+.

Copilot uses AI. Check for mistakes.

## Commands

```bash
# Install dev dependencies
composer install

# Lint (PHPCS with WordPress standards)
composer lint # Full lint check
composer lint:errors # Errors only (uses phpcs-errors.xml.dist)
composer lint:fix # Auto-fix with phpcbf

# Lint a specific file
vendor/bin/phpcs --standard=phpcs.xml.dist path/to/file.php
vendor/bin/phpcbf --standard=phpcs.xml.dist path/to/file.php
```

No build step — JS/CSS are maintained directly (no Webpack/Gulp). No automated test suite exists.

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line says no automated test suite exists, but this PR adds PHPUnit tests and a composer test script. Update the guidance so contributors discover and run the new test suite.

Suggested change
No build step — JS/CSS are maintained directly (no Webpack/Gulp). No automated test suite exists.
No build step — JS/CSS are maintained directly (no Webpack/Gulp). PHPUnit test suite available — run via `composer test`.

Copilot uses AI. Check for mistakes.

## Architecture

### Entry Point & Bootstrap

`paypal-for-woocommerce.php` — main plugin file. Loads shared includes from `angelleye-includes/`, then instantiates `AngellEYE_Gateway_Paypal` (the central controller class defined in the same file). This class registers all payment gateways via the `woocommerce_payment_gateways` filter at priority 1000.

### Gateway Structure

Two generations of gateways coexist:

**Modern (PPCP) — `ppcp-gateway/`:**
- `WC_Gateway_PPCP_AngellEYE` — main gateway class (`angelleye_ppcp`)
- `AngellEYE_PayPal_PPCP_Payment` — payment processing (largest file, ~310KB)
- `AngellEYE_PayPal_PPCP_Smart_Button` — smart button orchestration
- Child gateways: `WC_Gateway_CC_AngellEYE` (cards), `WC_Gateway_Apple_Pay_AngellEYE`, `WC_Gateway_Google_Pay_AngellEYE`
- Traits for shared behavior: `WC_Gateway_Base_AngellEYE`, `AngellEye_PPCP_Core`, `WC_PPCP_Pre_Orders_Trait`, `WC_Gateway_PPCP_Angelleye_Subscriptions_Base`

**Legacy — `classes/`:**
- PayPal Express Checkout (v1 & v2), Pro (DoDirectPayment), Pro PayFlow, Advanced, REST Credit Cards, Braintree
- Each has a corresponding subscriptions subclass in `classes/subscriptions/`
- PayPal/Braintree SDKs bundled in `classes/lib/`

### Key Directories

| Directory | Purpose |
|-----------|---------|
| `ppcp-gateway/` | Modern PayPal Commerce Platform gateway (active development focus) |
| `ppcp-gateway/subscriptions/` | WooCommerce Subscriptions support for PPCP |
| `ppcp-gateway/checkout-block/` | WooCommerce Blocks integration |
| `ppcp-gateway/funnelkit/` | FunnelKit (Aero Checkout, Upsells) integration |
| `ppcp-gateway/ppcp-payment-token/` | Payment tokenization/vaulting |
| `classes/` | Legacy gateway implementations |
| `angelleye-includes/` | Shared utilities, functions, session management |
| `template/` | Admin, email, and customer-facing templates |
| `assets/` | Legacy JS/CSS/images |
| `ppcp-gateway/js/`, `ppcp-gateway/css/` | PPCP-specific frontend assets |

### Integrations

The plugin integrates with: CartFlows (`ppcp-gateway/cartflow/`, `angelleye-includes/cartflows-pro/`), FunnelKit (`ppcp-gateway/funnelkit/`), WooCommerce Subscriptions, WooCommerce Pre-Orders, and WooCommerce Blocks.

## Coding Conventions

- **Class naming**: `WC_Gateway_*_AngellEYE` or `AngellEYE_*` prefix
- **Function naming**: `angelleye_*` or `angelleye_ppcp_*`, wrapped in `if (!function_exists())` checks
- **File naming**: `class-wc-gateway-*.php` for classes, `angelleye-*.php` for function files
- **Constants**: `PAYPAL_*` or `AE_*` prefix, guarded with `if (!defined())`
- **Singleton pattern**: `protected static $_instance` with `instance()` method
- **Code reuse**: Traits over inheritance for cross-cutting concerns (subscriptions, pre-orders, base gateway)
- **Standards**: WordPress Core/Extra/Docs via PHPCS; short array syntax `[]` is allowed
- **Namespace usage**: Minimal — only bundled PayPal/Braintree SDKs use namespaces; plugin code uses class prefixes
- **Logging**: `AngellEYE_PFW_Payment_Logger` singleton; log path via `angelleye_get_log_path()`
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=8.1.0",
"composer/installers": "^2.2"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpunit/phpunit": "^10.0",
"squizlabs/php_codesniffer": "^3.10",
"wp-coding-standards/wpcs": "^3.0"
},
"scripts": {
"lint:errors": "phpcs --standard=phpcs-errors.xml.dist",
"lint": "phpcs --standard=phpcs.xml.dist",
"lint:fix": "phpcbf --standard=phpcs.xml.dist"
"lint:fix": "phpcbf --standard=phpcs.xml.dist",
"test": "phpunit -c tests/Migration/phpunit.xml"
},
"config": {
"sort-packages": true,
Expand Down
6 changes: 6 additions & 0 deletions ppcp-gateway/includes/trait-angelleye-ppcp-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public function angelleye_ppcp_load_class($loadSettingsFields = false) {
include_once ( PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/ppcp-gateway/class-angelleye-paypal-ppcp-migration.php');
}
AngellEYE_PayPal_PPCP_Migration::instance();
// Load refactored migration system (subscription migration with state tracking)
$migration_autoload = PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/src/Migration/autoload.php';
if (file_exists($migration_autoload) && !function_exists('angelleye_ppcp_migration_init')) {
include_once $migration_autoload;
angelleye_ppcp_migration_init();
Comment on lines +46 to +49

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactored migration code uses PHP 8.1+ features (enums, etc.). This include happens without a PHP-version guard, so on older PHP it can fatal as soon as it’s loaded. If older PHP may still run this plugin, add a PHP_VERSION_ID/version_compare() check before including src/Migration/autoload.php / calling angelleye_ppcp_migration_init().

Suggested change
$migration_autoload = PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/src/Migration/autoload.php';
if (file_exists($migration_autoload) && !function_exists('angelleye_ppcp_migration_init')) {
include_once $migration_autoload;
angelleye_ppcp_migration_init();
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 80100) {
$migration_autoload = PAYPAL_FOR_WOOCOMMERCE_PLUGIN_DIR . '/src/Migration/autoload.php';
if (file_exists($migration_autoload) && !function_exists('angelleye_ppcp_migration_init')) {
include_once $migration_autoload;
angelleye_ppcp_migration_init();
}

Copilot uses AI. Check for mistakes.
}
$this->setting_obj = WC_Gateway_PPCP_AngellEYE_Settings::instance();
$this->api_log = AngellEYE_PayPal_PPCP_Log::instance();
$this->api_request = AngellEYE_PayPal_PPCP_Request::instance();
Expand Down
Loading