Remove class `ExtendedPayments`. (https://github.com/woocommerce/woocommerce-admin/pull/8461)
* Removed class `ExtendedPayments` * Add changelog Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
This commit is contained in:
parent
eb2777f344
commit
9a704ad1e2
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: Fix
|
||||
|
||||
Remove class ExtendedPayments. #8461
|
|
@ -108,7 +108,7 @@ class TaskLists {
|
|||
),
|
||||
),
|
||||
'tasks' => array(
|
||||
'ExtendedPayments',
|
||||
'AdditionalPayments',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
@ -145,7 +145,7 @@ class TaskLists {
|
|||
),
|
||||
),
|
||||
'tasks' => array(
|
||||
'ExtendedPayments',
|
||||
'AdditionalPayments',
|
||||
),
|
||||
'event_prefix' => 'extended_tasklist_',
|
||||
)
|
||||
|
|
|
@ -13,12 +13,12 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\WooCommercePayme
|
|||
class AdditionalPayments extends Payments {
|
||||
|
||||
/**
|
||||
* Parent ID.
|
||||
* ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_parent_id() {
|
||||
return 'extended';
|
||||
public function get_id() {
|
||||
return 'payments';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,35 @@ class AdditionalPayments extends Payments {
|
|||
return __( 'Set up additional payment providers', 'woocommerce-admin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content() {
|
||||
return __(
|
||||
'Choose payment providers and enable payment methods at checkout.',
|
||||
'woocommerce-admin'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_time() {
|
||||
return __( '2 minutes', 'woocommerce-admin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Task completion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_complete() {
|
||||
return self::has_gateways();
|
||||
}
|
||||
|
||||
/**
|
||||
* Task visibility.
|
||||
|
@ -51,5 +80,21 @@ class AdditionalPayments extends Payments {
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the store has any enabled gateways.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function has_gateways() {
|
||||
$gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
$enabled_gateways = array_filter(
|
||||
$gateways,
|
||||
function( $gateway ) {
|
||||
return 'yes' === $gateway->enabled && 'woocommerce_payments' !== $gateway->id;
|
||||
}
|
||||
);
|
||||
|
||||
return ! empty( $enabled_gateways );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\Features;
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\WooCommercePayments;
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
||||
|
||||
/**
|
||||
* Payments Task
|
||||
*/
|
||||
class ExtendedPayments extends Task {
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_id() {
|
||||
return 'payments';
|
||||
}
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
return __( 'Set up additional payment providers', 'woocommerce-admin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content() {
|
||||
return __(
|
||||
'Choose payment providers and enable payment methods at checkout.',
|
||||
'woocommerce-admin'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_time() {
|
||||
return __( '2 minutes', 'woocommerce-admin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Task completion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_complete() {
|
||||
return self::has_gateways();
|
||||
}
|
||||
|
||||
/**
|
||||
* Task visibility.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_view() {
|
||||
return Features::is_enabled( 'payment-gateway-suggestions' ) &&
|
||||
WooCommercePayments::is_requested() &&
|
||||
WooCommercePayments::is_installed() &&
|
||||
WooCommercePayments::is_supported() &&
|
||||
( $this->get_parent_id() !== 'extended_two_column' || ! WooCommercePayments::is_connected() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the store has any enabled gateways.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function has_gateways() {
|
||||
$gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
$enabled_gateways = array_filter(
|
||||
$gateways,
|
||||
function( $gateway ) {
|
||||
return 'yes' === $gateway->enabled && 'woocommerce_payments' !== $gateway->id;
|
||||
}
|
||||
);
|
||||
|
||||
return ! empty( $enabled_gateways );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue