-
-
Save snez/ad9b91c0049f96f78fb6d409c396ba2c to your computer and use it in GitHub Desktop.
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 | |
+}; |
If you prefer to stay on Olegnax that is fine. The adjustment is really simple. Instead of submitting the order, you first call createStripeToken() which will tokenize the card details. When the tokenization is finished, you get into the callback method, where you just submit the order with new Ajax.Request(classThis.placeOrderUrl, {})
@snez
Would you mind telling me which files and where should I make theses changes? I am not an expert. Regards
js/olegnax_osc/osc_form.js b/js/olegnax_osc/osc_form.js line 920
Is there a way of making a "before" and "after"
At the original code on "js/olegnax_osc/osc_form.js" from lines 918 to 925 I have this code:
new Ajax.Request(classThis.placeOrderUrl, { method: 'post', parameters: Form.serialize(classThis.form.form, true), onComplete: classThis.onComplete.bindAsEventListener(classThis) }); } }); }
If I change to your lines it stays like this from lines 918 to 933:
`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)
-
});
-
}`
This will not work, because my module is Stripe's official module and your mod is made to
Cryozonic's module. I have tried to change "cryozonic.displayCardError(err);" to "stripe.displayCardError(err);"
but it did not work neither...
Regards
It is better to just use an OSC module that is still actively supported. I think Amasty, Swisslabs and aheadWorks are still supporting their M1 OSC modules. These will also not need any integration work with the Stripe module.