Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
WooPayments::has_sandbox_account
Determines if the current account is a sandbox account.
Sandbox accounts are accounts that were onboarded in test mode. They are different from test accounts (i.e. test-drive accounts).
Sandbox accounts are generally created in development or staging environments when simulating live onboarding.
Method of the class: WooPayments{}
No Hooks.
Returns
true|false. True if the account is a sandbox account, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->has_sandbox_account(): bool;
WooPayments::has_sandbox_account() WooPayments::has sandbox account code WC 10.9.4
private function has_sandbox_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['isLive'] ) && empty( $account_status['testDrive'] );
}
}
return false;
}