Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions
PaymentGatewaysController::handle_successfull_connection()
Handle a successful gateway connection.
Метод класса: PaymentGatewaysController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = PaymentGatewaysController::handle_successfull_connection( $gateway_id );
- $gateway_id(строка) (обязательный)
- Gateway ID.
Код PaymentGatewaysController::handle_successfull_connection() PaymentGatewaysController::handle successfull connection WC 9.2.3
public static function handle_successfull_connection( $gateway_id ) { // phpcs:disable WordPress.Security.NonceVerification if ( ! isset( $_GET['success'] ) || 1 !== intval( $_GET['success'] ) ) { return; } // phpcs:enable WordPress.Security.NonceVerification $payment_gateways = WC()->payment_gateways()->payment_gateways(); $payment_gateway = isset( $payment_gateways[ $gateway_id ] ) ? $payment_gateways[ $gateway_id ] : null; if ( ! $payment_gateway ) { return; } $payment_gateway->update_option( 'enabled', 'yes' ); TransientNotices::add( array( 'user_id' => get_current_user_id(), 'id' => 'payment-gateway-connection-return-' . str_replace( ',', '-', $gateway_id ), 'status' => 'success', 'content' => sprintf( /* translators: the title of the payment gateway */ __( '%s connected successfully', 'woocommerce' ), $payment_gateway->method_title ), ) ); wc_admin_record_tracks_event( 'tasklist_payment_connect_method', array( 'payment_method' => $gateway_id, ) ); wp_safe_redirect( wc_admin_url() ); }