class-wc-abstract-order-data-store-interface.php
4 years ago
class-wc-coupon-data-store-interface.php
4 years ago
class-wc-customer-data-store-interface.php
4 years ago
class-wc-customer-download-data-store-interface.php
4 years ago
class-wc-customer-download-log-data-store-interface.php
4 years ago
class-wc-importer-interface.php
4 years ago
class-wc-log-handler-interface.php
4 years ago
class-wc-logger-interface.php
4 years ago
class-wc-object-data-store-interface.php
4 years ago
class-wc-order-data-store-interface.php
4 years ago
class-wc-order-item-data-store-interface.php
3 years ago
class-wc-order-item-product-data-store-interface.php
4 years ago
class-wc-order-item-type-data-store-interface.php
4 years ago
class-wc-order-refund-data-store-interface.php
4 years ago
class-wc-payment-token-data-store-interface.php
4 years ago
class-wc-product-data-store-interface.php
4 years ago
class-wc-product-variable-data-store-interface.php
4 years ago
class-wc-queue-interface.php
4 years ago
class-wc-shipping-zone-data-store-interface.php
4 years ago
class-wc-webhooks-data-store-interface.php
4 years ago
class-wc-payment-token-data-store-interface.php
72 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Payment Token Data Store Interface |
| 4 | * |
| 5 | * @version 3.0.0 |
| 6 | * @package WooCommerce\Interface |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * WC Payment Token Data Store Interface |
| 11 | * |
| 12 | * Functions that must be defined by payment token store classes. |
| 13 | * |
| 14 | * @version 3.0.0 |
| 15 | */ |
| 16 | interface WC_Payment_Token_Data_Store_Interface { |
| 17 | /** |
| 18 | * Returns an array of objects (stdObject) matching specific token criteria. |
| 19 | * Accepts token_id, user_id, gateway_id, and type. |
| 20 | * Each object should contain the fields token_id, gateway_id, token, user_id, type, is_default. |
| 21 | * |
| 22 | * @param array $args Arguments. |
| 23 | * @return array |
| 24 | */ |
| 25 | public function get_tokens( $args ); |
| 26 | |
| 27 | /** |
| 28 | * Returns an stdObject of a token for a user's default token. |
| 29 | * Should contain the fields token_id, gateway_id, token, user_id, type, is_default. |
| 30 | * |
| 31 | * @param int $user_id User ID. |
| 32 | * @return object |
| 33 | */ |
| 34 | public function get_users_default_token( $user_id ); |
| 35 | |
| 36 | /** |
| 37 | * Returns an stdObject of a token. |
| 38 | * Should contain the fields token_id, gateway_id, token, user_id, type, is_default. |
| 39 | * |
| 40 | * @param int $token_id Token ID. |
| 41 | * @return object |
| 42 | */ |
| 43 | public function get_token_by_id( $token_id ); |
| 44 | |
| 45 | /** |
| 46 | * Returns metadata for a specific payment token. |
| 47 | * |
| 48 | * @param int $token_id Token ID. |
| 49 | * @return array |
| 50 | */ |
| 51 | public function get_metadata( $token_id ); |
| 52 | |
| 53 | /** |
| 54 | * Get a token's type by ID. |
| 55 | * |
| 56 | * @param int $token_id Token ID. |
| 57 | * @return string |
| 58 | */ |
| 59 | public function get_token_type_by_id( $token_id ); |
| 60 | |
| 61 | /** |
| 62 | * Update's a tokens default status in the database. Used for quickly |
| 63 | * looping through tokens and setting their statuses instead of creating a bunch |
| 64 | * of objects. |
| 65 | * |
| 66 | * @param int $token_id Token ID. |
| 67 | * @param bool $status If should update status. |
| 68 | * @return string |
| 69 | */ |
| 70 | public function set_default_status( $token_id, $status = true ); |
| 71 | } |
| 72 |