PHP Class WC_Payment_Token_Data_Store

Author: WooThemes
Inheritance: extends WC_Data_Store_WP, implements WC_Payment_Token_Data_Store_Interface, implements WC_Object_Data_Store_Interface
Show file Open project: woocommerce/woocommerce

Protected Properties

Property Type Description
$meta_type string Meta type. Payment tokens are a new object type.

Public Methods

Method Description
create ( WC_Payment_Token &$token ) Create a new payment token in the database.
delete ( WC_Payment_Token &$token, boolean $force_delete = false ) Remove a payment token from the database.
get_metadata ( id $token_id ) : array Returns metadata for a specific payment token.
get_token_by_id ( id $token_id ) : object Returns an stdObject of a token.
get_token_type_by_id ( id $token_id ) : string Get a token's type by ID.
get_tokens ( array $args ) : array Returns an array of objects (stdObject) matching specific token critera.
get_users_default_token ( id $user_id ) : object Returns an stdObject of a token for a user's default token.
read ( WC_Payment_Token &$token ) Read a token from the database.
set_default_status ( id $token_id, $status = true ) : string Update's a tokens default status in the database. Used for quickly looping through tokens and setting their statuses instead of creating a bunch of objects.
update ( WC_Payment_Token &$token ) Update a payment token.

Method Details

create() public method

Create a new payment token in the database.
Since: 2.7.0
public create ( WC_Payment_Token &$token )
$token WC_Payment_Token

delete() public method

Remove a payment token from the database.
Since: 2.7.0
public delete ( WC_Payment_Token &$token, boolean $force_delete = false )
$token WC_Payment_Token
$force_delete boolean

get_metadata() public method

Returns metadata for a specific payment token.
Since: 2.7.0
public get_metadata ( id $token_id ) : array
$token_id id
return array

get_token_by_id() public method

Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
Since: 2.7.0
public get_token_by_id ( id $token_id ) : object
$token_id id
return object

get_token_type_by_id() public method

Get a token's type by ID.
Since: 2.7.0
public get_token_type_by_id ( id $token_id ) : string
$token_id id
return string

get_tokens() public method

Accepts token_id, user_id, gateway_id, and type. Each object should contain the fields token_id, gateway_id, token, user_id, type, is_default.
Since: 2.7.0
public get_tokens ( array $args ) : array
$args array
return array

get_users_default_token() public method

Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
Since: 2.7.0
public get_users_default_token ( id $user_id ) : object
$user_id id
return object

read() public method

Read a token from the database.
Since: 2.7.0
public read ( WC_Payment_Token &$token )
$token WC_Payment_Token

set_default_status() public method

Update's a tokens default status in the database. Used for quickly looping through tokens and setting their statuses instead of creating a bunch of objects.
Since: 2.7.0
public set_default_status ( id $token_id, $status = true ) : string
$token_id id
return string

update() public method

Update a payment token.
Since: 2.7.0
public update ( WC_Payment_Token &$token )
$token WC_Payment_Token

Property Details

$meta_type protected property

Meta type. Payment tokens are a new object type.
protected string $meta_type
return string