Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e1e1471
FN-14460 Removed unused test files and deprecated code.
akozubskicr May 12, 2026
2fd317d
FN-14460 Updated dependencies, removed unused test methods, and intro…
akozubskicr May 12, 2026
ae5868e
FN-15832 Added support for new Comfino paywall integration v3 with ne…
akozubskicr May 12, 2026
08bdfd5
FN-14460 Updated tests to use mocked WC_Settings_API instances instea…
akozubskicr May 12, 2026
e808eb1
FN-14460 Integration with new paywall API and new frontend SDK. Added…
akozubskicr May 15, 2026
255bd58
FN-15832 Enhanced paywall SDK integration by introducing PaywallCartS…
akozubskicr May 15, 2026
cf853fc
FN-15832 Refactored script_loader_tag filter to prevent async deferra…
akozubskicr May 15, 2026
06ba693
FN-14460 Updated Comfino paywall integration to dynamically adapt loa…
akozubskicr May 16, 2026
39e9eda
FN-14460 Updated translation strings for pl_PL locale, adjusted line …
akozubskicr May 16, 2026
7a5c1e5
FN-14460 Refactored frontend SDK integration for Blocks and Classic c…
akozubskicr May 16, 2026
75d0d61
FN-14460 Sanitized loan amount input to prevent XSS, improved comment…
akozubskicr May 16, 2026
777129e
FN-14460 Added runtime directory exclusion from WordPress Plugin Chec…
akozubskicr May 16, 2026
f59f181
FN-14460 Refactored Comfino Blocks checkout integration: introduced `…
akozubskicr May 16, 2026
c6103fd
FN-14460 Updated `BUILD_TS` constant and clarified loan parameter com…
akozubskicr May 18, 2026
20aac3c
FN-14460 Updated `BUILD_TS` constant and clarified loan parameter com…
akozubskicr May 18, 2026
ed4fd84
FN-14460 Added fixes for paywall issues with Google CMP and cart upda…
akozubskicr May 18, 2026
5509b00
FN-14460 Updated `getFinancialProducts` to include product types base…
akozubskicr May 19, 2026
35f81b3
FN-14460 Updated Composer dependencies: added `clue/stream-filter`, `…
akozubskicr May 19, 2026
5124133
FN-14460 Added `COMPOSER_AUTH` to workflow for authenticated dependen…
akozubskicr May 19, 2026
c8b587d
FN-14460 Updated test workflow to run PHPUnit directly via `vendor/bi…
akozubskicr May 19, 2026
e87fee7
FN-14460 Enhanced tests with output string expectations for template …
akozubskicr May 19, 2026
7ce4a3a
FN-14460 Removed unused Composer dependencies: `clue/stream-filter`, …
akozubskicr May 19, 2026
c40c79b
FN-14460 Added info to docs about new features
pkaluzinski-comfino May 20, 2026
859f449
FN-14460 Fix typo in docs
pkaluzinski-comfino May 20, 2026
c2bd8ef
FN-14460 Added support for SDK ESM build and `sdkScriptKind` configur…
akozubskicr May 21, 2026
4620baa
Merge remote-tracking branch 'origin/feature/FN-14460' into feature/F…
akozubskicr May 21, 2026
11243e1
FN-14460 Updated tested WordPress and WooCommerce versions to 7.0 and…
akozubskicr May 21, 2026
8f210d9
FN-14460 Refactored `allowedProductsConfig` logic to delegate normali…
akozubskicr May 22, 2026
e5104a7
FN-14460 Refactored frontend SDK script loading to utilize ESM or UMD…
akozubskicr May 22, 2026
1444454
FN-14460 Set client host name in `ApiClient` initialization using sho…
akozubskicr May 22, 2026
2fd2462
FN-14460 Introduced `SensitiveDataRedactor`, `UrlValidator`, and addi…
akozubskicr May 22, 2026
6cea84a
FN-14460 Improved error logging by including exception stack trace as…
akozubskicr May 22, 2026
1a57fcd
FN-14460 Added support for forbidden product types in `allowedProduct…
akozubskicr May 25, 2026
d47baff
FN-14460 Improved paywall container resolution logic to support multi…
akozubskicr May 25, 2026
ece5aae
FN-14460 Updated `BUILD_TS` and modified `composer.json` to remove au…
akozubskicr May 25, 2026
f36bfa6
FN-14460 Fixed issues with GitHub actions test flows - old dependenci…
akozubskicr May 25, 2026
9b23ba9
FN-14460 Improved test environment reliability: ensured writable log/…
akozubskicr May 25, 2026
990cb1c
FN-14460 Enhanced test coverage reporting in GitHub Actions and repla…
akozubskicr May 26, 2026
a6a0aa9
FN-14460 Reduced supported PHP versions in test matrix and removed ou…
akozubskicr May 26, 2026
2358e92
FN-14460 Simplified `require-dev` dependencies in `composer.json` by …
akozubskicr May 26, 2026
2e3007c
FN-14460 Updated GitHub Actions to use latest versions of actions and…
akozubskicr May 26, 2026
b967f16
FN-14460 Updated `setup-php` action to use major version `v2` in GitH…
akozubskicr May 26, 2026
366d2ef
FN-14460 Improved test workflow by adding autoloader validation and d…
akozubskicr May 26, 2026
b29c219
FN-14460 Enhanced PHPUnit configuration in GitHub Actions: improved e…
akozubskicr May 26, 2026
30f7e02
FN-14460 Fixed broken test configuration in GitHub Actions by adjusti…
akozubskicr May 26, 2026
eaa0ab0
FN-14460 Minor optimization of test workflow in GitHub Actions: refac…
akozubskicr May 26, 2026
90d9118
FN-14460 Removed `workflow_dispatch` trigger and simplified branch fi…
akozubskicr May 26, 2026
b2cfd08
Updated `BUILD_TS` in `PaymentGateway` to reflect the latest build ti…
akozubskicr May 26, 2026
54256ec
FN-14460 Suppressed PHP deprecation notices in PHPUnit by updating `e…
akozubskicr May 26, 2026
3f30807
FN-14460 Adjusted error reporting in `tests/bootstrap.php` to suppres…
akozubskicr May 26, 2026
de16b5a
FN-14460 Removed outdated error reporting configuration from `tests/b…
akozubskicr May 26, 2026
f7e2b8c
FN-14460 Added smoke test for `ApiClient::getInstance()` in GitHub Ac…
akozubskicr May 26, 2026
ebe5d10
FN-14460 More tests debug.
akozubskicr May 26, 2026
dea7300
FN-14460 Debugged and refined additional tests.
akozubskicr May 26, 2026
c17fea2
FN-14460 More tests debug.
akozubskicr May 26, 2026
d663408
FN-14460 Removed diagnostic and smoke-test steps from GitHub Actions …
akozubskicr May 26, 2026
5f6abc4
FN-14460 Added diagnostic step to check for scoped `psr/*` leakage in…
akozubskicr May 26, 2026
6e04ced
FN-14460 Updated diagnostic step in GitHub Actions workflow to refine…
akozubskicr May 26, 2026
b74434f
FN-14460 Refined dependency installation in GitHub Actions workflow; …
akozubskicr May 26, 2026
423cccd
FN-14460 Added support for enabling/disabling `allowed_products_confi…
akozubskicr May 26, 2026
f2931e3
FN-14460 Added support for custom payment method labels and removed r…
akozubskicr May 27, 2026
62799ee
FN-14460 Removed support for configurable payment method labels and c…
akozubskicr May 27, 2026
c1c15f0
FN-14460 Removed redundant paywall logo-related tests from FrontendMa…
akozubskicr May 28, 2026
8882fb3
FN-14460 Updated `BUILD_TS` in PaymentGateway constants.
akozubskicr May 28, 2026
ebde054
FN-14460 Added support for `productTypeNames` in backend and frontend…
akozubskicr May 29, 2026
0bd55ad
FN-14460 Adjusted `loadSdk` function to use standard brace style for …
akozubskicr May 29, 2026
de1125c
FN-14460 Added error object consistency in JavaScript error handlers …
akozubskicr Jun 2, 2026
d780f6b
FN-14460 Added `COMFINO_DEV_ENV` to PHPUnit configuration to prevent …
akozubskicr Jun 2, 2026
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
3 changes: 3 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.github
var/
86 changes: 78 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,34 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
dependency-version: [prefer-lowest, prefer-stable]
exclude:
# PHPUnit 5.7 minimum uses each() which was removed in PHP 8.0
- php: '8.0'
dependency-version: prefer-lowest

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Fetch sunrise artifact packages
uses: actions/checkout@v6
with:
repository: comfino/shop-plugins-lib-builder
token: ${{ secrets.LIB_BUILDER_TOKEN }}
sparse-checkout: packages/sunrise
sparse-checkout-cone-mode: false
path: .sunrise-checkout

- name: Stage sunrise zips
run: |
mkdir -p packages
mv .sunrise-checkout/packages/sunrise packages/sunrise
rm -rf .sunrise-checkout
ls -la packages/sunrise

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -37,17 +57,46 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.dependency-version }}-

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.LIB_BUILDER_TOKEN }}"}}'
run: |
# The committed vendor/ ships scoped namespaces (ComfinoExternal\...) for
# runtime distribution. Tests need the unscoped packagist versions, so
# wipe vendor/ first to force composer to re-extract every package.
rm -rf vendor
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress

- name: Create writable log and cache directories
run: mkdir -p var/log var/cache

- name: Check autoloader
run: php -r "require 'vendor/autoload.php'; echo 'Autoloader OK' . PHP_EOL;"

- name: Run tests
run: composer test
run: |
set +e
# Merge stderr into stdout so fatals interleave with PHPUnit's --debug
# "Starting test 'X'" lines, pinpointing the offending test.
exec 2>&1
php \
-d error_reporting=-1 \
-d display_errors=On \
-d display_startup_errors=On \
-d log_errors=On \
-d output_buffering=0 \
-d implicit_flush=1 \
-d zend.assertions=1 \
vendor/bin/phpunit --debug --verbose --stderr
status=$?
echo "::notice::phpunit exit code = $status"
exit $status

coverage:
runs-on: ubuntu-latest
Expand All @@ -56,7 +105,23 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Fetch sunrise artifact packages
uses: actions/checkout@v6
with:
repository: comfino/shop-plugins-lib-builder
token: ${{ secrets.LIB_BUILDER_TOKEN }}
sparse-checkout: packages/sunrise
sparse-checkout-cone-mode: false
path: .sunrise-checkout

- name: Stage sunrise zips
run: |
mkdir -p packages
mv .sunrise-checkout/packages/sunrise packages/sunrise
rm -rf .sunrise-checkout
ls -la packages/sunrise

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -66,13 +131,18 @@ jobs:
coverage: xdebug

- name: Install dependencies
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.LIB_BUILDER_TOKEN }}"}}'
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Create writable log and cache directories
run: mkdir -p var/log var/cache

- name: Run tests with coverage
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover coverage.xml
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover coverage.xml --coverage-html coverage --coverage-text

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v6
with:
files: ./coverage.xml
fail_ci_if_error: false
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea
/packages/sunrise
/composer.lock
/vendor/*
!/vendor/autoload.php
!/vendor/cache/
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![PHP Version](https://img.shields.io/badge/php-7.1%20to%208.4-blue.svg)](https://www.php.net/)
[![License](https://img.shields.io/badge/license-OSL--3.0-green.svg)](LICENSE)

> **Notice:** Version 4.3.0 is the **last release compatible with PHP 7.1**. The upcoming version 5.0.0 will require **PHP 8.1 or higher**, **WooCommerce 7.0.0 or higher**, and **WordPress 6.1 or higher**. Please plan your environment upgrade accordingly.

WooCommerce payment module for Comfino deferred payments gateway - installment payments, buy now pay later (BNPL) and corporate payments.

## Installation
Expand All @@ -18,11 +20,20 @@ WooCommerce payment module for Comfino deferred payments gateway - installment p

## Compatibility

### Current version (4.3.0 — last PHP 7.1 compatible release)

- **WooCommerce**: 3.0.0 or higher
- **WordPress**: 4.7 or higher
- **PHP**: 7.1 or higher
- **PHP extensions**: ctype, curl, json, zlib

### Upcoming version (5.0.0)

- **WooCommerce**: 7.0.0 or higher
- **WordPress**: 6.1 or higher
- **PHP**: 8.1 or higher
- **PHP extensions**: ctype, curl, json, sodium, zlib

## Development

### Requirements
Expand Down Expand Up @@ -89,7 +100,7 @@ Generate translation template files for internationalization:
4. Push to the branch (`git push origin feature/amazing-feature`).
5. Open a Pull Request.

All pull requests are automatically tested against PHP 7.1-8.4 with both lowest and stable dependencies.
All pull requests are currently tested against PHP 7.1-8.4 with both lowest and stable dependencies. Starting with version 5.0.0, the minimum supported PHP version will be 8.1.

## License

Expand Down
12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
4.3.0
* Paywall frontend migrated to V3 API and new frontend Comfino SDK — faster loading, improved stability.
* Fixed: paywall invisible when Cloudflare RocketLoader is active (added data-cfasync="false" to prevent async script deferral).
* Fixed: paywall invisible or broken with JS optimization plugins (PhastPress, Autoptimize, WP Rocket) that bundle or defer scripts.
* Fixed: paywall rendered inside hidden Elementor builder wrapper instead of the visible checkout — only the first visible paywall container is now used.
* Fixed: paywall invisible or malfunctioning when Google Consent Management Platform (Google CMP) is active.
* Fixed: paywall loan amount now updates correctly when cart items or shipping costs change.
* Added support for strict Content Security Policy environments: shops using a nonce-based CSP can now propagate the nonce to the dynamically injected SDK script via the comfino_csp_script_nonce WordPress filter.
* Added per-product-type installment term limits (allowedProductsConfig): admins can now restrict available installment terms per financial product type in the sale settings. Limits are enforced on both the paywall (financial products listing) and order creation.
* Added direct redirect mode: when enabled, the full paywall offer browser is skipped and the customer is redirected straight to the Comfino payment gateway with the default financial product.
* Added a custom paywall CSS style option: admins can inject a custom CSS file into the paywall iframe (only URLs within the store domain are accepted).

4.2.8
* Fixed a bug in webhook (payment status notifications): order not found error when "Use order reference as external ID" option is active, fixed a frontend bug concerned with Gutenberg blocks (empty comfino_loan_type error).

Expand Down
48 changes: 39 additions & 9 deletions comfino-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Plugin Name: Comfino Payment Gateway
* Plugin URI: https://github.com/comfino/WooCommerce.git
* Description: Comfino Payment Gateway for WooCommerce.
* Version: 4.2.8
* Version: 4.3.0
* Author: Comfino
* Author URI: https://github.com/comfino
* Domain Path: /languages
* Text Domain: comfino-payment-gateway
* WC tested up to: 10.5.0
* WC tested up to: 10.7.0
* WC requires at least: 3.0
* Tested up to: 6.9
* Tested up to: 7.0
* Requires at least: 5.0
* Requires PHP: 7.1
* License: GPLv3
Expand All @@ -23,9 +23,8 @@
}

/**
* Guard clause to prevent plugin execution in incompatible environments.
* This MUST be placed before any code which uses PHP 7.1+ syntax and before any use statements.
* Uses PHP 5.6+ compatible syntax.
* Guard clause to prevent plugin execution in incompatible environments. This MUST be placed before any code that uses
* PHP 7.1+ syntax and before any use statements. Uses PHP 5.6+ compatible syntax.
*/
if (PHP_VERSION_ID < 70100) {
// Display admin notice about PHP version incompatibility.
Expand Down Expand Up @@ -175,7 +174,10 @@ private function __construct()
return $methods;
});

// Add loaded script tag filter for adding custom attribute which prevents blocking by Google CMP scripts.
/* Add loaded script tag filter for adding a custom attribute which prevents blocking by Google CMP scripts.
Also prevent Cloudflare RocketLoader and JS bundlers (PhastPress, Autoptimize, WP Rocket) from deferring
Comfino frontend scripts asynchronously. These scripts depend on the wp_add_inline_script data block that
immediately precedes them in the HTML; async delivery breaks that ordering guarantee. */
add_filter('script_loader_tag', static function (string $tag, string $handle): string {
if (strpos($handle, PaymentGateway::GATEWAY_ID) !== 0) {
return $tag;
Expand All @@ -187,13 +189,14 @@ private function __construct()
if (strpos($tag, 'async') === false) {
$attributes[] = 'async';
}
} elseif (strpos($tag, 'defer') !== false) {
} elseif (strpos($handle, 'defer') !== false) {
if (strpos($tag, 'defer') === false) {
$attributes[] = 'defer';
}
}

$attributes[] = 'data-cmp-ab="2"';
$attributes[] = 'data-cmp-ab="2"'; // Google CMP blocking prevention
$attributes[] = 'data-cfasync="false"'; // Cloudflare RocketLoader async deferral prevention

return str_replace('">', '" ' . implode(' ', $attributes) . '>', $tag);
}, 10, 2);
Expand Down Expand Up @@ -253,6 +256,17 @@ public function activation_check(): void
wp_die(wp_kses_post($environmentWarning));
}

if (!in_array('sha3-256', hash_algos(), true)) {
add_action('admin_notices', static function () {
echo '<div class="notice notice-error"><p>'
. esc_html__(
'Comfino requires OpenSSL >= 1.1.0 (SHA-3 support) for the V3 paywall.',
'comfino-payment-gateway'
)
. '</p></div>';
});
}

Main::install();
}

Expand Down Expand Up @@ -658,6 +672,22 @@ private function upgrade_plugin(): void
update_option('comfino_plugin_current_version', $previousVersion, false);
}

/* 4.3.0 */
// Remove COMFINO_SHOW_LOGO — logo is now entirely SDK/CDN-driven; stored value is dead data.
$comfinoSettings = get_option('woocommerce_comfino_settings', []);

if (is_array($comfinoSettings) && array_key_exists('show_logo', $comfinoSettings)) {
unset($comfinoSettings['show_logo']);
update_option('woocommerce_comfino_settings', $comfinoSettings);
}

if (!is_array(ConfigManager::getConfigurationValue('COMFINO_ALLOWED_PRODUCTS_CONFIG_FORBIDDEN_PROD_TYPES'))) {
ConfigManager::updateConfigurationValue(
'COMFINO_ALLOWED_PRODUCTS_CONFIG_FORBIDDEN_PROD_TYPES',
['BLIK', 'PAY_LATER', 'PAY_IN_PARTS', 'INSTANT_PAYMENTS']
);
}

// Update code of widget initialization script.
ConfigManager::updateWidgetCode();

Expand Down
29 changes: 18 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "WooCommerce payment module for Comfino deferred payments gateway.",
"homepage": "https://github.com/comfino/WooCommerce",
"license": "OSL-3.0",
"author": "WooCommerce",
"authors": [
{
"name": "Artur Kozubski",
Expand All @@ -18,11 +17,20 @@
"platform": {
"php": "7.1.3"
},
"classmap-authoritative": true,
"optimize-autoloader": true,
"prepend-autoloader": false,
"allow-plugins": {
"php-http/discovery": true
},
"audit": {
"ignore": [
"PKSA-pwh8-d4fr-nywn",
"PKSA-z3gr-8qht-p93v",
"PKSA-v5yj-8nmz-sk2q",
"PKSA-ft77-7h5f-p3r6",
"PKSA-b14r-zh1d-vdrc",
"PKSA-xxgb-wq2d-7gpg"
]
}
},
"autoload": {
Expand Down Expand Up @@ -76,6 +84,7 @@
"cache/hierarchical-cache": "~1.1.0",
"league/flysystem": "~1.0.70",
"monolog/monolog": "^1.27",
"psr/http-factory": "^1.0",
"psr/log": "^1.1",
"symfony/deprecation-contracts": "<3.0",
"symfony/options-resolver": "~4.4.0",
Expand All @@ -85,19 +94,17 @@
"symfony/yaml": "~4.4.0"
},
"require-dev": {
"nyholm/psr7": "^1.6",
"php-http/mock-client": "^1.6",
"phpdocumentor/reflection-common": "~2.1.0",
"phpdocumentor/reflection-docblock": "~4.3.4",
"phpdocumentor/type-resolver": "~1.0.1",
"phpspec/prophecy-phpunit": "^1.1",
"phpunit/phpunit": "^5.7",
"webmozart/assert": "<1.10"
"phpunit/phpunit": "^5.7.27"
},
"repositories": [
{
"type": "artifact",
"url": "packages/sunrise"
},
{
"type": "vcs",
"url": "git@github.com:comfino/shop-plugins-shared.git"
"url": "git@github.com:comfino/shop-plugins-shared.git",
"no-api": true
}
]
}
Loading
Loading