PHP Class WC_Connect_Service_Settings_Store, woocommerce-connect-client

Exibir arquivo Open project: Automattic/woocommerce-connect-client Class Usage Examples

Protected Properties

Property Type Description
$api_client WC_Connect_API_Client
$logger WC_Connect_Logger
$service_schemas_store WC_Connect_Service_Schemas_Store

Public Methods

Method Description
__construct ( WC_Connect_Service_Schemas_Store $service_schemas_store, WC_Connect_API_Client $api_client, WC_Connect_Logger $logger )
get_account_settings ( ) : array Gets connect account settings (e.g. payment method)
get_enabled_services ( ) : array Returns the service type and id for each enabled Connect for WooCommerce service
get_origin_address ( )
get_package_lookup_for_service ( $service_id )
get_packages ( ) : array Returns a global list of packages
get_predefined_packages ( ) : array Returns a global list of enabled predefined packages for all services
get_predefined_packages_for_service ( $service_id ) : array Returns a list of enabled predefined packages for the specified service
get_preferred_paper_size ( )
get_selected_payment_method_id ( )
get_service_failure_timestamp_key ( string $service_id, integer $service_instance = false ) : string Based on the service id and optional instance, generates the options key that should be used to get/set the service's last failure timestamp
get_service_settings ( string $service_id, integer $service_instance = false ) : object | array Given a service's id and optional instance, returns the settings for that service or an empty array
get_store_options ( ) : object | array Gets woocommerce store options that are useful for all connect services
set_preferred_paper_size ( $size )
set_selected_payment_method_id ( $new_payment_method_id )
update_account_settings ( array $settings ) : true Updates connect account settings (e.g. payment method)
update_label_order_meta_data ( $order_id, $new_label_data )
update_origin_address ( $address )
update_packages ( $packages ) Updates the global list of packages
update_predefined_packages ( $packages ) Updates the global list of enabled predefined packages for all services
validate_and_possibly_update_settings ( $settings, $id, $instance = false ) : boolean | WP_Error Given id and possibly instance, validates the settings and, if they validate, saves them to options

Protected Methods

Method Description
get_service_settings_key ( string $service_id, integer $service_instance = false ) : string Based on the service id and optional instance, generates the options key that should be used to get/set the service's settings
sort_services ( $a, $b )

Private Methods

Method Description
translate_unit ( $value )

Method Details

__construct() public method

public __construct ( WC_Connect_Service_Schemas_Store $service_schemas_store, WC_Connect_API_Client $api_client, WC_Connect_Logger $logger )
$service_schemas_store WC_Connect_Service_Schemas_Store
$api_client WC_Connect_API_Client
$logger WC_Connect_Logger

get_account_settings() public method

Gets connect account settings (e.g. payment method)
public get_account_settings ( ) : array
return array

get_enabled_services() public method

Shipping services also include instance_id and shipping zone id Note that at this time, only shipping services exist, but this method will return other services in the future
public get_enabled_services ( ) : array
return array

get_origin_address() public method

public get_origin_address ( )

get_package_lookup_for_service() public method

public get_package_lookup_for_service ( $service_id )

get_packages() public method

Returns a global list of packages
public get_packages ( ) : array
return array

get_predefined_packages() public method

Returns a global list of enabled predefined packages for all services
public get_predefined_packages ( ) : array
return array

get_predefined_packages_for_service() public method

Returns a list of enabled predefined packages for the specified service
public get_predefined_packages_for_service ( $service_id ) : array
$service_id
return array

get_preferred_paper_size() public method

get_selected_payment_method_id() public method

get_service_failure_timestamp_key() public method

Based on the service id and optional instance, generates the options key that should be used to get/set the service's last failure timestamp
public get_service_failure_timestamp_key ( string $service_id, integer $service_instance = false ) : string
$service_id string
$service_instance integer
return string

get_service_settings() public method

Given a service's id and optional instance, returns the settings for that service or an empty array
public get_service_settings ( string $service_id, integer $service_instance = false ) : object | array
$service_id string
$service_instance integer
return object | array

get_service_settings_key() protected method

Based on the service id and optional instance, generates the options key that should be used to get/set the service's settings
protected get_service_settings_key ( string $service_id, integer $service_instance = false ) : string
$service_id string
$service_instance integer
return string

get_store_options() public method

Gets woocommerce store options that are useful for all connect services
public get_store_options ( ) : object | array
return object | array

set_preferred_paper_size() public method

public set_preferred_paper_size ( $size )

set_selected_payment_method_id() public method

public set_selected_payment_method_id ( $new_payment_method_id )

sort_services() protected method

protected sort_services ( $a, $b )

update_account_settings() public method

Updates connect account settings (e.g. payment method)
public update_account_settings ( array $settings ) : true
$settings array
return true

update_label_order_meta_data() public method

public update_label_order_meta_data ( $order_id, $new_label_data )

update_origin_address() public method

public update_origin_address ( $address )

update_packages() public method

Updates the global list of packages
public update_packages ( $packages )

update_predefined_packages() public method

Updates the global list of enabled predefined packages for all services
public update_predefined_packages ( $packages )

validate_and_possibly_update_settings() public method

Given id and possibly instance, validates the settings and, if they validate, saves them to options
public validate_and_possibly_update_settings ( $settings, $id, $instance = false ) : boolean | WP_Error
return boolean | WP_Error

Property Details

$api_client protected_oe property

protected WC_Connect_API_Client $api_client
return WC_Connect_API_Client

$logger protected_oe property

protected WC_Connect_Logger $logger
return WC_Connect_Logger

$service_schemas_store protected_oe property

protected WC_Connect_Service_Schemas_Store $service_schemas_store
return WC_Connect_Service_Schemas_Store