PHP Класс WC_Connect_API_Client, woocommerce-connect-client

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$validator WC_Connect_Services_Validator
$wc_connect_loader WC_Connect_Loader

Открытые методы

Метод Описание
__construct ( WC_Connect_Service_Schemas_Validator $validator, WC_Connect_Loader $wc_connect_loader )
auth_test ( ) : true | WP_Error Tests the connection to the Connect for WooCommerce Server
get_label_rates ( array $request ) : object | WP_Error Gets shipping rates (for labels) from the Connect for WooCommerce Server
get_label_status ( $label_id ) : object | WP_Error Gets the shipping label status (refund status, tracking code, etc)
get_labels_preview_pdf ( $request ) : object | WP_Error Gets a PDF with the set of dummy labels specified in the request
get_labels_print_pdf ( $request ) : object | WP_Error Gets a PDF with the requested shipping labels in it
get_payment_methods ( ) : mixed | WP_Error Asks the Connect for WooCommerce server for an array of payment methods
get_service_schemas ( ) : array | WP_Error Requests the available services for this site from the Connect for WooCommerce Server
get_shipping_rates ( $services, $package, $boxes ) : object | WP_Error Gets shipping rates (for checkout) from the Connect for WooCommerce Server
send_address_normalization_request ( $body )
send_shipping_label_refund_request ( $label_id ) : object | WP_Error Request a refund for a given shipping label
send_shipping_label_request ( $body )
validate_service_settings ( $service_slug, $service_settings ) : boolean | WP_Error Validates the settings for a given service with the Connect for WooCommerce Server

Защищенные методы

Метод Описание
authorization_header ( )
request ( $method, $path, $body = [] ) : mixed | WP_Error Sends a request to the Connect for WooCommerce Server
request_body ( array $initial_body = [] ) : array Adds useful WP/WC/WCC information to request bodies
request_headers ( ) : array | WP_Error Generates headers for our request to the Connect for WooCommerce Server
request_signature ( $token_key, $token_secret, $timestamp, $nonce, $time_diff )

Приватные методы

Метод Описание
generate_guid ( ) : string Generates a GUID.
get_guid ( )

Описание методов

__construct() публичный Метод

public __construct ( WC_Connect_Service_Schemas_Validator $validator, WC_Connect_Loader $wc_connect_loader )
$validator WC_Connect_Service_Schemas_Validator
$wc_connect_loader WC_Connect_Loader

auth_test() публичный Метод

Tests the connection to the Connect for WooCommerce Server
public auth_test ( ) : true | WP_Error
Результат true | WP_Error

authorization_header() защищенный Метод

protected authorization_header ( )

get_label_rates() публичный Метод

Gets shipping rates (for labels) from the Connect for WooCommerce Server
public get_label_rates ( array $request ) : object | WP_Error
$request array - array( 'packages' => array( array( 'id' => 'box_1', 'height' => 10, 'length' => 10, 'width' => 10, 'weight' => 10, ), array( 'id' => 'box_2', 'box_id' => 'medium_flat_box_top', 'weight' => 5, ), ... ), 'carrier' => 'usps', 'origin' => array( 'address' => '132 Hawthorne St', 'address_2' => '', 'city' => 'San Francisco', 'state' => 'CA', 'postcode' => '94107', 'country' => 'US', ), 'destination' => array( 'address' => '1550 Snow Creek Dr', 'address_2' => '', 'city' => 'Park City', 'state' => 'UT', 'postcode' => '84060', 'country' => 'US', ), )
Результат object | WP_Error

get_label_status() публичный Метод

Gets the shipping label status (refund status, tracking code, etc)
public get_label_status ( $label_id ) : object | WP_Error
$label_id integer
Результат object | WP_Error

get_labels_preview_pdf() публичный Метод

Gets a PDF with the set of dummy labels specified in the request
public get_labels_preview_pdf ( $request ) : object | WP_Error
$request
Результат object | WP_Error

get_labels_print_pdf() публичный Метод

Gets a PDF with the requested shipping labels in it
public get_labels_print_pdf ( $request ) : object | WP_Error
$request
Результат object | WP_Error

get_payment_methods() публичный Метод

Asks the Connect for WooCommerce server for an array of payment methods
public get_payment_methods ( ) : mixed | WP_Error
Результат mixed | WP_Error

get_service_schemas() публичный Метод

Requests the available services for this site from the Connect for WooCommerce Server
public get_service_schemas ( ) : array | WP_Error
Результат array | WP_Error

get_shipping_rates() публичный Метод

Gets shipping rates (for checkout) from the Connect for WooCommerce Server
public get_shipping_rates ( $services, $package, $boxes ) : object | WP_Error
$services All settings for all services we want rates for
$package Package provided to WC_Shipping_Method::calculate_shipping()
Результат object | WP_Error

request() защищенный Метод

Sends a request to the Connect for WooCommerce Server
protected request ( $method, $path, $body = [] ) : mixed | WP_Error
$method
$path
$body
Результат mixed | WP_Error

request_body() защищенный Метод

Adds useful WP/WC/WCC information to request bodies
protected request_body ( array $initial_body = [] ) : array
$initial_body array
Результат array

request_headers() защищенный Метод

Generates headers for our request to the Connect for WooCommerce Server
protected request_headers ( ) : array | WP_Error
Результат array | WP_Error

request_signature() защищенный Метод

protected request_signature ( $token_key, $token_secret, $timestamp, $nonce, $time_diff )

send_address_normalization_request() публичный Метод

send_shipping_label_refund_request() публичный Метод

Request a refund for a given shipping label
public send_shipping_label_refund_request ( $label_id ) : object | WP_Error
$label_id integer
Результат object | WP_Error

send_shipping_label_request() публичный Метод

public send_shipping_label_request ( $body )

validate_service_settings() публичный Метод

Validates the settings for a given service with the Connect for WooCommerce Server
public validate_service_settings ( $service_slug, $service_settings ) : boolean | WP_Error
$service_slug
$service_settings
Результат boolean | WP_Error

Описание свойств

$validator защищенное свойство

protected WC_Connect_Services_Validator $validator
Результат WC_Connect_Services_Validator

$wc_connect_loader защищенное свойство

protected WC_Connect_Loader $wc_connect_loader
Результат WC_Connect_Loader