Skip to content

Commit

Permalink
Merge pull request #1174 from angelleye/PFW-200
Browse files Browse the repository at this point in the history
Doesn't Redirect to Validation Message, PFW-200
  • Loading branch information
Andrew Angell committed Jul 16, 2018
2 parents 1ef4b82 + 2a301f6 commit c01c181
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,27 +504,28 @@ function is_angelleye_braintree_selected() {
}
if(is_angelleye_braintree_selected()) {
checkout_form.addEventListener('submit', function (event) {
if(is_angelleye_braintree_selected()) {
dropinInstance.requestPaymentMethod(function (err, payload) {
if(err) {
unique_form_for_validation.append('<input type="hidden" class="is_submit" name="is_submit" value="yes"/>');
$('.woocommerce-error').remove();
$('.braintree-device-data', ccForm).remove();
$('.braintree-token', ccForm).remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
$form.unblock();
$form.submit();
return true;
var scrollElement = $( '.woocommerce-error' );
if ( ! scrollElement.length ) {
scrollElement = $( '.form.checkout' );
}
$.scroll_to_notices( scrollElement );
return false;
}
if (payload) {
unique_form_for_validation.append('<input type="hidden" class="is_submit" name="is_submit" value="yes"/>');
$('.braintree-token', ccForm).remove();
unique_form_for_validation.append('<input type="hidden" class="braintree-token" name="braintree_token" value="' + payload.nonce + '"/>');
unique_form_for_validation.append("<input type='hidden' class='braintree-device-data' id='device_data' name='device_data' value=" + payload.deviceData + ">");
$form.submit();
}
});
} else {
return true;
}
});
}
});
Expand Down

0 comments on commit c01c181

Please sign in to comment.