-
-
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 | |
+}; |
@snex Hi there, how are you doing?
Olegnax does not provide support for M1 anymore.
I have the Olegnax OSC 1.0 and Stripe Official module here
I have noticed that your patch was intended to use with an old Stripe module made by Cryozonic, right?
Unfortunately it is deprecated by Stripe.
I'd thank you if you could take a look and see if it can be fixed
I really spent a lot of time to customize Olegnax OSC to Brazilian Market and I really
wanted to make it opensource to the community after all the tests.
It is one of a few modules that allows us to heavily customize its looks and easily disable
required fields with a simple click. Which by default, is a nightmare and is it something I was looking
for due to new privacy rules imposed by Google here in Brazil.
Here is the Google Drive link: https://drive.google.com/drive/folders/1Q2r_wO_06zE6yK60hWWgYJtc-rL4_NI4?usp=sharing
The link comes with Olegnax OSC 1.0 and Stripe latest module for M1
And yes, it is a incompability with the OSC as I have tested on Magento 1 (OpenMage 1.9.4.13) default checkout and it works fine.
I have installed it along with OpenMage 1.9.4.13 using PHP 7.3 which can be downloaded from here:
https://github.com/OpenMage/magento-lts/releases
If you or someone else here decide to take a look into it and need Stripe test keys, please let me know and I can provide mine.
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.
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
@LuizSantos22 this patch is outdated and cannot be used as-is. The idea is to first call the createStripeToken() method before submitting the order. If you send the example to Olegnax, they will be able to advise how to apply it to the latest version of their module.