Permalink
Browse files

[+] MO : PayU Latam, module added

  • Loading branch information...
1 parent 2a8affc commit cd00f2e5f6c8489c93c8a53180302417107bd199 @gaillafr gaillafr committed Dec 3, 2012
View
@@ -1,2 +1,3 @@
+.svn
.DS_Store
View
@@ -85,3 +85,6 @@
[submodule "ebay/backward_compatibility"]
path = ebay/backward_compatibility
url = https://github.com/PrestaShop/PrestaShop-backward_compatibility
+[submodule "payulatam/backward_compatibility"]
+ path = payulatam/backward_compatibility
+ url = https://github.com/PrestaShop/PrestaShop-backward_compatibility
View
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<module>
+ <name>payulatam</name>
+ <displayName><![CDATA[PayU Latam]]></displayName>
+ <version><![CDATA[1.0]]></version>
+ <description><![CDATA[Module for accepting payments in Latin American countries from local credit cards, local bank transfers and cash deposits.]]></description>
+ <author><![CDATA[PrestaShop]]></author>
+ <tab><![CDATA[payments_gateways]]></tab>
+ <confirmUninstall>Are you sure you want to delete your details?</confirmUninstall>
+ <is_configurable>1</is_configurable>
+ <need_instance>1</need_instance>
+ <limited_countries></limited_countries>
+</module>
View
@@ -0,0 +1,36 @@
+<?php
+/*
+* 2007-2012 PrestaShop
+*
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License (OSL 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/osl-3.0.php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to license@prestashop.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
+* versions in the future. If you wish to customize PrestaShop for your
+* needs please refer to http://www.prestashop.com for more information.
+*
+* @author PrestaShop SA <contact@prestashop.com>
+* @copyright 2007-2012 PrestaShop SA
+* @version Release: $Revision: 14009 $
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
View
@@ -0,0 +1,43 @@
+.payu-module-wrapper { font-family: Helvetica,Arial,sans-serif; margin: 0px auto; overflow: hidden; padding: 0px; max-width: 1024px; min-width: 930px; }
+.payu-module-inner-wrap { overflow: hidden; margin-bottom: 25px; padding-top: 10px; position: relative; }
+.payu-module-wrapper h1, .payu-module-wrapper h2 { color: #00B1E7; font-size: 16px; font-weight: lighter; line-height: 18px; letter-spacing: 2px; margin: 0px 0px 15px 0px; padding: 0px; text-transform: uppercase; text-shadow: 0px 1px 0px #D8D8D8; }
+.payu-module-wrapper h2 { margin: 0px 0px 5px 0px; text-transform: none; }
+.payu-module-inner-wrap p, .payu-module-inner-wrap ul li { color: #666; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 0px; padding: 0px; }
+ul.payu-benefits { list-style: none; margin: 0px 0px 20px 0px; padding: 0px; }
+ul.payu-benefits li { background: url(../img/payu-check.png) left 2px no-repeat; padding: 0px 0px 0px 20px; }
+
+img.payu-logo { position: absolute; left: 5px; top: 20px; }
+p.payu-module-intro { color: #333; margin: 0px; position: absolute; left: 0px; bottom: 15px; width: 280px; }
+a.payu-button {
+ background-image: url(../img/payu-btn.gif); background-repeat: repeat-x; background-position: center top;
+ -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
+ color: #FFF;
+ display: block; font-size: 16px; height: 45px; line-height: 45px; text-align: center; text-shadow: 0px 1px 1px #1B5C8B; vertical-align: middle; width: 280px;
+}
+a.payu-button:hover, a.payu-button:active { background-position: center bottom; color: #FFF; text-decoration: none; }
+.payu-module-right-col { border-left: #D8D8D8 dashed 1px; float: right; padding: 25px 0px 0px 45px; margin-left: 325px; }
+ul.payu-3cols { list-style: none; margin: 0px; padding: 0px; }
+ul.payu-3cols li { display: inline-block; float: left; margin: 0px; padding: 0px; width: 33%; }
+p.payu-small-col1 { border-right: #D8D8D8 dashed 1px; padding: 10px 17px 0px 0px; }
+p.payu-small-col2 { padding: 10px 17px 0px 17px; }
+p.payu-small-col3 { border-left: #D8D8D8 dashed 1px; padding: 10px 0px 0px 17px; }
+
+#menuTab {padding: 0; margin: 0; text-align: left; }
+#menuTab li { text-align: left; float: left; display: inline; padding: 5px 10px 5px 5px; background: #EFEFEF; font-weight: bold; cursor: pointer; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; margin-left: 5px; height: 14px; }
+#menuTab li.menuTabButton.selected { background: #FFFFF0; border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; margin-bottom: -1px; padding-bottom: 6px;}
+#menuTab li img { margin-top: -2px; }
+#tabList { clear: left; }
+.tabItem { display: none; }
+.tabItem.selected { display: block; background: #FFFFF0; border: 1px solid #CCCCCC; padding: 10px; }
+#tabList h4 { text-shadow: 0 1px 0 #FFFFFF; }
+#tabList h4.first { margin-top: 0px; }
+#tabList sup { color: #CC0000; font-weight: bold; vertical-align: text-top; }
+#tabList a { color: #268CCD; text-decoration: underline; }
+#tabList a:hover { color: #268CCD; text-decoration: none; }
+
+.tab-configure ul { list-style: none; margin: 0px 0px 10px -15px; overflow: hidden; padding: 0px; }
+.tab-configure ul li { display: block; float: left; width: 25%; }
+.tab-configure ul li p { border-right: #CCCED7 dashed 1px; margin: 0px; padding: 0px 15px 5px 15px; }
+.tab-configure ul li.last p { border-right: none; }
+.tab-configure ul li p img.info-img { margin-top: 10px; }
+.tab-configure p.note { color: #7F7F7F; font-size: 0.85em; }
View
@@ -0,0 +1,11 @@
+[08-Oct-2012 13:57:44 UTC] PHP Fatal error: Cannot access empty property in /home/bruphu/public_html/payu15/modules/payulatam/payulatam.php on line 303
+[09-Oct-2012 20:17:36 UTC] PHP Fatal error: Uncaught exception 'PrestaShopException' with message 'Property OrderPayment->id_currency is empty' in /home/bruphu/public_html/payu15/classes/ObjectModel.php:790
+Stack trace:
+#0 /home/bruphu/public_html/payu15/classes/ObjectModel.php(265): ObjectModelCore->validateFields()
+#1 /home/bruphu/public_html/payu15/classes/ObjectModel.php(465): ObjectModelCore->getFields()
+#2 /home/bruphu/public_html/payu15/classes/order/OrderPayment.php(65): ObjectModelCore->add(true, false)
+#3 /home/bruphu/public_html/payu15/classes/ObjectModel.php(427): OrderPaymentCore->add(true, false)
+#4 /home/bruphu/public_html/payu15/modules/payulatam/payulatam.php(304): ObjectModelCore->save()
+#5 /home/bruphu/public_html/payu15/modules/payulatam/validation.php(32): PayULatam->validation()
+#6 {main}
+ thrown in /home/bruphu/public_html/payu15/classes/ObjectModel.php on line 790
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,36 @@
+<?php
+/*
+* 2007-2012 PrestaShop
+*
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License (OSL 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/osl-3.0.php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to license@prestashop.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
+* versions in the future. If you wish to customize PrestaShop for your
+* needs please refer to http://www.prestashop.com for more information.
+*
+* @author PrestaShop SA <contact@prestashop.com>
+* @copyright 2007-2012 PrestaShop SA
+* @version Release: $Revision: 14009 $
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,36 @@
+<?php
+/*
+* 2007-2012 PrestaShop
+*
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License (OSL 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/osl-3.0.php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to license@prestashop.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
+* versions in the future. If you wish to customize PrestaShop for your
+* needs please refer to http://www.prestashop.com for more information.
+*
+* @author PrestaShop SA <contact@prestashop.com>
+* @copyright 2007-2012 PrestaShop SA
+* @version Release: $Revision: 14009 $
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
View
@@ -0,0 +1,36 @@
+<?php
+/*
+* 2007-2012 PrestaShop
+*
+* NOTICE OF LICENSE
+*
+* This source file is subject to the Open Software License (OSL 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/osl-3.0.php
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to license@prestashop.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
+* versions in the future. If you wish to customize PrestaShop for your
+* needs please refer to http://www.prestashop.com for more information.
+*
+* @author PrestaShop SA <contact@prestashop.com>
+* @copyright 2007-2012 PrestaShop SA
+* @version Release: $Revision: 14009 $
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
View
@@ -0,0 +1,7 @@
+$(".menuTabButton").click(function ()
+{
+ $(".menuTabButton.selected").removeClass("selected");
+ $(this).addClass("selected");
+ $(".tabItem.selected").removeClass("selected");
+ $("#" + this.id + "Sheet").addClass("selected");
+});
View
@@ -0,0 +1 @@
+2012:10:04 09:07:43<br/>----->0payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96payU_96----->96
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,118 @@
+<?php
+/*
+* 2007-2012 PrestaShop
+*
+* NOTICE OF LICENSE
+*
+0* 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
+* If you did not receive a copy of the license and are unable to
+* obtain it through the world-wide-web, please send an email
+* to license@prestashop.com so we can send you a copy immediately.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
+* versions in the future. If you wish to customize PrestaShop for your
+* needs please refer to http://www.prestashop.com for more information.
+*
+* @author PrestaShop SA <contact@prestashop.com>
+* @copyright 2007-2012 PrestaShop SA
+* @version Release: $Revision: 14011 $
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+$useSSL = true;
+include(dirname(__FILE__).'/../../config/config.inc.php');
+include(dirname(__FILE__).'/../../init.php');
+
+include_once(_PS_MODULE_DIR_.'/payulatam/payulatam.php');
+
+class PayUController extends FrontController
+{
+ public $ssl = true;
+
+ public function setMedia()
+ {
+ parent::setMedia();
+ }
+
+ public function process()
+ {
+ parent::process();
+
+ $params = $this->initParams();
+ self::$smarty->assign(array(
+ 'formLink' => Configuration::get('PAYU_DEMO') != 'yes' ? 'https://gatewaylap.pagosonline.net/ppp-web-gateway/' : 'https://stg.gatewaylap.pagosonline.net/ppp-web-gateway/',
+ 'payURedirection' => $params
+ ));
+ }
+
+ public function displayContent()
+ {
+ parent::displayContent();
+ self::$smarty->display(_PS_MODULE_DIR_.'payulatam/tpl/redirect.tpl');
+ }
+
+ public function initParams()
+ {
+
+ $tax = (float)self::$cart->getOrderTotal() - (float)self::$cart->getOrderTotal(false);
+ $base = (float)self::$cart->getOrderTotal(true, Cart::ONLY_PRODUCTS) + (float)self::$cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS) - (float)$tax;
+ if($tax == 0)
+ $base = 0;
+
+ $currency = new Currency(self::$cart->id_currency);
+
+ $language = new Language(self::$cart->id_lang);
+
+ $customer = new Customer(self::$cart->id_customer);
+
+ $ref = 'payU_'.Configuration::get('PS_SHOP_NAME').'_'.(int)self::$cart->id;
+
+ $token = md5(Tools::safeOutput(Configuration::get('PAYU_API_KEY')).'~'.(int)Configuration::get('PAYU_MERCHANT_ID').'~'.$ref.'~'.(float)self::$cart->getOrderTotal().'~'.Tools::safeOutput($currency->iso_code));
+
+ $params = array(
+ array('value' => (Configuration::get('PAYU_DEMO') == 'yes' ? 1 : 0), 'name' => 'test'),
+ array('value' => (int)Configuration::get('PAYU_MERCHANT_ID'), 'name' => 'merchantId'),
+ array('value' => $ref, 'name' => 'referenceCode'),
+ array('value' => substr(Configuration::get('PS_SHOP_NAME').' Order', 0, 255), 'name' => 'description'),
+ array('value' => (float)self::$cart->getOrderTotal(), 'name' => 'amount'),
+ array('value' => Tools::safeOutput($customer->email), 'name' => 'buyerEmail'),
+ array('value' => (float)$tax, 'name' => 'tax'),
+ array('value' => 'PRESTASHOP', 'name' => 'extra1'),
+ array('value' => (float)$base, 'name' => 'taxReturnBase'),
+ array('value' => Tools::safeOutput($currency->iso_code), 'name' => 'currency'),
+ array('value' => Tools::safeOutput($language->iso_code), 'name' => 'lng'),
+ array('value' => Tools::safeOutput($token), 'name' => 'signature'),
+ array('value' => 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'history.php', 'name' => 'responseUrl'),
+ array('value' => 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/payulatam/validation.php', 'name' => 'confirmationUrl'),
+ );
+
+ if (Configuration::get('PAYU_ACCOUNT_ID') != 0)
+ $params[] = array('value' => (int)Configuration::get('PAYU_ACCOUNT_ID'), 'name' => 'accountId');
+
+ if (Db::getInstance()->getValue('SELECT `token` FROM `'._DB_PREFIX_.'payu_token` WHERE `id_cart` = '.(int)self::$cart->id))
+ Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'payu_token` SET `token` = "'.pSQL($token).'" WHERE `id_cart` = '.(int)self::$cart->id);
+ else
+ Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'payu_token` (`id_cart`, `token`) VALUES ('.(int)self::$cart->id.', \''.pSQL($token).'\')');
+
+ return $params;
+ }
+
+ public function createPendingOrder()
+ {
+ $payu = new PayULatam();
+ $payu->validateOrder((int)self::$cart->id, (int)Configuration::get('PAYU_WAITING_PAYMENT'), (float)self::$cart->getOrderTotal(), $payu->displayName, NULL, array(), NULL, false, self::$cart->secure_key);
+ }
+}
+
+$payUController = new PayUController();
+
+if (isset($_GET['create-pending-order']))
+ $payUController->createPendingOrder();
+else
+ $payUController->run();
Oops, something went wrong.

0 comments on commit cd00f2e

Please sign in to comment.