-
-
Save LuizSantos22/d350e20e63d1b5b1c9fac07e136cf75b to your computer and use it in GitHub Desktop.
Stripe.js patch for Olegnax OneStepCheckout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/olegnax_osc/osc_form.js b/js/olegnax_osc/osc_form.js | |
index 2030f11..e093e31 100644 | |
--- a/js/olegnax_osc/osc_form.js | |
+++ b/js/olegnax_osc/osc_form.js | |
@@ -915,10 +915,22 @@ OnestepcheckoutForm.prototype = { | |
classThis.placeOrderButton.addClassName(classThis.disabledClassName); | |
classThis.placeOrderButton.disabled = true; | |
- new Ajax.Request(classThis.placeOrderUrl, { | |
- method: 'post', | |
- parameters: Form.serialize(classThis.form.form, true), | |
- onComplete: classThis.onComplete.bindAsEventListener(classThis) | |
+ createStripeToken(function(err) | |
+ { | |
+ if (err) | |
+ { | |
+ cryozonic.displayCardError(err); | |
+ classThis.turnOnPlaceOrderButton(); | |
+ classThis.overlay.hide(); | |
+ } | |
+ else | |
+ { | |
+ new Ajax.Request(classThis.placeOrderUrl, { | |
+ method: 'post', | |
+ parameters: Form.serialize(classThis.form.form, true), | |
+ onComplete: classThis.onComplete.bindAsEventListener(classThis) | |
+ }); | |
+ } | |
}); | |
} | |
}); | |
@@ -1360,4 +1372,4 @@ OnestepcheckoutAddress.prototype = { | |
afterFinish: function(){ delete el.effect; complateFunctionFn(); } | |
}); | |
} | |
-}; | |
\ No newline at end of file | |
+}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment