WooCommerce Code Reference

WC_Gateway_Paypal_Transact_Account_Manager
in package

Handles Transact account management.

Table of Contents

TRANSACT_ACCOUNT_CACHE_EXPIRY  = 60 * 60 * 24
The expiry time for the Transact account cache.
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_LIVE  = 'woocommerce_paypal_transact_merchant_account_live'
Cache keys for the merchant and provider accounts.
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_TEST  = 'woocommerce_paypal_transact_merchant_account_test'
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_LIVE  = 'woocommerce_paypal_transact_provider_account_live'
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_TEST  = 'woocommerce_paypal_transact_provider_account_test'
TRANSACT_PROVIDER_TYPE  = 'paypal_standard'
Transact provider type, for provider onboarding.
WPCOM_PROXY_ENDPOINT_API_VERSION  = 2
The API version for the proxy endpoint.
$gateway  : WC_Gateway_Paypal
Paypal gateway object.
__construct()  : mixed
Constructor.
do_onboarding()  : void
Onboard the merchant with the Transact platform.
get_transact_account_data()  : array<string|int, mixed>|null
Get the Transact account (merchant or provider) data. Performs a fetch if the account is not in cache or expired.
create_merchant_account()  : array<string|int, mixed>|null
Create the merchant account with the Transact platform.
create_provider_account()  : bool
Create the provider account with the Transact platform.
fetch_merchant_account()  : array<string|int, mixed>|null
Fetch the merchant account from the Transact platform.
fetch_provider_account()  : bool
Fetch the provider account from the Transact platform.
get_cache_key()  : string|null
Get the cache key for the transact account.
get_transact_account_from_cache()  : bool|null
Get the transact account (merchant or provider) from the database cache.
send_transact_api_request()  : array<string|int, mixed>|null
Send a request to the Transact platform.
update_transact_account_cache()  : mixed
Update the transact account (merchant or provider) cache.

Constants

Properties

Methods

get_transact_account_data()

Get the Transact account (merchant or provider) data. Performs a fetch if the account is not in cache or expired.

public get_transact_account_data(string $account_type) : array<string|int, mixed>|null
Parameters
$account_type : string

The type of account to get (merchant or provider).

Return values
array<string|int, mixed>|nullReturns null if the transact account cannot be retrieved.

get_transact_account_from_cache()

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

private get_transact_account_from_cache(string $cache_key) : bool|null
Parameters
$cache_key : string

The cache key to get the account.

Return values
bool|nullThe transact account data, or null if the cache is empty or expired.

send_transact_api_request()

Send a request to the Transact platform.

private send_transact_api_request(string $method, string $endpoint, array<string|int, mixed> $request_body) : array<string|int, mixed>|null
Parameters
$method : string

The HTTP method to use.

$endpoint : string

The endpoint to request.

$request_body : array<string|int, mixed>

The request body.

Return values
array<string|int, mixed>|nullThe API response body, or null if the request fails.

update_transact_account_cache()

Update the transact account (merchant or provider) cache.

private update_transact_account_cache(string $cache_key, array<string|int, mixed> $account_data) : mixed
Parameters
$cache_key : string

The cache key to update.

$account_data : array<string|int, mixed>

The transact account data.

Return values
mixed