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
TRANSACT_ACCOUNT_CACHE_EXPIRY
The expiry time for the Transact account cache.
private
int
TRANSACT_ACCOUNT_CACHE_EXPIRY
= 60 * 60 * 24
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_LIVE
Cache keys for the merchant and provider accounts.
private
string
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_LIVE
= 'woocommerce_paypal_transact_merchant_account_live'
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_TEST
private
mixed
TRANSACT_MERCHANT_ACCOUNT_CACHE_KEY_TEST
= 'woocommerce_paypal_transact_merchant_account_test'
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_LIVE
private
mixed
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_LIVE
= 'woocommerce_paypal_transact_provider_account_live'
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_TEST
private
mixed
TRANSACT_PROVIDER_ACCOUNT_CACHE_KEY_TEST
= 'woocommerce_paypal_transact_provider_account_test'
TRANSACT_PROVIDER_TYPE
Transact provider type, for provider onboarding.
private
string
TRANSACT_PROVIDER_TYPE
= 'paypal_standard'
WPCOM_PROXY_ENDPOINT_API_VERSION
The API version for the proxy endpoint.
private
int
WPCOM_PROXY_ENDPOINT_API_VERSION
= 2
Properties
$gateway
Paypal gateway object.
private
WC_Gateway_Paypal
$gateway
Methods
__construct()
Constructor.
public
__construct(WC_Gateway_Paypal $gateway) : mixed
Parameters
- $gateway : WC_Gateway_Paypal
-
Paypal gateway object.
Return values
mixed —do_onboarding()
Onboard the merchant with the Transact platform.
public
do_onboarding() : void
Return values
void —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>|null — Returns null if the transact account cannot be retrieved.create_merchant_account()
Create the merchant account with the Transact platform.
private
create_merchant_account() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null — The API response body, or null if the request fails.create_provider_account()
Create the provider account with the Transact platform.
private
create_provider_account() : bool
Return values
bool — True if the provider account creation was successful, false otherwise.fetch_merchant_account()
Fetch the merchant account from the Transact platform.
private
fetch_merchant_account() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null — The API response body, or null if the request fails.fetch_provider_account()
Fetch the provider account from the Transact platform.
private
fetch_provider_account() : bool
Return values
bool — True if the provider account exists, false otherwise.get_cache_key()
Get the cache key for the transact account.
private
get_cache_key(string $account_type) : string|null
Parameters
- $account_type : string
-
The type of account to get (merchant or provider).
Return values
string|null — The cache key, or null if the account type is invalid.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|null — The 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>|null — The 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.
