Skip to content

Commit

Permalink
Make sure to show credit card issuer field if gateway description is …
Browse files Browse the repository at this point in the history
…empty.
  • Loading branch information
rvdsteege committed May 29, 2017
1 parent e0ec79d commit 0b520c4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/CreditCardGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ public function __construct() {
// Handle subscription payments
add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'process_subscription_payment' ), 10, 2 );
}

// Has fields?
if ( $gateway ) {
$payment_method = $gateway->get_payment_method();

$gateway->set_payment_method( Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD );

if ( ! empty( $gateway->get_input_fields() ) ) {
// The credit card payment gateway has an card issuer select field
// @see https://github.com/woothemes/woocommerce/blob/v1.6.6/classes/gateways/class-wc-payment-gateway.php#L24
$this->has_fields = true;
}

$gateway->set_payment_method( $payment_method );
}
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 0b520c4

Please sign in to comment.