Automattic\WooCommerce\Gateways\PayPal
TransactAccountManager::send_transact_api_request
Send a request to the Transact platform.
Метод класса: TransactAccountManager{}
Хуков нет.
Возвращает
Массив|\WP_Error. The API response body, or null if the request fails.
Использование
// private - только в коде основоного (родительского) класса $result = $this->send_transact_api_request( $method, $endpoint, $request_body );
- $method(строка) (обязательный)
- The HTTP method to use.
- $endpoint(строка) (обязательный)
- The endpoint to request.
- $request_body(массив) (обязательный)
- The request body.
Список изменений
| С версии 10.5.0 | Введена. |
Код TransactAccountManager::send_transact_api_request() TransactAccountManager::send transact api request WC 11.0.1
private function send_transact_api_request( string $method, string $endpoint, array $request_body ) {
if ( 'GET' === $method ) {
$endpoint .= '?' . http_build_query( $request_body );
}
$response = Jetpack_Connection_Client::wpcom_json_api_request_as_blog(
$endpoint,
(string) self::WPCOM_PROXY_ENDPOINT_API_VERSION,
array(
'headers' => array( 'Content-Type' => 'application/json' ),
'method' => $method,
'timeout' => PayPalConstants::WPCOM_PROXY_REQUEST_TIMEOUT,
),
'GET' === $method ? null : wp_json_encode( $request_body ),
'wpcom'
);
return $response;
}