diff --git a/conekta_prestashop.php b/conekta_prestashop.php index 1b84f0e29..787f37fc1 100644 --- a/conekta_prestashop.php +++ b/conekta_prestashop.php @@ -876,6 +876,7 @@ protected function generateCardPaymentForm() //value by default $msi = 0; $jumps = array(1); + if (Configuration::get('PAYMENT_METHS_INSTALLMET')) { $msi = 1; $total = $this->context->cart->getOrderTotal(); @@ -896,7 +897,6 @@ protected function generateCardPaymentForm() 'months' => $months, 'years' => $years, 'msi' => $msi, - 'total' => $total, 'msi_jumps' => $jumps[0], 'test_private_key' => Configuration::get('TEST_PRIVATE_KEY') )); @@ -1104,20 +1104,14 @@ public function processPayment($type, $token, $msi) 'id_module' => (int) $this->id )); Tools::redirect($redirect); - } catch (\Conekta\ErrorList $e) { - $message = ""; - $log_message = ""; + } catch (\Exception $e) { + $log_message = $e->getMessage() . ' '; if (class_exists('Logger')) { - foreach ($e->details as $single_error) { - $log_message = $single_error->message . ' '; - Logger::addLog($this->l('Payment transaction failed') . ' ' - . $log_message, 2, null, 'Cart', (int)$this->context->cart->id, true); - } + Logger::addLog($this->l('Payment transaction failed') . ' ' + . $log_message, 2, null, 'Cart', (int)$this->context->cart->id, true); } - foreach ($e->details as $single_error) { - $message .= $single_error->message . ' '; - } + $message = $e->getMessage() . ' '; $controller = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc.php' : 'order.php'; $location = $this->context->link->getPageLink($controller, true) . (strpos($controller, '?') !== false ? '&' : '?') . 'step=3&conekta_error=1&message=' . $message . '#conekta_error'; diff --git a/model/Config.php b/model/Config.php index aee91ecc8..b78bb800f 100644 --- a/model/Config.php +++ b/model/Config.php @@ -18,7 +18,7 @@ */ class Config { - public function getLineItems($items = '') + public static function getLineItems($items = '') { $lineItems = array(); foreach ($items as $item) { @@ -51,7 +51,7 @@ public function getLineItems($items = '') return $lineItems; } - public function getTaxLines($items = '') + public static function getTaxLines($items = '') { $tax_lines = array(); foreach ($items as $item) { @@ -69,7 +69,7 @@ public function getTaxLines($items = '') return $tax_lines; } - public function getDiscountLines($cart, $discounts = '') + public static function getDiscountLines($cart, $discounts = '') { $discount_lines = array(); if (!empty($discounts)) { @@ -87,7 +87,7 @@ public function getDiscountLines($cart, $discounts = '') return $discount_lines; } - public function getShippingLines($shipping_service, $shipping_carrier = '', $shipping_price = '') + public static function getShippingLines($shipping_service, $shipping_carrier = '', $shipping_price = '') { $shipping_lines = array( array( @@ -101,7 +101,7 @@ public function getShippingLines($shipping_service, $shipping_carrier = '', $shi return $shipping_lines; } - public function getShippingContact($customer = '', $address_delivery = '', $state = '', $country = '') + public static function getShippingContact($customer = '', $address_delivery = '', $state = '', $country = '') { $shipping_contact = array( "receiver" => $customer->firstname . " " . $customer->lastname, @@ -119,7 +119,7 @@ public function getShippingContact($customer = '', $address_delivery = '', $stat return $shipping_contact; } - public function getCustomerInfo($customer = '', $address_delivery = '') + public static function getCustomerInfo($customer = '', $address_delivery = '') { $customer_info = array( "name" => $customer->firstname . " " . $customer->lastname, diff --git a/model/Database.php b/model/Database.php index bd02e72ae..95c985701 100644 --- a/model/Database.php +++ b/model/Database.php @@ -50,7 +50,7 @@ public static function insertOxxoPayment($order, $charge_response, $reference, $ . ($charge_response->livemode == 'true' ? '1' : '0') . '\' )'); } - public function installDb() + public static function installDb() { return (Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'conekta_transaction` ( `id_conekta_transaction` int(11) NOT NULL AUTO_INCREMENT, @@ -73,7 +73,7 @@ public function installDb() } - public function insertSpeiPayment($order, $charge_response, $reference, $currentOrder, $cartId) + public static function insertSpeiPayment($order, $charge_response, $reference, $currentOrder, $cartId) { return Db::getInstance()->Execute('INSERT INTO ' . _DB_PREFIX_ . 'conekta_transaction( type, id_cart, id_order, id_conekta_order, id_transaction, amount, @@ -87,7 +87,7 @@ public function insertSpeiPayment($order, $charge_response, $reference, $current . $reference . '\', \'' . ($charge_response->livemode == 'true' ? '1' : '0') . '\' )'); } - public function insertCardPayment($order, $charge_response, $currentOrder, $cartId) + public static function insertCardPayment($order, $charge_response, $currentOrder, $cartId) { return Db::getInstance()->Execute('INSERT INTO ' . _DB_PREFIX_ . 'conekta_transaction ( type, id_cart, id_order, id_conekta_order, id_transaction, diff --git a/views/js/tokenize.js b/views/js/tokenize.js index 508aa3e2d..2eb340d50 100644 --- a/views/js/tokenize.js +++ b/views/js/tokenize.js @@ -46,7 +46,7 @@ function conektaSetup() } /* Set Conekta public key */ - Conekta.setPublishableKey(conekta_public_key); + Conekta.setPublicKey(conekta_public_key); //since we are using smarty html_select_date custom function $('#conekta-card-expiry-month').removeAttr('name'); $('#conekta-card-expiry-year').removeAttr('name'); diff --git a/views/templates/front/spei.tpl b/views/templates/front/spei.tpl deleted file mode 100644 index 1ca25b129..000000000 --- a/views/templates/front/spei.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{* -* 2007-2017 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 Conekta -* @copyright 2007-2017 PrestaShop SA -* @version v1.0.0 -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -*} - -
-

{l s='Add some details about the payment option' mod='conekta_prestashop'}

-
diff --git a/views/templates/hook/hook-header.tpl b/views/templates/hook/hook-header.tpl index 49b14d981..2a29167d9 100644 --- a/views/templates/hook/hook-header.tpl +++ b/views/templates/hook/hook-header.tpl @@ -22,8 +22,8 @@ * @version v1.0.0 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) *} - - + +