Nenhuma Descrição

class-wc-payment-token-data-store-interface.php 1.8KB

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