PHP Класс WC_Payment_Token

Representation of a general payment token to be extended by individuals types of tokens examples: Credit Card, eCheck.
С версии: 2.6.0
Автор: WooThemes
Наследование: extends WC_Legacy_Payment_Token
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$data array Token Data (stored in the payment_tokens table).

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

Метод Описание
__construct ( mixed $token = '' ) Initialize a payment token.
get_display_name ( string $context = 'view' ) : string Get type to display to user.
get_gateway_id ( string $context = 'view' ) : string Returns the ID of the gateway associated with this payment token.
get_is_default ( string $context = 'view' ) : string Returns the ID of the gateway associated with this payment token.
get_token ( string $context = 'view' ) : string Returns the raw payment token.
get_type ( string $context = 'view' ) : string Returns the type of this payment token (CC, eCheck, or something else).
get_user_id ( string $context = 'view' ) : integer Returns the user ID associated with the token or false if this token is not associated.
is_default ( ) : boolean Returns if the token is marked as default.
set_default ( boolean $is_default ) Marks the payment as default or non-default.
set_gateway_id ( string $gateway_id ) Set the gateway ID.
set_token ( string $token ) Set the raw payment token.
set_type ( $type ) Sets the type of this payment token (CC, eCheck, or something else).
set_user_id ( integer $user_id ) Set the user ID for the user associated with this order.
validate ( ) : boolean Validate basic token info (token and type are required).

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

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

These fields are accepted by all payment tokens: is_default - boolean Optional - Indicates this is the default payment token for a user token - string Required - The actual token to store gateway_id - string Required - Identifier for the gateway this token is associated with user_id - int Optional - ID for the user this token is associated with. 0 if this token is not associated with a user
С версии: 2.6.0
public __construct ( mixed $token = '' )
$token mixed

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

Get's overwritten by child classes.
С версии: 2.6.0
public get_display_name ( string $context = 'view' ) : string
$context string
Результат string

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

Returns the ID of the gateway associated with this payment token.
С версии: 2.6.0
public get_gateway_id ( string $context = 'view' ) : string
$context string
Результат string Gateway ID

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

Returns the ID of the gateway associated with this payment token.
С версии: 2.6.0
public get_is_default ( string $context = 'view' ) : string
$context string
Результат string Gateway ID

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

Returns the raw payment token.
С версии: 2.6.0
public get_token ( string $context = 'view' ) : string
$context string
Результат string Raw token

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

Returns the type of this payment token (CC, eCheck, or something else).
С версии: 2.6.0
public get_type ( string $context = 'view' ) : string
$context string
Результат string Payment Token Type (CC, eCheck)

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

Returns the user ID associated with the token or false if this token is not associated.
С версии: 2.6.0
public get_user_id ( string $context = 'view' ) : integer
$context string
Результат integer User ID if this token is associated with a user or 0 if no user is associated

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

Returns if the token is marked as default.
С версии: 2.6.0
public is_default ( ) : boolean
Результат boolean True if the token is default

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

Marks the payment as default or non-default.
С версии: 2.6.0
public set_default ( boolean $is_default )
$is_default boolean True or false

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

Set the gateway ID.
С версии: 2.6.0
public set_gateway_id ( string $gateway_id )
$gateway_id string

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

Set the raw payment token.
С версии: 2.6.0
public set_token ( string $token )
$token string

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

Sets the type of this payment token (CC, eCheck, or something else).
С версии: 2.7.0
public set_type ( $type )

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

Set the user ID for the user associated with this order.
С версии: 2.6.0
public set_user_id ( integer $user_id )
$user_id integer

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

Validate basic token info (token and type are required).
С версии: 2.6.0
public validate ( ) : boolean
Результат boolean True if the passed data is valid

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

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

Token Data (stored in the payment_tokens table).
protected array $data
Результат array