2016-11-14 14:20:41 +00:00
|
|
|
<?php
|
2018-03-06 09:49:02 +00:00
|
|
|
/**
|
|
|
|
* Payment Token Data Store Interface
|
|
|
|
*
|
|
|
|
* @version 3.0.0
|
|
|
|
* @package WooCommerce/Interface
|
|
|
|
*/
|
|
|
|
|
2016-11-14 14:20:41 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WC Payment Token Data Store Interface
|
|
|
|
*
|
|
|
|
* Functions that must be defined by payment token store classes.
|
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2016-11-14 14:20:41 +00:00
|
|
|
*/
|
2016-11-14 17:13:55 +00:00
|
|
|
interface WC_Payment_Token_Data_Store_Interface {
|
2016-11-14 14:20:41 +00:00
|
|
|
/**
|
2017-07-10 05:56:28 +00:00
|
|
|
* Returns an array of objects (stdObject) matching specific token criteria.
|
2016-11-14 14:20:41 +00:00
|
|
|
* 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.
|
2018-03-06 09:49:02 +00:00
|
|
|
*
|
|
|
|
* @param array $args Arguments.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function get_tokens( $args );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an stdObject of a token for a user's default token.
|
|
|
|
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
|
2018-03-06 09:49:02 +00:00
|
|
|
*
|
|
|
|
* @param int $user_id User ID.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
public function get_users_default_token( $user_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an stdObject of a token.
|
|
|
|
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
|
2018-03-06 09:49:02 +00:00
|
|
|
*
|
|
|
|
* @param int $token_id Token ID.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
public function get_token_by_id( $token_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns metadata for a specific payment token.
|
2018-03-06 09:49:02 +00:00
|
|
|
*
|
|
|
|
* @param int $token_id Token ID.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function get_metadata( $token_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a token's type by ID.
|
|
|
|
*
|
2018-03-06 09:49:02 +00:00
|
|
|
* @param int $token_id Token ID.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_token_type_by_id( $token_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2018-03-06 09:49:02 +00:00
|
|
|
*
|
|
|
|
* @param int $token_id Token ID.
|
|
|
|
* @param bool $status If should update status.
|
2016-11-14 14:20:41 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function set_default_status( $token_id, $status = true );
|
|
|
|
}
|