mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge branch 'trunk' of github.com:woocommerce/woocommerce-paypal-payments into trunk
This commit is contained in:
commit
2b27f44268
19 changed files with 112 additions and 19 deletions
|
@ -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",
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class ApiModule implements ModuleInterface {
|
|||
*
|
||||
* @param ContainerInterface $container The container.
|
||||
*/
|
||||
public function run( ContainerInterface $container ) {
|
||||
public function run( ContainerInterface $container ): void {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,4 +39,4 @@ class CartBootstrap {
|
|||
}
|
||||
}
|
||||
|
||||
export default CartBootstrap;
|
||||
export default CartBootstrap;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -438,7 +438,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
*/
|
||||
public function message_renderer() {
|
||||
|
||||
echo '<div id="ppcp-messages"></div>';
|
||||
echo '<div id="ppcp-messages" data-partner-attribution-id="Woo_PPCP"></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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',
|
||||
|
|
12
modules/ppcp-compat/extensions.php
Normal file
12
modules/ppcp-compat/extensions.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* The compatibility module extensions.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Compat
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
return array();
|
16
modules/ppcp-compat/module.php
Normal file
16
modules/ppcp-compat/module.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* The compatibility module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Compat
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
use Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return new CompatModule();
|
||||
};
|
12
modules/ppcp-compat/services.php
Normal file
12
modules/ppcp-compat/services.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* The compatibility module services.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Compat
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
return array();
|
49
modules/ppcp-compat/src/class-compatmodule.php
Normal file
49
modules/ppcp-compat/src/class-compatmodule.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* The compatibility module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Compat
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
use Dhii\Container\ServiceProvider;
|
||||
use Dhii\Modular\Module\ModuleInterface;
|
||||
use Interop\Container\ServiceProviderInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Class CompatModule
|
||||
*/
|
||||
class CompatModule implements ModuleInterface {
|
||||
|
||||
/**
|
||||
* Setup the compatibility module.
|
||||
*
|
||||
* @return ServiceProviderInterface
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the compatibility module.
|
||||
*
|
||||
* @param ContainerInterface|null $container The Container.
|
||||
*/
|
||||
public function run( ContainerInterface $container ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ class OnboardingModule implements ModuleInterface {
|
|||
*
|
||||
* @param ContainerInterface|null $container The container.
|
||||
*/
|
||||
public function run( ContainerInterface $container ) {
|
||||
public function run( ContainerInterface $container ): void {
|
||||
|
||||
$asset_loader = $container->get( 'onboarding.assets' );
|
||||
/**
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -36,7 +36,7 @@ class WooCommerceLoggingModule implements ModuleInterface {
|
|||
*
|
||||
* @param ContainerInterface $container The container.
|
||||
*/
|
||||
public function run( ContainerInterface $container ) {
|
||||
public function run( ContainerInterface $container ): void {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<!-- Configs -->
|
||||
<config name="minimum_supported_wp_version" value="4.7" />
|
||||
<config name="testVersion" value="7.0-" />
|
||||
<config name="testVersion" value="7.1-" />
|
||||
|
||||
<!-- Rules -->
|
||||
<rule ref="WooCommerce-Core" />
|
||||
|
|
|
@ -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 {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue