From 7002c2e6d3cb7728e97fc5d8b1955a66ffb8c84b Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 26 Sep 2022 10:44:25 +0300 Subject: [PATCH] Use connection tab in some URLs instead of paypal tab --- modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php | 2 +- modules/ppcp-wc-gateway/src/Settings/SettingsListener.php | 2 +- woocommerce-paypal-payments.php | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php index 319f2c844..7bea6d2e2 100644 --- a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php +++ b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php @@ -60,7 +60,7 @@ class ConnectAdminNotice { 'PayPal Payments is almost ready. To get started, connect your account.', 'woocommerce-paypal-payments' ), - admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ) + admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-tab=' . Settings::CONNECTION_TAB_ID ) ); return new Message( $message, 'warning' ); } diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php b/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php index cf43fa518..936c30633 100644 --- a/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php +++ b/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php @@ -196,7 +196,7 @@ class SettingsListener { /** * The URL opened at the end of onboarding after saving the merchant ID/email. */ - $redirect_url = apply_filters( 'woocommerce_paypal_payments_onboarding_redirect_url', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-tab=ppcp-connection' ) ); + $redirect_url = apply_filters( 'woocommerce_paypal_payments_onboarding_redirect_url', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-tab=' . Settings::CONNECTION_TAB_ID ) ); if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) { $redirect_url = add_query_arg( 'ppcp-onboarding-error', '1', $redirect_url ); } diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index a06879ed5..f4ddc2404 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -19,6 +19,8 @@ declare( strict_types = 1 ); namespace WooCommerce\PayPalCommerce; +use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; + define( 'PAYPAL_API_URL', 'https://api.paypal.com' ); define( 'PAYPAL_SANDBOX_API_URL', 'https://api.sandbox.paypal.com' ); define( 'PAYPAL_INTEGRATION_DATE', '2022-04-13' ); @@ -134,7 +136,7 @@ define( 'PPCP_FLAG_SEPARATE_APM_BUTTONS', apply_filters( 'woocommerce_paypal_pay $links, sprintf( '%2$s', - admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ), + admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-tab=' . Settings::CONNECTION_TAB_ID ), __( 'Settings', 'woocommerce-paypal-payments' ) ) );