WC_Payment_Token_CC::get_invalid_token_fields │ public │ WC 11.3.0

Get the invalid token fields.

Method of the class: WC_Payment_Token_CC{}

No Hooks.

Returns

array<string, mixed>. The invalid token fields with the field name as the key and the field value as the value.

Usage

$WC_Payment_Token_CC = new WC_Payment_Token_CC();
$WC_Payment_Token_CC->get_invalid_token_fields(): array;

Changelog

Since 11.3.0 Introduced.

WC_Payment_Token_CC::get_invalid_token_fields() code WC 11.3.0

public function get_invalid_token_fields(): array {
	$invalid_fields = parent::get_invalid_token_fields();

	$last4 = $this->get_last4( 'edit' );
	if ( ! $last4 ) {
		$invalid_fields['last4'] = $last4;
	}

	$expiry_year = $this->get_expiry_year( 'edit' );
	if ( ! $expiry_year ) {
		$invalid_fields['expiry_year'] = $expiry_year;
	} elseif ( 4 !== strlen( $expiry_year ) ) {
		$invalid_fields['expiry_year'] = $expiry_year;
	}

	$expiry_month = $this->get_expiry_month( 'edit' );
	if ( ! $expiry_month ) {
		$invalid_fields['expiry_month'] = $expiry_month;
	} elseif ( 2 !== strlen( $expiry_month ) ) {
		$invalid_fields['expiry_month'] = $expiry_month;
	}

	$card_type = $this->get_card_type( 'edit' );
	if ( ! $card_type ) {
		$invalid_fields['card_type'] = $card_type;
	}

	return $invalid_fields;
}