Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[+] MO : PayU Latam, module added

  • Loading branch information...
commit cd00f2e5f6c8489c93c8a53180302417107bd199 1 parent 2a8affc
@gaillafr gaillafr authored
Showing with 1,144 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +3 −0  .gitmodules
  3. +1 −0  payulatam/backward_compatibility
  4. +13 −0 payulatam/config.xml
  5. +36 −0 payulatam/css/index.php
  6. +43 −0 payulatam/css/payu.css
  7. +11 −0 payulatam/error_log
  8. BIN  payulatam/img/credential.png
  9. +36 −0 payulatam/img/index.php
  10. BIN  payulatam/img/info-icon.gif
  11. BIN  payulatam/img/info-img1.jpg
  12. BIN  payulatam/img/info-img2.jpg
  13. BIN  payulatam/img/info-img3.jpg
  14. BIN  payulatam/img/logo.png
  15. BIN  payulatam/img/payu-btn.gif
  16. BIN  payulatam/img/payu-check.png
  17. BIN  payulatam/img/prestashop-1.5.png
  18. +36 −0 payulatam/index.php
  19. +36 −0 payulatam/js/index.php
  20. +7 −0 payulatam/js/payu.js
  21. +1 −0  payulatam/log.html
  22. BIN  payulatam/logo.gif
  23. BIN  payulatam/logo.png
  24. +118 −0 payulatam/payment.php
  25. +375 −0 payulatam/payulatam.php
  26. +66 −0 payulatam/tpl/admin.tpl
  27. +47 −0 payulatam/tpl/credential.tpl
  28. +31 −0 payulatam/tpl/error.tpl
  29. +44 −0 payulatam/tpl/help.tpl
  30. +36 −0 payulatam/tpl/index.php
  31. +31 −0 payulatam/tpl/payment.tpl
  32. +78 −0 payulatam/tpl/redirect.tpl
  33. +31 −0 payulatam/tpl/validation.tpl
  34. +31 −0 payulatam/tpl/warning.tpl
  35. +32 −0 payulatam/validation.php
