WC_Payment_Token_eCheck

WooCommerce eCheck Payment Token.

Defined (1)

The class is defined in the following location(s).

/includes/payment-tokens/class-wc-payment-token-echeck.php  
  1. class WC_Payment_Token_eCheck extends WC_Payment_Token { 
  2.  
  3. /** @protected string Token Type String. */ 
  4. protected $type = 'eCheck'; 
  5.  
  6. /** 
  7. * Stores eCheck payment token data. 
  8. * @var array 
  9. */ 
  10. protected $extra_data = array( 
  11. 'last4' => '',  
  12. ); 
  13.  
  14. /** 
  15. * Get type to display to user. 
  16. * @since 2.6.0 
  17. * @param string $deprecated Deprecated since WooCommerce 3.0 
  18. * @return string 
  19. */ 
  20. public function get_display_name( $deprecated = '' ) { 
  21. return __( 'eCheck', 'woocommerce' ); 
  22.  
  23. /** 
  24. * Hook prefix 
  25. * @since 3.0.0 
  26. */ 
  27. protected function get_hook_prefix() { 
  28. return 'woocommerce_payment_token_echeck_get_'; 
  29.  
  30. /** 
  31. * Validate eCheck payment tokens. 
  32. * These fields are required by all eCheck payment tokens: 
  33. * last4 - string Last 4 digits of the check 
  34. * @since 2.6.0 
  35. * @return boolean True if the passed data is valid 
  36. */ 
  37. public function validate() { 
  38. if ( false === parent::validate() ) { 
  39. return false; 
  40.  
  41. if ( ! $this->get_last4( 'edit' ) ) { 
  42. return false; 
  43. return true; 
  44.  
  45. /** 
  46. * Returns the last four digits. 
  47. * @since 2.6.0 
  48. * @param string $context 
  49. * @return string Last 4 digits 
  50. */ 
  51. public function get_last4( $context = 'view' ) { 
  52. return $this->get_prop( 'last4', $context ); 
  53.  
  54. /** 
  55. * Set the last four digits. 
  56. * @since 2.6.0 
  57. * @param string $last4 
  58. */ 
  59. public function set_last4( $last4 ) { 
  60. $this->set_prop( 'last4', $last4 );