Skip to content

Commit

Permalink
Merge pull request #35 from gmatsuoka/master
Browse files Browse the repository at this point in the history
Version 2.2.0
  • Loading branch information
flaviofat authored Aug 9, 2018
2 parents 0186073 + ac47bea commit ec76d37
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 131 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,3 @@ During the sandbox mode tests, you can operate over HTTP, but for homologation y
* **Choose the status when payment was chargeback**: Sets up the order status when payments are chargeback.
* **Choose the status when payment was canceled**: Sets up the order status when payments are canceled.
* **Choose the status when payment was reject**: Sets up the order status when payments are rejected.

<a name="social"></a>
##Social##

Follow our facebook group and watch our videos
<ul>
<li><a href="https://www.facebook.com/groups/modulos.mercadopago/?ref=ts&fref=ts" target="_blank">FACEBOOK</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLl8LGzRu2_sXxChIJm1e0xY6dU3Dj_tNi" target="_blank">YOUTUBE</a></li>
</ul>
10 changes: 0 additions & 10 deletions README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,3 @@ Puedes obtener tu **Public Key** y **Access Token**, dependiendo de tu país, en
* **Elige el status para ordenes canceladas**: Setea el status de la orden cuando los pagos son cancelados.
* **Elige el status para ordenes rechazadas**: Setea el status de la orden cuando los pagos son rechazados.


<a name="social"></a>
## social ##

Sigue nuestro grupo de facebook y mira nuestros videos
<ul>
<li><a href="https://www.facebook.com/groups/modulos.mercadopago/?ref=ts&fref=ts" target="_blank">FACEBOOK</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLl8LGzRu2_sXxChIJm1e0xY6dU3Dj_tNi" target="_blank">YOUTUBE</a></li>
</ul>

10 changes: 1 addition & 9 deletions README_pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,4 @@ Para obter seu **Access Token**, acesse o link abaixo de acordo com o seu país:
* Mexico: https://www.mercadopago.com/mlm/account/credentials
* Venezuela: https://www.mercadopago.com/mlv/account/credentials
* Uruguai: https://www.mercadopago.com/mlu/account/credentials

<a name="social"></a>
##Social##

Você pode participar do nosso grupo no facebook e assistir nossos vídeos no youtube
<ul>
<li><a href="https://www.facebook.com/groups/modulos.mercadopago/?ref=ts&fref=ts" target="_blank">FACEBOOK</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLl8LGzRu2_sXxChIJm1e0xY6dU3Dj_tNi" target="_blank">YOUTUBE</a></li>
</ul>

