WooCommerce Code Reference

WC_Payment_Token_ECheck extends WC_Payment_Token

WooCommerce eCheck Payment Token.

Representation of a payment token for eChecks.

Tags
class

WC_Payment_Token_ECheck

version
3.0.0
since
2.6.0

Table of Contents

$cache_group  : string
Stores meta in cache for future reads.
$changes  : array
Core data changes for this object.
$data  : array
Core data for this object. Name value pairs (name + default value).
$data_store  : object
Contains a reference to the data store for this class.
$default_data  : array
Set to _data on construct so we can track and reset data if needed.
$extra_data  : array
Stores eCheck payment token data.
$id  : int
ID for this object.
$meta_data  : array
Stores additional meta data.
$object_read  : bool
This is false until the object is read from the DB.
$object_type  : string
This is the name of this object type.
$type  : string
Token Type String.
__clone()  : mixed
When the object is cloned, make sure meta is duplicated correctly.
__construct()  : mixed
Default constructor.
__sleep()  : array
Only store the object ID to avoid serializing the data object instance.
__toString()  : string
Change data to JSON format.
__wakeup()  : mixed
Re-run the constructor with the object ID.
add_meta_data()  : mixed
Add meta data.
apply_changes()  : mixed
Merge changes with data and clear.
create()  : mixed
Create a token.
delete()  : bool
Delete an object, set the ID to 0, and return result.
delete_meta_data()  : mixed
Delete meta data.
delete_meta_data_by_mid()  : mixed
Delete meta data.
get_changes()  : array
Return data changes only.
get_data()  : array
Returns all data for this object.
get_data_keys()  : array
Returns array of expected data keys for this object.
get_data_store()  : object
Get the data store.
get_display_name()  : string
Get type to display to user.
get_extra_data_keys()  : array
Returns all "extra" data keys for an object (for sub objects like product types).
get_gateway_id()  : string
Returns the ID of the gateway associated with this payment token.
get_id()  : int
Returns the unique ID for this object.
get_is_default()  : string
Returns the ID of the gateway associated with this payment token.
get_last4()  : string
Returns the last four digits.
get_meta()  : mixed
Get Meta Data by Key.
get_meta_data()  : array
Get All Meta Data.
get_object_read()  : bool
Get object read property.
get_token()  : string
Returns the raw payment token.
get_type()  : string
Returns the type of this payment token (CC, eCheck, or something else).
get_user_id()  : int
Returns the user ID associated with the token or false if this token is not associated.
is_default()  : bool
Returns if the token is marked as default.
meta_exists()  : bool
See if meta data exists, since get_meta always returns a '' or array().
read()  : mixed
Read a token by ID.
read_meta_data()  : mixed
Read Meta Data from the database. Ignore any internal properties.
save()  : int
Save should create or update based on object existence.
save_meta_data()  : mixed
Update Meta Data in the database.
set_default()  : mixed
Marks the payment as default or non-default.
set_defaults()  : mixed
Set all props to default values.
set_gateway_id()  : mixed
Set the gateway ID.
set_id()  : mixed
Set ID.
set_last4()  : mixed
Set the last four digits.
set_meta_data()  : mixed
Set all meta data from array.
set_object_read()  : mixed
Set object read property.
set_props()  : bool|WP_Error
Set a collection of props in one go, collect any errors, and return the result.
set_token()  : mixed
Set the raw payment token.
set_type()  : mixed
Sets the type of this payment token (CC, eCheck, or something else).
set_user_id()  : mixed
Set the user ID for the user associated with this order.
update()  : mixed
Update a token.
update_meta_data()  : mixed
Update meta data by key or ID, if provided.
validate()  : bool
Validate eCheck payment tokens.
error()  : mixed
When invalid data is found, throw an exception unless reading from the DB.
filter_null_meta()  : bool
Filter null meta values from array.
get_hook_prefix()  : mixed
Hook prefix
get_prop()  : mixed
Gets a prop for a getter method.
is_internal_meta_key()  : bool
Check if the key is an internal one.
maybe_read_meta_data()  : mixed
Read meta data if null.
set_date_prop()  : mixed
Sets a date prop whilst handling formatting and datetime objects.
set_prop()  : mixed
Sets a prop for a setter method.

