Skip to content

Commit

Permalink
better direct debit validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vendidero committed Aug 25, 2015
1 parent 8537b1e commit 6f48c90
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public function add_email_template( $mails ) {

public function generate_mandate() {

if ( ! $this->is_available() )
exit();

if ( ! isset( $_GET[ '_wpnonce' ] ) || ! wp_verify_nonce( $_GET[ '_wpnonce' ], 'show_direct_debit' ) )
exit();

Expand Down Expand Up @@ -349,7 +352,7 @@ public function payment_fields() {

public function validate_checkbox( $posted ) {

if ( ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
if ( ! $this->is_available() || $this->enable_checkbox !== 'yes' || ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
return;

if ( ! isset( $_POST[ 'woocommerce_checkout_update_totals' ] ) ) {
Expand All @@ -363,7 +366,7 @@ public function validate_checkbox( $posted ) {

public function validate_fields() {

if ( ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
if ( ! $this->is_available() || ! isset( $_POST[ 'payment_method' ] ) || $_POST[ 'payment_method' ] != $this->id )
return;

$iban = ( isset( $_POST[ 'direct_debit_account_iban' ] ) ? wc_clean( $_POST[ 'direct_debit_account_iban' ] ) : '' );
Expand Down

0 comments on commit 6f48c90

Please sign in to comment.