PHP 클래스 WC_Connect_API_Client, woocommerce-connect-client

파일 보기 프로젝트 열기: Automattic/woocommerce-connect-client 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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