Properties

Methods

__construct()

Default constructor.

public __construct(int|object|array $read) : mixed
Parameters
$read : int|object|array

ID to load from the DB (optional) or already queried data.

Return values
mixed

add_meta_data()

Add meta data.

public add_meta_data(string $key, string|array $value[, bool $unique = false ]) : mixed
Parameters
$key : string

Meta key.

$value : string|array

Meta value.

$unique : bool = false

Should this be a unique key?.

Tags
since
2.6.0
Return values
mixed

delete()

Delete an object, set the ID to 0, and return result.

public delete([bool $force_delete = false ]) : bool
Parameters
$force_delete : bool = false

Should the date be deleted permanently.

Tags
since
2.6.0
Return values
boolresult

delete_meta_data()

Delete meta data.

public delete_meta_data(string $key) : mixed
Parameters
$key : string

Meta key.

Tags
since
2.6.0
Return values
mixed

delete_meta_data_by_mid()

Delete meta data.

public delete_meta_data_by_mid(int $mid) : mixed
Parameters
$mid : int

Meta ID.

Tags
since
2.6.0
Return values
mixed

get_display_name()

Get type to display to user.

public get_display_name([string $deprecated = '' ]) : string

Get's overwritten by child classes.

Parameters
$deprecated : string = ''

Deprecated since WooCommerce 3.0.

Tags
since
2.6.0
Return values
string

get_extra_data_keys()

Returns all "extra" data keys for an object (for sub objects like product types).

public get_extra_data_keys() : array
Tags
since
3.0.0
Return values
array

get_gateway_id()

Returns the ID of the gateway associated with this payment token.

public get_gateway_id([string $context = 'view' ]) : string
Parameters
$context : string = 'view'

In what context to execute this.

Tags
since
2.6.0
Return values
stringGateway ID

get_is_default()

Returns the ID of the gateway associated with this payment token.

public get_is_default([string $context = 'view' ]) : string
Parameters
$context : string = 'view'

In what context to execute this.

Tags
since
2.6.0
Return values
stringGateway ID

get_last4()

Returns the last four digits.

public get_last4([string $context = 'view' ]) : string
Parameters
$context : string = 'view'

What the value is for. Valid values are view and edit.

Tags
since
2.6.0
Return values
stringLast 4 digits

get_meta()

Get Meta Data by Key.

public get_meta([string $key = '' ][, bool $single = true ][, string $context = 'view' ]) : mixed
Parameters
$key : string = ''

Meta Key.

$single : bool = true

return first found meta with key, or all with $key.

$context : string = 'view'

What the value is for. Valid values are view and edit.

Tags
since
2.6.0
Return values
mixed

get_token()

Returns the raw payment token.

public get_token([string $context = 'view' ]) : string
Parameters
$context : string = 'view'

Context in which to call this.

Tags
since
2.6.0
Return values
stringRaw token

get_type()

Returns the type of this payment token (CC, eCheck, or something else).

public get_type([string $deprecated = '' ]) : string

Overwritten by child classes.

Parameters
$deprecated : string = ''

Deprecated since WooCommerce 3.0.

Tags
since
2.6.0
Return values
stringPayment Token Type (CC, eCheck)

get_user_id()

Returns the user ID associated with the token or false if this token is not associated.

public get_user_id([string $context = 'view' ]) : int
Parameters
$context : string = 'view'

In what context to execute this.

Tags
since
2.6.0
Return values
intUser ID if this token is associated with a user or 0 if no user is associated

meta_exists()

See if meta data exists, since get_meta always returns a '' or array().

public meta_exists([string $key = '' ]) : bool
Parameters
$key : string = ''

Meta Key.

Tags
since
3.0.0
Return values
bool

read_meta_data()

Read Meta Data from the database. Ignore any internal properties.

public read_meta_data([bool $force_read = false ]) : mixed

Uses it's own caches because get_metadata does not provide meta_ids.

Parameters
$force_read : bool = false

True to force a new DB read (and update cache).

Tags
since
2.6.0
Return values
mixed

set_default()

Marks the payment as default or non-default.

public set_default(bool $is_default) : mixed
Parameters
$is_default : bool

True or false.

Tags
since
2.6.0
Return values
mixed

set_meta_data()

Set all meta data from array.

public set_meta_data(array $data) : mixed
Parameters
$data : array

Key/Value pairs.

Tags
since
2.6.0
Return values
mixed

set_object_read()

Set object read property.

public set_object_read([bool $read = true ]) : mixed
Parameters
$read : bool = true

Should read?.

Tags
since
3.0.0
Return values
mixed

set_props()

Set a collection of props in one go, collect any errors, and return the result.

public set_props(array $props[, string $context = 'set' ]) : bool|WP_Error

Only sets using public methods.

Parameters
$props : array

Key value pairs to set. Key is the prop and should map to a setter function name.

$context : string = 'set'

In what context to run this.

Tags
since
3.0.0
Return values
bool|WP_Error

set_user_id()

Set the user ID for the user associated with this order.

public set_user_id(int $user_id) : mixed
Parameters
$user_id : int

User ID.

Tags
since
2.6.0
Return values
mixed

update_meta_data()

Update meta data by key or ID, if provided.

public update_meta_data(string $key, string|array $value, int $meta_id) : mixed
Parameters
$key : string

Meta key.

$value : string|array

Meta value.

$meta_id : int

Meta ID.

Tags
since
2.6.0
Return values
mixed

validate()

Validate eCheck payment tokens.

public validate() : bool

These fields are required by all eCheck payment tokens: last4 - string Last 4 digits of the check

Tags
since
2.6.0
Return values
boolTrue if the passed data is valid

error()

When invalid data is found, throw an exception unless reading from the DB.

protected error(string $code, string $message[, int $http_status_code = 400 ][, array $data = array() ]) : mixed
Parameters
$code : string

Error code.

$message : string

Error message.

$http_status_code : int = 400

HTTP status code.

$data : array = array()

Extra error data.

Tags
throws
WC_Data_Exception

Data Exception.

since
3.0.0
Return values
mixed

filter_null_meta()

Filter null meta values from array.

protected filter_null_meta(mixed $meta) : bool
Parameters
$meta : mixed

Meta value to check.

Tags
since
3.0.0
Return values
bool

get_prop()

Gets a prop for a getter method.

protected get_prop(string $prop[, string $context = 'view' ]) : mixed

Gets the value from either current pending changes, or the data itself. Context controls what happens to the value before it's returned.

Parameters
$prop : string

Name of prop to get.

$context : string = 'view'

What the value is for. Valid values are view and edit.

Tags
since
3.0.0
Return values
mixed

is_internal_meta_key()

Check if the key is an internal one.

protected is_internal_meta_key(string $key) : bool
Parameters
$key : string

Key to check.

Tags
since
3.2.0
Return values
booltrue if it's an internal key, false otherwise

set_date_prop()

Sets a date prop whilst handling formatting and datetime objects.

protected set_date_prop(string $prop, string|int $value) : mixed
Parameters
$prop : string

Name of prop to set.

$value : string|int

Value of the prop.

Tags
since
3.0.0
Return values
mixed

set_prop()

Sets a prop for a setter method.

protected set_prop(string $prop, mixed $value) : mixed

This stores changes in a special array so we can track what needs saving the the DB later.

Parameters
$prop : string

Name of prop to set.

$value : mixed

Value of the prop.

Tags
since
3.0.0
Return values
mixed