Validate length for expiry - 4 chars for year and 2 for month.
This commit is contained in:
parent
214f077a91
commit
7b57b4c4cc
|
@ -77,10 +77,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this payment token (cc, echeck, or something else)
|
||||
* Returns the type of this payment token (CC, eCheck, or something else)
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @return string Payment token type
|
||||
* @return string Payment Token Type (CC, eCheck)
|
||||
*/
|
||||
public function get_type() {
|
||||
return isset( $this->data['type'] ) ? $this->data['type'] : '';
|
||||
|
|
|
@ -54,6 +54,14 @@ class WC_Payment_Token_CC extends WC_Payment_Token {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( 4 !== strlen( $this->meta['expiry_year'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 2 !== strlen( $this->meta['expiry_month'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue