Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

Klarna::needs_setuppublicWC 1.0

Check if the payment gateway needs setup.

Method of the class: Klarna{}

No Hooks.

Returns

true|false. True if the payment gateway needs setup, false otherwise.

Usage

$Klarna = new Klarna();
$Klarna->needs_setup( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.

Klarna::needs_setup() code WC 10.8.1

public function needs_setup( WC_Payment_Gateway $payment_gateway ): bool {
	try {
		if ( class_exists( '\KP_Settings_Page' ) &&
			is_callable( '\KP_Settings_Page::get_setting_status' ) ) {

			return ! wc_string_to_bool( \KP_Settings_Page::get_setting_status( 'credentials' ) );
		}
	} catch ( Throwable $e ) {
		// Do nothing but log so we can investigate.
		SafeGlobalFunctionProxy::wc_get_logger()->debug(
			'Failed to determine if gateway needs setup: ' . $e->getMessage(),
			array(
				'gateway'   => $payment_gateway->id,
				'source'    => 'settings-payments',
				'exception' => $e,
			)
		);
	}

	return parent::needs_setup( $payment_gateway );
}