Skip to content

Commit

Permalink
Merge pull request #47 from conekta/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
JoValo authored Aug 25, 2017
2 parents 019f4a5 + 4f8012c commit de7cec5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 52 deletions.
18 changes: 6 additions & 12 deletions conekta_prestashop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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')
));
Expand Down Expand Up @@ -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';
Expand Down
12 changes: 6 additions & 6 deletions model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class Config
{
public function getLineItems($items = '')
public static function getLineItems($items = '')
{
$lineItems = array();
foreach ($items as $item) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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)) {
Expand All @@ -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(
Expand All @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions model/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion views/js/tokenize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
28 changes: 0 additions & 28 deletions views/templates/front/spei.tpl

This file was deleted.

4 changes: 2 additions & 2 deletions views/templates/hook/hook-header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* @version v1.0.0
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="https://conektaapi.s3.amazonaws.com/v0.3.2/js/conekta.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.conekta.io/js/latest/conekta.js"></script>
<script type="text/javascript" src="{$path|escape:'htmlall':'UTF-8'}views/js/tokenize.js"></script>
<script type="text/javascript">
var conekta_public_key = "{$api_key|escape:'htmlall':'UTF-8'}";
Expand Down

0 comments on commit de7cec5

Please sign in to comment.