class-wc-payment-token-echeck.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* WooCommerce eCheck Payment Token.
*
* Representation of a payment token for eChecks.
*
* @class WC_Payment_Token_eCheck
* @since 2.6.0
* @category PaymentTokens
* @package WooCommerce/PaymentTokens
* @author WooThemes
*/
class WC_Payment_Token_eCheck extends WC_Payment_Token {
/** @protected string Token Type String */
protected $type = 'eCheck';
/**
* Validate eCheck payment tokens.
*
* These fields are required by all eCheck payment tokens:
* last4 - string Last 4 digits of the check
*
* @since 2.6.0
* @return boolean True if the passed data is valid
*/
public function validate() {
if ( false === parent::validate() ) {
return false;
}
if ( ! $this->get_last4() ) {
return false;
}
return true;
}
/**
* Get type to display to user.
* @return string
*/
public function get_display_name() {
return __( 'eCheck', 'woocommerce' );
}
/**
* Returns the last four digits.
* @since 2.6.0
* @return string Last 4 digits
*/
public function get_last4() {
return $this->get_meta( 'last4' );
}
/**
* Set the last four digits.
* @since 2.6.0
* @param string $last4
*/
public function set_last4( $last4 ) {
$this->add_meta_data( 'last4', $last4, true );
}
}