Skip to content

Instantly share code, notes, and snippets.

@GiovanniCavallari
GiovanniCavallari / mercadopago-iva.php
Last active March 10, 2022 19:40
IVA Customization for mercadopago plugin for woocommerce
/**
* WC_WooMercadoPago_PreferenceAbstract.php
*/
// Declare the taxes variable at the beginning of the file
protected $taxes;
// Set the value on constructor
$this->taxes = 500;
<?php
/**
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@GiovanniCavallari
GiovanniCavallari / Fix for farmalisto
Created October 29, 2020 18:12
Prestashop/IpnNotification.php
<?php
/**
* 2007-2020 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@GiovanniCavallari
GiovanniCavallari / footers.html
Last active November 13, 2020 13:14
MP footer legales
---MLB---
<table cellspacing="0" cellpadding="0" width="100%" align="center" style="background: rgb(255, 255, 255);">
<tbody>
<tr>
<td align="center">
<!--[if mso]>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="600">
<tr>
<td align="center" valign="top" width="600">
<![endif]-->
@GiovanniCavallari
GiovanniCavallari / Payment.php
Created November 13, 2020 20:00
Fix to get ip_address to send on preference for MP API
<?php
namespace MercadoPago\Core\Model\CustomBankTransfer;
/**
* Class Payment
*
* @package MercadoPago\Core\Model\CustomBankTransfer
*/
class Payment
@GiovanniCavallari
GiovanniCavallari / MPv1.js
Created November 25, 2020 18:25
Fix to MPv1.js for MLM
/*
* MPv1
* Handlers Form Mercado Pago v1
* @version 1.0.4
*/
(function () {
var MPv1 = {
debug: false,
@GiovanniCavallari
GiovanniCavallari / Data.php
Created December 1, 2020 19:25
Fix to show success page to MP CHO Pro
<?php
namespace MercadoPago\Core\Helper;
use Magento\Framework\View\LayoutFactory;
/**
* Class Data
*
* @package MercadoPago\Core\Helper
@GiovanniCavallari
GiovanniCavallari / shopify-order.ts
Created February 10, 2021 19:12
Create shopify order with Rest API
const selectShippingMethod: ShippingMethodsDto = shippingMethods.find(
shippingRate => shippingRate.id === shippingLine?.id,
);
if ((shippingMethods.length > 0 && !selectShippingMethod) || (shippingMethods.length === 0 && shippingLine)) {
throw new InvalidShippingRatingError();
}
if (selectShippingMethod) {
shippingLine.price = Number(selectShippingMethod?.price || 0.0);
@GiovanniCavallari
GiovanniCavallari / mercadopago.php
Created May 25, 2021 17:22
Mercadopago plugin index file for stores with multistores
/**
* Create the payment states
*
* @return bool
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function createPaymentStates()
{
$order_states = array(