Tweak conditional in CC class

This commit is contained in:
Mike Jolley 2016-05-26 11:48:25 +01:00
parent 6fe37fff33
commit b4deb703fb
2 changed files with 13 additions and 20 deletions

View File

@ -13,22 +13,18 @@ if ( ! defined( 'ABSPATH' ) ) {
class WC_Payment_Gateway_CC extends WC_Payment_Gateway {
/**
* Builds our payment fields area - including tokenization fields and the actualy payment fields.
* If tokenization is displayed, just the fields will be displayed.
* Builds our payment fields area - including tokenization fields for logged
* in users, and the actual payment fields.
* @since 2.6.0
*/
public function payment_fields() {
$display_tokenization = $this->supports( 'tokenization' ) && is_checkout();
if ( $display_tokenization ) {
if ( $this->supports( 'tokenization' ) && is_checkout() && is_user_logged_in() ) {
$this->tokenization_script();
$this->saved_payment_methods();
}
$this->form();
if ( $display_tokenization ) {
$this->form();
$this->save_payment_method_checkbox();
} else {
$this->form();
}
}
@ -88,6 +84,7 @@ class WC_Payment_Gateway_CC extends WC_Payment_Gateway {
<div class="clear"></div>
</fieldset>
<?php
if ( $this->supports( 'credit_card_form_cvc_on_saved_method' ) ) {
echo '<fieldset>' . $cvc_field . '</fieldset>';
}

View File

@ -13,22 +13,18 @@ if ( ! defined( 'ABSPATH' ) ) {
class WC_Payment_Gateway_eCheck extends WC_Payment_Gateway {
/**
* Builds our payment fields area - including tokenization fields and the actualy payment fields.
* If tokenization is displayed, just the fields will be displayed.
* Builds our payment fields area - including tokenization fields for logged
* in users, and the actual payment fields.
* @since 2.6.0
*/
public function payment_fields() {
$display_tokenization = $this->supports( 'tokenization' ) && is_checkout();
if ( $display_tokenization ) {
if ( $this->supports( 'tokenization' ) && is_checkout() && is_user_logged_in() ) {
$this->tokenization_script();
$this->saved_payment_methods();
}
$this->form();
if ( $display_tokenization ) {
$this->form();
$this->save_payment_method_checkbox();
} else {
$this->form();
}
}