Skip to content

Commit

Permalink
Merge pull request #1192 from angelleye/PFW-231
Browse files Browse the repository at this point in the history
PFW-231
  • Loading branch information
Andrew Angell committed Sep 5, 2018
2 parents a8da0cd + 4995aee commit 24c634b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/wc-gateway-braintree-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ function braintreeFormHandler() {
function onComponent(name) {
return function (err, component) {
if (err) {
$('.woocommerce-error').remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
move_to_error();
return;
Expand Down Expand Up @@ -703,6 +704,7 @@ function onFetchClientToken(clientToken) {
}
function onClientCreate(err, client) {
if (err) {
$('.woocommerce-error').remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
move_to_error();
return;
Expand All @@ -715,6 +717,7 @@ function onClientCreate(err, client) {
kount: true
}, function (err, dataCollectorInstance) {
if (err) {
$('.woocommerce-error').remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
move_to_error();
$('.braintree-device-data', ccForm).remove();
Expand Down Expand Up @@ -780,6 +783,7 @@ class:'wc-credit-card-form-card-number'
event.preventDefault();
components.hostedFields.tokenize(function (err, payload) {
if (err) {
$('.woocommerce-error').remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
move_to_error();
return;
Expand All @@ -801,12 +805,12 @@ class:'wc-credit-card-form-card-number'
removeFrame: removeFrame
}, function (err, verification) {
if (err) {
$('.woocommerce-error').remove();
unique_form_for_validation.prepend('<ul class="woocommerce-error"><li>' + err + '</li></ul>');
move_to_error();
return;
}
$('.is_submit').remove();
$('.braintree-token').remove();
unique_form_for_validation.append('<input type="hidden" class="is_submit" name="is_submit" value="yes"/>');
unique_form_for_validation.append('<input type="hidden" class="braintree-token" name="braintree_token" value="' + verification.nonce + '"/>');
$form.submit();
Expand Down

0 comments on commit 24c634b

Please sign in to comment.