Skip to content

Commit

Permalink
Release: v5.12.0 - Add Cart/Checkout Blocks support (#614)
Browse files Browse the repository at this point in the history
* update blocks support namespaces

* Declare php-compatibility path & update minimum PHP version

As per https://github.com/PHPCompatibility/PHPCompatibility#installation-in-a-composer-project-method-1

* use underscored IDs instead of dasherized IDs (follow WC convention)

* use get_payment_method_data as method name for checkout block integrations

* Add missing typehints

* add configuration flags to payment method data

* revert back to dasherized ids

* Revert "revert back to dasherized ids"

This reverts commit 3346fd4.

* experiment with posted token & csc getters

* Support getting payment tokens by core (woo) ID

* Prepare checkout block payment tokens for payment

* Add test_mode to block payment method data

* Move test mode to flag"

* Rename flag

* Split logic from prepare_payment_token

* Update phpdoc

* Add payment gateway id to block data

* Get customer facing variables instead of merchants

* Add type to payment method block data

* Add supported card types to block data

* Add supported card types icons to block data

* Add gateway icons to block data

* Use raw icon url

* Code style tweak

* Add todos

* Do not load legacy frontend js if blocks is active

* Update changelog

* Pass dasherized id as name in block fields

* Update id/name dasherization

* Allow filtering gateway payment data

* Add notices when a plugin is not cart/checkout block compatible

* Add missing since tags

* Remove todos

* Use method title in icon alt

* Line tweak

* Update admin notice handling for blocks

* Update notices text

* Update notices text

* Plugin name in bold

* Plugin name in bold

* Remove redudant methods to get posted csc or token

* Attach apple pay data to block payment method data

* expose configured card types (identifiers) to blocks

* Add apple pay variables to payment method data

* Remove available card types

* Add Google Pay data to block payment method data

* Edit phpdocs

* Update incompatible block notice

* Update incompatible block notice IDs

* Update ext checkout frontend init logic

* Add external checkout flags

* Add todo note

* Add helper methods to restore cart/checkout shortcodes

* Fix page id

* Rework blocks admin notices

* Update blocks cta button class and add line break

* Fix wp update post

* Update restore_page_shortcode

* Update phpdoc

* Update alert message when restoring shortcodes

* Update changelog

* Add warning if the shortcode restoration is unsuccessful

* Add translator notes

* Add more detailed error messages if shortcode restoration fails

* Fix framework path

* Do not call methods that invoke assert() when building block payment data

* Do not call methods that invoke assert() when building block payment data

* Add eCheck icon support to block data

* Add sample echeck to payment method payload

* Add filter for block checkout gateway icons

* Add payment gateway defaults

* Add help tip icon to payment method data

* Update Apple / Google pay payment method data

* Add merchant name to Apple pay data

* Add block integration placeholders

* Document filter

* Normalize gateway defaults in payment data

* Prepare payment data from block checkout (tokenize flag, existing token)

* Add functions to External Checkout to determine block support

* Init external checkout frontend if does not support blocks

* Update payment method data payload based on external checkout supports

* Add inline comments

* Pass supported external checkout features from constructor

* By default external checkout blocks compatibility follows main plugin

* Remove cart/checkout CTA to revert to shortcode

* Update button label

* Allow filtering the main script handle and url

* Update phpdocs

* Add get_main_script_stylesheet_url as well

* Add Block_Integration trait functions to enqueue and filter dependencies

* Enforce types on filters

* Fix accidental comma instead of period in string concat

* Update filter names

* Update filter names

* Should use unique gateway in filter names

* Use string interpolation in filter names

* Update Gateway_Checkout_Block_Integration

* Replace is enabled with is available in is active block function

* No need for fully qualified namespaces in phpdocs

* Add context flag to payment sent via shortcode checkout

* Update phpdocs

* Move script and stylsheet dependencies to property so it can be extended before filtered

* Add utility functions to add dependencies to the block integration handler

* Add sv_wc_is_block_checkout helper flag when preparing payment data for processing

* Add logging_enabled flag to payment method data

* Pass time/date format in payment data payload

* Pass time/date format in payment data payload

* optionally pass additional data in get payment method data in block

* Add built in filter callback to override or extend payment method data

* Allow null additional data

* Nullable arg

* Cast nullable arg as array

* Remove get_payment_method_data arg

* Normalize enabled card types for blocks

* Add helper method to convert payment method data to json object

* rename method

* Use wp parse args to parse external checkout supported features

* Add echeck images

* Pass echeck images instead of a single one

* Add echeck sprite to sample echeck images array

* Fix filename typo

* Rename echeck files

* Update filter name

* Normalize payment method context between blocks and shortcode

* Update sample check images remove text

* Just use one sample echeck image

* Fix sample check asset url

* Add debug mode to payload

* Add log js data nonce

* Add AJAX logging for gateway blocks

* Fix ajax callback name and send response when log request

* Cast request and response to array

* Use null coalesce to avoid errors when grabbing ext checkout supported features

* Update main script URL and stylsheet defaults

* Fix url prefix

* Fix url prefix

* Add basic gateway config values and move flags to helper method

* Add inline comments

* Make sure gateway icons are filterable

* Use enabled card types for icons

* Move google and apple pay config to helper methods

* Ensure request/response are non-empty before logging

* Allow setting log type in log_api_request

* Account for legacy types

* Update block incompatibility notice copy

* Edit shortcode ref

* Open link to docs in new page

* Add i18n param to payment data

* Update changelog

* Use new function/filter for gateway localized params

* Add generic card type invalid message

* Just card without type

* Add flags.detailed_decline_messages_enabled in payment data payload

* Do not load gateway assets when block is in use

* Do not mark method as internal

* Allow loading assets on alt checkout pages

* Do not load payment form when checkout block is in use in checkout page

* Cannot use is_page args when init payment form

* Update phpdocs

* Try to grab any error notice when returning a process payment failure

* Add notices as user message regardless of error if debug checkout

* Ensure to parse array before sent to message string

* Remove extra newlines

* expose supported card types to blocks

* Move debug checkout condition check one up to avoid passing debug log accidentally

* convert XML chars to entities

* Ensure gateway supports card types before getting available ones

* Implode notice messages in newlines

* Spacing

* Typo in var name

* Update debug mode methods and payment data

* Simplify debug mode

* Rename debug mode value in payment data

* Update inline comment

* Bail and send response message when logging in blocks

* Send error message with invalid nonce.

* Use exceptions in log request

* Check for debug off

* Build assets

* ensure only card type keys are used for supported cards

* Update convention for block integration names/identifiers

* Fix get name/id

* Prepend with wc- for consistency

* Use the plugin dash id for default css and script names

* Implement BLock_Integration_Trait::initialize default method

* Update since tag

* Update example

* do not set script version if SCRIPT_DEBUG true

* Add helper method to prepare log data

* Update method paran name

* Rename method

* Add missing since tags

* should use dasherized id for main script url

* Update sprintf string for readability

* Also enqueue stylesheet via wp_enqueue_style

* Update wp_enqueue_block_style args

* Expand phpdocs in integration trait

* Use time() when script debug enabled to burst script/styles cache

* Check for explicit true

* Add jquery dependency

* Revert

* Also update maybe_enqueue_styles_scripts to burst caches

* Update should_render_js_on_checkout_page to match should_enqueue_gateway_assets

* Fix method declaration type

* Code style

* Detect if current page has shortcode

* Burst script caches for gateway scripts when using any debug mode

* Rename to assets version

* Update changelog

* Use get_plugin to get plugin class

* Add translator context

* Add translator context

* Fix Block_Integration_Trait

* Update phpdoc

* Rework checkout block logging

* Update AJAX logging in blocks

* Add basic debug logging via constants

* Do not send log type as log id

* Add get_ajax_log_data helper

* Fix filter name

* Formatting

* Add AJAX logging also in the standard Block Integration abstract

* Move get_ajax_log_data to trait

* Move ajax hooks to trait method

* Send request type when logging

* Update changelog

* Update phpdocs and namespace refs

* Revert "Update phpdocs and namespace refs"

This reverts commit 8b7102d.

* Document request/response could be stdClass

* Add flag for settings inherited

* Add flag whether cart has subscription

* Also add flag if cart has renewal

* Pass tokenization_forced to payment data

* Update namespace refs

* Add action to allow third parties hooking in the transaction response

* Update changelog

* Update supported features in ext checkout handling

* Add note

* Version: v5.12.0

* Update ext checkout supported features parsing

* Version: v5.12.0

---------

Co-authored-by: Illimar Tambek <[email protected]>
Co-authored-by: Fulvio Notarstefano <[email protected]>
  • Loading branch information
3 people authored Dec 14, 2023
1 parent de7f70c commit f7a4527
Show file tree
Hide file tree
Showing 160 changed files with 2,892 additions and 999 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "skyverge/wc-plugin-framework",
"description": "The official SkyVerge WooCommerce plugin framework",
"version": "5.11.12",
"version": "5.12.0",
"license": "GPL-3.0",
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wc-plugin-framework",
"version": "5.11.12",
"version": "5.12.0",
"title": "WooCommerce Plugin Framework",
"author": "SkyVerge Team",
"homepage": "https://github.com/skyverge/wc-plugin-framework#readme",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/API.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/Gateway.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
10 changes: 5 additions & 5 deletions tests/integration/API/CacheableAPIBaseTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\API\Abstract_Cacheable_API_Base;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\API\Traits\Cacheable_Request_Trait;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_API_JSON_Request;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_API_Request;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\API\Abstract_Cacheable_API_Base;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\API\Traits\Cacheable_Request_Trait;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_API_JSON_Request;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_API_Request;

if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', true );
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/DependenciesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Tests for the SV_WC_Plugin_Dependencies class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Dependencies
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Dependencies
*/
class DependenciesTest extends \Codeception\TestCase\WPTestCase {

Expand Down Expand Up @@ -31,7 +31,7 @@ protected function _after() {


/**
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Dependencies::get_active_scripts_optimization_plugins()
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Dependencies::get_active_scripts_optimization_plugins()
*/
public function test_get_active_scripts_optimization_plugins() {

Expand All @@ -40,7 +40,7 @@ public function test_get_active_scripts_optimization_plugins() {


/**
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Dependencies::is_scripts_optimization_plugin_active()
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Dependencies::is_scripts_optimization_plugin_active()
*/
public function test_is_scripts_optimization_plugin_active() {

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/HelperTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

/**
* Tests for the helper class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Compatibility
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Compatibility
*/
class HelperTest extends \Codeception\TestCase\WPTestCase {

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Tests for the base plugin class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin
*/
class PluginTest extends \Codeception\TestCase\WPTestCase {

Expand Down Expand Up @@ -152,7 +152,7 @@ public function test_get_framework_assets_path() {
*/
public function test_get_dependency_handler() {

$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Dependencies', $this->get_plugin()->get_dependency_handler() );
$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Dependencies', $this->get_plugin()->get_dependency_handler() );
}


Expand All @@ -161,7 +161,7 @@ public function test_get_dependency_handler() {
*/
public function test_get_lifecycle_handler() {

$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_11_12\Plugin\Lifecycle', $this->get_plugin()->get_lifecycle_handler() );
$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_12_0\Plugin\Lifecycle', $this->get_plugin()->get_lifecycle_handler() );
}


Expand Down
10 changes: 5 additions & 5 deletions tests/integration/REST_API/Controllers/SettingsTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\REST_API\Controllers\Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Control;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\REST_API\Controllers\Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Control;

/**
* Tests for the Settings class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\REST_API\Controllers\Settings
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\REST_API\Controllers\Settings
*/
class SettingsTest extends \Codeception\TestCase\WPTestCase {

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/REST_API/RESTAPITest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Helper;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Helper;

/**
* Tests for the REST_API class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\REST_API
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\REST_API
*/
class RESTAPITest extends \Codeception\TestCase\WPTestCase {

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/SV_WC_Payment_Gateway_Helper_Test.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Helper;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Helper;

/**
* Tests for the Payment Gateway Helper class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Helper
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Helper
*/
class SV_WC_Payment_Gateway_Helper_Test extends \Codeception\TestCase\WPTestCase {

Expand Down
12 changes: 6 additions & 6 deletions tests/integration/Settings_API/AbstractSettingsTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Control;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Exception;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Abstract_Settings;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Control;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Exception;

/**
* Tests for the Abstract_Settings class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Abstract_Settings
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Abstract_Settings
*/
class AbstractSettingsTest extends \Codeception\TestCase\WPTestCase {

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/Settings_API/SettingTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Plugin_Exception;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\Settings_API\Setting;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Plugin_Exception;

class SettingTest extends \Codeception\TestCase\WPTestCase {

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/payment-gateway/GatewayPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Tests for the gateway plugin class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Plugin
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Plugin
*/
class GatewayPluginTest extends \Codeception\TestCase\WPTestCase {

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/payment-gateway/MyPaymentMethodsTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_My_Payment_Methods;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Plugin;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_My_Payment_Methods;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Plugin;

/**
* Tests for the SV_WC_Payment_Gateway_My_Payment_Methods class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_My_Payment_Methods
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_My_Payment_Methods
*/
class MyPaymentMethodsTest extends \Codeception\TestCase\WPTestCase {

Expand Down Expand Up @@ -116,7 +116,7 @@ public function test_render_js() {
$payment_methods->render_js();

$this->assertStringContainsString( 'function load_gateway_test_plugin_payment_methods_handler', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_methods_handler_v5_11_12_loaded\', load_gateway_test_plugin_payment_methods_handler );', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_methods_handler_v5_12_0_loaded\', load_gateway_test_plugin_payment_methods_handler );', $wc_queued_js );
}


Expand Down
6 changes: 3 additions & 3 deletions tests/integration/payment-gateway/PaymentFormTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Payment_Form;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Payment_Form;

/**
* Tests for the SV_WC_Payment_Gateway_Payment_Form class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Payment_Form
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Payment_Form
*/
class PaymentFormTest extends \Codeception\TestCase\WPTestCase {

Expand Down Expand Up @@ -90,7 +90,7 @@ public function test_render_js() {
$this->get_plugin()->get_gateway()->get_payment_form_instance()->render_js();

$this->assertStringContainsString( 'function load_test_gateway_payment_form_handler', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_form_handler_v5_11_12_loaded\', load_test_gateway_payment_form_handler );', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_payment_form_handler_v5_12_0_loaded\', load_test_gateway_payment_form_handler );', $wc_queued_js );
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use \SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use \SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

/**
* Tests for the payment token object
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Payment_Token
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Payment_Token
*/
class SV_WC_Payment_Gateway_Payment_Token_Test extends \Codeception\TestCase\WPTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use \SkyVerge\WooCommerce\PluginFramework\v5_11_12 as Framework;
use \SkyVerge\WooCommerce\PluginFramework\v5_12_0 as Framework;

/**
* Tests for the payment tokens handler object
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Payment_Tokens_Handler
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Payment_Tokens_Handler
*/
class SV_WC_Payment_Gateway_Payment_Tokens_Handler_Test extends \Codeception\TestCase\WPTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Plugin;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Apple_Pay;
use SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Apple_Pay_Frontend;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Plugin;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Apple_Pay;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Apple_Pay_Frontend;

/**
* Tests for the SV_WC_Payment_Gateway_Apple_Pay_Frontend class.
*
* @see \SkyVerge\WooCommerce\PluginFramework\v5_11_12\SV_WC_Payment_Gateway_Apple_Pay_Frontend
* @see \SkyVerge\WooCommerce\PluginFramework\v5_12_0\SV_WC_Payment_Gateway_Apple_Pay_Frontend
*/
class ApplePayFrontendTest extends \Codeception\TestCase\WPTestCase {

Expand Down Expand Up @@ -106,7 +106,7 @@ public function test_enqueue_js_handler() {
$method->invokeArgs( $frontend_instance, [[]] );

$this->assertStringContainsString( 'function load_test_gateway_apple_pay_handler', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_apple_pay_handler_v5_11_12_loaded\', load_test_gateway_apple_pay_handler );', $wc_queued_js );
$this->assertStringContainsString( 'window.jQuery( document.body ).on( \'sv_wc_apple_pay_handler_v5_12_0_loaded\', load_test_gateway_apple_pay_handler );', $wc_queued_js );
}


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/API/CacheableRequestTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace API;

use SkyVerge\WooCommerce\PluginFramework\v5_11_12\API\Traits\Cacheable_Request_Trait;
use SkyVerge\WooCommerce\PluginFramework\v5_12_0\API\Traits\Cacheable_Request_Trait;

if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', true );
Expand Down
Loading

0 comments on commit f7a4527

Please sign in to comment.