Skip to content

Instantly share code, notes, and snippets.

Avatar

Christos Constantinou snez

View GitHub Profile
@snez
snez / magento2-order-items.php
Last active Jul 17, 2020
Magento 2 break down quote into component parts
View magento2-order-items.php
<?php
class SomeClass
{
public function __construct(
\StripeIntegration\Payments\Helper\Generic $helper,
\Magento\Framework\Session\Generic $session,
\StripeIntegration\Payments\Model\Config $config,
\Magento\Checkout\Model\Cart $cart,
\Magento\Framework\Locale\Resolver $localeResolver
@snez
snez / rest-example.php
Created Oct 22, 2019
How to use Magento 2 REST API using the official Stripe module
View rest-example.php
<?php
function getAdminToken()
{
$url = 'https://example.com/rest/default/V1/integration/admin/token';
$data = [
"username" => "user",
"password" => "user_password"
];
$data_string = json_encode($data);
@snez
snez / patch.txt
Created Mar 22, 2019
Firecheckout Patch for Stripe Payments v3.4.0 and newer
View patch.txt
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').ob
@snez
snez / patch.diff
Last active Feb 5, 2019
Stripe.js patch for Olegnax OneStepCheckout
View patch.diff
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',
@snez
snez / Subscriptions.php
Last active Jun 16, 2017
Modify getTrialDays() to make all subscriptions start on the 10th of each month
View Subscriptions.php
<?php
protected function getTrialDays($details)
{
switch ($details['trial_period_unit']) {
case null:
$days = 0;
break;
case 'day':
$days = $details['trial_period_frequency'];
@snez
snez / gist:89b55331dc602305a2aef5fdb4a1d664
Last active Aug 20, 2017
Stripe.js patch for TypoStores OneStepCheckout 4.1.1
View gist:89b55331dc602305a2aef5fdb4a1d664
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();
@snez
snez / gist:c5939edb12d6dd518d46d8141f27c7b0
Created Nov 24, 2016
Stripe.js patch for SoftProdigy EnhancedCheckout 1.0.1
View gist:c5939edb12d6dd518d46d8141f27c7b0
diff --git a/skin/frontend/default/default/js/softprodigy/checkout/opcheckout.js b/skin/frontend/default/default/js/softprodigy/checkout/opcheckout.js
index cf0d759..afc2423 100644
--- a/skin/frontend/default/default/js/softprodigy/checkout/opcheckout.js
+++ b/skin/frontend/default/default/js/softprodigy/checkout/opcheckout.js
@@ -95,6 +95,15 @@ Checkout.prototype = {
var url = this.blocks[stepId].url;
var data = this.getStepValues(stepId);
data['blocks'] = this.getBlocksToReloadByType(stepId);
+ if (typeof payment != 'undefined' && payment.currentMethod == 'cryozonic_stripe')
+ {
@snez
snez / gist:e5c6d797264b5f7bd6cdcf5cc5aba045
Last active Dec 30, 2017
Stripe.js patch for MageStore OneStepCheckout 3.2.0
View gist:e5c6d797264b5f7bd6cdcf5cc5aba045
diff --git a/app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml b/app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml
index e7971e7..6902b59 100755
--- a/app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml
+++ b/app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml
@@ -693,7 +693,17 @@
var options = document.getElementsByName('payment[method]');
for (var i = 0; i < options.length; i++) {
if ($(options[i].id).checked) {
- if (options[i].id.indexOf("tco") != -1) {
+ if (options[i].id.indexOf("cryozonic_stripe") != -1) {
@snez
snez / gist:9c7bca0199dddf07dca21d40c5d3fc2d
Last active Aug 20, 2017
Stripe.js patch for Lotusbreath OSC 4.1.1
View gist:9c7bca0199dddf07dca21d40c5d3fc2d
diff --git a/skin/frontend/base/default/lotusbreath/onestepcheckout/js/osc.js b/skin/frontend/base/default/lotusbreath/onestepcheckout/js/osc.js
index 303bff9..ecc940a 100644
--- a/skin/frontend/base/default/lotusbreath/onestepcheckout/js/osc.js
+++ b/skin/frontend/base/default/lotusbreath/onestepcheckout/js/osc.js
@@ -276,6 +276,23 @@
);
},
+ cryozonicPlaceOrder: function()
+ {
@snez
snez / gist:803a1e5912fcfd02f4fbe427d20aa8f0
Created Nov 21, 2016
IWD OPC 1.0.2 patch for Magento 2.1.x
View gist:803a1e5912fcfd02f4fbe427d20aa8f0
diff --git a/vendor/magento/module-ui/view/base/web/js/core/renderer/layout.js b/vendor/magento/module-ui/view/base/web/js/core/renderer/layout.js
index 9dbd57b..16ee902 100644
--- a/vendor/magento/module-ui/view/base/web/js/core/renderer/layout.js
+++ b/vendor/magento/module-ui/view/base/web/js/core/renderer/layout.js
@@ -75,7 +75,7 @@ define([
return false;
}
- if (cached) {
+ if (cached && JSON.stringify(nodes)) {
You can’t perform that action at this time.