Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
HelioPay::is_in_test_mode
Try to determine if the payment gateway is in test mode.
This is a best-effort attempt, as there is no standard way to determine this. Trust the true value, but don't consider a false value as definitive.
Method of the class: HelioPay{}
No Hooks.
Returns
true|false. True if the payment gateway is in test mode, false otherwise.
Usage
$HelioPay = new HelioPay(); $HelioPay->is_in_test_mode( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
HelioPay::is_in_test_mode() HelioPay::is in test mode code WC 10.7.0
public function is_in_test_mode( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( defined( 'HELIO_DEVNET_ENABLED' ) ) {
return wc_string_to_bool( $payment_gateway->get_option( \HELIO_DEVNET_ENABLED ) );
}
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway is in test mode: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
return parent::is_in_test_mode( $payment_gateway );
}