Automattic\WooCommerce\Gateways\PayPal

TransactAccountManager::get_transact_account_from_cacheprivateWC 10.5.0

Get the transact account (merchant or provider) from the database cache.

Method of the class: TransactAccountManager{}

No Hooks.

Returns

Mixed. The transact account data, or null if the cache is empty or expired.

Usage

// private - for code of main (parent) class only
$result = $this->get_transact_account_from_cache( $cache_key );
$cache_key(string) (required)
The cache key to get the account.

Changelog

Since 10.5.0 Introduced.

TransactAccountManager::get_transact_account_from_cache() code WC 10.9.4

private function get_transact_account_from_cache( string $cache_key ) {
	$transact_account = get_option( $cache_key, null );

	if ( empty( $transact_account ) || ( isset( $transact_account['expiry'] ) && $transact_account['expiry'] < time() ) ) {
		return null;
	}

	return $transact_account['account'] ?? null;
}