4 changes: 2 additions & 2 deletions mercadopago/mercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down Expand Up @@ -690,7 +690,7 @@ function makePreferenceV1($cart, $order, $payment_method){

$payment['description'] = $this->vendor->vendor_store_name . " - " . $order['details']['BT']->virtuemart_order_id;

$payment['transaction_amount'] = (float) number_format($cart->cartPrices['billTotal'], 2);
$payment['transaction_amount'] = (float) number_format($cart->cartPrices['billTotal'], 2, '.', '');

$payment['external_reference'] = $order['details']['BT']->virtuemart_order_id;

Expand Down
2 changes: 1 addition & 1 deletion mercadopago/mercadopago.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<authorUrl>https://mercadopago.com</authorUrl>
<copyright>Copyright (C) 2004-2016 Mercado Pago. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>2.1.0</version>
<version>2.2.0</version>
<description>Mercado Pago</description>

<files>
Expand Down
4 changes: 2 additions & 2 deletions mercadopago/mercadopago/fields/getmercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand All @@ -25,7 +25,7 @@ protected function getInput() {
$html = '<img src="' . $banner . '" />';
$html .= '<input type="hidden" name="mercadopago_sponsor_id" value="VALUE_SPONSOR_ID" />';
$html .= '<input type="hidden" name="mercadopago_site_id" value="VALUE_SITE_ID" />';
$html .= '<br/>Module Version: <strong>2.1.0</strong>';
$html .= '<br/>Module Version: <strong>2.2.0</strong>';

return $html;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
2 changes: 1 addition & 1 deletion mercadopago/mercadopago/helpers/mercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
97 changes: 11 additions & 86 deletions mercadopago/mercadopago/lib/mercadopago.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,6 @@ public function get_merchant_order($id) {
return $merchant_order;
}

/**
* Get information for specific payment
* @param int $id
* @return array(json)
*/
public function get_payment($id) {
$uri_prefix = $this->sandbox ? "/sandbox" : "";

$request = array(
"uri" => $uri_prefix."/collections/notifications/{$id}",
"params" => array(
"access_token" => $this->get_access_token()
)
);

$payment_info = MPRestClient::get($request);
return $payment_info;
}
public function get_payment_info($id) {
return $this->get_payment($id);
}

/**
* Get information for specific authorized payment
* @param id
Expand All @@ -138,46 +116,6 @@ public function get_authorized_payment($id) {
return $authorized_payment_info;
}

/**
* Refund accredited payment
* @param int $id
* @return array(json)
*/
public function refund_payment($id) {
$request = array(
"uri" => "/collections/{$id}",
"params" => array(
"access_token" => $this->get_access_token()
),
"data" => array(
"status" => "refunded"
)
);

$response = MPRestClient::put($request);
return $response;
}

/**
* Cancel pending payment
* @param int $id
* @return array(json)
*/
public function cancel_payment($id) {
$request = array(
"uri" => "/collections/{$id}",
"params" => array(
"access_token" => $this->get_access_token()
),
"data" => array(
"status" => "cancelled"
)
);

$response = MPRestClient::put($request);
return $response;
}

/**
* Cancel preapproval payment
* @param int $id
Expand All @@ -198,30 +136,6 @@ public function cancel_preapproval_payment($id) {
return $response;
}

/**
* Search payments according to filters, with pagination
* @param array $filters
* @param int $offset
* @param int $limit
* @return array(json)
*/
public function search_payment($filters, $offset = 0, $limit = 0) {
$filters["offset"] = $offset;
$filters["limit"] = $limit;

$uri_prefix = $this->sandbox ? "/sandbox" : "";

$request = array(
"uri" => $uri_prefix."/collections/search",
"params" => array_merge ($filters, array(
"access_token" => $this->get_access_token()
))
);

$collection_result = MPRestClient::get($request);
return $collection_result;
}

/**
* Create a checkout preference
* @param array $preference
Expand Down Expand Up @@ -556,6 +470,11 @@ public function delete($request, $params = null) {
class MPRestClient {
static $check_loop = 0;
const API_BASE_URL = "https://api.mercadopago.com";

/**
*Product Id
*/
const PRODUCT_ID = "BC32CJBU643001OI39C0";

private static function build_request($request) {
if (!extension_loaded ("curl")) {
Expand All @@ -572,6 +491,12 @@ private static function build_request($request) {

// Set headers
$headers = array("accept: application/json");

//set x_product_id
if($request["method"] == 'POST'){
$header_opt[] = "x-product-id: " . self::PRODUCT_ID;
}

$json_content = true;
$form_content = false;
$default_content_type = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Mercado Pago plugin
*
* @author Developers Mercado Pago <modulos@mercadopago.com>
* @version 2.1.0
* @version 2.2.0
* @package VirtueMart
* @subpackage payment
* @link https://www.mercadopago.com
Expand Down

1 comment on commit ec76d37

@josenovo77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hola, tengo la version 2.2.0 pero ya hace unos dias que tengo problema con Checkout básico, ingreso las credenciales y al guardar me genera error 500 (intente con dos cuentas y ocurre lo mismo). Pero el Checkout personalizado si funciona, no genera ningun error. ¿que puede ocurrir? antes funcionaba bien. Tengo la ultima version de joomla y de virtuemar.

500 error to call API LOGSMercadoPagoException: error to call API LOGSArray in /home/tiempojoven/campusumec.com/plugins/vmpayment/mercadopago/mercadopago/lib/mercadopago.php:619 Stack trace: #0 /home/tiempojoven/campusumec.com/plugins/vmpayment/mercadopago/mercadopago/lib/mercadopago.php(659): MPRestClient::exec(Array) #1 /home/tiempojoven/campusumec.com/plugins/vmpayment/mercadopago/mercadopago.php(1189): MPRestClient::put(Array) #2 /home/tiempojoven/campusumec.com/plugins/vmpayment/mercadopago/mercadopago.php(1159): plgVmPaymentMercadoPago->_twoCards(Array) #3 /home/tiempojoven/campusumec.com/libraries/joomla/event/event.php(70): plgVmPaymentMercadoPago->plgVmSetOnTablePluginPayment(Array, Object(TablePaymentmethods)) #4 /home/tiempojoven/campusumec.com/libraries/joomla/event/dispatcher.php(160): JEvent->update(Array) #5 /home/tiempojoven/campusumec.com/administrator/components/com_virtuemart/models/paymentmethod.php(199): JEventDispatcher->trigger('plgvmsetontable...', Array) #6 /home/tiempojoven/campusumec.com/administrator/components/com_virtuemart/helpers/vmcontroller.php(163): VirtueMartModelPaymentmethod->store(Array) #7 /home/tiempojoven/campusumec.com/administrator/components/com_virtuemart/controllers/paymentmethod.php(59): VmController->save(Array) #8 /home/tiempojoven/campusumec.com/libraries/src/MVC/Controller/BaseController.php(710): VirtuemartControllerPaymentmethod->save() #9 /home/tiempojoven/campusumec.com/administrator/components/com_virtuemart/virtuemart.php(76): Joomla\CMS\MVC\Controller\BaseController->execute('apply') #10 /home/tiempojoven/campusumec.com/libraries/src/Component/ComponentHelper.php(402): require_once('/home/tiempojov...') #11 /home/tiempojoven/campusumec.com/libraries/src/Component/ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent('/home/tiempojov...') #12 /home/tiempojoven/campusumec.com/libraries/src/Application/AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent('com_virtuemart') #13 /home/tiempojoven/campusumec.com/libraries/src/Application/AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch() #14 /home/tiempojoven/campusumec.com/libraries/src/Application/CMSApplication.php(196): Joomla\CMS\Application\AdministratorApplication->doExecute() #15 /home/tiempojoven/campusumec.com/administrator/index.php(51): Joomla\CMS\Application\CMSApplication->execute() #16 {main}

Please sign in to comment.