WooPayments can't be connected or onboarded if it is not active

This commit is contained in:
Vlad Olaru 2024-09-19 19:48:18 +03:00
parent 17b85b761d
commit cbadd61264
No known key found for this signature in database
1 changed files with 8 additions and 0 deletions

View File

@ -162,6 +162,10 @@ class WooCommercePayments extends Task {
*/ */
public static function is_connected() { public static function is_connected() {
$wc_payments_gateway = self::get_woo_payments_gateway(); $wc_payments_gateway = self::get_woo_payments_gateway();
if ( ! self::is_wcpay_active() ) {
return false;
}
if ( $wc_payments_gateway && method_exists( $wc_payments_gateway, 'is_connected' ) ) { if ( $wc_payments_gateway && method_exists( $wc_payments_gateway, 'is_connected' ) ) {
return $wc_payments_gateway->is_connected(); return $wc_payments_gateway->is_connected();
} }
@ -177,6 +181,10 @@ class WooCommercePayments extends Task {
*/ */
public static function is_account_partially_onboarded() { public static function is_account_partially_onboarded() {
$wc_payments_gateway = self::get_woo_payments_gateway(); $wc_payments_gateway = self::get_woo_payments_gateway();
if ( ! self::is_wcpay_active() ) {
return false;
}
if ( $wc_payments_gateway && method_exists( $wc_payments_gateway, 'is_account_partially_onboarded' ) ) { if ( $wc_payments_gateway && method_exists( $wc_payments_gateway, 'is_account_partially_onboarded' ) ) {
return $wc_payments_gateway->is_account_partially_onboarded(); return $wc_payments_gateway->is_account_partially_onboarded();
} }