Skip to content

Instantly share code, notes, and snippets.

@LuizSantos22
Forked from snez/patch.diff
Created June 26, 2021 03:08
Show Gist options
  • Save LuizSantos22/d350e20e63d1b5b1c9fac07e136cf75b to your computer and use it in GitHub Desktop.
Save LuizSantos22/d350e20e63d1b5b1c9fac07e136cf75b to your computer and use it in GitHub Desktop.
Stripe.js patch for Olegnax OneStepCheckout
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