Skip to content

Prepare release v1.3.0#6

Merged
wzul merged 14 commits into
mainfrom
feature/prepare-1.3.0-release
Jun 3, 2026
Merged

Prepare release v1.3.0#6
wzul merged 14 commits into
mainfrom
feature/prepare-1.3.0-release

Conversation

@wzul

@wzul wzul commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

What does this change?

This PR prepares the plugin for the v1.3.0 release. The primary focus is modernizing the development infrastructure, aligning the codebase with WordPress Coding Standards (WPCS), and improving compatibility with modern WooCommerce features.

Key Enhancements:

  • WooCommerce Blocks Compatibility: Ensures the CHIP gateway remains functional in block-based checkouts by injecting supported currency data into the block context.
  • CHIP v2.x Forward Compatibility: Introduces support for chip_ prefixed hooks (e.g., chip_{$id}_purchase_params) to align with the next generation of the CHIP gateway while maintaining backward compatibility for legacy wc_ hooks.
  • Code Modernization & Refactoring:
    • Renamed core singleton and provider methods from camelCase to snake_case (e.g., getInstanceget_instance).
    • Standardized file naming to follow WordPress conventions (e.g., class-currencysettings.php, class-chipwooconvertcurrency.php).
    • Consolidated core logic into includes/class-chipwooconvertcurrency.php and removed legacy provider files (BankNegaraMalaysia.php, OpenExchangeRate.php) in favor of a structured class-based inclusion.
    • Fixed a typo in method naming (add_repeative_hooksadd_repetitive_hooks).
  • CI/CD & DevX:
    • Added composer.json with PHPUnit and WPCS support.
    • Updated GitHub Actions to modern versions (Checkout v6, Artifacts v7).
    • Introduced plugin-check.yml for automated multi-PHP version testing (7.4–8.4), PHPCS, and PHPUnit.
    • Automated release workflows including AI-assisted changelog generation and automatic GitHub Releases on tagging.
    • Added CLAUDE.md for AI-assisted development guidance.
  • Transient Optimization: Fixed a redundant naming convention for cache keys by removing the duplicate "amount" string (wc_chip_amount_amount_converter_*wc_chip_amount_converter_*).
  • Metadata Updates: Bumped version to 1.3.0, increased minimum PHP requirement to 7.4, and updated "Tested up to" versions for WordPress 7.0 and WooCommerce 10.8.

How to test

  1. Plugin Activation: Verify the plugin activates cleanly on a WordPress environment running PHP 7.4 to 8.4.
  2. Currency Conversion: Configure a non-MYR currency and verify that conversion to MYR works correctly using the BNM or OER providers.
  3. WooCommerce Blocks: Use the Checkout Block and verify the CHIP gateway is selectable and functioning.
  4. Transient Migration: Inspect the wp_options table or use a cache viewer to verify that the new transient key wc_chip_amount_converter_* is created after a conversion occurs.
  5. Admin UI: Navigate to the Plugins page and verify the new "Settings" link appears. Verify settings visibility toggles correctly in WooCommerce → Settings → General.
  6. Package Integrity: Run git archive HEAD --format=zip --output=test.zip and ensure that development files (tests, composer.json, CLAUDE.md, workflows) are excluded via .gitattributes.
  7. Automated Tests: Run vendor/bin/phpunit and vendor/bin/phpcs to ensure code quality and logic parity.

Potential Risks & Review Items

  • Breaking Method Changes: Renaming getInstance() to get_instance() and fixing the typo in add_repetitive_hooks() are breaking changes for any third-party code or custom snippets interacting directly with the plugin's internal singleton.
  • Internal Refactoring: The movement of logic from BankNegaraMalaysia.php and OpenExchangeRate.php into the main class structure must be verified for parity, especially the header handling for the BNM API (which requires a null User-Agent).
  • PHP 7.4 Requirement: This version drops support for PHP 7.3 and lower.
  • Transient Invalidation: The change in transient naming will cause a one-time cache miss for exchange rates, resulting in a fresh API call on the first checkout attempt after the update.
  • Hook Duplication: The plugin now listens to both wc_ and chip_ prefixes. While logic appears idempotent, this should be verified to ensure no unexpected double-processing of totals occurs.

Is this PR safe for automatic approval?

No — This PR contains significant refactoring, breaking changes to internal method names, and a complete overhaul of the CI/CD pipeline which requires manual verification.

Images

N/A

Related Tasks / PRs

N/A

Checklist

  • Unit tests provided? (Infrastructure added via PHPUnit/WPCS)
  • All tests passing?
  • Tested in staging?
  • Task link provided?
  • Version bumped consistently in all files (chip-woo-convert-currency.php, readme.txt, changelog.txt)
  • Changelog entry added for v1.3.0

wzul and others added 14 commits June 3, 2026 17:56
Changes:
- Bump version to 1.3.0 across all files
- Update WC tested up to: 10.8
- Update Tested up to: 7.0
- Add v2.x gateway hooks with chip_ prefix
- Add WooCommerce Blocks compatibility
- Fix typo: add_repeative_hooks → add_repetitive_hooks
- Fix duplicated transient names (amount_amount → amount)
- Grammar fixes in README, readme.txt, and admin settings
- Replace chip-for-fluentcart with correct plugin name in CI
- Update all GitHub Actions to latest versions
- Add WordPress Plugin Check workflow
- Add PR Summary workflow
- Add Prepare Release workflow
- Update release-zip.yml to auto-create releases on tags
- Add release automation scripts (bump-version, generate_release_notes, generate_pr_summary)
- Update .gitattributes to exclude CLAUDE.md and scripts/

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add phpunit.xml.dist and tests/bootstrap.php with WordPress stubs
- Add tests/ChipWooConvertCurrencyTest.php (13 tests, 15 assertions)
- Add phpcs.xml with WordPress coding standards
- Update composer.json with PHPUnit and PHPCS dev dependencies
- Make PHPCS job non-blocking (legacy codebase has ~790 WPCS violations)
- Fix dynamic property deprecation in ChipOpenExchangeRate
- Fix define() to be idempotent using defined() || define()
- Fix README.md grammar and terminology issues
- Fix remaining AND → && in set_currency_provider()
- Update .gitattributes to exclude phpunit.xml.dist and phpcs.xml
- Update .gitignore to exclude vendor/, composer.lock, .phpunit.result.cache

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Remove duplicate woocommerce_settings_save_general action in __construct()
  (already registered in actions() method)
- Fix Open Exchange Rate link from HTTP to HTTPS in README.md
- Fix grammar in readme.txt FAQ: 'There is 2' → 'There are 2'

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- sjinks/setup-wordpress-test-library@v3 doesn't resolve in GitHub Actions.
  Revert to @master which is the only reliably available ref.
- wordpress/plugin-check-action requires Node 22. Add actions/setup-node@v6
  with node-version: '22' before the plugin-check step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- chip-woo-convert-currency.php:
  - Add file-level and class-level docblocks
  - Convert all indentation to tabs
  - Move opening braces to same line
  - Fix spacing around parentheses, commas, operators
  - Apply Yoda conditions (variable on RHS)
  - Use === and !== instead of == and !=
  - Use elseif instead of else if
  - Rename getInstance → get_instance (snake_case)
  - Rename getRates → get_rates in provider calls
  - Add docblocks for all properties and methods
  - Replace sizeof() with count() in loop
  - Add esc_html__() for exception message
  - Add add_action_links() filter for Settings link on plugins page
  - Remove duplicate add_action for woocommerce_settings_save_general

- includes/BankNegaraMalaysia.php:
  - Full WPCS compliance: tabs, docblocks, spacing
  - Rename getInstance → get_instance, getRates → get_rates
  - Use strict in_array comparison
  - Use Yoda conditions
  - Use wp_json_encode() instead of json_encode()

- includes/OpenExchangeRate.php:
  - Full WPCS compliance
  - Rename getInstance → get_instance, getRates → get_rates
  - Add declared  property (fixes PHP 8.2 deprecation)
  - Fix HTTP → HTTPS for API endpoint

- includes/admin/currency-settings.php:
  - Full WPCS compliance
  - Rename  →  (WPCS discourages underscore prefix)
  - Add docblocks, fix spacing, use array() syntax consistently

- tests/ updated to match renamed methods
- PHPCS now reports only ~5 minor issues (file naming conventions)
  down from ~790 violations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
README.md:
- Replace misleading define() constant documentation with actual WooCommerce
  admin UI settings (WooCommerce → Settings → General → CHIP Convert Currency)
- Add settings table for clarity
- Add prominent 'No Refund Support' section explaining why automatic refunds
  are disabled and how to handle them manually
- Keep advanced filter documentation intact

.gitignore:
- Add .wp-env.json, .ci/, ci-build/, dist/ for Plugin Check artifacts

CLAUDE.md:
- Add PHPUnit and PHPCS local commands
- Document plugin_action_links filter
- Add no-refund policy note
- Document all 6 CI workflows
- Add coding standards note (tabs, same-line braces, Yoda conditions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Rename BankNegaraMalaysia.php -> class-chipbnmapi.php
- Rename OpenExchangeRate.php -> class-chipopenexchangerate.php
- Rename currency-settings.php -> class-currencysettings.php
- Update chip-woo-convert-currency.php and tests/bootstrap.php to load renamed files
- Fix phpcs.xml: remove invalid is_plugin property, add exclude-pattern for main plugin file
- Fix plugin-activation.yml: install and activate WooCommerce before plugin activation
  (Required due to 'Requires Plugins: woocommerce' header)

PHPCS now reports 0 errors, 6 warnings (unused callback params only).
PHPUnit: 13 tests, 15 assertions, all passing.
- Extract ChipWooConvertCurrency class to includes/class-chipwooconvertcurrency.php
- chip-woo-convert-currency.php now serves as a thin bootstrap:
  defines constants, loads the class file, and instantiates the singleton
- Fix __FILE__ reference in before_woocommerce_init action to use CHIP_WCC_FILE
  (so HPOS compatibility declaration still points to the main plugin file)
- Fix require_once paths in set_currency_provider() to be absolute via
  plugin_dir_path( CHIP_WCC_FILE )
- Remove phpcs.xml exclude-pattern for main plugin file (no longer needed)

PHPCS: 0 errors, 6 warnings (unused callback params only).
PHPUnit: 13 tests, 15 assertions, all passing.
… warnings

Plugin Check job:
- Add continue-on-error: true to plugin-check job, following
  chip-for-gravity-forms approach. The upstream issue
  (WordPress/plugin-check-action#579) causes
  wp-env to silently fail on ubuntu-24.04 runner images.

WPCS unused parameter warnings:
- Add inline phpcs:ignore annotations for filter callback parameters
  that are required by the WordPress filter contract but unused in the
  method body. This is standard for hook callbacks.
  Affected methods: can_refund_order, blocks_payment_method_data,
  purchase_parameter, apply_myr_currency.

PHPCS: 0 errors, 0 warnings.
PHPUnit: 13 tests, 15 assertions, all passing.
The wordpress/plugin-check-action@v1 uses wp-env internally, which
requires a .wp-env.json configuration file to start properly. Without it,
the action fails with 'Environment not initialized. Run wp-env start first.'

- Create .wp-env.json with plugin-check.zip and local plugin mapping
- Remove .wp-env.json from .gitignore (it is now a tracked CI config file)
- Add .wp-env.json to .gitattributes export-ignore (excluded from release zips)
- Update prepare-plugin step to copy .wp-env.json into build artifact
  (since git archive excludes it via export-ignore)
- Remove continue-on-error from plugin-check job (fix is now in place)

PHPCS: 0 errors, 0 warnings.
PHPUnit: 13 tests, 15 assertions, all passing.
…ugin Check

- Remove .github/workflows/plugin-activation.yml. It is redundant with the
  plugin-check workflow (wordpress/plugin-check-action already validates
  activation). The other CHIP repos (chip-for-woocommerce, chip-for-gravity-forms)
  do not have this workflow.

- Restore continue-on-error: true on plugin-check job. Despite adding .wp-env.json,
  the upstream wp-env issue (#579) still causes silent failures on some runners.
  This follows the same pattern used in chip-for-gravity-forms.
- Remove the Plugin Check job entirely from plugin-check.yml. The upstream
  wordpress/plugin-check-action has a persistent bug (#579) where wp-env fails
  to initialize on ubuntu-24.04 runners, causing the job to always fail and
  block PR merges despite continue-on-error. The remaining jobs provide
  sufficient validation:
  - PHP 7.4 / 8.0 / 8.2 / 8.4 compatibility
  - PHPCS (WordPress Standards)
  - PHPUnit tests

- Remove the prepare-plugin artifact job (was only needed for plugin-check).

- Remove continue-on-error from PHPCS job. The WPCS refactor is complete;
  PHPCS now passes with 0 errors and 0 warnings.

- Remove .wp-env.json and its gitattributes entry (no longer needed without
  plugin-check).
The README claimed merchants could configure the plugin via PHP define()
constants in the main plugin file, but the code exclusively uses get_option()
and the WooCommerce admin settings UI. This line was misleading and could
confuse merchants.
- Replace text domain 'woocommerce' with 'chip-woo-convert-currency' across
  all PHP files. The plugin now uses its own text domain for i18n compliance
  and WordPress.org plugin check readiness.
  Affected files:
  - includes/class-chipwooconvertcurrency.php
  - includes/admin/class-currencysettings.php
  - phpcs.xml (I18n sniff property updated)

- Pin composer.json dev dependencies to specific version ranges:
  - squizlabs/php_codesniffer: ^3.13 (was '*')
  - wp-coding-standards/wpcs: ^3.0 (was '*')
  - dealerdirect/phpcodesniffer-composer-installer: ^1.0 (was '*')
  This prevents unexpected breaking updates from upstream packages.

PHPCS: 0 errors, 0 warnings.
PHPUnit: 13 tests, 15 assertions, all passing.
@wzul
wzul merged commit dacbb0c into main Jun 3, 2026
8 checks passed
@wzul
wzul deleted the feature/prepare-1.3.0-release branch June 3, 2026 11:43
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.

1 participant