Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
WooPayments::has_test_account
Determines if the current account is a test account.
Test accounts are test-drive accounts. They are different from sandbox accounts (i.e. accounts onboarded in test mode).
Method of the class: WooPayments{}
No Hooks.
Returns
true|false. True if the account is a test account, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->has_test_account(): bool;
WooPayments::has_test_account() WooPayments::has test account code WC 10.9.4
private function has_test_account(): bool {
if ( $this->proxy->call_function( 'function_exists', 'wcpay_get_container' ) &&
$this->proxy->call_function( 'class_exists', 'WC_Payments_Account' ) ) {
$woopayments_container = $this->proxy->call_function( 'wcpay_get_container' );
$account_service = $woopayments_container->get( 'WC_Payments_Account' );
if ( ! empty( $account_service ) &&
$this->proxy->call_function( 'method_exists', $account_service, 'get_account_status_data' ) &&
$this->proxy->call_function( 'is_callable', array( $account_service, 'get_account_status_data' ) ) ) {
$account_status = $account_service->get_account_status_data();
return ! empty( $account_status['testDrive'] );
}
}
return false;
}