diff --git a/composer.json b/composer.json index fd5d98be5..c562752b0 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "PayPal Commerce Platform for WooCommerce", "license": "GPL-2.0", "require": { - "dhii/module-interface": "^0.2", + "dhii/module-interface": "^0.2 || ^0.3", "psr/container": "1.0.0", "container-interop/service-provider": "^0.4.0", "dhii/containers": "v0.1.0-alpha1", diff --git a/modules/ppcp-admin-notices/src/class-adminnotices.php b/modules/ppcp-admin-notices/src/class-adminnotices.php index 657a1bc0f..686ae4db6 100644 --- a/modules/ppcp-admin-notices/src/class-adminnotices.php +++ b/modules/ppcp-admin-notices/src/class-adminnotices.php @@ -36,7 +36,7 @@ class AdminNotices implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { add_action( 'admin_notices', function() use ( $container ) { diff --git a/modules/ppcp-api-client/src/class-apimodule.php b/modules/ppcp-api-client/src/class-apimodule.php index a6f1ace8f..70265dad9 100644 --- a/modules/ppcp-api-client/src/class-apimodule.php +++ b/modules/ppcp-api-client/src/class-apimodule.php @@ -37,7 +37,7 @@ class ApiModule implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { } /** diff --git a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js index 83fe11f65..29e6a4819 100644 --- a/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js +++ b/modules/ppcp-button/resources/js/modules/ContextBootstrap/CartBootstap.js @@ -39,4 +39,4 @@ class CartBootstrap { } } -export default CartBootstrap; \ No newline at end of file +export default CartBootstrap; diff --git a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js index ee7153c67..9745997ba 100644 --- a/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js +++ b/modules/ppcp-button/resources/js/modules/Renderer/CreditCardRenderer.js @@ -7,6 +7,7 @@ class CreditCardRenderer { this.errorHandler = errorHandler; this.spinner = spinner; this.cardValid = false; + this.formValid = false; } render(wrapper, contextConfig) { @@ -97,12 +98,8 @@ class CreditCardRenderer { event.preventDefault(); } this.errorHandler.clear(); - const state = hostedFields.getState(); - const formValid = Object.keys(state.fields).every(function (key) { - return state.fields[key].isValid; - }); - if (formValid && this.cardValid) { + if (this.formValid && this.cardValid) { const save_card = this.defaultConfig.save_card ? true : false; const vault = document.getElementById('ppcp-credit-card-vault') ? document.getElementById('ppcp-credit-card-vault').checked : save_card; @@ -134,6 +131,13 @@ class CreditCardRenderer { const validCards = this.defaultConfig.hosted_fields.valid_cards; this.cardValid = validCards.indexOf(event.cards[0].type) !== -1; }) + hostedFields.on('validityChange', (event) => { + const formValid = Object.keys(event.fields).every(function (key) { + return event.fields[key].isValid; + }); + this.formValid = formValid; + + }) document.querySelector(wrapper + ' button').addEventListener( 'click', submitEvent diff --git a/modules/ppcp-button/src/Assets/class-smartbutton.php b/modules/ppcp-button/src/Assets/class-smartbutton.php index e003aec9b..4fb0eee10 100644 --- a/modules/ppcp-button/src/Assets/class-smartbutton.php +++ b/modules/ppcp-button/src/Assets/class-smartbutton.php @@ -438,7 +438,7 @@ class SmartButton implements SmartButtonInterface { */ public function message_renderer() { - echo '
'; + echo '
'; } /** diff --git a/modules/ppcp-button/src/class-buttonmodule.php b/modules/ppcp-button/src/class-buttonmodule.php index 5981c14c9..659183db8 100644 --- a/modules/ppcp-button/src/class-buttonmodule.php +++ b/modules/ppcp-button/src/class-buttonmodule.php @@ -43,7 +43,7 @@ class ButtonModule implements ModuleInterface { * * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { add_action( 'wp', diff --git a/modules/ppcp-compat/extensions.php b/modules/ppcp-compat/extensions.php new file mode 100644 index 000000000..8155f88b8 --- /dev/null +++ b/modules/ppcp-compat/extensions.php @@ -0,0 +1,12 @@ +get( 'onboarding.assets' ); /** diff --git a/modules/ppcp-session/src/class-sessionmodule.php b/modules/ppcp-session/src/class-sessionmodule.php index 7199b5078..b2c5a5aef 100644 --- a/modules/ppcp-session/src/class-sessionmodule.php +++ b/modules/ppcp-session/src/class-sessionmodule.php @@ -37,7 +37,7 @@ class SessionModule implements ModuleInterface { * * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { add_action( 'woocommerce_init', function () use ( $container ) { diff --git a/modules/ppcp-subscription/src/class-subscriptionmodule.php b/modules/ppcp-subscription/src/class-subscriptionmodule.php index 20d964d82..edb7f9408 100644 --- a/modules/ppcp-subscription/src/class-subscriptionmodule.php +++ b/modules/ppcp-subscription/src/class-subscriptionmodule.php @@ -44,7 +44,7 @@ class SubscriptionModule implements ModuleInterface { * * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { add_action( 'woocommerce_scheduled_subscription_payment_' . PayPalGateway::ID, function ( $amount, $order ) use ( $container ) { diff --git a/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php b/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php index faf79817f..981491351 100644 --- a/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php +++ b/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php @@ -53,7 +53,7 @@ class WcGatewayModule implements ModuleInterface { * * @param ContainerInterface|null $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { $this->register_payment_gateways( $container ); $this->register_order_functionality( $container ); $this->register_columns( $container ); diff --git a/modules/ppcp-webhooks/src/class-webhookmodule.php b/modules/ppcp-webhooks/src/class-webhookmodule.php index 5e2783798..24a765a08 100644 --- a/modules/ppcp-webhooks/src/class-webhookmodule.php +++ b/modules/ppcp-webhooks/src/class-webhookmodule.php @@ -36,7 +36,7 @@ class WebhookModule implements ModuleInterface { * * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { add_action( 'rest_api_init', static function () use ( $container ) { diff --git a/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php b/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php index 11a0054f5..1d4da4899 100644 --- a/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php +++ b/modules/woocommerce-logging/src/class-woocommerceloggingmodule.php @@ -36,7 +36,7 @@ class WooCommerceLoggingModule implements ModuleInterface { * * @param ContainerInterface $container The container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e33a90b71..533eefc50 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -4,7 +4,7 @@ - + diff --git a/src/class-pluginmodule.php b/src/class-pluginmodule.php index f891c6e84..ef622a978 100644 --- a/src/class-pluginmodule.php +++ b/src/class-pluginmodule.php @@ -31,7 +31,7 @@ class PluginModule implements ModuleInterface { * * @param ContainerInterface|null $container The Container. */ - public function run( ContainerInterface $container ) { + public function run( ContainerInterface $container ): void { } /**