Created
March 22, 2019 15:47
-
-
Save snez/b2c89ea607d16f6da90791c8d0821551 to your computer and use it in GitHub Desktop.
Firecheckout Patch for Stripe Payments v3.4.0 and newer
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/app/design/frontend/base/default/template/tm/firecheckout/patches/stripe/form/stripe.phtml b/app/design/frontend/base/default/template/tm/firecheckout/patches/stripe/form/stripe.phtml | |
index d5ed0e88a..15e0396d4 100755 | |
--- a/app/design/frontend/base/default/template/tm/firecheckout/patches/stripe/form/stripe.phtml | |
+++ b/app/design/frontend/base/default/template/tm/firecheckout/patches/stripe/form/stripe.phtml | |
@@ -214,40 +214,9 @@ function stripeResponseHandler(status, response) { | |
Event.observe(window, 'load', function(e) { | |
if ($('onestepcheckout-form')) { | |
$$('.onestepcheckout-place-order-wrapper').each(function(elem){$(elem).replace('<div class="onestepcheckout-place-order-wrapper"><button type="button" title="Place order now" id="onestepcheckout-check-order" class="large orange onestepcheckout-button onestepcheckout-check-order" onclick="javascript:void(0);"><span><span>Place order now</span></span></button></div>')}); | |
- $('onestepcheckout-check-order').observe('click',createStripeToken); | |
} | |
}); | |
- | |
- function createStripeToken() { | |
- var form = payment.form; | |
- var validator = new Validation(form); | |
- if (validator.validate()) { | |
- if ($F('stripe_stripe_customer_id') == ""||$F("stripe_create_stripe_customer")=="1") { | |
- checkout.setLoadWaiting('payment'); | |
- Stripe.createToken({ | |
- <?php if ($this->sendAddressData()) : ?> | |
- name: $F("billing:firstname") + " " + $F("billing:lastname"), | |
- address_line1: $F("billing:street1"), | |
- address_line2: $F("billing:street2"), | |
- address_state: $F("billing:region"), | |
- address_zip: $F("billing:postcode"), | |
- address_country: $F('billing:country_id'), | |
- <?php endif; ?> | |
- number: $F('<?php echo $_code?>_cc_number'), | |
- <?php if ($this->hasVerification()) : ?> | |
- cvc: $F('<?php echo $_code?>_cc_cid'), | |
- <?php endif; ?> | |
- exp_month: $F('<?php echo $_code?>_expiration'), | |
- exp_year: $F('<?php echo $_code?>_expiration_yr') | |
- }, stripeResponseHandler); | |
- } else { | |
- obj = {error:false}; | |
- stripeResponseHandler(200,obj); | |
- } | |
- } | |
- } | |
- | |
function stripeResponseHandler(status,response) { | |
checkout.setLoadWaiting(false); | |
if (response.error) { | |
diff --git a/skin/frontend/base/default/tm/firecheckout/js/integration/cryozonic_stripe.js b/skin/frontend/base/default/tm/firecheckout/js/integration/cryozonic_stripe.js | |
index 6149dd2c7..326417845 100755 | |
--- a/skin/frontend/base/default/tm/firecheckout/js/integration/cryozonic_stripe.js | |
+++ b/skin/frontend/base/default/tm/firecheckout/js/integration/cryozonic_stripe.js | |
@@ -1,17 +1,5 @@ | |
document.observe('dom:loaded', function() { | |
if (typeof OnecolumnCheckout !== 'undefined' && typeof createStripeToken !== 'undefined') { | |
- OnecolumnCheckout.saveStep = OnecolumnCheckout.saveStep.wrap(function(o, url, button, callback, params) { | |
- if (url !== checkout.urls.payment_method || payment.currentMethod != 'cryozonic_stripe') { | |
- return o(url, button, callback, params); | |
- } | |
- | |
- createStripeToken(function(err) { | |
- if (err) { | |
- alert(err); | |
- } else { | |
- return o(url, button, callback, params); | |
- } | |
- }); | |
- }); | |
+ | |
} | |
-}); | |
\ No newline at end of file | |
+}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment