'wc-settings', 'tab' => 'checkout', 'section' => WC_Payment_Gateway_WCPay::GATEWAY_ID, ]; /** * Initialize class actions. * * @param WC_Payment_Gateway_WCPay $gateway Payment Gateway. * @param WC_Payments_Account $account The account service. */ public function __construct( WC_Payment_Gateway_WCPay $gateway, WC_Payments_Account $account ) { $this->gateway = $gateway; $this->account = $account; } /** * Initializes this class's WP hooks. * * @return void */ public function init_hooks() { add_action( 'woocommerce_woocommerce_payments_admin_notices', [ $this, 'maybe_show_test_mode_notice' ] ); add_action( 'woocommerce_woocommerce_payments_admin_notices', [ $this, 'maybe_show_test_account_notice' ] ); add_action( 'woocommerce_woocommerce_payments_admin_notices', [ $this, 'maybe_show_sandbox_account_notice' ] ); add_filter( 'plugin_action_links_' . plugin_basename( WCPAY_PLUGIN_FILE ), [ $this, 'add_plugin_links' ] ); add_action( 'admin_init', [ $this, 'maybe_redirect_payment_method_settings' ], 16 ); } /** * Add notice about payments being in test mode when using a live account. * * This notice is mutually exclusive with the test account and sandbox account notices. * * @see self::maybe_show_test_account_notice() * @see self::maybe_show_sandbox_account_notice() */ public function maybe_show_test_mode_notice() { // If there is no valid account connected, bail. if ( ! $this->gateway->is_connected() || ! $this->account->is_stripe_account_valid() ) { return; } // If this is not a live account, bail since we will inform the user about the test account instead. if ( ! $this->account->get_is_live() ) { return; } // If the test mode is not enabled, bail. if ( ! WC_Payments::mode()->is_test() ) { return; } // Output the notice. ?>
is_dev() ) { printf( /* translators: 1: Anchor opening tag; 2: Anchor closing tag; 3: Anchor opening tag; 4: Anchor closing tag */ esc_html__( 'Test mode is active because your store is running in a development or staging environment. To disable it, switch to a production %1$sWordPress environment%2$s or remove the WCPAY_DEV_MODE constant. %3$sLearn more%4$s', 'woocommerce-payments' ), '', '', '', '' ); } else { printf( /* translators: 1: Anchor opening tag; 2: Anchor closing tag */ esc_html__( 'You can use %1$stest card numbers%2$s to simulate various types of transactions.', 'woocommerce-payments' ), '', '' ); } ?>
is_dev() ) { printf( /* translators: %s: URL to learn more */ esc_html__( 'Provide additional details about your business so you can begin accepting real payments. %1$sLearn more%2$s', 'woocommerce-payments' ), '', '' ); } else { esc_html_e( '⚠️ Development mode is enabled for the store! There can be no live onboarding process while using development, testing, or staging WordPress environments!', 'woocommerce-payments' ); echo ''; printf( /* translators: 1: Anchor opening tag; 2: Anchor closing tag; 3: Anchor opening tag; 4: Anchor closing tag */ esc_html__( 'To begin accepting real payments, please go to the live store or change your %1$sWordPress environment%2$s to a production one. %3$sLearn more%4$s', 'woocommerce-payments' ), '', '', '', '' ); } ?>
is_dev() ) { ?>is_dev() ) { printf( /* translators: 1: Anchor opening tag; 2: Anchor closing tag; 3: Anchor opening tag; 4: Anchor closing tag */ esc_html__( 'To begin accepting real payments you will need to first %1$sreset your account%2$s and, then, provide additional details about your business. %3$sLearn more%4$s', 'woocommerce-payments' ), '', '', '', '', ); } else { esc_html_e( '⚠️ Development mode is enabled for the store! There can be no live onboarding process while using development, testing, or staging WordPress environments!', 'woocommerce-payments' ); echo ''; printf( /* translators: 1: Anchor opening tag; 2: Anchor closing tag; 3: Anchor opening tag; 4: Anchor closing tag */ esc_html__( 'To begin accepting real payments, please go to the live store or change your %1$sWordPress environment%2$s to a production one. %3$sLearn more%4$s', 'woocommerce-payments' ), '', '', '', '' ); } ?>