View
1  .gitignore
@@ -1,2 +1,3 @@
+.svn
.DS_Store
View
3  .gitmodules
@@ -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
1  payulatam/backward_compatibility
@@ -0,0 +1 @@
+Subproject commit 12e4b125e6925d2421a6aa2dd51a8676fac8fd89
View
13 payulatam/config.xml
@@ -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
36 payulatam/css/index.php
@@ -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
43 payulatam/css/payu.css
@@ -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
11 payulatam/error_log
@@ -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
View
BIN  payulatam/img/credential.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 payulatam/img/index.php
@@ -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
BIN  payulatam/img/info-icon.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/info-img1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/info-img2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/info-img3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/payu-btn.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/payu-check.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/img/prestashop-1.5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 payulatam/index.php
@@ -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
36 payulatam/js/index.php
@@ -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
7 payulatam/js/payu.js
@@ -0,0 +1,7 @@
+$(".menuTabButton").click(function ()
+{
+ $(".menuTabButton.selected").removeClass("selected");
+ $(this).addClass("selected");
+ $(".tabItem.selected").removeClass("selected");
+ $("#" + this.id + "Sheet").addClass("selected");
+});
View
1  payulatam/log.html
@@ -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
BIN  payulatam/logo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  payulatam/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
118 payulatam/payment.php
@@ -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();
View
375 payulatam/payulatam.php
@@ -0,0 +1,375 @@
+<?php
+/*
+* 2007-2012 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
+* 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
+*/
+
+if (!defined('_PS_VERSION_'))
+ exit;
+
+class PayULatam extends PaymentModule
+{
+ private $_postErrors = array();
+
+ /**
+ * @brief Constructor
+ */
+ public function __construct()
+ {
+ $this->name = 'payulatam';
+ $this->tab = 'payments_gateways';
+ $this->version = '1.0';
+ $this->author = 'PrestaShop';
+
+ parent::__construct();
+
+ $this->displayName = $this->l('PayU Latam');
+ $this->description = $this->l('Module for accepting payments in Latin American countries from local credit cards, local bank transfers and cash deposits.');
+
+ $this->confirmUninstall = $this->l('Are you sure you want to delete your details?');
+
+ /* Backward compatibility */
+ require(_PS_MODULE_DIR_.'payulatam/backward_compatibility/backward.php');
+ $this->context->smarty->assign('base_dir', __PS_BASE_URI__);
+ }
+
+ /**
+ * @brief Install method
+ *
+ * @return Success or failure
+ */
+ public function install()
+ {
+ if (!parent::install() || !$this->registerHook('payment') ||
+ !Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'payu_token` (
+ `id_cart` int(10) NOT NULL,
+ `token` varchar(32) DEFAULT NULL,
+ `status` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`id_cart`)
+ ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;')) // prod | test
+ return false;
+
+ if (!Configuration::get('PAYU_WAITING_PAYMENT'))
+ Configuration::updateValue('PAYU_WAITING_PAYMENT', $this->addState('Payu Latam : Pending payment', '#DDEEFF'));
+
+//PAYU_WAITING_PAYMENT
+ return true;
+ }
+
+ private function addState($en, $color)
+ {
+ $orderState = new OrderState();
+ $orderState->name = array();
+ foreach (Language::getLanguages() AS $language)
+ {
+ /*if (strtolower($language['iso_code']) == 'en')
+ $orderState->name[$language['id_lang']] = $fr;
+ else*/
+ $orderState->name[$language['id_lang']] = $en;
+ }
+ $orderState->send_email = false;
+ $orderState->color = $color;
+ $orderState->hidden = false;
+ $orderState->delivery = false;
+ $orderState->logable = false;
+ if ($orderState->add())
+ copy(dirname(__FILE__).'/logo.gif', dirname(__FILE__).'/../../img/os/'.(int)$orderState->id.'.gif');
+ return $orderState->id;
+ }
+
+ /**
+ * @brief Uninstall function
+ *
+ * @return Success or failure
+ */
+ public function uninstall()
+ {
+ // Uninstall parent and unregister Configuration
+ Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'payu_token`');
+ $orderState = new OrderState((int)Configuration::get('PAYU_WAITING_PAYMENT'));
+ $orderState->delete();
+ Configuration::deleteByName('PAYU_WAITING_PAYMENT');
+ if (!parent::uninstall())
+ return false;
+ return true;
+ }
+
+ /**
+ * @brief Main Form Method
+ *
+ * @return Rendered form
+ */
+ public function getContent()
+ {
+ $html = '';
+
+ if (isset($_POST) && isset($_POST['submitPayU']))
+ {
+ $this->_postValidation();
+ if (!count($this->_postErrors))
+ {
+ $this->_postProcess();
+ $html .= $this->_displayValidation();
+ }
+ else
+ $html .= $this->_displayErrors();
+ }
+ return $html.$this->_displayAdminTpl();
+ }
+
+ /**
+ * @brief Method that will displayed all the tabs in the configurations forms
+ *
+ * @return Rendered form
+ */
+ private function _displayAdminTpl()
+ {
+ $this->context->smarty->assign(array(
+ 'tab' => array(
+ 'intro' => array(
+ 'title' => $this->l('How to configure'),
+ 'content' => $this->_displayHelpTpl(),
+ 'icon' => '../modules/payulatam/img/info-icon.gif',
+ 'tab' => 1,
+ 'selected' => (Tools::isSubmit('submitPayU') ? false : true),
+ ),
+ 'credential' => array(
+ 'title' => $this->l('Credentials'),
+ 'content' => $this->_displayCredentialTpl(),
+ 'icon' => '../modules/payulatam/img/credential.png',
+ 'tab' => 2,
+ 'selected' => (Tools::isSubmit('submitPayU') ? true : false),
+ ),
+ ),
+ 'tracking' => 'http://www.prestashop.com/modules/payulatam.png?url_site='.Tools::safeOutput($_SERVER['SERVER_NAME']).'&id_lang='.(int)$this->context->cookie->id_lang,
+ 'logo' => '../modules/payulatam/img/logo.png',
+ 'script' => array('../modules/payulatam/js/payu.js'),
+ 'css' => '../modules/payulatam/css/payu.css',
+ 'lang' => ($this->context->language->iso_code != 'en' || $this->context->language->iso_code != 'es' ? 'en' : $this->context->language->iso_code)
+ ));
+
+ return $this->display(__FILE__, 'tpl/admin.tpl');
+ }
+
+ private function _displayHelpTpl()
+ {
+ return $this->display(__FILE__, 'tpl/help.tpl');
+ }
+
+ /**
+ * @brief Credentials Form Method
+ *
+ * @return Rendered form
+ */
+ private function _displayCredentialTpl()
+ {
+ $this->context->smarty->assign(array(
+ 'formCredential' => './index.php?tab=AdminModules&configure=payulatam&token='.Tools::getAdminTokenLite('AdminModules').'&tab_module='.$this->tab.'&module_name=payulatam',
+ 'credentialTitle' => $this->l('Log in'),
+ 'credentialText' => $this->l('In order to use this module, please fill out the form with the logins provided to you by PayU Latam.'),
+ 'credentialInputVar' => array(
+ 'merchantId' => array(
+ 'name' => 'merchantId',
+ 'required' => true,
+ 'value' => (Tools::getValue('merchantId') ? (int)Tools::getValue('merchantId') : (int)Configuration::get('PAYU_MERCHANT_ID')),
+ 'type' => 'text',
+ 'label' => $this->l('Merchant ID:'),
+ 'desc' => $this->l('The Merchant ID given to you by PayU Latam at the creation of your account.'),
+ ),
+ 'apiKey' => array(
+ 'name' => 'apiKey',
+ 'required' => true,
+ 'value' => (Tools::getValue('apiKey') ? Tools::safeOutput(Tools::getValue('apiKey')) : Tools::safeOutput(Configuration::get('PAYU_API_KEY'))),
+ 'type' => 'text',
+ 'label' => $this->l('Api Key:'),
+ 'desc' => $this->l('The Api Key given to you by PayU Latam at the creation of your account.'),
+ ),
+ 'accountId' => array(
+ 'name' => 'accountId',
+ 'required' => false,
+ 'value' => (Tools::getValue('accountId') ? (int)Tools::getValue('accountId') : (int)Configuration::get('PAYU_ACCOUNT_ID')),
+ 'type' => 'text',
+ 'label' => $this->l('Account ID:'),
+ 'desc' => $this->l('The Account ID given to you by PayU Latam at the creation of your account.'),
+ ),
+ 'demo' => array(
+ 'name' => 'demo',
+ 'required' => false,
+ 'value' => (Tools::getValue('demo') ? Tools::safeOutput(Tools::getValue('demo')) : Tools::safeOutput(Configuration::get('PAYU_DEMO'))),
+ 'type' => 'radio',
+ 'values' => array('yes', 'no'),
+ 'label' => $this->l('Mode Test:'),
+ 'desc' => $this->l(''),
+ ))));
+ return $this->display(__FILE__, 'tpl/credential.tpl');
+ }
+
+ /**
+ * @brief Validate Method
+ *
+ * @return update the module depending
+ */
+ private function _postValidation()
+ {
+ if (Tools::isSubmit('submitPayU'))
+ $this->_postValidationCredentials();
+ }
+
+ private function _postValidationCredentials()
+ {
+ $merchantId = Tools::getValue('merchantId');
+ $apiKey = Tools::getValue('apiKey');
+ //$accountId = Tools::getValue('accountId');
+
+ if ($merchantId == '' || $apiKey == '')// || $accountId == '')
+ $this->_postErrors[] = $this->l('Please fill out the entire form.');
+ }
+
+ private function _postProcess()
+ {
+ if (Tools::isSubmit('submitPayU'))
+ $this->_postProcessCredentials();
+ }
+
+ private function _postProcessCredentials()
+ {
+ Configuration::updateValue('PAYU_MERCHANT_ID', (int)Tools::getValue('merchantId'));
+ Configuration::updateValue('PAYU_API_KEY', pSQL(Tools::getValue('apiKey')));
+ Configuration::updateValue('PAYU_ACCOUNT_ID', (int)Tools::getValue('accountId'));
+ Configuration::updateValue('PAYU_DEMO', pSQL(Tools::getValue('demo')));
+ }
+
+ private function _displayErrors()
+ {
+ $this->context->smarty->assign('postErrors', $this->_postErrors);
+ return $this->display(__FILE__, 'tpl/error.tpl');
+ }
+
+ private function _displayValidation()
+ {
+ $this->context->smarty->assign('postValidation', array($this->l('Updated succesfully')));
+ return $this->display(__FILE__, 'tpl/validation.tpl');
+ }
+
+ private function _displayWarning()
+ {
+ $this->context->smarty->assign('warnings', array($this->l('Please, activate Soap (PHP extension).')));
+ return $this->display(__FILE__, 'tpl/warning.tpl');
+ }
+
+ /**
+ * @brief to display the payment option, so the customer will pay by merchant ware
+ */
+ public function hookPayment($params)
+ {
+ if (!$this->active || Configuration::get('PAYU_MERCHANT_ID') == '')
+ return false;
+
+ $this->context->smarty->assign(array('pathSsl' => (_PS_VERSION_ >= 1.4 ? Tools::getShopDomainSsl(true, true) : '' ).__PS_BASE_URI__.'modules/payulatam/', 'modulePath'=> $this->_path));
+
+ return $this->display(__FILE__, 'tpl/payment.tpl');
+ }
+
+ /**
+ * @brief Validate a payment, verify if everything is right
+ */
+ public function validation()
+ {
+ if (!isset($_POST['sign']) && !isset($_POST['signature']))
+ Logger::AddLog('[Payulatam] the signature is missing.', 2, null, null, null, true);
+ else
+ $token = isset($_POST['sign']) ? $_POST['sign'] : $_POST['signature'];
+ if (!isset($_POST['reference_sale']) && !isset($_POST['referenceCode']))
+ Logger::AddLog('[Payulatam] the reference is missing.', 2, null, null, null, true);
+ else
+ $ref = isset($_POST['reference_sale']) ? $_POST['reference_sale'] : $_POST['referenceCode'];
+ if (!isset($_POST['value']) && !isset($_POST['amount']))
+ Logger::AddLog('[Payulatam] the amount is missing.', 2, null, null, null, true);
+ else
+ $amount = isset($_POST['value']) ? $_POST['value'] : $_POST['amount'];
+
+ if (!isset($_POST['merchant_id']) && !isset($_POST['merchantId']))
+ Logger::AddLog('[Payulatam] the merchantId is missing.', 2, null, null, null, true);
+ else
+ $merchantId = isset($_POST['merchant_id']) ? $_POST['merchant_id'] : $_POST['merchantId'];
+
+ if (!isset($_POST['lap_state']) && !isset($_POST['state_pol']))
+ Logger::AddLog('[Payulatam] the lap_state is missing.', 2, null, null, null, true);
+ else
+ $statePol = isset($_POST['lap_state']) ? $_POST['lap_state'] : $_POST['state_pol'];
+
+ $idCart = substr($ref, 6 + strlen(Configuration::get('PS_SHOP_NAME')));
+
+ $this->context->cart = new Cart((int)$idCart);
+
+ if (!$this->context->cart->OrderExists())
+ {
+ Logger::AddLog('[Payulatam] The shopping card '.(int)$idCart.' doesn\'t have any order created', 2, null, null, null, true);
+ return false;
+ }
+
+ if (Validate::isLoadedObject($this->context->cart))
+ {
+ $id_orders = Db::getInstance()->ExecuteS('SELECT `id_order` FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->context->cart->id.'');
+ foreach ($id_orders as $val)
+ {
+ $order = new Order((int)$val['id_order']);
+
+ if ($this->context->cart->getOrderTotal() != $amount)
+ Logger::AddLog('[Payulatam] The shopping card '.(int)$idCart.' doesn\'t have the correct amount expected during payment validation', 2, null, null, null, true);
+ else
+ {
+ $currency = new Currency((int)$this->context->cart->id_currency);
+ if ($token == md5(Configuration::get('PAYU_API_KEY').'~'.(int)Configuration::get('PAYU_MERCHANT_ID').'~payU_'.Configuration::get('PS_SHOP_NAME').'_'.(int)$this->context->cart->id.'~'.(float)$this->context->cart->getOrderTotal().'~'.$currency->iso_code.'~'.$statePol))
+ {
+ if ($statePol == 7)
+ $order->setCurrentState((int)Configuration::get('PAYU_WAITING_PAYMENT'));
+ else if ($statePol == 4)
+ $order->setCurrentState((int)Configuration::get('PS_OS_PAYMENT'));
+ else
+ {
+ $order->setCurrentState((int)Configuration::get('PS_OS_ERROR'));
+ Logger::AddLog('[PayU] The shopping card '.(int)$idCart.' has been rejected by PayU state pol='.(int)$statePol, 2, null, null, null, true);
+ }
+ }
+ else
+ Logger::AddLog('[PayU] The shopping card '.(int)$idCart.' has an incorrect token given from payU during payment validation', 2, null, null, null, true);
+ }
+ if (_PS_VERSION_ >= 1.5)
+ {
+ $payment = $order->getOrderPaymentCollection();
+ if (isset($payment[0]))
+ {
+ $payment[0]->transaction_id = pSQL($ref);
+ $payment[0]->save();
+ }
+ }
+ }
+ }
+ else
+ {
+ Logger::AddLog('[PayU] The shopping card '.(int)$idCart.' was not found during the payment validation step', 2, null, null, null, true);
+ }
+ }
+}
View
66 payulatam/tpl/admin.tpl
@@ -0,0 +1,66 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<link href="{$css|escape:'htmlall':'UTF-8'}" rel="stylesheet" type="text/css">
+<img src="{$tracking}" alt="tracking" style="display:none"/>
+<div class="payu-module-wrapper">
+ <div class="payu-module-inner-wrap">
+ <img src="{$logo|escape:'htmlall':'UTF-8'}" alt="logo" class="payu-logo" />
+ <p class="payu-module-intro">{l s='The payment solutions offered by PayU Latam adapt to any type of company or business: big or small, beginner or experienced, local or multinational, already selling online or willing to accept payments through the web.' mod='payulatam'}<br /><br />
+ <a class="payu-button" href="http://www.latinamericanpayments.com/prestashop-{$lang}">{l s='Open your FREE account today!' mod='payulatam'}</a></p>
+ <div class="payu-module-right-col">
+ <h1>{l s='Start selling in Latin America now!' mod='payulatam'}</h1>
+ <ul>
+ <li>{l s='Accept' mod='payulatam'} <strong>{l s='different payment methods in a single platform:' mod='payulatam'}</strong> {l s='cash deposits, bank transfers and credit cards.' mod='payulatam'}</li>
+ <li>{l s='Receive payments in' mod='payulatam'} <strong>{l s='several countries in Latin America' mod='payulatam'}</strong> {l s='with a single integration.' mod='payulatam'}</li>
+ <li><strong>{l s='Multi-language' mod='payulatam'}</strong> {l s='and' mod='payulatam'} <strong>{l s='multi-currency' mod='payulatam'}</strong> {l s='options.' mod='payulatam'}</li>
+ <li>{l s='Reduce the risk of selling online by a powerful' mod='payulatam'} <strong>{l s='Anti-Fraud system' mod='payulatam'}</strong> {l s='and transactions control.' mod='payulatam'}</li>
+ <li>{l s='Prevent major investments in infrastructure, technic developments, maintenance and administration of the payment system.' mod='payulatam'}</li>
+ </ul>
+ <h2>{l s='Safety and Support' mod='payulatam'}</h2>
+ <ul class="payu-3cols">
+ <li><p class="payu-small-col1"><strong>{l s='Anti-fraud Control:' mod='payulatam'}</strong><br />{l s='Anti-fraud module for automatic validation of transactions and manual verification procedures, carried out by experts in analysis and identification of fraud.' mod='payulatam'}</p></li>
+ <li><p class="payu-small-col2"><strong>{l s='Certified PCI DSS:' mod='payulatam'}</strong><br />{l s='With this certification, PayU Latam ensures the protection, confidentiality, and integrity of the card holder information.' mod='payulatam'}</p></li>
+ <li><p class="payu-small-col3"><strong>{l s='Veracode Recognition:' mod='payulatam'}</strong><br />{l s='The unique award-winning company in Latin America thanks to its high safety standards in the development of its transactional platform and related services.' mod='payulatam'}</p></li>
+ </ul>
+ </div>
+ </div>
+ <ul id="menuTab">
+ {foreach from=$tab item=li}
+ <li id="menuTab{$li.tab|escape:'htmlall':'UTF-8'}" class="menuTabButton {if $li.selected}selected{/if}">{if $li.icon != ''}<img src="{$li.icon|escape:'htmlall':'UTF-8'}" alt="{$li.title|escape:'htmlall':'UTF-8'}"/>{/if} {$li.title|escape:'htmlall':'UTF-8'}</li>
+ {/foreach}
+ </ul>
+ <div id="tabList">
+ {foreach from=$tab item=div}
+ <div id="menuTab{$div.tab|escape:'htmlall':'UTF-8'}Sheet" class="tabItem {if $div.selected}selected{/if}">
+ {$div.content}
+ </div>
+ {/foreach}
+ </div>
+</div>
+{foreach from=$script item=link}
+<script type="text/javascript" src="{$link|escape:'htmlall':'UTF-8'}"></script>
+{/foreach}
View
47 payulatam/tpl/credential.tpl
@@ -0,0 +1,47 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<form action="{$formCredential|escape:'htmlall':'UTF-8'}" method="POST">
+ <fieldset>
+ <p>{$credentialText|escape:'htmlall':'UTF-8'}</p>
+ <input type="hidden" name="submitPayU" value="1" />
+ {foreach from=$credentialInputVar item=input}
+ <label from="{$input.name|escape:'htmlall':'UTF-8'}">{$input.label|escape:'htmlall':'UTF-8'}</label>
+ <div class="margin-form">
+ {if $input.type == 'text'}
+ <input type="{$input.type|escape:'htmlall':'UTF-8'}" name="{$input.name|escape:'htmlall':'UTF-8'}" id="{$input.name|escape:'htmlall':'UTF-8'}" value="{$input.value|escape:'htmlall':'UTF-8'}" /> {if $input.required}<span style="color:red">*</span>{/if} {$input.desc|escape:'htmlall':'UTF-8'}
+ {elseif $input.type == 'radio'}
+ {foreach from=$input.values item=val}
+ <input type="{$input.type|escape:'htmlall':'UTF-8'}" {if $val == $input.value}checked='checked'{/if} name="{$input.name|escape:'htmlall':'UTF-8'}" id="{$input.name|escape:'htmlall':'UTF-8'}{$val}" value="{$val|escape:'htmlall':'UTF-8'}" /> {if $input.required}<span style="color:red">*</span>{/if} {$val|escape:'htmlall':'UTF-8'}
+ {/foreach}
+ {/if}
+ </div>
+ {/foreach}
+ <div class="margin-form">
+ <input type="submit" class="button" value="{l s='Save' mod='payulatam'}" />
+ </div>
+ </fieldset>
+</form>
View
31 payulatam/tpl/error.tpl
@@ -0,0 +1,31 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<div class="error">
+ {foreach from=$postErrors item=error}
+ <img src="../img/admin/forbbiden.gif" alt="nok" />&nbsp;{$error|escape:'htmlall':'UTF-8'}</br>
+ {/foreach}
+</div>
View
44 payulatam/tpl/help.tpl
@@ -0,0 +1,44 @@
+{*
+* 2007-2012 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
+* 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
+*}
+<fieldset class="tab-configure">
+ <h4 class="first">{l s='How to get a PayU Latam account:' mod='payulatam'}</h4>
+ <p>{l s='Go to' mod='payulatam'} <a href="http://www.latinamericanpayments.com/prestashop" rel="external">{l s='PayU Latam' mod='payulatam'}</a> {l s='and fill out the form to create your account.' mod='payulatam'}</p>
+ <h4>{l s='How to configure the PayU Latam module:' mod='payulatam'}</h4>
+ <ul>
+ <li class="first"><p>{l s='Enter your username and password to the Sign in located in the upper right corner in' mod='payulatam'} <a href="http://www.payulatam.com" rel="external">{l s='www.payulatam.com' mod='payulatam'}</a><br>
+ <img alt="" class="info-img" src="{$module_dir}img/info-img1.jpg" /></p></li>
+ <li><p>{l s='In the PayU Latam administrative module go to the "Configuration" tab' mod='payulatam'}<br><br>
+ <img alt="" class="info-img" src="{$module_dir}img/info-img2.jpg" /></p>
+</li>
+ <li><p>{l s='In the "Technical information" section you will find the ApiKey and Merchant Id' mod='payulatam'}<br>
+ <img alt="" class="info-img" src="{$module_dir}img/info-img3.jpg" /></p></li>
+ <li class="last"><p>{l s='With this information, go to "Credentials" within the PrestaShop PayU Latam module and fill in the required fields' mod='payulatam'}</p><br>
+ <p>{l s='Press the "Save" button' mod='payulatam'}</p></li>
+ </ul>
+ <h4>{l s='Please consider:' mod='payulatam'}</h4>
+ <p>{l s='If you enable the "Test Mode" all transactions to be processed will not be real' mod='payulatam'} <sup>*</sup></p>
+ <p class="note"><sup>*</sup> {l s='this mode should never be active in production for real transactions' mod='payulatam'}</p>
+</fieldset>
View
36 payulatam/tpl/index.php
@@ -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
31 payulatam/tpl/payment.tpl
@@ -0,0 +1,31 @@
+{*
+* 2007-2012 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
+* 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
+*}
+<p class="payment_module">
+ <a href="{$pathSsl|escape:'htmlall':'UTF-8'}payment.php">
+ <img src="{$modulePath|escape:'htmlall':'UTF-8'}img/logo.png" alt="PayULatam" style="width:160px"/>
+ {l s='Pay by Payu Latam (pay with credit card or cash deposit)' mod='payulatam'}
+ </a>
+</p>
View
78 payulatam/tpl/redirect.tpl
@@ -0,0 +1,78 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<style>
+ .payu-button {
+cursor:pointer;
+ background-image: url("./img/payu-btn.gif");
+ background-position: center top;
+ background-repeat: repeat-x;
+ border-radius: 4px 4px 4px 4px;
+ color: #FFFFFF;
+ font-size: 16px;
+ height: 45px;
+ line-height: 45px;
+ text-align: center;
+ text-shadow: 0 1px 1px #1B5C8B;
+ vertical-align: middle;
+ width: 280px;
+}
+.payu-button:hover, a.payu-button:active { background-position: center bottom; color: #FFF; text-decoration: none; }
+
+</style>
+<div style="text-align:center;">
+{if isset($error)}
+<p style="color:red">{l s='An error occured, please try again later.' mod='payulatam'}</p>
+{else}
+<p style="font-size:15px;">{l s='You are going to be redirected to PayU\'s website for your payment.' mod='payulatam'}</p>
+<form action="{$formLink|escape:'htmlall':'UTF-8'}" method="POST" id="formPayU">
+ {foreach from=$payURedirection item=value}
+ <input type="hidden" value="{$value.value}" name="{$value.name}"/>
+ {/foreach}
+ <input class="payu-button" id="payuSubmit" type="button" value="{l s='Please click here' mod='payulatam'}" />
+</form>
+</div>
+{literal}
+<script type="text/javascript">
+$('#payuSubmit').click(
+ function()
+ {
+ $.ajax(
+ {
+ type : 'GET',
+ url : './payment.php?create-pending-order',
+ dataType: 'html',
+ success: function(data)
+ {
+ $('#formPayU').submit();
+ }
+ });
+
+ }
+);
+</script>
+{/literal}
+{/if}
View
31 payulatam/tpl/validation.tpl
@@ -0,0 +1,31 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<div class="conf">
+ {foreach from=$postValidation item=validate}
+ <img src="../img/admin/enabled.gif" alt="nok" />&nbsp;{$validate|escape:'htmlall':'UTF-8'}</br>
+ {/foreach}
+</div>
View
31 payulatam/tpl/warning.tpl
@@ -0,0 +1,31 @@
+{*
+* 2007-2012 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
+* 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
+*}
+
+<div class="warn">
+ {foreach from=$warnings item=warning}
+ <img src="../img/admin/warn2.png" alt="nok" />&nbsp;{$warning|escape:'htmlall':'UTF-8'}</br>
+ {/foreach}
+</div>
View
32 payulatam/validation.php
@@ -0,0 +1,32 @@
+<?php
+/*
+* 2007-2012 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
+* 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
+*/
+
+require_once(dirname(__FILE__).'/../../config/config.inc.php');
+require_once(_PS_MODULE_DIR_.'payulatam/payulatam.php');
+
+$payU = new PayULatam();
+$payU->validation();
Please sign in to comment.
Something went wrong with that request. Please try again.