Skip to content

Instantly share code, notes, and snippets.

@snez
Last active August 20, 2017 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snez/89b55331dc602305a2aef5fdb4a1d664 to your computer and use it in GitHub Desktop.
Save snez/89b55331dc602305a2aef5fdb4a1d664 to your computer and use it in GitHub Desktop.
Stripe.js patch for TypoStores OneStepCheckout 4.1.1
diff --git a/skin/frontend/base/default/typostores/onestepcheckout/opcheckout.js b/skin/frontend/base/default/typostores/onestepcheckout/opcheckout.js
index de885a6..7e41327 100755
--- a/skin/frontend/base/default/typostores/onestepcheckout/opcheckout.js
+++ b/skin/frontend/base/default/typostores/onestepcheckout/opcheckout.js
@@ -100,9 +100,32 @@
});
this.element
.on('click', this.options.checkout.continueSelector, function(e) {
+ var me = this;
e.preventDefault();
- $.proxy(_this._save($(this)), _this);
- $(".mage-error").show();
+
+ var proceed = function()
+ {
+ $.proxy(_this._save($(me)), _this);
+ $(".mage-error").show();
+ };
+
+ if (payment.currentMethod != 'cryozonic_stripe' && payment.currentMethod !== "")
+ {
+ proceed();
+ }
+ else
+ {
+ createStripeToken(function(err)
+ {
+ if (err)
+ alert(err);
+ else
+ proceed();
+ });
+ }
+
return false;
})
var that = this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment