diff --git a/v1.6.x/mercadopago/composer.json b/v1.6.x/mercadopago/composer.json deleted file mode 100755 index 8380939..0000000 --- a/v1.6.x/mercadopago/composer.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "prestashop/paymentexample", - "description": "PrestaShop module paymentexample", - "homepage": "https://github.com/PrestaShop/paymentexample", - "license": "AFL - Academic Free License (AFL 3.0)", - "authors": [ - { - "name": "PrestaShop SA", - "email": "contact@prestashop.com" - } - ], - "require": { - "php": ">=5.3.2" - }, - "config": { - "preferred-install": "dist" - }, - "type": "prestashop-module" -} diff --git a/v1.6.x/mercadopago/config.xml b/v1.6.x/mercadopago/config.xml index aaa3d05..ae88a86 100644 --- a/v1.6.x/mercadopago/config.xml +++ b/v1.6.x/mercadopago/config.xml @@ -1,12 +1,13 @@ - mercadopago - - - - - - true - 1 + mercadopago + + + + + + + 1 + 0 \ No newline at end of file diff --git a/v1.6.x/mercadopago/config_br.xml b/v1.6.x/mercadopago/config_br.xml index 03ecde4..155ab5d 100644 --- a/v1.6.x/mercadopago/config_br.xml +++ b/v1.6.x/mercadopago/config_br.xml @@ -1,13 +1,13 @@ - mercadopago - - - - - - - 1 - 1 + mercadopago + + + + + + + 1 + 0 \ No newline at end of file diff --git a/v1.6.x/mercadopago/config_es.xml b/v1.6.x/mercadopago/config_es.xml index 8610862..38afe35 100644 --- a/v1.6.x/mercadopago/config_es.xml +++ b/v1.6.x/mercadopago/config_es.xml @@ -2,7 +2,7 @@ mercadopago - + diff --git a/v1.6.x/mercadopago/config_pt.xml b/v1.6.x/mercadopago/config_pt.xml deleted file mode 100644 index 2a39fe5..0000000 --- a/v1.6.x/mercadopago/config_pt.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - mercadopago - - - - - - - 1 - 0 - - \ No newline at end of file diff --git a/v1.6.x/mercadopago/controllers/front/cancelorder.php b/v1.6.x/mercadopago/controllers/front/cancelorder.php new file mode 100644 index 0000000..4c12039 --- /dev/null +++ b/v1.6.x/mercadopago/controllers/front/cancelorder.php @@ -0,0 +1,77 @@ +cancelOrder(); + } + + public function cancelOrder() + { + // card_token_id + $mercadopago = $this->module; + $mercadopago_sdk = $mercadopago->mercadopago; + + $token = Tools::getAdminToken('AdminOrder'.Tools::getValue('id_order')); + + $token_form = Tools::getValue('token_form'); + //check token + if ($token == $token_form) { + $order = new Order(Tools::getValue("id_order")); + $order_payments = $order->getOrderPayments(); + foreach ($order_payments as $order_payment) { + if ($order_payment->transaction_id > 0) { + $result = $mercadopago_sdk->getPayment($order_payment->transaction_id); + if ($result['status'] == 200) { + $responseCancel = $mercadopago_sdk->cancelPaymentsCustom( + $order_payment->transaction_id + ); + } else { + $result = $mercadopago_sdk->getPaymentStandard($order_payment->transaction_id); + $responseCancel = $mercadopago_sdk->cancelPaymentsStandard( + $order_payment->transaction_id + ); + } + } + break; + } + + if ($responseCancel != null && $responseCancel['status'] == 200) { + $mercadopago->updateOrderHistory($order->id, Configuration::get('PS_OS_CANCELED')); + } + + $getAdminLink = $this->context->link->getAdminLink('AdminOrders'); + $getViewOrder = $getAdminLink.'&vieworder&id_order='.Tools::getValue('id_order'); + + Tools::redirectAdmin($getViewOrder); + } + } +} diff --git a/v1.6.x/mercadopago/controllers/front/custompayment.php b/v1.6.x/mercadopago/controllers/front/custompayment.php new file mode 100644 index 0000000..830ecf8 --- /dev/null +++ b/v1.6.x/mercadopago/controllers/front/custompayment.php @@ -0,0 +1,178 @@ +display_column_left = false; + parent::initContent(); + $this->placeOrder(); + } + + private function placeOrder() + { + // card_token_id + $mercadopago = $this->module; + + $response = $mercadopago->execPayment($_POST); + + $order_status = null; + if (array_key_exists('status', $response)) { + switch ($response['status']) { + case 'in_process': + $order_status = 'MERCADOPAGO_STATUS_0'; + break; + case 'approved': + $order_status = 'MERCADOPAGO_STATUS_1'; + break; + case 'pending': + $order_status = 'MERCADOPAGO_STATUS_7'; + break; + } + } + + if ($order_status != null) { + $cart = Context::getContext()->cart; + + $total = (double) number_format($response['transaction_amount'], 2, '.', ''); + $extra_vars = array( + '{bankwire_owner}' => $mercadopago->textshowemail, + '{bankwire_details}' => '', + '{bankwire_address}' => '', + ); + + $id_order = Order::getOrderByCartId($cart->id); + + $order = new Order($id_order); + $existStates = $mercadopago->checkStateExist($id_order, Configuration::get($order_status)); + if ($existStates) { + return; + } + $payment_type_id = $response['payment_type_id']; + $displayName = UtilMercadoPago::setNamePaymentType($payment_type_id); + + $payment_mode = 'boleto'; + $installments = 1; + if (Tools::getIsset('card_token_id')) { + $payment_mode = 'cartao'; + $installments = (int)$response['installments']; + } + + $percent = (float) Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'); + $id_cart_rule = null; + if ($percent > 0) { + $id_cart_rule = $mercadopago->applyDiscount($cart, $payment_mode, $installments); + } + + $mercadopago->validateOrder( + $cart->id, + Configuration::get($order_status), + $total, + $displayName, + null, + $extra_vars, + $cart->id_currency, + false, + $cart->secure_key + ); + + if ($id_cart_rule != null) { + $cartRule = new CartRule($id_cart_rule); + $cartRule->active = false; + $cartRule->save(); + } + + $order = new Order($mercadopago->currentOrder); + $order_payments = $order->getOrderPayments(); + $order_payments[0]->transaction_id = $response['id']; + + $uri = __PS_BASE_URI__.'order-confirmation.php?id_cart='.$cart->id.'&id_module='.$mercadopago->id. + '&id_order='.$mercadopago->currentOrder.'&key='.$order->secure_key.'&payment_id='. + $response['id'].'&payment_status='.$response['status']; + + if (Tools::getIsset('card_token_id')) { + // get credit card last 4 digits + $four_digits = '**** **** **** '.$response['card']['last_four_digits']; + + $cardholderName = $response['card']['cardholder']['name']; + + $order_payments[0]->card_number = $four_digits; + $order_payments[0]->card_brand = Tools::ucfirst($response['payment_method_id']); + $order_payments[0]->card_holder = $cardholderName; + + $uri .= '&card_token='.Tools::getValue('card_token_id').'&card_holder_name='.$cardholderName. + '&four_digits='.$four_digits.'&payment_method_id='.$response['payment_method_id']. + '&payment_type='.$response['payment_type_id'].'&installments='.$response['installments']. + '&statement_descriptor='.$response['statement_descriptor'].'&status_detail='. + $response['status_detail'].'&amount='.$response['transaction_details']['total_paid_amount']; + } else { + $uri .= '&payment_method_id='.$response['payment_method_id'].'&payment_type='. + $response['payment_type_id'].'&boleto_url='. + urlencode($response['transaction_details']['external_resource_url']); + } + $order_payments[0]->save(); + Tools::redirectLink($uri); + } else { + $this->context->controller->addCss( + (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__. + 'modules/mercadopago/views/css/mercadopago_core.css', + 'all' + ); + + $data = array( + 'version' => $mercadopago->getPrestashopVersion(), + 'one_step' => Configuration::get('PS_ORDER_PROCESS_TYPE'), + ); + $data['expiration_date'] = ''; + if (array_key_exists('message', $response) && (strpos($response['message'], 'Invalid users involved') !== + false || (strpos($response['message'], 'users from different countries') !== false))) { + $data['valid_user'] = false; + } else { + $data['version'] = $mercadopago->getPrestashopVersion(); + + $data['status_detail'] = $response['status_detail']; + $data['card_holder_name'] = Tools::getValue('cardholderName'); + $data['four_digits'] = Tools::getValue('lastFourDigits'); + $data['payment_method_id'] = Tools::getValue('payment_method_id'); + $data['installments'] = $response['installments']; + $data['amount'] = Tools::displayPrice( + $response['transaction_details']['total_paid_amount'], + new Currency(Context::getContext()->cart->id_currency), + false + ); + $data['payment_id'] = $response['id']; + $data['one_step'] = Configuration::get('PS_ORDER_PROCESS_TYPE'); + $data['valid_user'] = true; + $data['message'] = isset($response['message']) ? $response['message'] : ''; + } + $this->context->smarty->assign($data); + $this->setTemplate('error.tpl'); + } + } +} diff --git a/v1.6.x/mercadopago/controllers/front/discount.php b/v1.6.x/mercadopago/controllers/front/discount.php new file mode 100644 index 0000000..507942f --- /dev/null +++ b/v1.6.x/mercadopago/controllers/front/discount.php @@ -0,0 +1,64 @@ +displayAjax(); + } + + public function displayAjax() + { + if (isset($_REQUEST['acao'])) { + $cart = Context::getContext()->cart; + $response = array( + 'status' => 200, + 'valor' => $cart->getOrderTotal(true, Cart::BOTH) + ); + } else { + if (isset($_REQUEST['coupon_id']) && $_REQUEST['coupon_id'] != '') { + $coupon_id = $_REQUEST['coupon_id']; + $mercadopago = $this->module; + $response = $mercadopago->validCoupon($coupon_id); + } else { + $response = array( + 'status' => 400, + 'response' => array( + 'error' => 'invalid_id', + 'message' => 'invalid id' + ) + ); + } + } + header('Content-Type: application/json'); + echo Tools::jsonEncode($response); + exit(); + } +} diff --git a/v1.6.x/mercadopago/controllers/front/index.php b/v1.6.x/mercadopago/controllers/front/index.php old mode 100755 new mode 100644 index 0f370e2..880b636 --- a/v1.6.x/mercadopago/controllers/front/index.php +++ b/v1.6.x/mercadopago/controllers/front/index.php @@ -1,35 +1,35 @@ - -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; \ No newline at end of file + + * @copyright 2007-2014 PrestaShop SA + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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(); diff --git a/v1.6.x/mercadopago/controllers/front/notification.php b/v1.6.x/mercadopago/controllers/front/notification.php new file mode 100644 index 0000000..042bcea --- /dev/null +++ b/v1.6.x/mercadopago/controllers/front/notification.php @@ -0,0 +1,77 @@ +displayAjax(); + } + + public function displayAjax() + { + + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + UtilMercadoPago::logMensagem( + 'Debug Mode :: displayAjax - topic = ' . Tools::getValue('topic'), + MPApi::INFO + ); + UtilMercadoPago::logMensagem( + 'Debug Mode :: displayAjax - id = ' . Tools::getValue('id'), + MPApi::INFO + ); + UtilMercadoPago::logMensagem( + 'Debug Mode :: displayAjax - checkout = ' . Tools::getValue('checkout'), + MPApi::INFO + ); + } + + if (Tools::getValue('checkout') && Tools::getValue('data_id') || Tools::getValue('id')) { + $mercadopago = $this->module; + if (Tools::getValue('checkout') == "custom") { + $mercadopago->listenIPN( + Tools::getValue('checkout'), + Tools::getValue('type'), + Tools::getValue('data_id') + ); + } else { + error_log("retorno ipn === ".Tools::getValue('checkout')); + error_log("retorno ipn === ".Tools::getValue('id')); + error_log(print_r($_GET, true)); + $mercadopago->listenIPN( + Tools::getValue('checkout'), + Tools::getValue('topic'), + Tools::getValue('id') + ); + } + } + } +} diff --git a/v1.6.x/mercadopago/controllers/front/paymentpos.php b/v1.6.x/mercadopago/controllers/front/paymentpos.php new file mode 100644 index 0000000..1a505b0 --- /dev/null +++ b/v1.6.x/mercadopago/controllers/front/paymentpos.php @@ -0,0 +1,237 @@ +paymentPOS(); + } + + public static function createMP() + { + return new MPApi( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); + } + + public function paymentPOS() + { + $id_order = Tools::getValue("id_order"); + $order = new Order($id_order); + $poi = (int)Tools::getValue("id_point"); + $typePOS = $this->getTypePOS($poi); + $action = Tools::getValue("action"); + $response = null; + if ($action == "post") { + $response = $this->postTransactionPayment($order, $poi, $typePOS); + } else if ($action == "get") { + $response = $this->getTransactionPayment($id_order); + } else if ($action == "delete") { + $response = $this->deleteTransactionPayment($poi); + } + + header('Content-Type: application/json'); + echo Tools::jsonEncode($response); + exit; + } + + private function getPOIAndTypePOS($poi) { + $json = $this->getJSONPOS(); + $return = null; + foreach ($json['points'] as $field) { + if ($field['poi'] == $poi) { + $return = array('poi' => $field['poi'], 'poi_type' => $field['poi_type']); + return $return; + } + } + } + + private function getTypePOS($poi) { + $json = $this->getJSONPOS(); + + foreach ($json['points'] as $field) { + if ($field['poi'] == $poi) { + return $field['model']; + } + } + } + + public function getJSONPOS() { + if ($str = file_get_contents(dirname(__FILE__) . '/../../pos.json')) { + return Tools::jsonDecode($str, true); + } + return null; + } + + private function deleteTransactionPayment($poi) { + error_log("===deleteTransactionPayment===="); + if ($poi_and_type = $this->getPOIAndTypePOS($poi)) { + error_log("===result poi_and_type====". Tools::jsonEncode($poi_and_type)); + $data = array( + 'poi' => $poi_and_type['poi'], + 'poi_type' => $poi_and_type['poi_type'] + ); + $this->mercadopago = MercadoPagoPaymentPOSModuleFrontController::createMP(); + $result = $this->mercadopago->deletePaymentPoint($data); + + error_log("===result data point====". Tools::jsonEncode($result)); + if ($result['status'] == '200') { + $response = array( + 'status' => '200', + 'message' => "The transaction was cancelled." + ); + return $response; + } + } + $response = array( + 'status' => '404', + 'message' => "There isn't transaction for that device." + ); + + return $response; + } + + + + private function getTransactionPayment($id_order) { + $exist_transaction = false; + $id_transaction = $this->getIdTransactionPOS($id_order); + if ($id_transaction) { + + $this->mercadopago = MercadoPagoPaymentPOSModuleFrontController::createMP(); + + $result = $this->mercadopago->getPaymentPoint($id_transaction); + error_log("====result getPaymentPoint====". Tools::jsonEncode($result)); + if ($result['status'] == '200' && $result['response']['status'] != 'cancelled') { + $response = array( + 'status' => '200', + 'message' => "There is a pending transaction for that device." + ); + $exist_transaction = true; + } + } + + if (! $exist_transaction) { + $response = array( + 'status' => '404', + 'message' => "There isn't transaction for that device." + ); + } + + return $response; + } + + + + private function postTransactionPayment($order, $poi, $typePOS) { + + if ($typePOS == "H") { + + } else if($typePOS == "I") { + return $this->postD200($order, $poi); + } + return null; + } + + + private function postD200($order, $poi) { + $data = array( + 'transaction_amount' => (double) number_format($order->total_paid, 2, '.', ''), + 'payment_type' => 'credit_card', + 'external_reference' => $order->id_cart, + 'poi' => $poi, + "installments" => 1, + 'poi_type' => 'ABECS_PAX_D200_GPRS' + ); + + // populate all payments accoring to country + $this->mercadopago = MercadoPagoPaymentPOSModuleFrontController::createMP(); + + error_log("===data point====". Tools::jsonEncode($data)); + $result = $this->mercadopago->sendPaymentPoint($data); + error_log("===result data point====". Tools::jsonEncode($result)); + + $response = array( + 'status' => $result['status'], + 'message' => $this->getMessageAndSave($result, $order->id) + ); + + return $response; + } + + protected function getMessageAndSave($result, $id_order) { + $message = ""; + switch ($result['status']) { + case 201: + $message = 'Payment created successfully, waiting payment.'; + $this->saveTransactionPOS($id_order, $result['response']['id']); + break; + case 400: + $message = 'There is another payment attempt pending for that device.'; + break; + case 403: + $message = 'Invalid access_token, please use a production Access token.'; + break; + default: + $message = ""; + break; + } + return $message; + } + + private function getIdTransactionPOS($id_order) + { + + $sql = 'SELECT MAX(`id_transaction`) AS `id_transaction` + FROM `'._DB_PREFIX_.'mercadopago_point_order` + WHERE `id_order` = '.(int) $id_order; + + $result = Db::getInstance()->getRow($sql); + return isset($result['id_transaction']) ? $result['id_transaction'] : false; + } + + private function saveTransactionPOS($id_order, $id_transaction) + { + $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'mercadopago_point_order` (`id_transaction`, `id_order`) + VALUES (\'' . pSQL($id_transaction) . '\', \'' . (int) $id_order . '\')'; + + if (! Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute($sql)) { + die(Tools::displayError('Error when save the id_transaction in database')); + } + } + + protected function redirectOrderDetail($orderId) + { + $getAdminLink = $this->context->link->getAdminLink('AdminOrders'); + $getViewOrder = $getAdminLink.'&vieworder&id_order='.$orderId; + Tools::redirectAdmin($getViewOrder); + } +} diff --git a/v1.6.x/mercadopago/controllers/front/standard.php b/v1.6.x/mercadopago/controllers/front/standard.php deleted file mode 100755 index d85ba29..0000000 --- a/v1.6.x/mercadopago/controllers/front/standard.php +++ /dev/null @@ -1,347 +0,0 @@ -context->cart; - if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { - Tools::redirect('index.php?controller=order&step=1'); - } - - // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process - $authorized = false; - foreach (Module::getPaymentModules() as $module) { - if ($module['name'] == 'mercadopago') { - $authorized = true; - break; - } - } - - if (!$authorized) { - die($this->module->l('This payment method is not available.', 'standard')); - } - - $cart = $this->context->cart; - $messageLog = - 'MercadoPago - start payment process, method : '. $this->paymentMethod . - ' by customer id : ' . $cart->id_customer; - PrestaShopLogger::addLog($messageLog, 1, null, 'Cart', $cart->id, true); - - PrestaShopLogger::addLog('MercadoPago - get post parameters', 1, null, 'Cart', $cart->id, true); - $postParameters = $this->getPreferencesStandard(); - - $messageLog = 'MercadoPago - post parameters : ' . print_r($postParameters, true); - PrestaShopLogger::addLog($messageLog, 1, null, 'Cart', $cart->id, true); - - PrestaShopLogger::addLog('MercadoPago - request sid', 1, null, 'Cart', $cart->id, true); - - error_log("=======postParameters=====".Tools::jsonEncode($postParameters)); - - try { - $result = MPApi::getInstanceMP()->createPreference($postParameters); - error_log("=====RESULT====".Tools::jsonEncode($result)); - if (array_key_exists('init_point', $result['response'])) { - $data['preferences_url'] = $result['response']['init_point']; - } else { - $data['preferences_url'] = null; - PrestaShopLogger::addLog( - 'MercadoPago::postProcess - An error occurred during preferences creation.'. - 'Please check your credentials and try again.: ', - MPApi::ERROR, - 0 - ); - } - } catch (Exception $e) { - PrestaShopLogger::addLog('Mercado Pago - prefence not created', 3, null, 'Cart', $cart->id, true); - $this->redirectError('ERROR_GENERAL_REDIRECT'); - } - - Tools::redirect($result['response']['init_point']); - - } - - public function createStandardCheckoutPreference() - { - $preferences = $this->getPrestashopPreferencesStandard(null); - if (Configuration::get('MERCADOPAGO_LOG') == 'true') { - PrestaShopLogger::addLog("=====preferences=====".Tools::jsonEncode($preferences), MPApi::INFO, 0); - } - return $this->mercadopago->createPreference($preferences); - } - - private function getPreferencesStandard() - { - $customer_fields = Context::getContext()->customer->getFields(); - $cart = Context::getContext()->cart; - - $mercadopagoSettings = $this->getMercadoPagoSettings(); - - // Get costumer data - $address_invoice = new Address((integer) $cart->id_address_invoice); - $phone = $address_invoice->phone; - $phone .= $phone == '' ? '' : '|'; - $phone .= $address_invoice->phone_mobile; - $customer_data = array( - 'first_name' => $customer_fields['firstname'], - 'last_name' => $customer_fields['lastname'], - 'email' => $customer_fields['email'], - 'phone' => array( - 'area_code' => '-', - 'number' => $phone, - ), - 'address' => array( - 'zip_code' => $address_invoice->postcode, - 'street_name' => $address_invoice->address1.' - '.$address_invoice->address2.' - '. - $address_invoice->city.'/'.$address_invoice->country, - 'street_number' => '-', - ), - // just have this data when using credit card - 'identification' => array( - 'number' => '', - 'type' => '', - ), - ); - - // items - $products = $cart->getProducts(); - $items = array(); - $summary = ''; - $round_place = 2; - - if ($mercadopagoSettings['country'] == 'MCO') { - $round_place = 0; - } - - foreach ($products as $key => $product) { - $image = Image::getCover($product['id_product']); - $product_image = new Product($product['id_product'], false, Context::getContext()->language->id); - $link = new Link();//because getImageLInk is not static function - $imagePath = $link->getImageLink( - $product_image->link_rewrite, - $image['id_image'], - "" - ); - - $item = array( - 'id' => $product['id_product'], - 'title' => $product['name'], - 'description' => $product['description_short'], - 'quantity' => $product['quantity'], - 'unit_price' => round($product['price_wt'], $round_place), - 'picture_url' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$imagePath, - 'category_id' => $mercadopagoSettings['category_id'], - ); - if ($key == 0) { - $summary .= $product['name']; - } else { - $summary .= ', '.$product['name']; - } - $items[] = $item; - } - // include wrapping cost - $wrapping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_WRAPPING); - if ($wrapping_cost > 0) { - $item = array( - 'title' => 'Wrapping', - 'description' => 'Wrapping service used by store', - 'quantity' => 1, - 'unit_price' => $wrapping_cost, - 'category_id' => $mercadopagoSettings['category_id'], - 'currency_id' => $cart->id_currency, - ); - $items[] = $item; - } - // include discounts - $discounts = (double) $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); - if ($discounts > 0) { - $item = array( - 'title' => 'Discount', - 'description' => 'Discount provided by store', - 'quantity' => 1, - 'unit_price' => -$discounts, - 'category_id' => $mercadopagoSettings['category_id'], - ); - $items[] = $item; - } - - $shipments = array(); - // include shipping cost - $shipping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_SHIPPING); - if ($shipping_cost > 0) { - $item = array( - 'title' => 'Shipping', - 'description' => 'Shipping service used by store', - 'quantity' => 1, - 'unit_price' => $shipping_cost, - 'category_id' => $mercadopagoSettings['category_id'], - ); - $items[] = $item; - } - - $data = array( - 'external_reference' => $cart->id, - 'customer' => $customer_data, - 'items' => $items, - 'shipments' => $shipments, - ); - if (!MPApi::getInstanceMP()->isTestUser()) { - switch ($mercadopagoSettings['country']) { - case 'MLB': - $data['sponsor_id'] = 178326379; - break; - case 'MLM': - $data['sponsor_id'] = 187899553; - break; - case 'MLA': - $data['sponsor_id'] = 187899872; - break; - case 'MCO': - $data['sponsor_id'] = 187900060; - break; - case 'MLV': - $data['sponsor_id'] = 187900246; - break; - case 'MLC': - $data['sponsor_id'] = 187900485; - break; - case 'MPE': - $data['sponsor_id'] = 217182014; - break; - case 'MLU': - $data['sponsor_id'] = 241730009; - break; - } - } - $data['auto_return'] = $mercadopagoSettings['auto_return'] == 'approved' ? 'approved' : ''; - $data['back_urls']['success'] = $this->getURLReturn($cart->id, $mercadopagoSettings, 'success'); - $data['back_urls']['failure'] = $this->getURLReturn($cart->id, $mercadopagoSettings, 'failure'); - $data['back_urls']['pending'] = $this->getURLReturn($cart->id, $mercadopagoSettings, 'pending'); - $data['payment_methods']['excluded_payment_methods'] = $this->getExcludedPaymentMethods(); - $data['payment_methods']['excluded_payment_types'] = array(); - $data['payment_methods']['installments'] = (integer) $mercadopagoSettings['installments']; - $data['notification_url'] = $this->context->link->getModuleLink( - 'mercadopago', - 'standardreturn', - array(), - $mercadopagoSettings['ssl_enabled'], - null, - null, - false - ).'?checkout=standard&cart_id='.$cart->id; - // swap to payer index since customer is only for transparent - $data['customer']['name'] = $data['customer']['first_name']; - $data['customer']['surname'] = $data['customer']['last_name']; - $data['payer'] = $data['customer']; - unset($data['customer']); - - return $data; - } - - private function getURLReturn($cart_id, $mercadopagoSettings, $typeReturn) - { - - error_log("=====URL DE RETORNO=====".$this->context->link->getModuleLink( - 'mercadopago', - 'validationstandard', - array(), - $mercadopagoSettings['ssl_enabled'], - Configuration::get('PS_SSL_ENABLED'), - null, - null, - false - ).'?checkout=standard&cart_id='.$cart_id.'&typeReturn='.$typeReturn); - - return $this->context->link->getModuleLink( - 'mercadopago', - 'validationstandard', - array(), - $mercadopagoSettings['ssl_enabled'], - Configuration::get('PS_SSL_ENABLED'), - null, - null, - false - ).'?checkout=standard&cart_id='.$cart_id.'&typeReturn='.$typeReturn; - } - - private function redirectError($returnMessage) - { - $this->errors[] = $this->module->getLocaleErrorMapping($returnMessage); - $this->redirectWithNotifications($this->context->link->getPageLink('order', true, null, array( - 'step' => '3'))); - } - - private function getMercadoPagoSettings() - { - $mercadoPagoSettings = array(); - $mercadoPagoSettings['client_id'] = Configuration::get('MERCADOPAGO_CLIENT_ID'); - $mercadoPagoSettings['client_secret'] = Configuration::get('MERCADOPAGO_CLIENT_SECRET'); - $mercadoPagoSettings['standardActive'] = Configuration::get('MERCADOPAGO_STARDAND_ACTIVE'); - $mercadoPagoSettings['country'] = Configuration::get('MERCADOPAGO_COUNTRY'); - $mercadoPagoSettings['auto_return'] = true; - $mercadoPagoSettings['category_id'] = Configuration::get('MERCADOPAGO_CATEGORY'); - $mercadoPagoSettings['ssl_enabled'] = Configuration::get('PS_SSL_ENABLED'); - $mercadoPagoSettings['installments'] = Configuration::get('MERCADOPAGO_INSTALLMENTS'); - - - error_log("====PS_SSL_ENABLED======".Configuration::get('PS_SSL_ENABLED')); - - - return $mercadoPagoSettings; - } - - private function getExcludedPaymentMethods() - { - $payment_methods = MPApi::getInstanceMP()->getPaymentMethods(); - $excluded_payment_methods = array(); - - foreach ($payment_methods as $payment_method) { - $pm_variable_name = 'MERCADOPAGO_'.$payment_method['id'].'_ACTIVE'; - - $value = Configuration::get($pm_variable_name); - - error_log("=====value payment ===" . $value); - if ($value == '0') { - $excluded_payment_methods[] = array( - 'id' => $payment_method['id'], - ); - } - } - return $excluded_payment_methods; - } - -} diff --git a/v1.6.x/mercadopago/controllers/front/standardreturn.php b/v1.6.x/mercadopago/controllers/front/standardreturn.php index aceb514..bb3bd68 100644 --- a/v1.6.x/mercadopago/controllers/front/standardreturn.php +++ b/v1.6.x/mercadopago/controllers/front/standardreturn.php @@ -1,5 +1,4 @@ listenIPN( - $checkout, - $topic, - Tools::getValue('id') - ); - } - } - - public function listenIPN($checkout, $topic, $id) + public function initContent() { - $mercadopago_sdk = MPApi::getInstanceMP(); - $mercadopago = $this->module; - $payment_method_ids = array(); - $payment_ids = array(); - $payment_statuses = array(); - $payment_types = array(); - $credit_cards = array(); - $transaction_amounts = 0; - $cardholders = array(); - $external_reference = ''; - $cost_mercadoEnvios = 0; - $isMercadoEnvios = 0; - - $result = $mercadopago_sdk->getMerchantOrder($id); - $merchant_order_info = $result['response']; - if (isset($merchant_order_info['status']) && $merchant_order_info['status'] == 404) { - error_log("==return==merchant_order_info===". Tools::jsonEncode($merchant_order_info )); - return; - } - error_log("====merchant_order_info===". Tools::jsonEncode($merchant_order_info )); - // check value - $cart = new Cart($merchant_order_info['external_reference']); - if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { - $total = floor($cart->getOrderTotal(true, Cart::BOTH)); - - error_log("vai formatar total ". floor($cart->getOrderTotal(true, Cart::BOTH))); - } else { - $total = (float)$cart->getOrderTotal(true, Cart::BOTH); - } - - // check the module - $id_order = $mercadopago->getOrderByCartId($merchant_order_info['external_reference']); - $order = new Order($id_order); - $total_amount = $merchant_order_info['total_amount']; - - error_log("entrou no retorno total=". $total); - error_log("entrou no retorno total_amount=".$total_amount); + parent::initContent(); + if (Tools::getIsset('collection_id') && Tools::getValue('collection_id') != 'null') { + // payment variables + $payment_statuses = array(); + $payment_ids = array(); + $payment_types = array(); + $payment_method_ids = array(); + $card_holder_names = array(); + $four_digits_arr = array(); + $statement_descriptors = array(); + $status_details = array(); + $transaction_amounts = 0; + $collection_ids = explode(',', Tools::getValue('collection_id')); + + $merchant_order_id = Tools::getValue('merchant_order_id'); + + $mercadopago = $this->module; + $mercadopago_sdk = $mercadopago->mercadopago; + + foreach ($collection_ids as $collection_id) { + $result = $mercadopago_sdk->getPaymentStandard($collection_id); + + $payment_info = $result['response']['collection']; + $id_cart = $payment_info['external_reference']; + $cart = new Cart($id_cart); + $payment_statuses[] = $payment_info['status']; + $payment_ids[] = $payment_info['id']; + $payment_types[] = $payment_info['payment_type']; + + if (isset($payment_info['payment_method_id'])) { + $payment_method_ids[] = $payment_info['payment_method_id']; + } - if ($total_amount != $total) { - PrestaShopLogger::addLog('MercadoPago :: listenIPN - Não atualizou o pedido, valores diferentes'. - ' id = '.$id, MPApi::INFO, 0); + $transaction_amounts += $payment_info['transaction_amount']; - error_log("entrou no retorno="); - error_log("entrou no retorno="); - return; - } - $status_shipment = null; - if (isset($merchant_order_info['shipments'][0]) && - $merchant_order_info['shipments'][0]['shipping_mode'] == 'me2') { - $isMercadoEnvios = true; - $cost_mercadoEnvios = $merchant_order_info['shipments'][0]['shipping_option']['cost']; + if (isset($payment_info['payment_type']) && $payment_info['payment_type'] == 'credit_card') { + $card_holder_names[] = isset($payment_info['card']['cardholder']['name']) + ? $payment_info['card']['cardholder']['name'] : ''; + if (isset($payment_info['card']['last_four_digits'])) { + $four_digits_arr[] = '**** **** **** '.$payment_info['card']['last_four_digits']; + } + $statement_descriptors[] = $payment_info['statement_descriptor']; + $status_details[] = $payment_info['status_detail']; + } + } - $status_shipment = $merchant_order_info['shipments'][0]['status']; + if (Validate::isLoadedObject($cart)) { + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { + $total = (double) ceil($transaction_amounts); + $total_ordem = ceil($cart->getOrderTotal(true, Cart::BOTH)); + } else { + $total = (double) number_format($transaction_amounts, 2, '.', ''); + $total_ordem = $cart->getOrderTotal(true, Cart::BOTH); + } - $id_order = $mercadopago->getOrderByCartId($merchant_order_info['external_reference']); - $order = new Order($id_order); - $order_status = null; - switch ($status_shipment) { - case 'ready_to_ship': - $order_status = 'MERCADOPAGO_STATUS_8'; - break; - case 'shipped': - $order_status = 'MERCADOPAGO_STATUS_9'; - break; - case 'delivered': - $order_status = 'MERCADOPAGO_STATUS_10'; - break; - } - if ($order_status != null) { - $existStates = $this->checkStateExist($id_order, Configuration::get($order_status)); - if ($existStates) { - return; + $extra_vars = array( + '{bankwire_owner}' => $mercadopago->textshowemail, + '{bankwire_details}' => '', + '{bankwire_address}' => '', + ); + $order_status = null; + $payment_status = $payment_info['status']; + switch ($payment_status) { + case 'in_process': + $order_status = 'MERCADOPAGO_STATUS_0'; + break; + case 'approved': + $order_status = 'MERCADOPAGO_STATUS_1'; + break; + case 'pending': + $order_status = 'MERCADOPAGO_STATUS_7'; + break; } - $this->updateOrderHistory($order->id, Configuration::get($order_status)); - } - return; - } - $payments = $merchant_order_info['payments']; - $external_reference = $merchant_order_info['external_reference']; - foreach ($payments as $payment) { - // get payment info - $result = $mercadopago_sdk->getPaymentStandard($payment['id']); - $payment_info = $result['response']['collection']; - // colect payment details - $payment_ids[] = $payment_info['id']; - $payment_statuses[] = $payment_info['status']; - $payment_types[] = $payment_info['payment_type']; - $transaction_amounts += $payment_info['transaction_amount']; - if ($payment_info['payment_type'] == 'credit_card') { - $payment_method_ids[] = isset($payment_info['payment_method_id']) ? - $payment_info['payment_method_id'] : ''; - $credit_cards[] = isset($payment_info['card']['last_four_digits']) ? - '**** **** **** '.$payment_info['card']['last_four_digits'] : ''; - $cardholders[] = isset($payment_info['card']['cardholder']['name']) ? - $payment_info['card']['cardholder']['name'] : ''; - } - } + $order_id = $mercadopago->getOrderByCartId($cart->id); - if ($merchant_order_info['total_amount'] == $transaction_amounts) { - if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { - $transaction_amounts = $cart->getOrderTotal(true, Cart::BOTH); - } - $this->updateOrder( - $payment_ids, - $payment_statuses, - $payment_method_ids, - $payment_types, - $credit_cards, - $cardholders, - $transaction_amounts, - $external_reference, - $result - ); - } - } + if ($order_status != null) { + $result_merchant = $mercadopago_sdk->getMerchantOrder($merchant_order_id); + $merchant_order_info = $result_merchant['response']; - private function updateOrder( - $payment_ids, - $payment_statuses, - $payment_method_ids, - $payment_types, - $credit_cards, - $cardholders, - $transaction_amounts, - $external_reference, - $result - ) { - $order = null; - $mercadopago = $this->module; - // if has two creditcard validate whether payment has same status in order to continue validating order - if (count($payment_statuses) == 1 || - (count($payment_statuses) == 2 && $payment_statuses[0] == $payment_statuses[1])) { - $order = null; - $order_status = null; - $payment_status = $payment_statuses[0]; - $payment_type = $payment_types[0]; + if (isset($merchant_order_info['shipments'][0]) && + $merchant_order_info['shipments'][0]['shipping_mode'] == 'me2') { + $cost_mercadoEnvios = $merchant_order_info['shipments'][0]['shipping_option']['cost']; - switch ($payment_status) { - case 'in_process': - $order_status = 'MERCADOPAGO_STATUS_0'; - break; - case 'approved': - $order_status = 'MERCADOPAGO_STATUS_1'; - break; - case 'cancelled': - $order_status = 'MERCADOPAGO_STATUS_2'; - break; - case 'refunded': - $order_status = 'MERCADOPAGO_STATUS_4'; - break; - case 'charged_back': - $order_status = 'MERCADOPAGO_STATUS_5'; - break; - case 'in_mediation': - $order_status = 'MERCADOPAGO_STATUS_6'; - break; - case 'pending': - $order_status = 'MERCADOPAGO_STATUS_7'; - break; - case 'rejected': - $order_status = 'MERCADOPAGO_STATUS_3'; - break; - case 'ready_to_ship': - $order_status = 'MERCADOPAGO_STATUS_8'; - break; - case 'shipped': - $order_status = 'MERCADOPAGO_STATUS_9'; - break; - case 'delivered': - $order_status = 'MERCADOPAGO_STATUS_10'; - break; - } - // just change if there is an order status - if ($order_status) { - $id_cart = $external_reference; - $id_order = $mercadopago->getOrderByCartId($id_cart); - if ($id_order) { - $order = new Order($id_order); + $total += $cost_mercadoEnvios; + } - $existStates = $this->checkStateExist( - $id_order, - Configuration::get($order_status) - ); - if ($existStates) { + if ($total != $total_ordem) { + PrestaShopLogger::addLog('Não atualizou o pedido, valores diferentes'. + ' merchant_order_id = '.$merchant_order_id, MPApi::INFO, 0); return; } - } - // If order wasn't created yet and payment is approved or pending or in_process, create it. - // This can happen when user closes checkout standard - if (empty($id_order) && ($payment_status == 'in_process' || $payment_status == 'approved' || - $payment_status == 'pending') - ) { - $cart = new Cart($id_cart); - $total = (double) number_format($transaction_amounts, 2, '.', ''); - $extra_vars = array( - '{bankwire_owner}' => $this->l('You must follow MercadoPago rules for purchase to be valid'), - '{bankwire_details}' => '', - '{bankwire_address}' => '', - ); - $id_order = !$id_order ? $mercadopago->getOrderByCartId($id_cart) : $id_order; - $order = new Order($id_order); - $existStates = $this->checkStateExist($id_order, Configuration::get($order_status)); - if ($existStates) { - return; + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { + $total = $cart->getOrderTotal(true, Cart::BOTH); } - $displayName = UtilMercadoPago::setNamePaymentType($payment_type); + if (!$order_id) { + $displayName = UtilMercadoPago::setNamePaymentType($payment_types[0]); + $mercadopago->validateOrder( + $cart->id, + Configuration::get($order_status), + $total, + $displayName, + null, + $extra_vars, + $cart->id_currency, + false, + $cart->secure_key + ); + } + + $order_id = !$mercadopago->currentOrder ? + Order::getOrderByCartId($cart->id) : $mercadopago->currentOrder; + $order = new Order($order_id); + + $uri = __PS_BASE_URI__.'order-confirmation.php?id_cart='.$order->id_cart.'&id_module='. + $mercadopago->id.'&id_order='.$order->id.'&key='.$order->secure_key; + $order_payments = $order->getOrderPayments(); - $this->module->validateOrder( - $id_cart, - Configuration::get($order_status), - $total, - $displayName, - null, - $extra_vars, - $cart->id_currency, - false, - $cart->secure_key - ); - } elseif (!empty($order) && $order->current_state != null && - $order->current_state != Configuration::get($order_status)) { - $id_order = !$id_order ? $mercadopago->getOrderByCartId($id_cart) : $id_order; - $order = new Order($id_order); - /* - * this is necessary to ignore the transactions with the same - * external reference and states diferents - * the transaction approved cant to change the status, except refunded. - */ - if ($payment_status == 'cancelled' || $payment_status == 'rejected') { - // check if is mercadopago - if ($order->module == "mercadopago") { - $retorno = $this->getOrderStateApproved($id_order); - if ($retorno) { - return; - } - } else { - return; - } + if ($order_payments == null || $order_payments[0] == null) { + $order_payments[0] = new stdClass(); } - $this->updateOrderHistory($order->id, Configuration::get($order_status)); - // Cancel the order to force products to go to stock. - switch ($payment_status) { - case 'cancelled': - case 'refunded': - case 'rejected': - $this->updateOrderHistory($id_order, Configuration::get('PS_OS_CANCELED'), false); - break; + $order_payments[0]->transaction_id = Tools::getValue('collection_id'); + $uri .= '&payment_status='.$payment_statuses[0]; + $uri .= '&payment_id='.implode(' / ', $payment_ids); + $uri .= '&payment_type='.implode(' / ', $payment_types); + $uri .= '&payment_method_id='.implode(' / ', $payment_method_ids); + $uri .= '&amount='.$total; + if ($payment_info['payment_type'] == 'credit_card') { + $uri .= '&card_holder_name='.implode(' / ', $card_holder_names); + $uri .= '&four_digits='.implode(' / ', $four_digits_arr); + $uri .= '&statement_descriptor='.$statement_descriptors[0]; + $uri .= '&status_detail='.$status_details[0]; + $order_payments[0]->card_number = empty($four_digits_arr) ? '' : + implode(' / ', $four_digits_arr); + $order_payments[0]->card_brand = empty($payment_method_ids) ? '' : + implode(' / ', $payment_method_ids); + $order_payments[0]->card_holder = implode(' / ', $card_holder_names); } - } - if ($order) { - // update order payment information + $order_payments[0]->save(); $order_payments = $order->getOrderPayments(); - foreach ($order_payments as $order_payment) { - $order_payment->transaction_id = implode(' / ', $payment_ids); - if ($payment_type == 'credit_card') { - $order_payment->card_number = implode(' / ', $credit_cards); - $order_payment->card_brand = implode(' / ', $payment_method_ids); - $order_payment->card_holder = implode(' / ', $cardholders); - } - $order_payment->save(); - } + Tools::redirectLink($uri); } } + } else { + UtilMercadoPago::logMensagem( + 'MercadoPagoStandardReturnModuleFrontController::initContent = '. + 'External reference is not set. Order placement has failed.', + MPApi::ERROR + ); } } - - public function updateOrderHistory($id_order, $status, $mail = true) - { - // Change order state and send email - $history = new OrderHistory(); - $history->id_order = (integer) $id_order; - $history->changeIdOrderState((integer) $status, (integer) $id_order, true); - if ($mail) { - $extra_vars = array(); - $history->addWithemail(true, $extra_vars); - } - } - - /** - * Verify if there is state approved for order. - */ - public static function checkStateExist($id_order, $id_order_state) - { - return (bool) Db::getInstance()->getValue( - ' - SELECT `id_order_state` - FROM '._DB_PREFIX_.'order_history - WHERE `id_order` = '.(int) $id_order.' - AND `id_order_state` = '. - (int) $id_order_state - ); - } } diff --git a/v1.6.x/mercadopago/controllers/front/validationstandard.php b/v1.6.x/mercadopago/controllers/front/validationstandard.php deleted file mode 100644 index 5557bc8..0000000 --- a/v1.6.x/mercadopago/controllers/front/validationstandard.php +++ /dev/null @@ -1,191 +0,0 @@ -redirectError(); - } - if (Tools::getIsset('collection_id') && Tools::getValue('collection_id') != 'null') { - error_log("entrou aqui 1 "); - // payment variables - $payment_statuses = array(); - $payment_ids = array(); - $payment_types = array(); - $payment_method_ids = array(); - $card_holder_names = array(); - $four_digits_arr = array(); - $statement_descriptors = array(); - $status_details = array(); - $transaction_amounts = 0; - $collection_ids = explode(',', Tools::getValue('collection_id')); - - $merchant_order_id = Tools::getValue('merchant_order_id'); - - $mercadopago = $this->module; - $mercadopago_sdk = MPApi::getInstanceMP(); - error_log("entrou aqui 2 "); - foreach ($collection_ids as $collection_id) { - $result = $mercadopago_sdk->getPaymentStandard($collection_id); - error_log("===result standard=====".Tools::jsonEncode($result)); - $payment_info = $result['response']['collection']; - $id_cart = $payment_info['external_reference']; - $cart = new Cart($id_cart); - $payment_statuses[] = $payment_info['status']; - $payment_ids[] = $payment_info['id']; - $payment_types[] = $payment_info['payment_type']; - - if (isset($payment_info['payment_method_id'])) { - $payment_method_ids[] = $payment_info['payment_method_id']; - } - - $transaction_amounts += $payment_info['transaction_amount']; - - if (isset($payment_info['payment_type']) && $payment_info['payment_type'] == 'credit_card') { - $card_holder_names[] = isset($payment_info['card']['cardholder']['name']) - ? $payment_info['card']['cardholder']['name'] : ''; - if (isset($payment_info['card']['last_four_digits'])) { - $four_digits_arr[] = '**** **** **** '.$payment_info['card']['last_four_digits']; - } - $statement_descriptors[] = $payment_info['statement_descriptor']; - $status_details[] = $payment_info['status_detail']; - } - } - - if (Validate::isLoadedObject($cart)) { - $total = (double) number_format($transaction_amounts, 2, '.', ''); - $extra_vars = array( - '{bankwire_owner}' => 'teste', - '{bankwire_details}' => '', - '{bankwire_address}' => '', - ); - $order_status = null; - $payment_status = $payment_info['status']; - switch ($payment_status) { - case 'in_process': - $order_status = 'MERCADOPAGO_STATUS_0'; - break; - case 'approved': - $order_status = 'MERCADOPAGO_STATUS_1'; - break; - case 'pending': - $order_status = 'MERCADOPAGO_STATUS_7'; - break; - } - - $order_id = $mercadopago->getOrderByCartId($cart->id); - - if ($order_status != null) { - $result_merchant = $mercadopago_sdk->getMerchantOrder($merchant_order_id); - $merchant_order_info = $result_merchant['response']; - - if (isset($merchant_order_info['shipments'][0]) && - $merchant_order_info['shipments'][0]['shipping_mode'] == 'me2') { - $cost_mercadoEnvios = $merchant_order_info['shipments'][0]['shipping_option']['cost']; - - $total += $cost_mercadoEnvios; - } - - if (!$order_id) { - $displayName = UtilMercadoPago::setNamePaymentType($payment_types[0]); - - $mercadopago->validateOrder( - $cart->id, - Configuration::get($order_status), - $total, - $displayName, - null, - $extra_vars, - $cart->id_currency, - false, - $cart->secure_key - ); - } - - $order_id = !$mercadopago->currentOrder ? - Order::getOrderByCartId($cart->id) : $mercadopago->currentOrder; - $order = new Order($order_id); - - $uri = __PS_BASE_URI__.'order-confirmation.php?id_cart='.$order->id_cart.'&id_module='. - $mercadopago->id.'&id_order='.$order->id.'&key='.$order->secure_key; - $order_payments = $order->getOrderPayments(); - - if ($order_payments == null || $order_payments[0] == null) { - $order_payments[0] = new stdClass(); - } - - $order_payments[0]->transaction_id = Tools::getValue('collection_id'); - $uri .= '&payment_status='.$payment_statuses[0]; - $uri .= '&payment_id='.implode(' / ', $payment_ids); - $uri .= '&payment_type='.implode(' / ', $payment_types); - $uri .= '&payment_method_id='.implode(' / ', $payment_method_ids); - $uri .= '&amount='.$total; - if ($payment_info['payment_type'] == 'credit_card') { - $uri .= '&card_holder_name='.implode(' / ', $card_holder_names); - $uri .= '&four_digits='.implode(' / ', $four_digits_arr); - $uri .= '&statement_descriptor='.$statement_descriptors[0]; - $uri .= '&status_detail='.$status_details[0]; - $order_payments[0]->card_number = empty($four_digits_arr) ? '' : - implode(' / ', $four_digits_arr); - $order_payments[0]->card_brand = empty($payment_method_ids) ? '' : - implode(' / ', $payment_method_ids); - $order_payments[0]->card_holder = implode(' / ', $card_holder_names); - } - $order_payments[0]->save(); - $order_payments = $order->getOrderPayments(); - - - error_log("====vai fazer o redirect====". $uri); - - Tools::redirectLink($uri); - } - } - } else { - UtilMercadoPago::logMensagem( - 'MercadoPagoStandardReturnModuleFrontController::initContent = '. - 'External reference is not set. Order placement has failed.', - MPApi::ERROR - ); - } - } - - protected function redirectError() - { - error_log("Entrou no redirectError ===== " . $this->context->link->getPageLink('order', true, null, array( - 'step' => '3'))); - $this->errors[] = $this->module->getMappingError("ERROR_PENDING"); - $this->redirectWithNotifications($this->context->link->getPageLink('order', true, null, array( - 'step' => '3'))); - } -} diff --git a/v1.6.x/mercadopago/controllers/index.php b/v1.6.x/mercadopago/controllers/index.php old mode 100755 new mode 100644 index 72b7262..f4531ce --- a/v1.6.x/mercadopago/controllers/index.php +++ b/v1.6.x/mercadopago/controllers/index.php @@ -1,35 +1,35 @@ - -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; \ No newline at end of file + +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; diff --git a/v1.6.x/mercadopago/includes/MPApi.php b/v1.6.x/mercadopago/includes/MPApi.php index e8ae528..f00fef4 100644 --- a/v1.6.x/mercadopago/includes/MPApi.php +++ b/v1.6.x/mercadopago/includes/MPApi.php @@ -31,7 +31,7 @@ class MPApi { - const VERSION = '3.4.1'; + const VERSION = '3.4.5'; /* Info */ const INFO = 1; @@ -59,37 +59,27 @@ public function __construct($client_id, $client_secret) $this->client_secret = $client_secret; } - public static function getInstanceMP() - { - static $mercadopago = null; - if (null === $mercadopago) { - $mercadopago = new MPApi( - Configuration::get('MERCADOPAGO_CLIENT_ID'), - Configuration::get('MERCADOPAGO_CLIENT_SECRET') - ); - } - - return $mercadopago; - } - /** * Get Access Token for API use */ public function getAccessToken() { - $app_client_values = $this->buildQuery( - array( - 'client_id' => $this->client_id, - 'client_secret' => $this->client_secret, - 'grant_type' => 'client_credentials' - ) - ); + if ($this->client_id != null) { + $app_client_values = $this->buildQuery( + array( + 'client_id' => $this->client_id, + 'client_secret' => $this->client_secret, + 'grant_type' => 'client_credentials' + ) + ); - $access_data = MPRestCli::post('/oauth/token', $app_client_values, 'application/x-www-form-urlencoded'); + $access_data = MPRestCli::post('/oauth/token', $app_client_values, 'application/x-www-form-urlencoded'); - $this->access_data = $access_data['response']; + $this->access_data = $access_data['response']; - return $this->access_data['access_token']; + return $this->access_data['access_token']; + } + return null; } /** @@ -134,9 +124,12 @@ public function isTestUser() public function getCountry() { $access_token = $this->getAccessToken(); - $result = MPRestCli::get('/users/me?access_token=' . $access_token); - - return $result['response']['site_id']; + if ($access_token != null) { + $result = MPRestCli::get('/users/me?access_token=' . $access_token); + return $result['response']['site_id']; + } else { + return null; + } } /* @@ -273,14 +266,14 @@ public function getPaymentMethods() { $result = MPRestCli::get('/sites/' . $this->getCountry() . '/payment_methods?marketplace=NONE'); $result = $result['response']; - - // remove account_money + if (isset($result['status']) && $result['status'] != "200") { + return null; + } foreach ($result as $key => $value) { if ($value['payment_type_id'] == 'account_money') { unset($result[$key]); } } - return $result; } @@ -291,8 +284,18 @@ public function getPaymentMethods() */ public function getOfflinePaymentMethods() { - $access_token = $this->getAccessTokenV1(); + //$access_token = $this->getAccessTokenV1(); + $access_token = $this->getAccessToken(); $result = MPRestCli::get('/v1/payment_methods?access_token=' . $access_token); + if ($result['status'] != "200") { + PrestaShopLogger::addLog( + 'MercadoPago::getContent - Fatal Error: '.Tools::jsonEncode($result), + MPApi::WARNING, + 0 + ); + return array(); + } + $result = $result['response']; // remove account_money @@ -428,11 +431,9 @@ public static function getCategories() public function getCheckConfigCard() { - $access_token = $this->getAccessTokenV1(); + $access_token = $this->getAccessToken(); $uri = "/settings?access_token=".$access_token; - error_log("======url======".$uri); - $result = MPRestCli::getConfig($uri); return $result; } @@ -443,14 +444,12 @@ public function getCheckConfigCard() */ public function setEnableDisableTwoCard($params) { - $access_token = $this->getAccessTokenV1(); - error_log("=====params two cards=====".$params); + $access_token = $this->getAccessToken(); $params = array( "two_cards" => $params ); $result = MPRestCli::putConfig("/settings?access_token=" . $access_token, $params); - error_log("=====result two cards=====".Tools::jsonEncode($result)); return $result; } @@ -458,11 +457,8 @@ public function getTestUser($siteID) { $access_token = $this->getAccessToken(); $uri = "/users/test_user?access_token=" . $access_token; - error_log("====uri=====".$uri); $result = MPRestCli::post($uri, $siteID); - error_log("=====getTestUser======".Tools::jsonEncode($result)); - return $result; } @@ -485,14 +481,48 @@ public function getDiscount($params) */ public function saveSettings($params) { - $access_token = $this->getAccessTokenV1(); - $uri = "/modules/tracking/saveSettings?access_token=" . $access_token; + $access_token = $this->getAccessToken(); + $uri = "/modules/tracking/settings?access_token=" . $access_token; $result_response = MPRestCli::post($uri, $params); return $result_response; } + /* + * Send payment for POINT + */ + public function sendPaymentPoint($data) + { + $access_token = $this->getAccessTokenV1(); + $uri = "/point/services/payment_attempt?access_token=" . $access_token; + $result_response = MPRestCli::post($uri, $data); + return $result_response; + } + + /* + * delete payment for POINT + */ + public function deletePaymentPoint($data) + { + $access_token = $this->getAccessTokenV1(); + $uri = "/point/services/payment_attempt/?access_token=" . $access_token; + $result = MPRestCli::delete($uri,$data); + return $result; + } + + /* + * Get payment for POINT + */ + public function getPaymentPoint($id_transaction) + { + $access_token = $this->getAccessTokenV1(); + $uri = "/point/services/payment_attempt/" . $id_transaction . "?access_token=" . $access_token; + $result = MPRestCli::get($uri); + return $result; + } + + private function buildQuery($params) { if (function_exists('http_build_query')) { diff --git a/v1.6.x/mercadopago/includes/MPRestCli.php b/v1.6.x/mercadopago/includes/MPRestCli.php index 8de3cf0..4998947 100644 --- a/v1.6.x/mercadopago/includes/MPRestCli.php +++ b/v1.6.x/mercadopago/includes/MPRestCli.php @@ -135,6 +135,7 @@ private static function exec($method, $uri, $data, $content_type, $uri_base) } $api_result = curl_exec($connect); + error_log("===saida exec====". Tools::jsonEncode($api_result)); $api_http_code = curl_getinfo($connect, CURLINFO_HTTP_CODE); $response = array( 'status' => $api_http_code, @@ -179,6 +180,11 @@ public static function post($uri, $data, $content_type = 'application/json') return self::exec('POST', $uri, $data, $content_type, self::API_BASE_URL); } + public static function delete($uri, $data, $content_type = 'application/json') + { + return self::exec('DELETE', $uri, $data, $content_type, self::API_BASE_URL); + } + public static function postTracking($uri, $data, $trackingID, $content_type = 'application/json') { return self::execTracking('POST', $uri, $data, $content_type, $trackingID); diff --git a/v1.6.x/mercadopago/includes/UtilMercadoPago.php b/v1.6.x/mercadopago/includes/UtilMercadoPago.php index 87b6316..b3c89af 100644 --- a/v1.6.x/mercadopago/includes/UtilMercadoPago.php +++ b/v1.6.x/mercadopago/includes/UtilMercadoPago.php @@ -39,8 +39,6 @@ public static function logMensagem($mensagem, $nivel) null, true ); - } else { - error_log($data_hora."===".$mensagem); } } @@ -119,4 +117,12 @@ public static function checkRequirements() return $requirements; } + + public static function checkValueNull($value) + { + if (is_null($value) || empty($value)) { + return "false"; + } + return $value; + } } diff --git a/v1.6.x/mercadopago/index.php b/v1.6.x/mercadopago/index.php old mode 100755 new mode 100644 index 044cb85..0df7996 --- a/v1.6.x/mercadopago/index.php +++ b/v1.6.x/mercadopago/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2015 PrestaShop SA +* @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; \ No newline at end of file +exit; diff --git a/v1.6.x/mercadopago/mercadopago.jpg b/v1.6.x/mercadopago/mercadopago.jpg deleted file mode 100644 index 3d670a3..0000000 Binary files a/v1.6.x/mercadopago/mercadopago.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/mercadopago.php b/v1.6.x/mercadopago/mercadopago.php old mode 100755 new mode 100644 index a6a81d9..d5cbbbb --- a/v1.6.x/mercadopago/mercadopago.php +++ b/v1.6.x/mercadopago/mercadopago.php @@ -1,107 +1,153 @@ -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -use PrestaShop\PrestaShop\Core\Payment\PaymentOption; - -if (!defined("_PS_VERSION_")) { - exit; +/** + * 2007-2015 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 MERCADOPAGO.COM REPRESENTAÇÕES LTDA. + * @copyright Copyright(c) MercadoPago [http://www.mercadopago.com] + * @license http://opensource.org/licenses/osl-3.0.php Open Software License(OSL 3.0) + * International Registered Trademark & Property of MercadoPago + */ + +if (!defined('_PS_VERSION_')) { + exit(); } -include dirname(__FILE__)."/includes/MPApi.php"; +function_exists('curl_init'); +include dirname(__FILE__).'/includes/MPApi.php'; class MercadoPago extends PaymentModule { - protected $html = ""; - protected $_postErrors = array(); - - public $details; - public $owner; - public $address; - public $extra_mail_vars; - - protected $selectedTab = false; - - public $secret_key; - public $client_id; - + public static $listShipping; + + public static $appended_text; + + public static $listCache = array(); + public $id_carrier; + + private $dimensionUnitList = array( + 'CM' => 'CM', + 'IN' => 'IN', + 'CMS' => 'CM', + 'INC' => 'IN', + ); + private $weightUnitList = array('KG' => 'KGS', + 'KGS' => 'KGS', + 'LBS' => 'LBS', + 'LB' => 'LBS', + ); + + public static $countryOptions = array( + 'MLA' => array( + 'normal' => array( + 'value' => 73328, 'label' => 'MercadoEnvios - OCA Estándar', + 'description' => 'Después de la publicación, recibirá el producto en', + ), + 'expresso' => array( + 'value' => 73330, 'label' => 'MercadoEnvios - OCA Prioritario', + 'description' => 'Después de la publicación, recibirá el producto en', + ), + ), + 'MLB' => array( + 'normal' => array( + 'value' => 100009, 'label' => 'MercadoEnvios - Normal', + 'description' => 'Após a postagem, você o receberá o produto em até', + ), + 'expresso' => array( + 'value' => 182, 'label' => 'MercadoEnvios - Expresso', + 'description' => 'Após a postagem, você o receberá o produto em até', + ), + ), + 'MLM' => array( + 'normal' => array( + 'value' => 501245, 'label' => 'MercadoEnvios - DHL Estándar', + 'description' => 'Después de la publicación, recibirá el producto en', + ), + 'expresso' => array( + 'value' => 501345, 'label' => 'MercadoEnvios - DHL Express', + 'description' => 'Después de la publicación, recibirá el producto en', + ), + ), + ); public function __construct() { - $this->name = "mercadopago"; - $this->tab = "payments_gateways"; - $this->version = "1.0.4"; - $this->ps_versions_compliancy = array("min" => "1.7", "max" => _PS_VERSION_); - $this->author = "Mercado Pago"; - $this->controllers = array("validationstandard", "standardreturn"); - $this->has_curl = function_exists('curl_version'); - $this->is_eu_compatible = 1; - + $this->name = 'mercadopago'; + $this->tab = 'payments_gateways'; + $this->version = '3.4.5'; $this->currencies = true; - $this->currencies_mode = "checkbox"; - $this->confirmUninstall = $this->l("Are you sure you want to uninstall?"); - if (!isset($this->access_key) || !isset($this->secret_key)) { - $this->warning = $this->l("Your Mercado Pago details must be configured before using this module."); - } - $this->bootstrap = true; + //$this->currencies_mode = 'radio'; + $this->need_instance = 0; + $this->module_key = '4380f33bbe84e7899aacb0b7a601376f'; + $this->ps_versions_compliancy = array( + 'min' => '1.6', + 'max' => '1.7', + ); + parent::__construct(); - $this->displayName = $this->l("Mercado Pago"); - $this->description = $this->l("Receive your payments using Mercado Pago, you can using the Checkout Standard."); + $this->page = basename(__file__, '.php'); + $this->displayName = 'Mercado Pago'; + $this->description = $this->l( + 'Receive your payments using Mercado Pago, you can using the Custom Checkout or Checkout Standard.' + ); -// this->getTranslator()->trans('Receive your payments using Mercado Pago, you can using the Checkout Standard.', array(), 'Admin.Global'); + //Receba seus pagamentos utilizando o Mercado + //Pago e receba em cartão de crédito e boletos através + //no nosso checkout Transparente ou Padrão. + + $this->confirmUninstall = $this->l('Are you sure you want to uninstall MercadoPago?'); + $this->textshowemail = $this->l('You must follow MercadoPago rules for purchase to be valid'); + $this->author = $this->l('MERCADOPAGO.COM Representações LTDA.'); + $this->link = new Link(); + $this->mercadopago = new MPApi( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); - if (!count(Currency::checkPaymentCurrencies($this->id))) { - $this->warning = $this->l("No currency has been set for this module."); - } - } + $this->currencies_mode = 'checkbox'; - public function install() - { - $returnStatus = $this->createStates(); - return parent::install() && - $this->registerHook('paymentOptions') && - $this->registerHook('displayPayment') && - $this->registerHook('paymentReturn') && - $this->registerHook('payment') && - $this->registerHook('header'); + //$this->bootstrap = true; } - - public function hookPayment($params) - { - error_log("entro no hookPayment"); - } - public function hookDisplayPayment($params) + /** + * Check if the state exist before create another one. + * + * @param int $id_order_state + * State ID + * + * @return bool availability + */ + public static function orderStateAvailable($id_order_state) { - error_log("entro no hookDisplayPayment"); - return $this->hookPayment($params); + $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( + ' + SELECT `id_order_state` AS ok + FROM `'._DB_PREFIX_.'order_state` + WHERE `id_order_state` = '.(int) $id_order_state + ); + + return $result['ok']; } + /** * Create the states, we need to check if doens`t exists. */ - private function createStates() + public function createStates() { $order_states = array( array( @@ -172,6 +218,7 @@ private function createStates() ), ); + foreach ($order_states as $key => $value) { if (!is_null($this->orderStateAvailable(Configuration::get('MERCADOPAGO_STATUS_'.$key)))) { continue; @@ -213,6 +260,7 @@ private function createStates() Configuration::updateValue('MERCADOPAGO_STATUS_'.$key, $order_state->id); } } + return true; } @@ -229,708 +277,1204 @@ private function populateEmail($lang, $name, $extension) } } + private function deleteStates() + { + for ($index = 0; $index <= 10; ++$index) { + $order_state = new OrderState(Configuration::get('MERCADOPAGO_STATUS_'.$index)); + if (!$order_state->delete()) { + return false; + } + } + + return true; + } + /** - * Check if the state exist before create another one. - * - * @param int $id_order_state - * State ID - * - * @return bool availability + * install module. */ - public static function orderStateAvailable($id_order_state) + public function install() { - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow( - ' - SELECT `id_order_state` AS ok - FROM `'._DB_PREFIX_.'order_state` - WHERE `id_order_state` = '.(int) $id_order_state - ); - error_log("===result status===".$result['ok']); - return $result['ok']; + $errors = array(); + if (!function_exists('curl_version')) { + $errors[] = $this->l('Curl not installed'); + + return false; + } + + if (!parent::install() || !$this->createStates() || !$this->registerHook('payment') || + !$this->registerHook('paymentReturn') || !$this->registerHook('displayHeader') || + !$this->registerHook('displayOrderDetail') + || + !$this->registerHook('displayAdminOrder') + || + !$this->registerHook('backOfficeHeader') + || + !$this->registerHook('displayBackOfficeHeader') + + //|| + //!$this->registerHook('beforeCarrier') + || + !$this->registerHook('displayBeforeCarrier') + || + !$this->registerHook('displayFooter') + || + ! $this->createTables() + ) { + return false; + } + + return true; } - public function uninstall() + private function isMercadoEnvios($id_carrier) { - if (!Configuration::deleteByName("MERCADOPAGO_CHECKOUT_DISPLAY") - || !Configuration::deleteByName("MERCADOPAGO_STARDAND_ACTIVE") - || !Configuration::deleteByName("MERCADOPAGO_CLIENT_SECRET") - || !Configuration::deleteByName("MERCADOPAGO_CLIENT_ID") - || !Configuration::deleteByName("MERCADOPAGO_INSTALLMENTS") - || !Configuration::deleteByName("MERCADOPAGO_CATEGORY") - - || !$this->unregisterHook("paymentOptions") - || !$this->unregisterHook("paymentReturn") - || !$this->unregisterHook("payment") - || !$this->unregisterHook("displayPayment") - || !$this->unregisterHook("header") - || !parent::uninstall()) { - return false; + error_log("=====isMercadoEnvios id_carrier=====" . $id_carrier); + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + + error_log("=====isMercadoEnvios id_carrier=====" . Tools::jsonEncode(Configuration::get('MERCADOPAGO_CARRIER'))); + + $id_mercadoenvios_service_code = 0; + if (isset($lista_shipping['MP_CARRIER']) && + array_key_exists($id_carrier, $lista_shipping['MP_CARRIER'])) { + $id_mercadoenvios_service_code = $lista_shipping['MP_CARRIER'][$id_carrier]; } - return true; + + return $id_mercadoenvios_service_code; } - public function hookHeader($parameters) + /** + * Verify if there is state approved for order. + */ + public static function getOrderStatePending($id_order) { - $this->context->controller->addCSS(($this->_path).'views/css/mercadopago.css', 'all'); + return (int) Db::getInstance()->getValue( + ' + SELECT MAX(id_order_state) + FROM '._DB_PREFIX_.'order_history + WHERE id_order = '.(int) $id_order + ); } - public function getContent() + public function hookDisplayAdminOrder($params) { - $shopDomainSsl = Tools::getShopDomainSsl(true, true); - $backOfficeCssUrl = $shopDomainSsl.__PS_BASE_URI__."modules/".$this->name."/views/css/backoffice.css"; - $marketingCssUrl = $shopDomainSsl.__PS_BASE_URI__."modules/".$this->name."/views/css/marketing.css"; - $backOfficeJsUrl = $shopDomainSsl.__PS_BASE_URI__."modules/".$this->name."/views/js/backoffice.js"; - - $tplVars = array( - "tabs" => $this->getConfigurationTabs(), - "selectedTab" => $this->getSelectedTab(), - "backOfficeJsUrl" => $backOfficeJsUrl, - "backOfficeCssUrl" => $backOfficeCssUrl, - "marketingCssUrl" => $marketingCssUrl + $order = new Order((int) $params['id_order']); + + $statusOrder = ''; + $id_order_state = $this->getOrderStatePending($order->id); + + if ($id_order_state == Configuration::get('MERCADOPAGO_STATUS_7')) { + $statusOrder = 'Pendente'; + } + + $token_form = Tools::getAdminToken('AdminOrder'.Tools::getValue('id_order')); + + $data = array( + 'id_order' => $params['id_order'], + 'token_form' => $token_form, + 'statusOrder' => $statusOrder, + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, + 'cancel_action_url' => $this->link->getModuleLink( + 'mercadopago', + 'cancelorder', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ), + ); + $data["payment_pos_action_url"] = $this->link->getModuleLink( + 'mercadopago', + 'paymentpos', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false ); - if (isset($this->context->cookie->mercadoPagoConfigMessage)) { - $tplVars["message"]["success"] = $this->context->cookie->mercadoPagoMessageSuccess; - $tplVars["message"]["text"] = $this->context->cookie->mercadoPagoConfigMessage; - unset($this->context->cookie->mercadoPagoConfigMessage); + $this->context->smarty->assign('pos_active', Configuration::get('MERCADOPAGO_POINT')); + error_log("====MERCADOPAGO_POINT====" . Configuration::get('MERCADOPAGO_POINT')); + if (Configuration::get('MERCADOPAGO_POINT') == "true") { + error_log("====entrou aqui===="); + $this->context->smarty->assign('pos_options', $this->loadPoints()); } else { - $tplVars["message"] = false; + error_log("====entrou aqui no else===="); + $this->context->smarty->assign('pos_options', array()); + } + + $id_order_carrier = $order->getIdOrderCarrier(); + + $order_carrier = new OrderCarrier($id_order_carrier); + $id_mercadoenvios_service_code = $this->isMercadoEnvios($order_carrier->id_carrier); + error_log("====entrou aqui mercadoenvios====".$id_mercadoenvios_service_code); + if ($id_mercadoenvios_service_code > 0) { + error_log("====entrou aqui mercadoenvios 1===="); + $order_payments = $order->getOrderPayments(); + foreach ($order_payments as $order_payment) { + $result = $this->mercadopago->getPaymentStandard($order_payment->transaction_id); + error_log(print_r($result, true)); + if ($result['status'] == '200') { + $payment_info = $result['response']; + if (isset($payment_info['collection'])) { + $merchant_order_id = $payment_info['collection']['merchant_order_id']; + $result_merchant = $this->mercadopago->getMerchantOrder($merchant_order_id); + $return_tracking = $this->setTracking( + $order, + $result_merchant['response']['shipments'], + false + ); + $tag_shipment = $this->mercadopago->getTagShipment( + $return_tracking['shipment_id'] + ); + $tag_shipment_zebra = $this->mercadopago->getTagShipmentZebra( + $return_tracking['shipment_id'] + ); + + $return_tracking['tag_shipment_zebra'] = $tag_shipment_zebra; + + $return_tracking['tag_shipment'] = $tag_shipment; + $this->context->smarty->assign($return_tracking); + } + } + break; + } } - $this->context->smarty->assign($tplVars); + $this->context->smarty->assign($data); - return $this->display(__FILE__, "views/templates/admin/tabs.tpl"); + return $this->display(__file__, '/views/templates/hook/display_admin_order.tpl'); } - protected function getSelectedTab() + private function loadPoints() { - if ($this->selectedTab) { - return $this->selectedTab; - } + $pos_options = array(); + + $str = file_get_contents(dirname(__FILE__)."/pos.json"); + $json = Tools::jsonDecode($str, true); - if (Tools::getValue("selected_tab")) { - return Tools::getValue("selected_tab"); + foreach ($json['points'] as $field) { + $pos_options[$field['poi']] = $field['label']; } - return "presentation"; + return $pos_options; } - protected function getConfigurationTabs() + private function createTables() { - $tabsLocale = $this->getTabsLocale(); - $tabs = array(); - - $tabs[] = array( - "id" => "presentation", - "title" => $tabsLocale["presentation"], - "content" => $this->getPresentationTemplate() - ); + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mercadopago_point_order` ( + `id` int(11) unsigned NOT NULL auto_increment, + `id_transaction` varchar(255) NOT NULL, + `id_order` int(10) unsigned NOT NULL , + PRIMARY KEY (`id`) + ) ENGINE=' . _MYSQL_ENGINE_ . + ' DEFAULT CHARSET=utf8 auto_increment=1;'; + if (! Db::getInstance()->Execute($sql)) { + return false; + } + return true; + } - $tabs[] = array( - "id" => "requirements", - "title" => $tabsLocale["requirements"], - "content" => $this->getPageRequirements() - ); + public function hookDisplayOrderDetail($params) + { + if ($params['order']->module == 'mercadopago') { + $order = new Order(Tools::getValue('id_order')); + $order_payments = $order->getOrderPayments(); + foreach ($order_payments as $order_payment) { + $result = $this->mercadopago->getPayment($order_payment->transaction_id); + if ($result['status'] == '404') { + $result = $this->mercadopago->getPaymentStandard($order_payment->transaction_id); + + $result_merchant = $this->mercadopago->getMerchantOrder( + $result['response']['collection']['merchant_order_id'] + ); + } + if ($result['status'] == 200) { + $payment_info = $result['response']['collection']; + + $id_mercadoenvios_service_code = $this->isMercadoEnvios($order->id_carrier); + if ($id_mercadoenvios_service_code > 0) { + $merchant_order_id = $payment_info['merchant_order_id']; + $result_merchant = $this->mercadopago->getMerchantOrder($merchant_order_id); + $return_tracking = $this->setTracking( + $order, + $result_merchant['response']['shipments'], + true + ); + $this->context->smarty->assign($return_tracking); + } - $tabs[] = array( - "id" => "general_setting", - "title" => $tabsLocale["settings"], - "content" => $this->salveGeneralSetting() - ); + $payment_type_id = isset($payment_info['payment_type_id']) ? + isset($payment_info['payment_type_id']) : $payment_info['payment_type']; - $tabs[] = array( - "id" => "payment_configuration", - "title" => $tabsLocale["paymentsConfig"], - "content" => $this->getPaymentConfigurationTemplate() - ); - return $tabs; + if ($payment_type_id == 'ticket' || $payment_type_id == 'atm') { + $settings = array( + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, + 'boleto_url' => urldecode($payment_info['transaction_details']['external_resource_url']), + 'payment_type_id' => $payment_type_id, + ); + $this->context->smarty->assign($settings); + } + } + break; + } + return $this->display(__file__, '/views/templates/hook/print_details_order.tpl'); + } } - protected function getPaymentConfigurationTemplate() + + private function setTracking($order, $shipments, $update) { - $locale = $this->getPaymentConfigurationLocale(); - if ($this->existCredentials()) { - if (Tools::isSubmit("btnSubmitPaymentConfig")) { - $this->selectedTab = "payment_configuration"; - $this->updatePaymentConfig(); + error_log("entrou aqui setTracking"); + $shipment_id = null; + $retorno = null; + foreach ($shipments as $shipment) { + if ($shipment['shipping_mode'] != 'me2') { + continue; + } + + $shipment_id = $shipment['id']; + $response_shipment = $this->mercadopago->getTracking($shipment_id); + $response_shipment = $response_shipment['response']; + $tracking_number = $response_shipment['tracking_number']; + + if ($response_shipment['tracking_number'] != 'pending') { + $status = ''; + switch ($response_shipment['status']) { + case 'ready_to_ship': + $status = $this->l('Ready to ship'); + break; + default: + $status = $response_shipment['status']; + break; + } + + switch ($response_shipment['substatus']) { + case 'ready_to_print': + $substatus_description = $this->l('Tag ready to print'); + break; + case 'printed': + $substatus_description = $this->l('Tag printed'); + break; + case 'stale': + $substatus_description = $this->l('Unsuccessful'); + break; + case 'delayed': + $substatus_description = $this->l('Sending the delayed path'); + break; + case 'receiver_absent': + $substatus_description = $this->l('Missing recipient for delivery'); + break; + case 'returning_to_sender': + $substatus_description = $this->l('In return to sender'); + break; + case 'claimed_me': + $substatus_description = $this->l('Buyer initiates complaint and requested a refund.'); + break; + default: + $substatus_description = $response_shipment['substatus']; + break; + } + $estimated_delivery = new DateTime( + $response_shipment['shipping_option'] + ['estimated_delivery_time'] + ['date'] + ); + $estimated_handling_limit = new DateTime( + $response_shipment['shipping_option'] + ['estimated_handling_limit'] + ['date'] + ); + $estimated_delivery_final = new DateTime( + $response_shipment['shipping_option'] + ['estimated_delivery_final'] + ['date'] + ); + $retorno = array( + 'shipment_id' => $shipment_id, + 'tracking_number' => $tracking_number, + 'name' => $response_shipment['shipping_option']['name'], + 'status' => $status, + 'substatus' => $response_shipment['substatus'], + 'substatus_description' => $substatus_description, + 'estimated_delivery' => $estimated_delivery->format('d/m/Y'), + 'estimated_handling_limit' => $estimated_handling_limit->format('d/m/Y'), + 'estimated_delivery_final' => $estimated_delivery_final->format('d/m/Y'), + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, + ); + if ($update) { + $id_order_carrier = $order->getIdOrderCarrier(); + $order_carrier = new OrderCarrier($id_order_carrier); + $order_carrier->tracking_number = $tracking_number; + $order_carrier->update(); + } + } else { + $retorno = array( + 'shipment_id' => $shipment_id, + 'tracking_number' => '', + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, + ); } + } + + return $retorno; + } - $paymentsResult = MPApi::getInstanceMP()->getPaymentMethods(); + private function removeMercadoEnvios() + { + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER') + ); + if (isset($lista_shipping['MP_SHIPPING'])) { + foreach ($lista_shipping['MP_SHIPPING'] as $id_carrier) { + $carrier = new Carrier($id_carrier); + $carrier->deleted = true; + $carrier->active = false; + $carrier->save(); + } + Configuration::deleteByName('MERCADOPAGO_CARRIER'); + } + } - $i = 0; - $payments = array(); - foreach ($paymentsResult as $paymentMethod) { - $paymentTypeLowerCase = Tools::strtolower($paymentMethod["name"]); + public function uninstall() + { + $this->removeMercadoEnvios(); + $this->uninstallModule(); + // continue the states + if (!$this->uninstallPaymentSettings() || !Configuration::deleteByName('MERCADOPAGO_PUBLIC_KEY') || + !Configuration::deleteByName('MERCADOPAGO_CATEGORY') || + !Configuration::deleteByName('MERCADOPAGO_CREDITCARD_BANNER') || + !Configuration::deleteByName('MERCADOPAGO_CREDITCARD_ACTIVE') || + !Configuration::deleteByName('MERCADOPAGO_ACCESS_TOKEN') || + !Configuration::deleteByName('MERCADOPAGO_STANDARD_ACTIVE') || + !Configuration::deleteByName('MERCADOPAGO_LOG') || + !Configuration::deleteByName('MERCADOPAGO_STANDARD_BANNER') || + !Configuration::deleteByName('MERCADOPAGO_WINDOW_TYPE') || + !Configuration::deleteByName('MERCADOPAGO_IFRAME_WIDTH') || + !Configuration::deleteByName('MERCADOPAGO_IFRAME_HEIGHT') || + !Configuration::deleteByName('MERCADOPAGO_INSTALLMENTS') || + !Configuration::deleteByName('MERCADOPAGO_AUTO_RETURN') || + !Configuration::deleteByName('MERCADOPAGO_COUNTRY') || + !Configuration::deleteByName('MERCADOPAGO_COUPON_ACTIVE') || + !Configuration::deleteByName('MERCADOPAGO_POINT') || + !Configuration::deleteByName('MERCADOPAGO_COUPON_TICKET_ACTIVE') || + !Configuration::deleteByName('MERCADOENVIOS_ACTIVATE') || + !Configuration::deleteByName('MERCADOPAGO_CARRIER') || + !Configuration::deleteByName('MERCADOPAGO_CARRIER_ID_1') || + !Configuration::deleteByName('MERCADOPAGO_CARRIER_ID_2') || + + !Configuration::deleteByName('MERCADOPAGO_DISCOUNT_PERCENT') || + !Configuration::deleteByName('MERCADOPAGO_ACTIVE_CREDITCARD') || + !Configuration::deleteByName('MERCADOPAGO_ACTIVE_BOLETO') || + + !parent::uninstall()) { + return false; + } - $activeConfigName = Configuration::get("MERCADOPAGO_".$paymentMethod["id"]."_ACTIVE"); - $modeConfigName = Configuration::get("MERCADOPAGO_".$paymentMethod["id"]."_MODE"); + $this->setSettings(); - $payments[$i]["id"] = $paymentMethod["id"]; - $payments[$i]["title"] = $paymentTypeLowerCase; - $payments[$i]["type"] = $paymentMethod["payment_type_id"]; - $payments[$i]["active"] = Tools::getValue("MERCADOPAGO_".$paymentMethod["id"]."_ACTIVE", $activeConfigName); - $payments[$i]["mode"] = Tools::getValue("MERCADOPAGO_".$paymentMethod["id"]."_MODE", $modeConfigName); - $payments[$i]["brand"] = $paymentMethod["secure_thumbnail"]; - $payments[$i]["tooltips"] = ""; + Configuration::deleteByName('MERCADOPAGO_CLIENT_ID'); + Configuration::deleteByName('MERCADOPAGO_CLIENT_SECRET'); - error_log("".$paymentMethod["id"]); + return true; + } - $i++; + public function uninstallPaymentSettings() + { + $client_id = Configuration::get('MERCADOPAGO_CLIENT_ID'); + $client_secret = Configuration::get('MERCADOPAGO_CLIENT_SECRET'); + + if ($client_id != '' && $client_secret != '') { + $payment_methods = $this->mercadopago->getPaymentMethods(); + foreach ($payment_methods as $payment_method) { + $pm_variable_name = 'MERCADOPAGO_'.Tools::strtoupper($payment_method['id']); + if (!Configuration::deleteByName($pm_variable_name)) { + return false; + } } - $tplVars = array( - "show" => true, - "mercadoPagoActive" => Configuration::get("MERCADOPAGO_STARDAND_ACTIVE"), - "panelTitle" => "teste", - "payments" => $payments, - "thisPath" => Tools::getShopDomain(true, true).__PS_BASE_URI__."modules/mercadopago/", - "fieldsValue" => $this->getPaymentConfiguration(), - "currentIndex" => $this->getAdminModuleLink(), - "label" => $locale["label"], - "button" => $locale["button"] - ); - } else { - $tplVars = array( - "show" => false, - "mercadoPagoActive" => false, - "panelTitle" => "teste", - "payments" => array(), - "thisPath" => Tools::getShopDomain(true, true).__PS_BASE_URI__."modules/mercadopago/", - "fieldsValue" => $this->getPaymentConfiguration(), - "currentIndex" => $this->getAdminModuleLink(), - "label" => $locale["label"], - "button" => $locale["button"] - ); + $offline_methods_payments = $this->mercadopago->getOfflinePaymentMethods(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); + if (!Configuration::deleteByName($op_banner_variable) || + !Configuration::deleteByName($op_active_variable)) { + return false; + } + } } - $this->context->smarty->assign($tplVars); - return $this->display(__FILE__, "views/templates/admin/paymentConfiguration.tpl"); + return true; } - - protected function getPaymentConfigurationLocale() + public function getContent() { - $locale = array(); + $errors = array(); + $success = false; + $payment_methods = null; + $payment_methods_settings = null; + $offline_payment_settings = null; + $offline_methods_payments = null; + + $client_id = Configuration::get('MERCADOPAGO_CLIENT_ID'); + $client_secret = Configuration::get('MERCADOPAGO_CLIENT_SECRET'); + + $this->context->controller->addCss($this->_path.'views/css/settings.css', 'all'); + $this->context->controller->addCss($this->_path.'views/css/bootstrap.css', 'all'); + $this->context->controller->addCss($this->_path.'views/css/style.css', 'all'); + + $this->smarty->assign(array( + 'percent' => Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'), + 'active_credicard' => Configuration::get('MERCADOPAGO_ACTIVE_CREDITCARD'), + 'active_boleto' => Configuration::get('MERCADOPAGO_ACTIVE_BOLETO') + )); + + if (Tools::getValue('login')) { + $client_id = Tools::getValue('MERCADOPAGO_CLIENT_ID'); + $client_secret = Tools::getValue('MERCADOPAGO_CLIENT_SECRET'); + if (empty($client_id) || empty($client_secret)) { + $errors[] = $this->l('Please, complete the fieds Client Id, Client Secret.'); + $success = false; + + $settings = array( + 'errors' => $errors, + 'version' => $this->getPrestashopVersion(), + ); + $this->context->smarty->assign($settings); + + return $this->display(__file__, '/views/templates/admin/settings.tpl'); + } - $locale["label"]["active"] = $this->l("Enabled"); - $locale["label"]["disable"] = $this->l("Disable"); + if (!$this->validateCredential($client_id, $client_secret)) { + $errors[] = $this->l('Client Id or Client Secret invalid.'); + $success = false; + } else { + $this->setDefaultValues($client_id, $client_secret); + } + } elseif (Tools::getValue('submitmercadopago')) { + $client_id = Tools::getValue('MERCADOPAGO_CLIENT_ID'); + $client_secret = Tools::getValue('MERCADOPAGO_CLIENT_SECRET'); + $access_token = Tools::getValue('MERCADOPAGO_ACCESS_TOKEN'); + + Configuration::updateValue( + 'MERCADOPAGO_DISCOUNT_PERCENT', + (float) Tools::getValue('MERCADOPAGO_DISCOUNT_PERCENT') + ); + Configuration::updateValue( + 'MERCADOPAGO_ACTIVE_CREDITCARD', + (int) Tools::getValue('MERCADOPAGO_ACTIVE_CREDITCARD') + ); - $locale["paymentsConfig"] = $this->l("Payment Configuration"); + Configuration::updateValue( + 'MERCADOPAGO_ACTIVE_BOLETO', + (int) Tools::getValue('MERCADOPAGO_ACTIVE_BOLETO') + ); - $locale["flexible"]["tooltips"] = - $this->l("When enabled, all single payment methods will be disabled"); + Configuration::updateValue( + 'MERCADOPAGO_CUSTOM_TEXT', + (int) Tools::getValue('MERCADOPAGO_CUSTOM_TEXT') + ); - $locale["button"]["save"] = $this->l("Save"); - $locale["button"]["yes"] = $this->l("Yes"); - $locale["button"]["no"] = $this->l("No"); + $this->smarty->assign(array( + 'percent' => Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'), + 'active_credicard' => Configuration::get('MERCADOPAGO_ACTIVE_CREDITCARD'), + 'active_boleto' => Configuration::get('MERCADOPAGO_ACTIVE_BOLETO') + )); + + if (empty($client_id) || empty($client_secret)) { + $errors[] = $this->l('Please, complete the fieds Client Id and Client Secret.'); + $success = false; + $settings = array( + 'errors' => $errors, + 'version' => $this->getPrestashopVersion(), + ); + $this->context->smarty->assign($settings); + return $this->display(__file__, '/views/templates/admin/settings.tpl'); + } - return $locale; - } + $client_id = Tools::getValue('MERCADOPAGO_CLIENT_ID'); + $client_secret = Tools::getValue('MERCADOPAGO_CLIENT_SECRET'); + $access_token = Tools::getValue('MERCADOPAGO_ACCESS_TOKEN'); - protected function getAdminModuleLink() - { - $adminLink = $this->context->link->getAdminLink("AdminModules", false); - $module = "&configure=".$this->name."&tab_module=".$this->tab."&module_name=".$this->name; - $adminToken = Tools::getAdminTokenLite("AdminModules"); + $public_key = Tools::getValue('MERCADOPAGO_PUBLIC_KEY'); + $creditcard_active = Tools::getValue('MERCADOPAGO_CREDITCARD_ACTIVE'); + $coupon_active = Tools::getValue('MERCADOPAGO_COUPON_ACTIVE'); + $point_active = Tools::getValue('MERCADOPAGO_POINT'); + $coupon_ticket_active = Tools::getValue('MERCADOPAGO_COUPON_TICKET_ACTIVE'); - return $adminLink.$module."&token=".$adminToken; - } + $boleto_active = Tools::getValue('MERCADOPAGO_BOLETO_ACTIVE'); + $standard_active = Tools::getValue('MERCADOPAGO_STANDARD_ACTIVE'); + $mercadopago_log = Tools::getValue('MERCADOPAGO_LOG'); - protected function getPaymentConfiguration() - { - $saveConfig = array(); - return $saveConfig; - } + $mercadoenvios_activate = Tools::getValue('MERCADOENVIOS_ACTIVATE'); - protected function salveGeneralSetting() - { - if (Tools::isSubmit("btnSubmit")) { - error_log("getGeneralSetting"); - $this->validateGeneralSetting(); - $this->selectedTab = "general_setting"; - } + $new_country = false; - $this->html .= $this->renderGeneralSettingForm(); + try { + if (!$this->validateCredential($client_id, $client_secret)) { + $errors[] = $this->l('Client Id or Client Secret invalid.'); + $success = false; + } else { + $previous_country = $this->getCountry( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); + $current_country = $this->getCountry($client_id, $client_secret); + $new_country = $previous_country == $current_country ? false : true; + + Configuration::updateValue('MERCADOPAGO_CLIENT_ID', $client_id); + Configuration::updateValue('MERCADOPAGO_CLIENT_SECRET', $client_secret); + Configuration::updateValue('MERCADOPAGO_COUNTRY', $this->getCountry($client_id, $client_secret)); + $success = true; + Configuration::updateValue('MERCADOPAGO_PUBLIC_KEY', $public_key); + Configuration::updateValue('MERCADOPAGO_ACCESS_TOKEN', $access_token); + if ($mercadoenvios_activate == 'true' && + count(Tools::jsonDecode(Configuration::get('MERCADOPAGO_CARRIER'))) == 0) { + $this->setCarriers(); + } elseif (count(Tools::jsonDecode(Configuration::get('MERCADOPAGO_CARRIER'))) > 0) { + $this->removeMercadoEnvios(); + } - return $this->html; - } + // populate all payments accoring to country + $this->mercadopago = new MPApi( + $client_id, + $client_secret + ); + $payment_methods = $this->mercadopago->getPaymentMethods(); + $configCard = $this->mercadopago->setEnableDisableTwoCard(Tools::getValue('MERCADOPAGO_TWO_CARDS')); - protected function validateGeneralSetting() - { - if (Tools::isSubmit("btnSubmit")) { - $locale = $this->getGeneralSettingLocale(); - $isRequired = false; - $fieldsRequired = array(); - - if (trim(Tools::getValue("MERCADOPAGO_CLIENT_ID")) == "" - && trim(Configuration::get("MERCADOPAGO_CLIENT_ID")) == "") { - $fieldsRequired[] = $locale["client_id"]["label"]; - $isRequired = true; - } - if (trim(Tools::getValue("MERCADOPAGO_CLIENT_SECRET")) == "" - && trim(Configuration::get("MERCADOPAGO_CLIENT_SECRET")) == "") { - $fieldsRequired[] = $locale["client_secret"]["label"]; - $isRequired = true; + $two_cards = $configCard['response']['two_cards']; + Configuration::updateValue('MERCADOPAGO_TWO_CARDS', $two_cards); + } + } catch (Exception $e) { + PrestaShopLogger::addLog( + 'MercadoPago::getContent - Fatal Error: '.$e->getMessage(), + MPApi::FATAL_ERROR, + 0 + ); + $this->context->smarty->assign( + array( + 'message_error' => $e->getMessage(), + 'version' => $this->getPrestashopVersion(), + ) + ); + return $this->display(__file__, '/views/templates/front/error_admin.tpl'); } + $category = Tools::getValue('MERCADOPAGO_CATEGORY'); + Configuration::updateValue('MERCADOPAGO_CATEGORY', $category); - if (trim(Tools::getValue("MERCADOPAGO_CHECKOUT_DISPLAY")) == "" - && trim(Configuration::get("MERCADOPAGO_CHECKOUT_DISPLAY")) == "") { - $fieldsRequired[] = $locale["checkout_display"]["label"]; - $isRequired = true; - } + $creditcard_banner = Tools::getValue('MERCADOPAGO_CREDITCARD_BANNER'); + Configuration::updateValue('MERCADOPAGO_CREDITCARD_BANNER', $creditcard_banner); + + Configuration::updateValue('MERCADOPAGO_STANDARD_ACTIVE', $standard_active); + Configuration::updateValue('MERCADOENVIOS_ACTIVATE', $mercadoenvios_activate); + Configuration::updateValue('MERCADOPAGO_LOG', $mercadopago_log); + + Configuration::updateValue('MERCADOPAGO_BOLETO_ACTIVE', $boleto_active); + Configuration::updateValue('MERCADOPAGO_CREDITCARD_ACTIVE', $creditcard_active); + Configuration::updateValue('MERCADOPAGO_COUPON_ACTIVE', $coupon_active); + Configuration::updateValue('MERCADOPAGO_POINT', $point_active); + Configuration::updateValue('MERCADOPAGO_COUPON_TICKET_ACTIVE', $coupon_ticket_active); + + $standard_banner = Tools::getValue('MERCADOPAGO_STANDARD_BANNER'); + Configuration::updateValue('MERCADOPAGO_STANDARD_BANNER', $standard_banner); + + $window_type = Tools::getValue('MERCADOPAGO_WINDOW_TYPE'); + Configuration::updateValue('MERCADOPAGO_WINDOW_TYPE', $window_type); + + $iframe_width = Tools::getValue('MERCADOPAGO_IFRAME_WIDTH'); + Configuration::updateValue('MERCADOPAGO_IFRAME_WIDTH', $iframe_width); + + $iframe_height = Tools::getValue('MERCADOPAGO_IFRAME_HEIGHT'); + Configuration::updateValue('MERCADOPAGO_IFRAME_HEIGHT', $iframe_height); + + $installments = Tools::getValue('MERCADOPAGO_INSTALLMENTS'); + Configuration::updateValue('MERCADOPAGO_INSTALLMENTS', $installments); - if (trim(Tools::getValue("MERCADOPAGO_INSTALLMENTS")) == "" - && trim(Configuration::get("MERCADOPAGO_INSTALLMENTS")) == "") { - $fieldsRequired[] = $locale["checkout_installments"]["label"]; - $isRequired = true; + $auto_return = Tools::getValue('MERCADOPAGO_AUTO_RETURN'); + Configuration::updateValue('MERCADOPAGO_AUTO_RETURN', $auto_return); + + $exclude_all = true; + + foreach ($payment_methods as $payment_method) { + $pm_variable_name = 'MERCADOPAGO_'.Tools::strtoupper($payment_method['id']); + $value = Tools::getValue($pm_variable_name); + + if ($value != 'on') { + $exclude_all = false; + } + // current settings + $payment_methods_settings[$payment_method['id']] = Configuration::get($pm_variable_name); } - if ($isRequired) { - $warning = implode(", ", $fieldsRequired) . " "; - if ($this->l("ERROR_MANDATORY") == "ERROR_MANDATORY") { - $warning .= $this->l("is required. Please fill this field."); - } else { - $warning .= $this->l("ERROR_MANDATORY"); + if (!$exclude_all) { + $payment_methods_settings = array(); + foreach ($payment_methods as $payment_method) { + $pm_variable_name = 'MERCADOPAGO_'.Tools::strtoupper($payment_method['id']); + $value = Tools::getValue($pm_variable_name); + // save setting per payment_method + Configuration::updateValue($pm_variable_name, $value); + $payment_methods_settings[$payment_method['id']] = Configuration::get($pm_variable_name); } - $this->context->cookie->mercadoPagoMessageSuccess = false; - $this->context->cookie->mercadoPagoConfigMessage = $warning; } else { - $this->updateGeneralSetting(); - + $errors[] = $this->l('Cannnot exclude all payment methods.'); + $success = false; + } + // if it is new country, reset values + if ($new_country) { + $this->setCustomSettings($client_id, $client_secret, $this->getCountry($client_id, $client_secret)); + + $offline_methods_payments = $this->mercadopago->getOfflinePaymentMethods(); + $offline_payment_settings = array(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); + + $op_banner = Configuration::get($op_banner_variable); + $op_active = Configuration::get($op_banner_variable); + + $offline_payment_settings[$offline_payment['id']] = array( + 'name' => $offline_payment['name'], + 'banner' => Configuration::get($op_banner_variable), + 'active' => Configuration::get($op_active_variable), + ); + + if ($offline_payment['payment_type_id'] == "ticket") { + $ticket_active = Configuration::get('MERCADOPAGO_'. + Tools::strtoupper($offline_payment['id'].'_ACTIVE')); + Configuration::updateValue('MERCADOPAGO_CUSTOM_BOLETO', $ticket_active); + } + } + } else { + // save offline payment settings + $offline_methods_payments = $this->mercadopago->getOfflinePaymentMethods(); + $offline_payment_settings = array(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); + + $op_banner = Tools::getValue($op_banner_variable); + + // save setting per payment_method + Configuration::updateValue($op_banner_variable, $op_banner); + + $op_active = Tools::getValue($op_active_variable); + // save setting per payment_method + Configuration::updateValue($op_active_variable, $op_active); + + $offline_payment_settings[$offline_payment['id']] = array( + 'name' => $offline_payment['name'], + 'banner' => Configuration::get($op_banner_variable), + 'active' => Configuration::get($op_active_variable), + ); + if ($offline_payment['payment_type_id'] == "ticket") { + $ticket_active = Configuration::get('MERCADOPAGO_'. + Tools::strtoupper($offline_payment['id'].'_ACTIVE')); + Configuration::updateValue('MERCADOPAGO_CUSTOM_BOLETO', $ticket_active); + } + } + } + } else { + // populate all payments according to country + if ($client_id != '' && + $client_secret != '') { + $this->mercadopago = new MPApi( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); + + // load payment method settings for standard + $payment_methods = $this->mercadopago->getPaymentMethods(); + $payment_methods_settings = array(); + foreach ($payment_methods as $payment_method) { + $pm_variable_name = 'MERCADOPAGO_'.Tools::strtoupper($payment_method['id']); + $value = Configuration::get($pm_variable_name); + + $payment_methods_settings[$payment_method['id']] = Configuration::get($pm_variable_name); + } } } - } - protected function updateGeneralSetting() - { - if (Tools::isSubmit("btnSubmit")) { - $client_id = Tools::getValue("MERCADOPAGO_CLIENT_ID"); - $client_secret = Tools::getValue("MERCADOPAGO_CLIENT_SECRET"); + $this->mercadopago = new MPApi( + $client_id, + $client_secret + ); - Configuration::updateValue("MERCADOPAGO_CLIENT_ID", Tools::getValue("MERCADOPAGO_CLIENT_ID")); - Configuration::updateValue("MERCADOPAGO_CLIENT_SECRET", Tools::getValue("MERCADOPAGO_CLIENT_SECRET")); - Configuration::updateValue("MERCADOPAGO_CHECKOUT_DISPLAY", Tools::getValue("MERCADOPAGO_CHECKOUT_DISPLAY")); - Configuration::updateValue("MERCADOPAGO_CATEGORY", Tools::getValue("MERCADOPAGO_CATEGORY")); + // load all offline payment method settings + $offline_methods_payments = $this->mercadopago->getOfflinePaymentMethods(); - error_log("====MERCADOPAGO_INSTALLMENTS====".Tools::getValue("MERCADOPAGO_INSTALLMENTS")); + $payment_methods = $this->mercadopago->getPaymentMethods(); + // load all offline payment method settings + //$offline_methods_payments = $mp->getOfflinePaymentMethods(); - Configuration::updateValue("MERCADOPAGO_INSTALLMENTS", Tools::getValue("MERCADOPAGO_INSTALLMENTS")); + $offline_payment_settings = array(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); - Configuration::updateValue("MERCADOPAGO_COUNTRY", MPApi::getInstanceMP()->getCountry()); + $offline_payment_settings[$offline_payment['id']] = array( + 'name' => $offline_payment['name'], + 'banner' => Configuration::get($op_banner_variable), + 'active' => Configuration::get($op_active_variable), + ); - $successMessage = $this->l("Settings successfully saved"); - $this->context->cookie->mercadoPagoMessageSuccess = true; - $this->context->cookie->mercadoPagoConfigMessage = $successMessage; + if ($offline_payment['payment_type_id'] == "ticket") { + $ticket_active = Configuration::get('MERCADOPAGO_'. + Tools::strtoupper($offline_payment['id'].'_ACTIVE')); + Configuration::updateValue('MERCADOPAGO_ACTIVE_BOLETO', $ticket_active); + } } - } + $site_id = array( + 'site_id' => Configuration::get('MERCADOPAGO_COUNTRY'), + ); + $test_user = $this->mercadopago->getTestUser($site_id); - private function existCredentials() - { - $client_id = Configuration::get("MERCADOPAGO_CLIENT_ID"); - $client_secret = Configuration::get("MERCADOPAGO_CLIENT_SECRET"); - if (trim($client_id) == "" || trim($client_secret) == "") { - return false; + $requirements = UtilMercadoPago::checkRequirements(); + + $configCard = $this->mercadopago->getCheckConfigCard(); + if (!isset($configCard['response']['status'])) { + $two_cards = $configCard['response']['two_cards']; + Configuration::updateValue('MERCADOPAGO_TWO_CARDS', $two_cards); } - return true; - } - protected function getPresentationTemplate() - { - $vars = array( - "thisPath" => $this->_path + $notification_url = $this->link->getModuleLink( + 'mercadopago', + 'notification', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false ); - $this->context->smarty->assign($vars); - return $this->display(__FILE__, "views/templates/admin/presentation.tpl"); - } - protected function getPageRequirements() - { - $tplVars = array( - "thisPath" => $this->_path + $settings = array( + 'test_user' => $test_user, + 'requirements' => $requirements, + 'requirements' => $requirements, + 'custom_text' => htmlentities(Configuration::get('MERCADOPAGO_CUSTOM_TEXT'), ENT_COMPAT, 'UTF-8'), + 'two_cards' => htmlentities(Configuration::get('MERCADOPAGO_TWO_CARDS'), ENT_COMPAT, 'UTF-8'), + 'public_key' => htmlentities(Configuration::get('MERCADOPAGO_PUBLIC_KEY'), ENT_COMPAT, 'UTF-8'), + 'access_token' => htmlentities(Configuration::get('MERCADOPAGO_ACCESS_TOKEN'), ENT_COMPAT, 'UTF-8'), + 'client_id' => htmlentities(Configuration::get('MERCADOPAGO_CLIENT_ID'), ENT_COMPAT, 'UTF-8'), + 'client_secret' => htmlentities(Configuration::get('MERCADOPAGO_CLIENT_SECRET'), ENT_COMPAT, 'UTF-8'), + 'country' => htmlentities(Configuration::get('MERCADOPAGO_COUNTRY'), ENT_COMPAT, 'UTF-8'), + 'category' => htmlentities(Configuration::get('MERCADOPAGO_CATEGORY'), ENT_COMPAT, 'UTF-8'), + 'notification_url' => htmlentities($notification_url, ENT_COMPAT, 'UTF-8'), + 'creditcard_banner' => htmlentities( + Configuration::get('MERCADOPAGO_CREDITCARD_BANNER'), + ENT_COMPAT, + 'UTF-8' + ), + 'creditcard_active' => htmlentities( + Configuration::get('MERCADOPAGO_CREDITCARD_ACTIVE'), + ENT_COMPAT, + 'UTF-8' + ), + 'coupon_active' => htmlentities(Configuration::get('MERCADOPAGO_COUPON_ACTIVE'), ENT_COMPAT, 'UTF-8'), + 'point_active' => htmlentities(Configuration::get('MERCADOPAGO_POINT'), ENT_COMPAT, 'UTF-8'), + 'coupon_ticket_active' => htmlentities( + Configuration::get('MERCADOPAGO_COUPON_TICKET_ACTIVE'), + ENT_COMPAT, + 'UTF-8' + ), + 'boleto_active' => htmlentities(Configuration::get('MERCADOPAGO_BOLETO_ACTIVE'), ENT_COMPAT, 'UTF-8'), + 'standard_active' => htmlentities(Configuration::get('MERCADOPAGO_STANDARD_ACTIVE'), ENT_COMPAT, 'UTF-8'), + 'MERCADOENVIOS_ACTIVATE' => htmlentities( + Configuration::get('MERCADOENVIOS_ACTIVATE'), + ENT_COMPAT, + 'UTF-8' + ), + 'log_active' => htmlentities(Configuration::get('MERCADOPAGO_LOG'), ENT_COMPAT, 'UTF-8'), + 'standard_banner' => htmlentities(Configuration::get('MERCADOPAGO_STANDARD_BANNER'), ENT_COMPAT, 'UTF-8'), + 'window_type' => htmlentities(Configuration::get('MERCADOPAGO_WINDOW_TYPE'), ENT_COMPAT, 'UTF-8'), + 'iframe_width' => htmlentities(Configuration::get('MERCADOPAGO_IFRAME_WIDTH'), ENT_COMPAT, 'UTF-8'), + 'iframe_height' => htmlentities(Configuration::get('MERCADOPAGO_IFRAME_HEIGHT'), ENT_COMPAT, 'UTF-8'), + 'installments' => htmlentities(Configuration::get('MERCADOPAGO_INSTALLMENTS'), ENT_COMPAT, 'UTF-8'), + 'auto_return' => htmlentities(Configuration::get('MERCADOPAGO_AUTO_RETURN'), ENT_COMPAT, 'UTF-8'), + 'uri' => $_SERVER['REQUEST_URI'], + 'payment_methods' => $payment_methods ? $payment_methods : null, + 'payment_methods_settings' => $payment_methods_settings ? $payment_methods_settings : null, + 'offline_methods_payments' => $offline_methods_payments ? $offline_methods_payments : null, + 'offline_payment_settings' => $offline_payment_settings ? $offline_payment_settings : null, + 'errors' => $errors, + 'success' => $success, + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, + 'version' => $this->getPrestashopVersion(), ); - $this->context->smarty->assign($tplVars); - return $this->display(__FILE__, "views/templates/admin/requirements.tpl"); - } + if (Tools::getValue('login') || + Tools::getValue('submitmercadopago')) { + $this->setSettings(); + } - protected function getTabsLocale() - { - $locale = array(); - $locale["presentation"] = $this->l("Presentation"); - $locale["requirements"] = $this->l("Requirement"); - $locale["settings"] = $this->l("Basic Settings"); - $locale["paymentsConfig"] = $this->l("Payment Settings"); + $this->context->smarty->assign($settings); - return $locale; + return $this->display(__file__, '/views/templates/admin/settings.tpl'); } - protected function updatePaymentConfig() + private function setDefaultValues($client_id, $client_secret) { - if (Tools::isSubmit("btnSubmitPaymentConfig")) { - - foreach (MPApi::getInstanceMP()->getPaymentMethods() as $paymentMethod) { - $active = Tools::getValue("MERCADOPAGO_".$paymentMethod["id"]."_ACTIVE"); - $mode = Tools::getValue("MERCADOPAGO_".$paymentMethod["id"]."_MODE"); - Configuration::updateValue("MERCADOPAGO_".$paymentMethod["id"]."_ACTIVE", $active); - Configuration::updateValue("MERCADOPAGO_".$paymentMethod["id"]."_MODE", $mode); - } + $country = $this->getCountry($client_id, $client_secret); + + Configuration::updateValue('MERCADOPAGO_CLIENT_ID', $client_id); + Configuration::updateValue('MERCADOPAGO_CLIENT_SECRET', $client_secret); + Configuration::updateValue('MERCADOPAGO_COUNTRY', $country); + Configuration::updateValue('MERCADOPAGO_WINDOW_TYPE', 'redirect'); + Configuration::updateValue('MERCADOPAGO_IFRAME_WIDTH', '725'); + Configuration::updateValue('MERCADOPAGO_IFRAME_HEIGHT', '570'); + Configuration::updateValue('MERCADOPAGO_INSTALLMENTS', '12'); + Configuration::updateValue('MERCADOPAGO_AUTO_RETURN', 'approved'); + + $this->setCustomSettings($client_id, $client_secret, $country); + } - Configuration::updateValue("MERCADOPAGO_STARDAND_ACTIVE", Tools::getValue("MERCADOPAGO_STARDAND_ACTIVE")); + public function hookDisplayBackOfficeHeader($params) + { + return $this->hookBackOfficeHeader($params); + } - if ($this->l("SUCCESS_GENERAL_PAYMENTCONFIG") == "SUCCESS_GENERAL_PAYMENTCONFIG") { - $successMessage = $this->l("Congratulations, your payments configuration were successfully updated."); - } else { - $successMessage = $this->l("SUCCESS_GENERAL_PAYMENTCONFIG"); - } + public function hookBackOfficeHeader($params) + { + if (Configuration::get('MERCADOPAGO_CARRIER') != null && + Configuration::get('MERCADOENVIOS_ACTIVATE') == 'true') { + $lista_shipping = Tools::jsonDecode(Configuration::get('MERCADOPAGO_CARRIER'), true); + $lista_shipping = implode(',', $lista_shipping['MP_SHIPPING']); + + $javascript = ''; - $this->context->cookie->mercadoPagoMessageSuccess = true; - $this->context->cookie->mercadoPagoConfigMessage = $successMessage; + return $javascript; } } - - protected function renderGeneralSettingForm() + private function setCustomSettings($client_id, $client_secret, $country) { - $locale = $this->getGeneralSettingLocale(); - - $helper = new HelperForm(); - $helper->show_toolbar = false; - $helper->table = $this->table; - $lang = new Language((int)Configuration::get("PS_LANG_DEFAULT")); - $helper->default_form_language = $lang->id; - if (Configuration::get("PS_BO_ALLOW_EMPLOYEE_FORM_LANG")) { - $helper->allow_employee_form_lang = Configuration::get("PS_BO_ALLOW_EMPLOYEE_FORM_LANG"); + if ($country == 'MLB' || $country == 'MLM' || $country == 'MLA' || $country == 'MLC' || $country == 'MCO' || + $country == 'MLV' || + $country == 'MPE' + ) { + Configuration::updateValue( + 'MERCADOPAGO_CREDITCARD_BANNER', + (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__. + 'modules/mercadopago/views/img/'.$country.'/credit_card.png' + ); + Configuration::updateValue('MERCADOPAGO_CREDITCARD_ACTIVE', 'true'); + Configuration::updateValue('MERCADOPAGO_STANDARD_ACTIVE', 'false'); + Configuration::updateValue('MERCADOPAGO_COUPON_ACTIVE', 'false'); + Configuration::updateValue('MERCADOPAGO_COUPON_TICKET_ACTIVE', 'false'); + + Configuration::updateValue('MERCADOPAGO_LOG', 'false'); + + // set all offline payment settings + $mp = new MPApi($client_id, $client_secret); + + $offline_methods_payments = $mp->getOfflinePaymentMethods(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + Configuration::updateValue($op_banner_variable, $offline_payment['secure_thumbnail']); + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); + Configuration::updateValue($op_active_variable, 'true'); + } } else { - $helper->allow_employee_form_lang = 0; - } - $this->fields_form = array(); - $this->fields_form = $this->getGeneralSettingForm($locale); - - $helper->id = (int)Tools::getValue("id_carrier"); - $helper->identifier = $this->identifier; - $helper->submit_action = "btnSubmit"; - $helper->currentIndex = $this->getAdminModuleLink(); - $helper->token = Tools::getAdminTokenLite("AdminModules"); - $helper->tpl_vars = array( - "fields_value" => $this->getGeneralSetting(), - "languages" => $this->context->controller->getLanguages(), - "id_language" => $this->context->language->id - ); - - return $helper->generateForm($this->fields_form); - } + Configuration::updateValue('MERCADOPAGO_STANDARD_ACTIVE', 'true'); + } - protected function getGeneralSettingForm($locale) - { - $getDisplayList = $this->getDisplayList($locale["checkout_display"]); - $getDisplayCategoryList = $this->getDisplayCategoryList($locale["checkout_display_category"]); - - $generalForm = array(); - $generalForm[] = array( - "form" => array( - "input" => array( - $this->getTextForm("CLIENT_ID", $locale["client_id"], true), - $this->getTextForm("CLIENT_SECRET", $locale["client_secret"], true), - $this->getTextForm("INSTALLMENTS", $locale["checkout_installments"], true), - $this->getSelectForm("CHECKOUT_DISPLAY", $locale["checkout_display"], $getDisplayList), - $this->getSelectForm("CATEGORY", $locale["checkout_display_category"], $getDisplayCategoryList), - ), - "submit" => array( - "title" => $locale["save"] - ) - ) + Configuration::updateValue( + 'MERCADOPAGO_STANDARD_BANNER', + (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__. + 'modules/mercadopago/views/img/'.$country.'/banner_all_methods.png' ); - - return $generalForm; } - private function getTextForm($pm, $locale, $requirement = false) + private function getCountry($client_id, $client_secret) { - $textForm = - array( - "type" => "text", - "label" => @$locale["label"], - "name" => "MERCADOPAGO_".$pm, - "required" => $requirement, - "desc" => @$locale["desc"] - ); + $mp = new MPApi($client_id, $client_secret); - return $textForm; + return $mp->getCountry(); } - private function getPasswordForm($pm, $locale, $requirement = false) + private function validateCredential($client_id, $client_secret) { - $passwordForm = - array( - "type" => "password", - "label" => $locale["label"], - "name" => "MERCADOPAGO_".$pm, - "required" => $requirement, - "desc" => $locale["desc"] - ); + $mp = new MPApi($client_id, $client_secret); - return $passwordForm; + return $mp->getAccessToken() ? true : false; } - private function getSelectForm($pm, $locale, $selectList) + public function hookDisplayHeader() { - $selectForm = array( - "type" => "select", - "label" => $locale["label"], - "name" => "MERCADOPAGO_".$pm, - "desc" => $locale["desc"], - "options" => array( - "query" => $selectList, - "id" => "id", - "name" => "name" - ) + if (!$this->active) { + return; + } + + $data = array( + 'creditcard_active' => Configuration::get('MERCADOPAGO_CREDITCARD_ACTIVE'), + 'public_key' => Configuration::get('MERCADOPAGO_PUBLIC_KEY'), + 'access_token' => Configuration::get('MERCADOPAGO_ACCESS_TOKEN'), ); - return $selectForm; - } - private function getDisplayList($display) - { - $displayList = array ( - array( - "id" => "IFRAME", - "name" => $display["iframe"] - ), - array( - "id" => "REDIRECT", - "name" => $display["redirect"] - ) + $this->context->controller->addCss($this->_path.'views/css/mercadopago_core.css', 'all'); + $this->context->controller->addCss($this->_path.'views/css/chico.min.css', 'all'); + $this->context->controller->addCss($this->_path.'views/css/dd.css', 'all'); + $this->context->controller->addCss( + $this->_path.'views/css/mercadopago_v6.css', + 'all' ); + $this->context->smarty->assign($data); - return $displayList; + return $this->display(__file__, '/views/templates/hook/header.tpl'); } - - private function getDisplayCategoryList($display) + public function hookDisplayFooter() { - $displayList = array ( - array( - "id" => "others", - "name" => $display["others"] - ), - array( - "id" => "art", - "name" => $display["art"] - ), - array( - "id" => "baby", - "name" => $display["baby"] - ), - array( - "id" => "coupons", - "name" => $display["coupons"] - ), - array( - "id" => "donations", - "name" => $display["donations"] - ), - array( - "id" => "cameras", - "name" => $display["cameras"] - ), - array( - "id" => "video_games", - "name" => $display["video_games"] - ), - array( - "id" => "television", - "name" => $display["television"] - ), - array( - "id" => "car_electronics", - "name" => $display["car_electronics"] - ), - array( - "id" => "electronics", - "name" => $display["electronics"] - ), - array( - "id" => "automotive", - "name" => $display["automotive"] - ), - array( - "id" => "entertainment", - "name" => $display["entertainment"] - ) - - , - array( - "id" => "fashion", - "name" => $display["fashion"] - ), - array( - "id" => "games", - "name" => $display["games"] - ), - array( - "id" => "home", - "name" => $display["home"] - ), - array( - "id" => "musical", - "name" => $display["musical"] - ), - array( - "id" => "phones", - "name" => $display["phones"] - ), - array( - "id" => "services", - "name" => $display["services"] - ), - array( - "id" => "learnings", - "name" => $display["learnings"] - ), - array( - "id" => "tickets", - "name" => $display["tickets"] - ), - array( - "id" => "travels", - "name" => $display["travels"] - ), - array( - "id" => "virtual_goods", - "name" => $display["virtual_goods"] - ) - ); + if (!$this->active) { + return; + } - return $displayList; + return $this->display(__file__, '/views/templates/hook/display.tpl'); } - protected function getGeneralSettingLocale() + public function hookPayment($params) { - $locale = array(); - $locale["setting"]["label"] = $this->l("Configuration"); - - $locale["client_id"]["label"] = "Client ID"; - $locale["client_secret"]["label"] = "Client Secret"; - - $locale["checkout_display"]["label"] = $this->l("Visualization mode"); - $locale["checkout_display"]["label"] = "Display"; - $locale["checkout_display"]["iframe"] = "iFrame"; - $locale["checkout_display"]["redirect"] = "Redirect"; - - $locale["checkout_display"]["desc"] = - $this->l("iFrame – We enable within your checkout an area with enviroment of Mercado Mercado, - Redirect – The client will be redirect to Mercadopago environment (Recommended)."); - - //descrições - $locale["client_id"]["desc"] = - $this->l("This field is required and you can't to show to other people. - For more information: https://www.mercadopago.com.br/developers/en/solutions/payments/basic-checkout/receive-payments."); - $locale["client_secret"]["desc"] = - $this->l("This field is required and you can't to show to other people. - For more information: https://www.mercadopago.com.br/developers/en/solutions/payments/basic-checkout/receive-payments."); - - $locale["checkout_installments"]["label"] = $this->l("Installments"); - $locale["checkout_installments"]["desc"] = $this->l("Inform the allowed amount of parcels that the customers can install, maximum 24."); - - $locale["checkout_display_category"]["label"] = "Categoria"; - $locale["checkout_display_category"]["others"] = "Other categories"; - - $locale["checkout_display_category"]["desc"] = "Selecione a categoria da sua loja."; - $locale["checkout_display_category"]["art"] = "Collectibles & Art"; - $locale["checkout_display_category"]["baby"] = "Toys for Baby, Stroller, Stroller Accessories, Car Safety Seats"; - - $locale["checkout_display_category"]["coupons"] = "Coupons"; - $locale["checkout_display_category"]["donations"] = "Donations"; - - $locale["checkout_display_category"]["computing"] = "Computers & Tablets"; - $locale["checkout_display_category"]["cameras"] = "Cameras & Photography"; - $locale["checkout_display_category"]["video_games"] = "Video Games & Consoles"; - $locale["checkout_display_category"]["television"] = "LCD, LED, Smart TV, Plasmas, TVs"; - $locale["checkout_display_category"]["car_electronics"] = "Car Audio, Car Alarm Systems & Security, Car DVRs, Car Video Players, Car PC"; - $locale["checkout_display_category"]["electronics"] = "Audio & Surveillance, Video & GPS, Others"; - $locale["checkout_display_category"]["automotive"] = "Parts & Accessories"; - $locale["checkout_display_category"]["entertainment"] = "Music, Movies & Series, Books, Magazines & Comics, Board Games & Toys"; - - $locale["checkout_display_category"]["fashion"] = "Men\'s, Women\'s, Kids & baby, Handbags & Accessories, Health & Beauty, Shoes, Jewelry & Watches"; - $locale["checkout_display_category"]["games"] = "Online Games & Credits"; - $locale["checkout_display_category"]["home"] = "Home appliances. Home & Garden"; - $locale["checkout_display_category"]["musical"] = "Instruments & Gear"; - $locale["checkout_display_category"]["phones"] = "Cell Phones & Accessories"; - $locale["checkout_display_category"]["services"] = "General services"; - $locale["checkout_display_category"]["learnings"] = "Trainings, Conferences, Workshops"; - $locale["checkout_display_category"]["tickets"] = "Tickets for Concerts, Sports, Arts, Theater, Family, Excursions tickets, Events & more"; - $locale["checkout_display_category"]["travels"] = "Plane tickets, Hotel vouchers, Travel vouchers"; - $locale["checkout_display_category"]["virtual_goods"] = "E-books, Music Files, Software, Digital Images,". - "PDF Files and any item which can be electronically stored in a file, Mobile Recharge, DTH Recharge and any Online Recharge"; - - $locale["save"] = $this->l("Save"); - - return $locale; - } + if (!$this->active) { + return; + } - protected function getGeneralSetting() - { - $configClient_id = Configuration::get("MERCADOPAGO_CLIENT_ID"); - $configClientSecret = Configuration::get("MERCADOPAGO_CLIENT_SECRET"); - $configDisplay = Configuration::get("MERCADOPAGO_CHECKOUT_DISPLAY"); - $configDisplayCategory = Configuration::get("MERCADOPAGO_CATEGORY"); + $percent = (float) Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'); - $configDisplayInstallments = Configuration::get("MERCADOPAGO_INSTALLMENTS"); + //calculo desconto parcela a vista + $cart = $params['cart']; + $active_credit_card = (int) Configuration::get('MERCADOPAGO_ACTIVE_CREDITCARD'); + $shipping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_SHIPPING); + $product_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS); - $generalSetting = array(); - $generalSetting["MERCADOPAGO_CLIENT_ID"] = - Tools::getValue("MERCADOPAGO_CLIENT_ID", $configClient_id); - $generalSetting["MERCADOPAGO_CLIENT_SECRET"] = - Tools::getValue("MERCADOPAGO_CLIENT_SECRET", $configClientSecret); + $discount = ($percent / 100) * $product_cost; - $generalSetting["MERCADOPAGO_CHECKOUT_DISPLAY"] = - Tools::getValue("MERCADOPAGO_CHECKOUT_DISPLAY", $configDisplay); + $orderTotal = number_format(($product_cost - $discount) + $shipping_cost, 2, ',', '.'); - $generalSetting["MERCADOPAGO_CATEGORY"] = - Tools::getValue("MERCADOPAGO_CATEGORY", $configDisplayCategory); + $this->context->smarty->assign(array('orderTotal' => $orderTotal,'active_credit_card' => $active_credit_card)); - $generalSetting["MERCADOPAGO_INSTALLMENTS"] = - Tools::getValue("MERCADOPAGO_INSTALLMENTS", $configDisplayInstallments); - return $generalSetting; - } + $creditcard_active = Configuration::get('MERCADOPAGO_CREDITCARD_ACTIVE'); + $mercadoenvios_activate = Configuration::get('MERCADOENVIOS_ACTIVATE'); + $boleto_active = Configuration::get('MERCADOPAGO_BOLETO_ACTIVE'); + if ($mercadoenvios_activate == 'true') { + $creditcard_active = 'false'; + $boleto_active = 'false'; + } else { + $mercadoenvios_activate = 'false'; + } + + $credit_card_discount = (int) Configuration::get('MERCADOPAGO_ACTIVE_CREDITCARD'); + $boleto_discount = (int) Configuration::get('MERCADOPAGO_ACTIVE_BOLETO'); + $percent = (float) Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'); + + if ($this->hasCredential()) { + $this_path_ssl = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__; + $data = array( + 'credit_card_discount'=> $credit_card_discount, + 'boleto_discount'=> $boleto_discount, + + 'percent'=> $percent, + 'this_path_ssl' => $this_path_ssl, + 'mercadoenvios_activate' => $mercadoenvios_activate, + 'boleto_active' => $boleto_active, + 'creditcard_active' => $creditcard_active, + 'coupon_active' => Configuration::get('MERCADOPAGO_COUPON_ACTIVE'), + 'coupon_ticket_active' => Configuration::get('MERCADOPAGO_COUPON_TICKET_ACTIVE'), + + 'standard_active' => Configuration::get('MERCADOPAGO_STANDARD_ACTIVE'), + 'log_active' => Configuration::get('MERCADOPAGO_LOG'), + 'version' => $this->getPrestashopVersion(), + 'custom_action_url' => $this->link->getModuleLink( + 'mercadopago', + 'custompayment', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ), + 'discount_action_url' => $this->link->getModuleLink( + 'mercadopago', + 'discount', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ), + 'payment_status' => Tools::getValue('payment_status'), + 'status_detail' => Tools::getValue('status_detail'), + 'payment_method_id' => Tools::getValue('payment_method_id'), + 'installments' => Tools::getValue('installments'), + 'statement_descriptor' => Tools::getValue('statement_descriptor'), + 'window_type' => Configuration::get('MERCADOPAGO_WINDOW_TYPE'), + 'iframe_width' => Configuration::get('MERCADOPAGO_IFRAME_WIDTH'), + 'iframe_height' => Configuration::get('MERCADOPAGO_IFRAME_HEIGHT'), + 'country' => Configuration::get('MERCADOPAGO_COUNTRY'), + ); + // send credit card configurations only activated + if ($creditcard_active == 'true') { + $data['public_key'] = Configuration::get('MERCADOPAGO_PUBLIC_KEY'); + $data['creditcard_banner'] = Configuration::get('MERCADOPAGO_CREDITCARD_BANNER'); + $data['amount'] = (double) number_format($params['cart']->getOrderTotal(true, Cart::BOTH), 2, '.', ''); + + // get the customer cards + $customerID = $this->getCustomerID(); + // get customer cards + if ($customerID != null) { + $data['customerID'] = $customerID; + $customerCards = $this->getCustomerCards($customerID); + $data['customerCards'] = Tools::jsonEncode($customerCards); + } else { + $data['customerCards'] = null; + $data['customerID'] = null; + } + } else { + $data['customerCards'] = null; + $data['customerID'] = null; + } + // send standard configurations only activated + if (Configuration::get('MERCADOPAGO_STANDARD_ACTIVE') == 'true') { + $result = $this->createStandardCheckoutPreference(); + + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + $messageLog = "====result====".Tools::jsonEncode($result); + PrestaShopLogger::addLog( + $messageLog, + MPApi::ERROR, + 0 + ); + } - /*fim admin*/ + if (array_key_exists('init_point', $result['response'])) { + $data['standard_banner'] = Configuration::get('MERCADOPAGO_STANDARD_BANNER'); + $data['preferences_url'] = $result['response']['init_point']; + } else { + $data['preferences_url'] = null; + PrestaShopLogger::addLog( + 'MercadoPago::hookPayment - An error occurred during preferences creation.'. + 'Please check your credentials and try again.: ', + MPApi::ERROR, + 0 + ); + } + } + // send offline settings + $offline_methods_payments = $this->mercadopago->getOfflinePaymentMethods(); - public function hookPaymentOptions($params) - { - error_log("======ENTROU NO hookPaymentOptions======="); + $offline_payment_settings = array(); + foreach ($offline_methods_payments as $offline_payment) { + $op_banner_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_BANNER'); + $op_active_variable = 'MERCADOPAGO_'.Tools::strtoupper($offline_payment['id'].'_ACTIVE'); - if (!$this->active) { - return; - } + $thumbnail = $offline_payment['thumbnail']; - if (!$this->checkCurrency($params["cart"])) { - return; + if (Configuration::get('PS_SSL_ENABLED')) { + $thumbnail = str_replace("http", "https", $offline_payment['thumbnail']); + } + $offline_payment_settings[$offline_payment['id']] = array( + 'name' => $offline_payment['name'], + 'banner' => Configuration::get($op_banner_variable), + 'active' => Configuration::get($op_active_variable), + 'thumbnail' => $thumbnail, + ); + } + + + $data['offline_payment_settings'] = $offline_payment_settings; + + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MLM' || + Configuration::get('MERCADOPAGO_COUNTRY') == 'MPE' + ) { + $payment_methods_credit = $this->mercadopago->getPaymentCreditsMLM(); + $data['payment_methods_credit'] = $payment_methods_credit; + } else { + $data['payment_methods_credit'] = array(); + } + + $this->context->smarty->assign($data); + $this->context->smarty->assign($this->setPreModuleAnalytics()); + + return $this->display(__file__, '/views/templates/hook/checkout.tpl'); } + } + + private function setPreModuleAnalytics() + { + $customer_fields = Context::getContext()->customer->getFields(); + + $select = 'SELECT name FROM '. _DB_PREFIX_ .'module where active = 1 AND id_module IN ( + SELECT h.id_module + FROM '. _DB_PREFIX_ .'hook_module h INNER JOIN '. _DB_PREFIX_ .'hook ph on ph.id_hook = h.id_hook + WHERE ph.name = "displayPayment" + )'; + $query = Db::getInstance()->executeS($select); - $payment_options = [ - $this->getExternalPaymentOption() - ]; + $resultModules = array(); + + foreach ($query as $result) { + array_push($resultModules, $result['name']); + } - return $payment_options; + $return = array( + 'publicKey'=> Configuration::get('MERCADOPAGO_PUBLIC_KEY') ? + Configuration::get('MERCADOPAGO_PUBLIC_KEY') : "", + 'token'=> Configuration::get('MERCADOPAGO_ACCESS_TOKEN'), + 'platform' => "PRESTASHOP", + 'platformVersion' => $this->getPrestashopVersion(), + 'moduleVersion' => $this->version, + 'payerEmail' => $customer_fields['email'], + 'userLogged' => $this->context->customer->isLogged() ? 1 : 0, + 'installedModules' => implode(', ', $resultModules), + 'additionalInfo' => "" + ); + return $return; } - public function hookPaymentReturn($parameters) + /** + * @param + * $params + */ + public function hookPaymentReturn($params) { if (!$this->active) { return; } - error_log("==========hookPaymentReturn====="); - $currency = $this->context->currency; - - $logo_mercadopago = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo-mercadopago.png'); if (Tools::getValue('payment_method_id') == 'bolbradesco' || Tools::getValue('payment_type') == 'bank_transfer' || Tools::getValue('payment_type') == 'atm' || Tools::getValue('payment_type') == 'ticket') { - error_log("====boleto_url====". Tools::getValue('boleto_url')); + $this->context->controller->addCss($this->_path.'views/css/mercadopago_core.css', 'all'); + $boleto_url = Tools::getValue('boleto_url'); if (Configuration::get('PS_SSL_ENABLED')) { $boleto_url = str_replace("http", "https", $boleto_url); @@ -938,20 +1482,18 @@ public function hookPaymentReturn($parameters) $this->context->smarty->assign( array( - 'logo_mercadopago' => $logo_mercadopago, 'payment_id' => Tools::getValue('payment_id'), - 'payment_status' => Tools::getValue('payment_status'), 'boleto_url' => Tools::getValue('boleto_url'), 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, ) ); - error_log("vai retornar aqui no boleto"); - return $this->display(__FILE__, 'views/templates/hook/displayStatusOrderTicket.tpl'); + + return $this->display(__file__, '/views/templates/hook/boleto_payment_return.tpl'); } else { + $this->context->controller->addCss($this->_path.'views/css/mercadopago_core.css', 'all'); $this->context->smarty->assign( array( - 'logo_mercadopago' => $logo_mercadopago, 'payment_status' => Tools::getValue('payment_status'), 'status_detail' => Tools::getValue('status_detail'), 'card_holder_name' => Tools::getValue('card_holder_name'), @@ -960,14 +1502,14 @@ public function hookPaymentReturn($parameters) 'installments' => Tools::getValue('installments'), 'transaction_amount' => Tools::displayPrice( Tools::getValue('amount'), - $currency, + $params['currencyObj'], false ), 'statement_descriptor' => Tools::getValue('statement_descriptor'), 'payment_id' => Tools::getValue('payment_id'), 'amount' => Tools::displayPrice( Tools::getValue('amount'), - $currency, + $params['currencyObj'], false ), 'this_path_ssl' => ( @@ -975,96 +1517,1763 @@ public function hookPaymentReturn($parameters) ).htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__, ) ); - error_log("vai retornar o cartão"); - return $this->display(__FILE__, 'views/templates/hook/displayStatusOrder.tpl'); + + return $this->display(__file__, '/views/templates/hook/creditcard_payment_return.tpl'); } } - public function checkCurrency($cart) + /** + * Verify the credentials. + * + * @return bool + */ + private function hasCredential() { - $currency_order = new Currency($cart->id_currency); - $currencies_module = $this->getCurrency($cart->id_currency); + return Configuration::get('MERCADOPAGO_CLIENT_ID') != '' && + Configuration::get('MERCADOPAGO_CLIENT_SECRET') != ''; + } - if (is_array($currencies_module)) { - foreach ($currencies_module as $currency_module) { - if ($currency_order->id == $currency_module["id_currency"]) { - return true; - } + /** + * @param + * $post + */ + public function execPayment($post) + { + $preferences = $this->getPreferencesCustom($post); + $result = $this->mercadopago->createCustomPayment($preferences); + + return $result['response']; + } + + /** + * @param + * $coupon_id + * + * @return $details_discount + */ + public function validCoupon($coupon_id) + { + $cart = Context::getContext()->cart; + + $client_id = Configuration::get('MERCADOPAGO_CLIENT_ID'); + $client_secret = Configuration::get('MERCADOPAGO_CLIENT_SECRET'); + $mp = new MPApi($client_id, $client_secret); + + $customer_fields = Context::getContext()->customer->getFields(); + $transaction_amount = (double) number_format($cart->getOrderTotal(true, Cart::BOTH), 2, '.', ''); + $params = array( + 'transaction_amount' => $transaction_amount, + 'payer_email' => $customer_fields['email'], + 'coupon_code' => $coupon_id, + ); + + $details_discount = $mp->getDiscount($params); + + // add value on return api discount + $details_discount['response']['transaction_amount'] = $params['transaction_amount']; + $details_discount['response']['params'] = $params; + + return $details_discount; + } + + /** + * @param + * $post + */ + private function getPreferencesCustom($post) + { + + $customer_fields = Context::getContext()->customer->getFields(); + $cart = Context::getContext()->cart; + + // items + $products = $cart->getProducts(); + $items = array(); + $summary = ''; + + foreach ($products as $key => $product) { + $image = Image::getCover($product['id_product']); + $product_image = new Product($product['id_product'], false, Context::getContext()->language->id); + $link = new Link();//because getImageLInk is not static function + $imagePath = $link->getImageLink( + $product_image->link_rewrite, + $image['id_image'], + ImageType::getFormatedName('home') + ); + + $item = array( + 'id' => $product['id_product'], + 'title' => $product['name'], + 'description' => $product['description_short'], + 'picture_url' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$imagePath, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + 'quantity' => $product['quantity'], + 'unit_price' => $product['price_wt'], + ); + if ($key == 0) { + $summary .= $product['name']; + } else { + $summary .= ', '.$product['name']; } + + $items[] = $item; } - return false; + + // include shipping cost + $shipping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_SHIPPING); + if ($shipping_cost > 0) { + $item = array( + 'title' => 'Shipping', + 'description' => 'Shipping service used by store', + 'quantity' => 1, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + 'unit_price' => $shipping_cost, + ); + + $items[] = $item; + } + + // include wrapping cost + $wrapping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_WRAPPING); + if ($wrapping_cost > 0) { + $item = array( + 'title' => 'Wrapping', + 'description' => 'Wrapping service used by store', + 'quantity' => 1, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + 'unit_price' => $wrapping_cost, + ); + + $items[] = $item; + } + + // include discounts + $discounts = (double) $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); + if ($discounts > 0) { + $item = array( + 'title' => 'Discount', + 'description' => 'Discount provided by store', + 'quantity' => 1, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + 'unit_price' => -$discounts, + ); + + $items[] = $item; + } + + // Get payer address for additional_info + $address_invoice = new Address((integer) $cart->id_address_invoice); + $phone = $address_invoice->phone; + $phone .= $phone == '' ? '' : '|'; + $phone .= $address_invoice->phone_mobile; + $payer_additional_info = array( + 'first_name' => $customer_fields['firstname'], + 'last_name' => $customer_fields['lastname'], + 'registration_date' => $customer_fields['date_add'], + 'phone' => array( + 'area_code' => '-', + 'number' => $phone, + ), + 'address' => array( + 'zip_code' => $address_invoice->postcode, + 'street_name' => $address_invoice->address1.' - '.$address_invoice->address2.' - '. + $address_invoice->city.'/'.$address_invoice->country, + 'street_number' => '-', + ), + ); + // Get shipment address for additional_info + $address_delivery = new Address((integer) $cart->id_address_delivery); + $shipments = array( + 'receiver_address' => array( + 'zip_code' => $address_delivery->postcode, + 'street_name' => $address_delivery->address1.' - '.$address_delivery->address2.' - '. + $address_delivery->city.'/'.$address_delivery->country, + 'street_number' => '-', + 'floor' => '-', + 'apartment' => '-', + ), + ); + + $notification_url = $this->link->getModuleLink( + 'mercadopago', + 'notification', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ); + + //aplicar desconto parcela a vista + $installments = 1; + $payment_mode = 'boleto'; + if (isset($post['opcaoPagamentoCreditCard']) && 'Customer' == $post['opcaoPagamentoCreditCard']) { + $installments = (integer) $post['installmentsCust']; + } + + if (isset($post['card_token_id'])) { + $payment_mode = 'cartao'; + } + + $percent = (float) Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'); + + if (count($percent) > 0) { + $this->applyDiscount($cart, $payment_mode, $installments); + } + + $ordelTotal = (double) number_format($cart->getOrderTotal(true, Cart::BOTH), 2, '.', ''); + + $payment_preference = array( + 'transaction_amount' => $ordelTotal, + 'external_reference' => $cart->id, + 'statement_descriptor' => '', + 'payment_method_id' => $post['payment_method_id'], + 'payer' => array( + 'email' => $customer_fields['email'], + ), + + 'additional_info' => array( + 'items' => $items, + 'payer' => $payer_additional_info, + 'shipments' => $shipments, + ), + ); + + if ($post['payment_method_id'] == "webpay") { + $payment_preference['callback_url'] = $this->link->getModuleLink( + 'mercadopago', + 'standardreturn', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ); + $payment_preference['transaction_details']['financial_institution'] = 1234; + $ip = getenv('HTTP_CLIENT_IP')?: + getenv('HTTP_X_FORWARDED_FOR')?: + getenv('HTTP_X_FORWARDED')?: + getenv('HTTP_FORWARDED_FOR')?: + getenv('HTTP_FORWARDED')?: + getenv('REMOTE_ADDR'); + $payment_preference['additional_info']['ip_address'] = $ip; + + //$payment_preference['payer']['entity_type'] = "individual"; + } + + if (isset($post['opcaoPagamentoCreditCard']) && $post['opcaoPagamentoCreditCard'] == 'Cards') { + // salva o cartão + $payment_preference['metadata'] = array( + 'opcao_pagamento' => $post['opcaoPagamentoCreditCard'], + 'customer_id' => $post['customerID'], + 'card_token_id' => $post['card_token_id'], + ); + } + + if (!strrpos($notification_url, 'localhost')) { + $payment_preference['notification_url'] = $notification_url.'?checkout=custom&'; + } + + $payment_preference['description'] = $summary; + // add only for creditcard + if (array_key_exists('card_token_id', $post)) { + // add only it has issuer id + if (array_key_exists('issuersOptions', $post) && $post['issuersOptions'] != '-1') { + $payment_preference['issuer_id'] = (integer) $post['issuersOptions']; + } + + if ('Customer' == $post['opcaoPagamentoCreditCard']) { + $customerID = $post['customerID']; + $payment_preference['payer']['id'] = $customerID; + $payment_preference['installments'] = (integer) $post['installmentsCust']; + } else { + $payment_preference['installments'] = (integer) $post['installments']; + } + $payment_preference['token'] = $post['card_token_id']; + } + + $mercadopago_coupon = isset($post['mercadopago_coupon']) ? $post['mercadopago_coupon'] : ''; + if ($mercadopago_coupon != '') { + $coupon = $this->validCoupon($mercadopago_coupon); + if ($coupon['status'] == 200) { + $payment_preference['campaign_id'] = $coupon['response']['id']; + $payment_preference['coupon_amount'] = (float) $coupon['response']['coupon_amount']; + $payment_preference['coupon_code'] = Tools::strtoupper($mercadopago_coupon); + } else { + PrestaShopLogger::addLog($coupon['response']['error'].Tools::jsonEncode($coupon), MPApi::ERROR, 0); + $this->context->smarty->assign( + array( + 'message_error' => $coupon['response']['error'], + 'version' => $this->getPrestashopVersion(), + ) + ); + + return $this->display(__file__, '/views/templates/front/error_admin.tpl'); + } + } + + // //PRESTASHOP + // if (!$this->mercadopago->isTestUser()) { + // switch (Configuration::get('MERCADOPAGO_COUNTRY')) { + // case 'MLB': + // $payment_preference['sponsor_id'] = 236914421; + // break; + // case 'MLM': + // $payment_preference['sponsor_id'] = 237793014; + // break; + // case 'MLA': + // $payment_preference['sponsor_id'] = 237788409; + // break; + // case 'MCO': + // $payment_preference['sponsor_id'] = 237788769; + // break; + // case 'MLV': + // $payment_preference['sponsor_id'] = 237789083; + // break; + // case 'MLC': + // $payment_preference['sponsor_id'] = 237788173; + // break; + // case 'MPE': + // $payment_preference['sponsor_id'] = 237791025; + // break; + // case 'MLU': + // $payment_preference['sponsor_id'] = 241729464; + // break; + // } + // } + + //GIT HUB + if (!$this->mercadopago->isTestUser()) { + switch (Configuration::get('MERCADOPAGO_COUNTRY')) { + case 'MLB': + $payment_preference['sponsor_id'] = 178326379; + break; + case 'MLM': + $payment_preference['sponsor_id'] = 187899553; + break; + case 'MLA': + $payment_preference['sponsor_id'] = 187899872; + break; + case 'MCO': + $payment_preference['sponsor_id'] = 187900060; + break; + case 'MLV': + $payment_preference['sponsor_id'] = 187900246; + break; + case 'MLC': + $payment_preference['sponsor_id'] = 187900485; + break; + case 'MPE': + $payment_preference['sponsor_id'] = 217182014; + break; + case 'MLU': + $payment_preference['sponsor_id'] = 241730009; + break; + } + } + + $payment_preference['statement_descriptor'] = 'MERCADOPAGO'; + + return $payment_preference; } - public function getExternalPaymentOption() + + private function getPrestashopPreferencesStandard() { - error_log("URL DE ENVIO DO PAGAMENTO====" . $this->context->link->getModuleLink($this->name, "standard", array(), true)); - $country = strtoupper(MPApi::getInstanceMP()->getCountry()); - $externalOption = new PaymentOption(); - $externalOption->setCallToActionText($this->l("Mercado Pago Redirect")) - ->setAction($this->context->link->getModuleLink($this->name, "standard", array(), true)) - ->setInputs([ - "token" => [ - "name" =>"token", - "type" =>"hidden", - "value" =>"12345689", - ], - ]) - ->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name."/views/img/".$country."/mercadopago_468X60.jpg")); - - return $externalOption; + $customer_fields = Context::getContext()->customer->getFields(); + $cart = Context::getContext()->cart; + + // Get costumer data + $address_invoice = new Address((integer) $cart->id_address_invoice); + $phone = $address_invoice->phone; + $phone .= $phone == '' ? '' : '|'; + $phone .= $address_invoice->phone_mobile; + $customer_data = array( + 'first_name' => $customer_fields['firstname'], + 'last_name' => $customer_fields['lastname'], + 'email' => $customer_fields['email'], + 'phone' => array( + 'area_code' => '-', + 'number' => $phone, + ), + 'address' => array( + 'zip_code' => $address_invoice->postcode, + 'street_name' => $address_invoice->address1.' - '.$address_invoice->address2.' - '. + $address_invoice->city.'/'.$address_invoice->country, + 'street_number' => '-', + ), + // just have this data when using credit card + 'identification' => array( + 'number' => '', + 'type' => '', + ), + ); + + // items + $products = $cart->getProducts(); + $items = array(); + $summary = ''; + $round = false; + + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { + $round = true; + } + + foreach ($products as $key => $product) { + $image = Image::getCover($product['id_product']); + $product_image = new Product($product['id_product'], false, Context::getContext()->language->id); + $link = new Link();//because getImageLInk is not static function + $imagePath = $link->getImageLink( + $product_image->link_rewrite, + $image['id_image'], + ImageType::getFormatedName('home') + ); + + $item = array( + 'id' => $product['id_product'], + 'title' => $product['name'], + 'description' => $product['description_short'], + 'quantity' => $product['quantity'], + 'unit_price' => $round ? floor($product['price_wt']) : $product['price_wt'], + 'picture_url' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').$imagePath, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + ); + if ($key == 0) { + $summary .= $product['name']; + } else { + $summary .= ', '.$product['name']; + } + $items[] = $item; + } + + // include wrapping cost + $wrapping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_WRAPPING); + if ($wrapping_cost > 0) { + $item = array( + 'title' => 'Wrapping', + 'description' => 'Wrapping service used by store', + 'quantity' => 1, + 'unit_price' => $round ? floor($wrapping_cost) : $wrapping_cost, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + 'currency_id' => $cart->id_currency, + ); + $items[] = $item; + } + // include discounts + $discounts = (double) $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); + if ($discounts > 0) { + $item = array( + 'title' => 'Discount', + 'description' => 'Discount provided by store', + 'quantity' => 1, + 'unit_price' => -($round ? floor($discounts) : $discounts), + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + ); + $items[] = $item; + } + + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + + if (Configuration::get('MERCADOENVIOS_ACTIVATE') == 'true' && + isset($lista_shipping['MP_CARRIER'][$cart->id_carrier]) + ) { + $dimensions = $this->getDimensions($products); + + $id_mercadoenvios_service_code = $lista_shipping['MP_CARRIER'][$cart->id_carrier]; + $address_delivery = new Address((integer) $cart->id_address_delivery); + $shipments = array( + 'mode' => 'me2', + 'zip_code' => $address_invoice->postcode, + 'default_shipping_method' => $id_mercadoenvios_service_code, + 'dimensions' => $dimensions, + 'receiver_address' => array( + 'floor' => '-', + 'zip_code' => $address_delivery->postcode, + 'street_name' => $address_delivery->address1.' - '.$address_delivery->address2.' - '. + $address_delivery->city.'/'.$address_delivery->country, + 'apartment' => '-', + 'street_number' => '-', + ), + ); + } else { + $shipments = array(); + // include shipping cost + $shipping_cost = (double) $cart->getOrderTotal(true, Cart::ONLY_SHIPPING); + if ($shipping_cost > 0) { + $item = array( + 'title' => 'Shipping', + 'description' => 'Shipping service used by store', + 'quantity' => 1, + 'unit_price' => $round ? floor($shipping_cost) : $shipping_cost, + 'category_id' => Configuration::get('MERCADOPAGO_CATEGORY'), + ); + $items[] = $item; + } + } + $data = array( + 'external_reference' => $cart->id, + 'customer' => $customer_data, + 'items' => $items, + 'shipments' => $shipments, + ); + + // PRESTASHOP + // if (!$this->mercadopago->isTestUser()) { + // switch (Configuration::get('MERCADOPAGO_COUNTRY')) { + // case 'MLB': + // $data['sponsor_id'] = 236914421; + // break; + // case 'MLM': + // $data['sponsor_id'] = 237793014; + // break; + // case 'MLA': + // $data['sponsor_id'] = 237788409; + // break; + // case 'MCO': + // $data['sponsor_id'] = 237788769; + // break; + // case 'MLV': + // $data['sponsor_id'] = 237789083; + // break; + // case 'MLC': + // $data['sponsor_id'] = 237788173; + // break; + // case 'MPE': + // $data['sponsor_id'] = 237791025; + // break; + // case 'MLU': + // $data['sponsor_id'] = 241729464; + // break; + // } + // } + + //GIT HUB + if (!$this->mercadopago->isTestUser()) { + switch (Configuration::get('MERCADOPAGO_COUNTRY')) { + case 'MLB': + $data['sponsor_id'] = 178326379; + break; + case 'MLM': + $data['sponsor_id'] = 187899553; + break; + case 'MLA': + $data['sponsor_id'] = 187899872; + break; + case 'MCO': + $data['sponsor_id'] = 187900060; + break; + case 'MLV': + $data['sponsor_id'] = 187900246; + break; + case 'MLC': + $data['sponsor_id'] = 187900485; + break; + case 'MPE': + $data['sponsor_id'] = 217182014; + break; + case 'MLU': + $data['sponsor_id'] = 241730009; + break; + } + } + $data['auto_return'] = Configuration::get('MERCADOPAGO_AUTO_RETURN') == 'approved' ? 'approved' : ''; + $data['back_urls']['success'] = $this->link->getModuleLink( + 'mercadopago', + 'standardreturn', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ); + $data['back_urls']['failure'] = $this->link->getPageLink( + 'order-opc', + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false, + null + ); + $data['back_urls']['pending'] = $this->link->getModuleLink( + 'mercadopago', + 'standardreturn', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ); + $data['payment_methods']['excluded_payment_methods'] = $this->getExcludedPaymentMethods(); + $data['payment_methods']['excluded_payment_types'] = array(); + $data['payment_methods']['installments'] = (integer) Configuration::get('MERCADOPAGO_INSTALLMENTS'); + $data['notification_url'] = $this->link->getModuleLink( + 'mercadopago', + 'notification', + array(), + Configuration::get('PS_SSL_ENABLED'), + null, + null, + false + ).'?checkout=standard&'; + // swap to payer index since customer is only for transparent + $data['customer']['name'] = $data['customer']['first_name']; + $data['customer']['surname'] = $data['customer']['last_name']; + $data['payer'] = $data['customer']; + unset($data['customer']); + + return $data; } - protected function generateForm() + private function getDimensions($products) { - $months = []; - for ($i = 1; $i <= 12; $i++) { - $months[] = sprintf("%02d", $i); + // pega medidas dos produtos + $width = 0; + $height = 0; + $length = 0; + $weight = 0; + foreach ($products as $product) { + for ($qty = 0; $qty < $product['quantity']; ++$qty) { + $width += $product['width']; + $height += $product['height']; + $length += $product['depth']; + $weight += $product['weight'] * 1000; + } } - $years = []; - for ($i = 0; $i <= 10; $i++) { - $years[] = date("Y", strtotime("+".$i." years")); + $height = ceil($height); + $width = ceil($width); + $length = ceil($length); + $weight = ceil($weight); + + if (!($height > 0 && $length > 0 && $width > 0 && $weight > 0)) { + $error = 'Invalid dimensions cart [height, length, width, weight]'; + PrestaShopLogger::addLog('MercadoPago :: getDimensions = '.$error, MPApi::INFO, 0); + + $this->context->smarty->assign( + $this->setErrorMercadoEnvios( + $error + ) + ); + + throw new Exception($error); } - $this->context->smarty->assign([ - "action" => $this->context->link->getModuleLink($this->name, "validation", array(), true), - "months" => $months, - "years" => $years, - ]); + return $height.'x'.$width.'x'.$length.','.$weight; + } - return $this->context->smarty->fetch("module:paymentexample/views/templates/front/payment_form.tpl"); + public function createStandardCheckoutPreference() + { + $preferences = $this->getPrestashopPreferencesStandard(null); + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + PrestaShopLogger::addLog("=====preferences=====".Tools::jsonEncode($preferences), MPApi::INFO, 0); + } + return $this->mercadopago->createPreference($preferences); } - public function getMappingError($idError) + private function getExcludedPaymentMethods() { - switch ($idError) { - case 'ERROR_PENDING': - $message = $this->l("Unfortunately, the confirmation of your payment failed. - Please contact your merchant for clarification."); - break; - default: - $message = ""; - break; - } - return $message; + $payment_methods = $this->mercadopago->getPaymentMethods(); + $excluded_payment_methods = array(); + + foreach ($payment_methods as $payment_method) { + $pm_variable_name = 'MERCADOPAGO_'.Tools::strtoupper($payment_method['id']); + $value = Configuration::get($pm_variable_name); + + if ($value == 'on') { + $excluded_payment_methods[] = array( + 'id' => $payment_method['id'], + ); + } + } + + return $excluded_payment_methods; } /** - * Get an order by its cart id. - * - * @param int $id_cart Cart id + * salve the token for to use in IPN. * - * @return array Order details + * @param $post + * @param $cart */ - public static function getOrderByCartId($id_cart) + private function saveCard($result) { - $sql = 'SELECT `id_order` - FROM `'._DB_PREFIX_.'orders` - WHERE `id_cart` = '.(int) $id_cart - .Shop::addSqlRestriction().' order by id_order desc'; - $result = Db::getInstance()->getRow($sql); + if (isset($result['response']['metadata'])) { + $token = $result['response']['metadata']['card_token_id']; + $customerID = $result['response']['metadata']['customer_id']; - return isset($result['id_order']) ? $result['id_order'] : false; + $tokenPagamentoJson = array( + 'token' => $token, + ); + $result_response = $this->mercadopago->addCustomerCard($tokenPagamentoJson, $customerID); + return $result_response; + } + return null; } + public function listenIPN($checkout, $topic, $id) + { + $payment_method_ids = array(); + $payment_ids = array(); + $payment_statuses = array(); + $payment_types = array(); + $credit_cards = array(); + $transaction_amounts = 0; + $cardholders = array(); + $external_reference = ''; + $cost_mercadoEnvios = 0; + $isMercadoEnvios = 0; + + + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + PrestaShopLogger::addLog('MercadoPago :: listenIPN - topic = '.$topic, MPApi::INFO, 0); + PrestaShopLogger::addLog('MercadoPago :: listenIPN - id = '.$id, MPApi::INFO, 0); + PrestaShopLogger::addLog('MercadoPago :: listenIPN - checkout = '.$checkout, MPApi::INFO, 0); + } + + if ($checkout == 'standard' && $topic == 'merchant_order' && $id > 0) { + $result = $this->mercadopago->getMerchantOrder($id); + error_log("====checkout=====".$checkout); + error_log(print_r($result, true)); + + $merchant_order_info = $result['response']; + + // check value + $cart = new Cart($merchant_order_info['external_reference']); + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { + $total = floor($cart->getOrderTotal(true, Cart::BOTH)); + } else { + $total = (float)$cart->getOrderTotal(true, Cart::BOTH); + } + + // check the module + $id_order = $this->getOrderByCartId($merchant_order_info['external_reference']); + $order = new Order($id_order); + $total_amount = $merchant_order_info['total_amount']; + + if ($total_amount != $total) { + PrestaShopLogger::addLog('MercadoPago :: listenIPN - Não atualizou o pedido, valores diferentes'. + ' id = '.$id, MPApi::INFO, 0); + error_log('MercadoPago :: listenIPN - Não atualizou o pedido, valores diferentes'); + return; + } + $status_shipment = null; + if (isset($merchant_order_info['shipments'][0]) && + $merchant_order_info['shipments'][0]['shipping_mode'] == 'me2') { + $isMercadoEnvios = true; + $cost_mercadoEnvios = $merchant_order_info['shipments'][0]['shipping_option']['cost']; + + $status_shipment = $merchant_order_info['shipments'][0]['status']; + + $id_order = $this->getOrderByCartId($merchant_order_info['external_reference']); + $order = new Order($id_order); + $order_status = null; + switch ($status_shipment) { + case 'ready_to_ship': + $order_status = 'MERCADOPAGO_STATUS_8'; + break; + case 'shipped': + $order_status = 'MERCADOPAGO_STATUS_9'; + break; + case 'delivered': + $order_status = 'MERCADOPAGO_STATUS_10'; + break; + } + if ($order_status != null) { + $existStates = $this->checkStateExist($id_order, Configuration::get($order_status)); + if ($existStates) { + error_log('MercadoPago :: listenIPN - existStates'); + return; + } + $this->updateOrderHistory($order->id, Configuration::get($order_status)); + } + error_log('MercadoPago :: listenIPN - return'); + return; + } + $payments = $merchant_order_info['payments']; + $external_reference = $merchant_order_info['external_reference']; + foreach ($payments as $payment) { + // get payment info + $result = $this->mercadopago->getPaymentStandard($payment['id']); + $payment_info = $result['response']['collection']; + // colect payment details + $payment_ids[] = $payment_info['id']; + $payment_statuses[] = $payment_info['status']; + $payment_types[] = $payment_info['payment_type']; + $transaction_amounts += $payment_info['transaction_amount']; + if ($payment_info['payment_type'] == 'credit_card') { + $payment_method_ids[] = isset($payment_info['payment_method_id']) ? + $payment_info['payment_method_id'] : ''; + $credit_cards[] = isset($payment_info['card']['last_four_digits']) ? + '**** **** **** '.$payment_info['card']['last_four_digits'] : ''; + $cardholders[] = isset($payment_info['card']['cardholder']['name']) ? + $payment_info['card']['cardholder']['name'] : ''; + } + } + + if ($merchant_order_info['total_amount'] == $transaction_amounts) { + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MCO') { + $transaction_amounts = $cart->getOrderTotal(true, Cart::BOTH); + } + if ($isMercadoEnvios) { + $transaction_amounts += $cost_mercadoEnvios; + } + $this->updateOrder( + $payment_ids, + $payment_statuses, + $payment_method_ids, + $payment_types, + $credit_cards, + $cardholders, + $transaction_amounts, + $external_reference, + $result + ); + } + } elseif (($checkout == 'custom' || $checkout == 'pos') && $topic == 'payment' && $id > 0) { + $result = $this->mercadopago->getPayment($id); + + $payment_info = $result['response']; + error_log(print_r($payment_info, true)); + $external_reference = $payment_info['external_reference']; + + $id_order = $this->getOrderByCartId($external_reference); + $order = new Order($id_order); + + // colect payment details + $payment_ids[] = $payment_info['id']; + $payment_statuses[] = $payment_info['status']; + $payment_types[] = $payment_info['payment_type_id']; + $transaction_amounts += $payment_info['transaction_amount']; + if ($payment_info['payment_type_id'] == 'credit_card') { + $payment_method_ids[] = $payment_info['payment_method_id']; + $credit_cards[] = '**** **** **** '.$payment_info['card']['last_four_digits']; + $cardholders[] = $payment_info['card']['cardholder']['name']; + } + + $this->updateOrder( + $payment_ids, + $payment_statuses, + $payment_method_ids, + $payment_types, + $credit_cards, + $cardholders, + $transaction_amounts, + $external_reference, + $result + ); + } + } + + /** + * Verify if there is state approved for order. + */ + public static function getOrderStateApproved($id_order) + { + return (bool) Db::getInstance()->getValue( + ' + SELECT `id_order_state` + FROM '._DB_PREFIX_.'order_history + WHERE `id_order` = '.(int) $id_order.' + AND `id_order_state` = '. + (int) Configuration::get('MERCADOPAGO_STATUS_1') + ); + } + + /** + * Verify if there is state approved for order. + */ + public static function checkStateExist($id_order, $id_order_state) + { + return (bool) Db::getInstance()->getValue( + ' + SELECT `id_order_state` + FROM '._DB_PREFIX_.'order_history + WHERE `id_order` = '.(int) $id_order.' + AND `id_order_state` = '. + (int) $id_order_state + ); + } + + private function updateOrder( + $payment_ids, + $payment_statuses, + $payment_method_ids, + $payment_types, + $credit_cards, + $cardholders, + $transaction_amounts, + $external_reference, + $result + ) { + $order = null; + + error_log('MercadoPago :: updateOrder'); + // if has two creditcard validate whether payment has same status in order to continue validating order + if (count($payment_statuses) == 1 || + (count($payment_statuses) == 2 && $payment_statuses[0] == $payment_statuses[1])) { + $order = null; + $order_status = null; + $payment_status = $payment_statuses[0]; + $payment_type = $payment_types[0]; + error_log('MercadoPago :: updateOrder 1'); + switch ($payment_status) { + case 'in_process': + $order_status = 'MERCADOPAGO_STATUS_0'; + break; + case 'approved': + $order_status = 'MERCADOPAGO_STATUS_1'; + break; + case 'cancelled': + $order_status = 'MERCADOPAGO_STATUS_2'; + break; + case 'refunded': + $order_status = 'MERCADOPAGO_STATUS_4'; + break; + case 'charged_back': + $order_status = 'MERCADOPAGO_STATUS_5'; + break; + case 'in_mediation': + $order_status = 'MERCADOPAGO_STATUS_6'; + break; + case 'pending': + $order_status = 'MERCADOPAGO_STATUS_7'; + break; + case 'rejected': + $order_status = 'MERCADOPAGO_STATUS_3'; + break; + case 'ready_to_ship': + $order_status = 'MERCADOPAGO_STATUS_8'; + break; + case 'shipped': + $order_status = 'MERCADOPAGO_STATUS_9'; + break; + case 'delivered': + $order_status = 'MERCADOPAGO_STATUS_10'; + break; + } + if ($payment_type == 'credit_card' && + $payment_status == 'approved') { + $this->saveCard($result); + } + // just change if there is an order status + if ($order_status) { + $id_cart = $external_reference; + $id_order = $this->getOrderByCartId($id_cart); + if ($id_order) { + $order = new Order($id_order); + + $existStates = $this->checkStateExist( + $id_order, + Configuration::get($order_status) + ); + if ($existStates) { + return; + } + } + // If order wasn't created yet and payment is approved or pending or in_process, create it. + // This can happen when user closes checkout standard + if (empty($id_order) && ($payment_status == 'in_process' || $payment_status == 'approved' || + $payment_status == 'pending') + ) { + $cart = new Cart($id_cart); + $total = (double) number_format($transaction_amounts, 2, '.', ''); + $extra_vars = array( + '{bankwire_owner}' => $this->textshowemail, + '{bankwire_details}' => '', + '{bankwire_address}' => '', + ); + $id_order = !$id_order ? $this->getOrderByCartId($id_cart) : $id_order; + $order = new Order($id_order); + $existStates = $this->checkStateExist($id_order, Configuration::get($order_status)); + if ($existStates) { + return; + } + + $displayName = UtilMercadoPago::setNamePaymentType($payment_type); + + $this->validateOrder( + $id_cart, + Configuration::get($order_status), + $total, + $displayName, + null, + $extra_vars, + $cart->id_currency, + false, + $cart->secure_key + ); + } elseif (!empty($order) && $order->current_state != null && + $order->current_state != Configuration::get($order_status)) { + $id_order = !$id_order ? $this->getOrderByCartId($id_cart) : $id_order; + $order = new Order($id_order); + /* + * this is necessary to ignore the transactions with the same + * external reference and states diferents + * the transaction approved cant to change the status, except refunded. + */ + if ($payment_status == 'cancelled' || $payment_status == 'rejected') { + error_log('MercadoPago :: updateOrder 2'); + // check if is mercadopago + if ($order->module == "mercadopago") { + error_log('MercadoPago :: updateOrder 3'); + $retorno = $this->getOrderStateApproved($id_order); + if ($retorno) { + error_log('MercadoPago :: updateOrder 4'); + return; + } + } else { + return; + } + } + $this->updateOrderHistory($order->id, Configuration::get($order_status)); + + // Cancel the order to force products to go to stock. + switch ($payment_status) { + case 'cancelled': + case 'refunded': + case 'rejected': + error_log('MercadoPago :: updateOrder 5'); + $this->updateOrderHistory($id_order, Configuration::get('PS_OS_CANCELED'), false); + break; + } + } + if ($order) { + // update order payment information + $order_payments = $order->getOrderPayments(); + foreach ($order_payments as $order_payment) { + $order_payment->transaction_id = implode(' / ', $payment_ids); + if ($payment_type == 'credit_card') { + $order_payment->card_number = implode(' / ', $credit_cards); + $order_payment->card_brand = implode(' / ', $payment_method_ids); + $order_payment->card_holder = implode(' / ', $cardholders); + } + $order_payment->save(); + } + } + } + } + } + + /** + * Return the customerID. + */ + private function getCustomerCards($customerID) + { + $responseCustomer = $this->mercadopago->getCustomerCards($customerID); + + return $responseCustomer; + } + + /** + * Return the customerID. + */ + private function getCustomerID() + { + $customer_fields = Context::getContext()->customer->getFields(); + $emailCustomer = $customer_fields['email']; + $customerData = array(); + $customerData['email'] = $emailCustomer; + $responseCustomer = $this->mercadopago->getCustomer($customerData); + + $customerID = null; + if ($responseCustomer['status'] == 200 && $responseCustomer['response']['paging']['total'] > 0) { + $customerID = $responseCustomer['response']['results'][0]['id']; + } else { + if ($customerID == null || empty($customerID)) { + $customerData = array(); + $customerData['email'] = $emailCustomer; + $customer = $this->mercadopago->createCustomerCard($customerData); + + if (isset($customer['response']['status']) && $customer['response']['status'] == 200) { + $customerID = $customer['response']['id']; + } + } + } + + return $customerID; + } + + public function updateOrderHistory($id_order, $status, $mail = true) + { + error_log('MercadoPago :: updateOrderHistory - ' . $id_order); + // Change order state and send email + $history = new OrderHistory(); + $history->id_order = (integer) $id_order; + $history->changeIdOrderState((integer) $status, (integer) $id_order, true); + if ($mail) { + $extra_vars = array(); + $history->addWithemail(true, $extra_vars); + } + } + + public function setCarriers() + { + $country = $this->getCountry( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); + $normal = self::$countryOptions[$country]['normal']; + $expresso = self::$countryOptions[$country]['expresso']; + + $carrierConfig = array( + 0 => array('name' => $normal['label'], + 'carrier_code' => $normal['value'], + 'id_tax_rules_group' => 0, + 'active' => true, + 'deleted' => 0, + 'shipping_handling' => false, + 'range_behavior' => 0, + 'delay' => array( + 'ar' => "Después de la publicación, recibirá el producto en", + 'br' => "Após a postagem, você o receberá o produto em até", + 'mx' => "Después de la publicación, recibirá el producto en", + 'es' => "After the posting, you will receive the product within", + Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')) => $normal['description'], + ), + 'id_zone' => 1, + 'is_module' => true, + 'shipping_external' => true, + 'external_module_name' => 'mercadopago', + 'need_range' => true, + ), + 1 => array('name' => $expresso['label'], + 'carrier_code' => $expresso['value'], + 'id_tax_rules_group' => 0, + 'active' => true, + 'deleted' => 0, + 'shipping_handling' => false, + 'range_behavior' => 0, + 'delay' => array( + 'ar' => "Después de la publicación, recibirá el producto en", + 'br' => "Após a postagem, você o receberá o produto em até", + 'mx' => "Después de la publicación, recibirá el producto en", + 'es' => "After the posting, you will receive the product within", + Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')) => $expresso['description'], + ), + 'id_zone' => 1, + 'is_module' => true, + 'shipping_external' => true, + 'external_module_name' => 'mercadopago', + 'need_range' => true, + ), + ); + + $id_carrier1 = $this->installExternalCarrier($carrierConfig[0]); + $id_carrier2 = $this->installExternalCarrier($carrierConfig[1]); + + Configuration::updateValue('MERCADOPAGO_CARRIER_ID_1', (int) $id_carrier1); + Configuration::updateValue('MERCADOPAGO_CARRIER_ID_2', (int) $id_carrier2); + + $shipping = array(); + + $shipping['MP_CARRIER'][$id_carrier1] = $normal['value']; + $shipping['MP_CARRIER'][$id_carrier2] = $expresso['value']; + + $shipping['MP_SHIPPING'][$normal['value']] = $id_carrier1; + $shipping['MP_SHIPPING'][$expresso['value']] = $id_carrier2; + + self::$listShipping = $shipping; + + Configuration::updateValue( + 'MERCADOPAGO_CARRIER', + Tools::jsonEncode($shipping) + ); + } + + public function hookdisplayBeforeCarrier($params) + { + if (!isset($this->context->smarty->tpl_vars['delivery_option_list'])) { + return; + } + + //global $appended_text; + $mercado_envios_activate = Configuration::get('MERCADOENVIOS_ACTIVATE'); + if (empty($mercado_envios_activate) || + $mercado_envios_activate == "false") { + return; + } + + // Init var + $address = new Address($params['cart']->id_address_delivery); + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + + $delivery_option_list = $this->context->smarty->tpl_vars['delivery_option_list']; + $retornoCalculadora = $this->calculateListCache($address->postcode); + + $mpCarrier = $lista_shipping['MP_SHIPPING']; + + foreach ($delivery_option_list->value as $id_address) { + foreach ($id_address as $key) { + foreach ($key['carrier_list'] as $id_carrier) { + //$obj_carrier = $delivery_option_list_param[$id_address]; + if (in_array($id_carrier['instance']->id, $mpCarrier)) { + if (isset($lista_shipping['MP_CARRIER'][(int)$id_carrier['instance']->id])) { + $id_mercadoenvios_service_code = $lista_shipping['MP_CARRIER'][$id_carrier['instance']->id]; + $calculadora = $retornoCalculadora[(string) $id_mercadoenvios_service_code]; + $msg = $calculadora['estimated_delivery'].' '.$this->l('working days.'); + + $id_carrier['instance']->delay[$this->context->cart->id_lang] = + $this->l('After the post, receive the product ').$msg; + } + } + } + } + } + } + + private function calculateListCache($postcode) + { + $cart = Context::getContext()->cart; + $products = $cart->getProducts(); + $price_total = 0; + foreach ($products as $product) { + for ($qty = 0; $qty < $product['quantity']; ++$qty) { + $price_total += $product['price_wt']; + } + } + + $external_reference = $cart->id; + + $chave = $external_reference. + '|'. + $postcode.''. + $price_total; + + if (isset(self::$listCache[$chave])) { + return self::$listCache[$chave]; + } else { + $retorno = $this->calculateList($postcode); + self::$listCache[$chave] = $retorno; + return $retorno; + } + } + + private function calculateList($postcode) + { + $cart = Context::getContext()->cart; + $products = $cart->getProducts(); + $price_total = 0; + + $mp = $this->mercadopago; + + // pega medidas dos produtos + $width = 0; + $height = 0; + $length = 0; + $weight = 0; + foreach ($products as $product) { + for ($qty = 0; $qty < $product['quantity']; ++$qty) { + if ($product['width'] == 0) { + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + $error = 'Invalid dimensions cart [width].'; + PrestaShopLogger::addLog("=====dimensions=====". + $error, MPApi::ERROR, 0); + } + + $this->context->smarty->assign( + $this->setErrorMercadoEnvios( + $error + ) + ); + return; + } + + $price_total += $product['price_wt']; + $width += $product['width']; + $height += $product['height']; + $length += $product['depth']; + $weight += $product['weight'] * 1000; + } + } + + $height = ceil($height); + $width = ceil($width); + $length = ceil($length); + $weight = ceil($weight); + + if (!($height > 0 && $length > 0 && $width > 0 && $weight > 0)) { + $error = 'Invalid dimensions cart [height,length, width, weight].'; + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + PrestaShopLogger::addLog("=====dimensions=====".$error, MPApi::ERROR, 0); + } + + $this->context->smarty->assign( + $this->setErrorMercadoEnvios($error) + ); + + return; + //throw new Exception($error); + } + + $dimensions = $height.'x'.$width.'x'.$length.','.$weight; + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MLB') { + $postcode = str_replace('-', '', $postcode); + } /*elseif (Configuration::get('MERCADOPAGO_COUNTRY') == 'MLA') { + $postcode = Tools::substr($postcode, 1); + }*/ + + $return = array(); + $paramsMP = array( + 'dimensions' => $dimensions, + 'zip_code' => $postcode, + //'zip_code' => "5700", + 'item_price' => (double) number_format($price_total, 2, '.', ''), + 'free_method' => '', // optional + ); + + $response = $mp->calculateEnvios($paramsMP); + + if ($response['status'] == '200' && isset($response['response']['options'])) { + $shipping_options = $response['response']['options']; + foreach ($shipping_options as $shipping_option) { + $value = $shipping_option['shipping_method_id']; + $shipping_speed = $shipping_option['estimated_delivery_time']['shipping']; + + $return[$value] = array( + 'name' => $shipping_option['name'], + 'checked' => $shipping_option['display'], + 'shipping_speed' => $shipping_speed, + 'estimated_delivery' => $shipping_speed < 24 ? 1 : ceil($shipping_speed / 24), + 'cost' => $shipping_option['cost'] == 0 ? 'FREE' : $shipping_option['cost'], + ); + } + } else { + $this->context->smarty->assign( + 'mensagem', + $this->errorMercadoEnvios( + $response + ) + ); + + return; + } + + return $return; + } + + private function setErrorMercadoEnvios($messageError) + { + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + + $errorShipment = array( + 'mensagem' => $this->l($messageError), + 'code_shipment' => Tools::jsonEncode($lista_shipping['MP_CARRIER']), + ); + + return $errorShipment; + } + + private function errorMercadoEnvios($response) + { + $mensagem = ''; + + if ($this->context->customer->isLogged()) { + $status = $response['status']; + if ($status == 200) { + $mensagem = $this->l('Mercado Envios not loading.'); + } else { + $error = $response['response']['error']; + if ($error == 'invalid_zip_code') { + $mensagem = $this->l('Invalid zip code.'); + + return $mensagem; + } + switch ($status) { + case 404: + $mensagem = $this->l('Not found receiver address.'); + break; + case 400: + $mensagem = $this->l('Invalid dimensions.'); + break; + default: + $mensagem = $this->l('Mercado Envios not loading.'); + break; + } + } + } + return $mensagem; + } + + + public function getOrderShippingCostExternal($params) + { + return $this->getOrderShippingCost($params, 0); + } + + public function getOrderShippingCost($params, $shipping_cost) + { + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + + $mpCarrier = $lista_shipping['MP_SHIPPING']; + if (in_array($this->id_carrier, $mpCarrier)) { + $retorno = $this->verifyCache($params, $this->id_carrier); + $shipping_cost = (float) $retorno['cost']; + if ($retorno != null) { + return $shipping_cost; + } + } + + return false; + } + + private function verifyCache($params, $id_carrier) + { + $cart = Context::getContext()->cart; + $products = $cart->getProducts(); + $price_total = 0; + foreach ($products as $product) { + for ($qty = 0; $qty < $product['quantity']; ++$qty) { + $price_total += $product['price_wt']; + } + } + + $address = new Address($params->id_address_delivery); + $postcode = $address->postcode; + + $external_reference = $cart->id; + + $chave = $external_reference. + '|'. + $id_carrier.''. + $postcode.''. + $price_total; + + if (array_key_exists($chave, self::$listCache)) { + return self::$listCache[$chave]; + } else { + $retorno = $this->calculate($params, $id_carrier); + self::$listCache[$chave] = $retorno; + + return $retorno; + } + } + + private function calculate($params, $id_carrier) + { + $lista_shipping = (array) Tools::jsonDecode( + Configuration::get('MERCADOPAGO_CARRIER'), + true + ); + $id_mercadoenvios_service_code = $lista_shipping['MP_CARRIER'][$id_carrier]; + + $cart = Context::getContext()->cart; + $price_total = 0; + + // Init var + $address = new Address($params->id_address_delivery); + $products = $cart->getProducts(); + $mp = $this->mercadopago; + + // pega medidas dos produtos + $width = 0; + $height = 0; + $length = 0; + $weight = 0; + foreach ($products as $product) { + for ($qty = 0; $qty < $product['quantity']; ++$qty) { + $price_total += $product['price_wt']; + $width += $product['width']; + $height += $product['height']; + $length += $product['depth']; + $weight += $product['weight'] * 1000; + } + } + + $height = ceil($height); + $width = ceil($width); + $length = ceil($length); + $weight = ceil($weight); + + if (!($height > 0 && $length > 0 && $width > 0 && $weight > 0)) { + $error = 'Invalid dimensions cart [height, length, width, weight]'; + PrestaShopLogger::addLog("=====calculate=====".$error, MPApi::ERROR, 0); + // throw new Exception($error); + } + + $dimensions = $height.'x'.$width.'x'.$length.','.$weight; + + $postcode = $address->postcode; + if (Configuration::get('MERCADOPAGO_COUNTRY') == 'MLB') { + $postcode = str_replace('-', '', $postcode); + } /*elseif (Configuration::get('MERCADOPAGO_COUNTRY') == 'MLA') { + $postcode = Tools::substr($postcode, 1); + }*/ + $return = null; + $paramsMP = array( + 'dimensions' => $dimensions, + + 'zip_code' => $postcode, + //'zip_code' => '5700', + + 'item_price' => (double) number_format($price_total, 2, '.', ''), + 'free_method' => '', // optional + ); + + $response = $mp->calculateEnvios($paramsMP); + if ($response['status'] == '200' && isset($response['response']['options'])) { + $shipping_options = $response['response']['options']; + foreach ($shipping_options as $shipping_option) { + $value = $shipping_option['shipping_method_id']; + $shipping_speed = $shipping_option['estimated_delivery_time']['shipping']; + if ($value == $id_mercadoenvios_service_code) { + $return = array( + 'name' => $shipping_option['name'], + 'checked' => $shipping_option['display'] == 'recommended' ? "checked='checked'" : '', + 'shipping_speed' => $shipping_speed, + 'estimated_delivery' => $shipping_speed < 24 ? 1 : ceil($shipping_speed / 24), + 'cost' => $shipping_option['cost'] == 0 ? 'FREE' : $shipping_option['cost'], + ); + break; + } + } + } else { + $this->context->smarty->assign( + $this->setErrorMercadoEnvios( + $this->errorMercadoEnvios( + $response + ) + ) + ); + } + + return $return; + } + public static function installExternalCarrier($config) + { + $carrier = new Carrier(); + $carrier->name = $config['name']; + $carrier->id_tax_rules_group = $config['id_tax_rules_group']; + $carrier->id_zone = $config['id_zone']; + $carrier->active = $config['active']; + $carrier->deleted = $config['deleted']; + $carrier->delay = $config['delay']; + $carrier->shipping_handling = $config['shipping_handling']; + $carrier->range_behavior = $config['range_behavior']; + $carrier->is_module = $config['is_module']; + $carrier->shipping_external = $config['shipping_external']; + $carrier->external_module_name = $config['external_module_name']; + $carrier->need_range = $config['need_range']; + + $languages = Language::getLanguages(true); + foreach ($languages as $language) { + if ($language['iso_code'] == 'br') { + $carrier->delay[(int) $language['id_lang']] = $config['delay'][$language['iso_code']]; + } elseif ($language['iso_code'] == 'es') { + $carrier->delay[(int) $language['id_lang']] = $config['delay'][$language['iso_code']]; + } elseif ($language['iso_code'] == Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'))) { + $carrier->delay[(int) $language['id_lang']] = $config['delay'][$language['iso_code']]; + } + } + + if ($carrier->add()) { + $groups = Group::getGroups(true); + foreach ($groups as $group) { + Db::getInstance()->autoExecute( + _DB_PREFIX_.'carrier_group', + array('id_carrier' => (int) ($carrier->id), + 'id_group' => (int) ($group['id_group']), + ), + 'INSERT' + ); + } + + $rangePrice = new RangePrice(); + $rangePrice->id_carrier = $carrier->id; + $rangePrice->delimiter1 = '0'; + $rangePrice->delimiter2 = '10000'; + $rangePrice->add(); + + $rangeWeight = new RangeWeight(); + $rangeWeight->id_carrier = $carrier->id; + $rangeWeight->delimiter1 = '0'; + $rangeWeight->delimiter2 = '30.000'; + $rangeWeight->add(); + + $zones = Zone::getZones(true); + foreach ($zones as $zone) { + Db::getInstance()->autoExecute( + _DB_PREFIX_.'carrier_zone', + array('id_carrier' => (int) ($carrier->id), + 'id_zone' => (int) ($zone['id_zone']), + ), + 'INSERT' + ); + Db::getInstance()->autoExecuteWithNullValues( + _DB_PREFIX_.'delivery', + array('id_carrier' => (int) ($carrier->id), + 'id_range_price' => (int) ($rangePrice->id), + 'id_range_weight' => null, + 'id_zone' => (int) ($zone['id_zone']), + 'price' => '0', + ), + 'INSERT' + ); + Db::getInstance()->autoExecuteWithNullValues( + _DB_PREFIX_.'delivery', + array('id_carrier' => (int) ($carrier->id), + 'id_range_price' => null, + 'id_range_weight' => (int) ($rangeWeight->id), + 'id_zone' => (int) ($zone['id_zone']), + 'price' => '0', + ), + 'INSERT' + ); + } + + // Copy Logo + @copy(dirname(__FILE__).'/views/img/carrier.jpg', _PS_SHIP_IMG_DIR_.'/'.(int) $carrier->id.'.jpg'); + + // Return ID Carrier + return (int) ($carrier->id); + } + + return false; + } + + /** + * Get an order by its cart id. + * + * @param int $id_cart Cart id + * + * @return array Order details + */ + public static function getOrderByCartId($id_cart) + { + $sql = 'SELECT `id_order` + FROM `'._DB_PREFIX_.'orders` + WHERE `id_cart` = '.(int) $id_cart + .Shop::addSqlRestriction().' order by id_order desc'; + $result = Db::getInstance()->getRow($sql); + + return isset($result['id_order']) ? $result['id_order'] : false; + } + + public function applyDiscount($cart, $payment_mode, $installments = 1) + { + $percent = (float) Configuration::get('MERCADOPAGO_DISCOUNT_PERCENT'); + + $credit_card = (int) Configuration::get('MERCADOPAGO_ACTIVE_CREDITCARD'); + $boleto = (int) Configuration::get('MERCADOPAGO_ACTIVE_BOLETO'); + + $rules = $cart->getCartRules(); + $discount_name = 'Desconto Mercado Pago Cart-ID=' . $cart->id; + + foreach ($rules as $value) { + if ($value['name'] == $discount_name) { + return $value['id_cart_rule']; + } + } + + if (count($percent) > 0) { + if (($credit_card && $payment_mode == 'cartao') || ($boleto && $payment_mode == 'boleto')) { + if ($installments == 1) { + $cart_rule = new CartRule(); + $cart_rule->reduction_percent = $percent; + $cart_rule->reduction_amount = 0; + $cart_rule->active = true; + $cart_rule->date_from = date('Y-m-d H:i:s'); + $cart_rule->date_to = date( + 'Y-m-d H:i:s', + mktime(0, 0, 0, date("m"), date("d"), date("Y") + 10) + ); + $cart_rule->partial_use = false; + $cart_rule->quantity = 9; + $cart_rule->quantity_per_user = 9; + $cart_rule->code = $cart->id . '-DISCOUNT-MP'; + foreach (Language::getLanguages(true) as $lang) { + $cart_rule->name[$lang['id_lang']] = $discount_name; + } + + $cart_rule->save(); + + $cart->addCartRule($cart_rule->id); + return $cart_rule->id; + } + } + } + return null; + } + + + public function uninstallModule() + { + Configuration::updateValue('MERCADOPAGO_CREDITCARD_ACTIVE', false); + Configuration::updateValue('MERCADOPAGO_CUSTOM_BOLETO', false); + Configuration::updateValue('MERCADOPAGO_STANDARD_ACTIVE', false); + + Configuration::updateValue('MERCADOPAGO_TWO_CARDS', false); + Configuration::updateValue('MERCADOPAGO_COUPON_ACTIVE', false); + Configuration::updateValue('MERCADOPAGO_POINT', false); + Configuration::updateValue('MERCADOENVIOS_ACTIVATE', false); + } + + public function setSettings() + { + if ($this->hasCredential()) { + $mp = new MPApi( + Configuration::get('MERCADOPAGO_CLIENT_ID'), + Configuration::get('MERCADOPAGO_CLIENT_SECRET') + ); + + $request = array( + "platform_version" => _PS_VERSION_, + "two_cards" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOPAGO_TWO_CARDS') + ), + "mercado_envios" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOENVIOS_ACTIVATE') + ), + "checkout_custom_ticket" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOPAGO_CUSTOM_BOLETO') + ), + "checkout_custom_credit_card_coupon" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOPAGO_COUPON_ACTIVE') + ), + "checkout_basic" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOPAGO_STANDARD_ACTIVE') + ), + "checkout_custom_credit_card" => UtilMercadoPago::checkValueNull( + Configuration::get('MERCADOPAGO_CREDITCARD_ACTIVE') + ), + "code_version" => phpversion(), + "module_version" => $this->version, + "platform" => "PrestaShop", + ); + + try { + $mp->saveSettings($request); + } catch (Exception $e) { + if (Configuration::get('MERCADOPAGO_LOG') == 'true') { + PrestaShopLogger::addLog("=====settings=====".$e->getMessage(), MPApi::ERROR, 0); + } + } + } + } + + public function getPrestashopVersion() + { + if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { + $version = 7; + } elseif (version_compare(_PS_VERSION_, '1.6.0.1', '>=')) { + $version = 6; + } elseif (version_compare(_PS_VERSION_, '1.5.0.1', '>=')) { + $version = 5; + } else { + $version = 4; + } + + return $version; + } } diff --git a/v1.6.x/mercadopago/pos.json b/v1.6.x/mercadopago/pos.json new file mode 100644 index 0000000..abd967f --- /dev/null +++ b/v1.6.x/mercadopago/pos.json @@ -0,0 +1,21 @@ +{ + "points": [{ + "poi": "50894589", + "poi_type": "ABECS_PAX_D200_GPRS", + "model": "I", + "label": "Restaurante 1" + }, + { + "poi": "456", + "poi_type": "ABECS_PAX_D100", + "model": "H", + "label": "Restaurante 2" + }, + { + "poi": "789", + "poi_type": "ABECS_PAX_D80", + "model": "H", + "label": "Restaurante 3" + } + ] +} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/css/backoffice.css b/v1.6.x/mercadopago/views/css/backoffice.css deleted file mode 100644 index d18b6e1..0000000 --- a/v1.6.x/mercadopago/views/css/backoffice.css +++ /dev/null @@ -1,284 +0,0 @@ -.panel-presentation { - padding-left: 0px !important; - padding-right: 0px !important; -} -.mercadopago-tabs { - margin: 0; - padding: 0; -} -.mercadopago-tabs nav { - padding: 0; - margin: 30px 0 0 0; - display: block; -} -.mercadopago-tabs nav a { - padding: 8px 12px; - background-color: none; - color: #00aff0; - text-decoration: none; - margin: 0 5px 0 1px; - font-size: 15px; - vertical-align: top; - position: relative; - top: -5px; - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - text-transform: uppercase; -} -.mercadopago-tabs nav a:hover { - border: 1px solid #ddd; - border-bottom: none; - border-radius: 3px 3px 0 0; - margin: 0 4px 0 0; - text-decoration: none; - color: #0077a4; -} -.mercadopago-tabs nav a.active { - border-radius: 3px 3px 0 0; - background-color: #F5F8F9; - text-decoration: none; - border: 1px solid #ccc; - border-bottom: none; - margin: 0 4px 0 0; - font-size: 15px; - color: #000; -} -.mercadopago-tabs .content { - margin: 0; - padding: 10px; - background-color: #F5F8F9; - border: 1px solid #ccc; - border-radius: 0 3px 3px 3px; -} - -.payment-config-logo { - height: 35px !important; -} -.payment-config-tooltip { - height: 30px; - width: 30px; - padding: 0 0 10px 10px; - cursor: pointer; -} -.border-none { - border: none !important; -} -.payment-label { - margin-bottom: 0 !important; - padding-top: 7px; - font-size: 13px; - font-weight: normal !important; - color: #666; -} -.form-group { - border-top: 1px solid #eee; - padding: 15px 0; - margin: 0 !important; -} -.logo-wrapper { - text-align:right; - padding-right: 10px; -} -.switch-label { - padding-right: 20px !important; -} - -.general-tooltip { - font: 12px "Open Sans",Helvetica,Arial,sans-serif; - font-style: italic; - color: #959595; - font-weight: normal !important; - margin-top: 5px; -} - -.clear { - clear: both; -} -.align-right { - text-align: right; -} -.pres-header-logo { - border-bottom: 1px solid #eee; - padding-bottom: 25px; - text-align: center; -} -.pres-header-group { - margin-top: 10px; -} -.pres-logo { - height: 50px !important; -} -.pres-content { - padding-top: 25px; -} -.pres-content-img { - text-align: center; -} -.pres-content-wrapper { - padding-bottom: 40px; -} -.pres-content-bottom { - border-top: 1px solid #eee; -} -.pres-header-text { - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - font-size: 21px; -} -.pres-about-image { - width: 100%; - max-width: 400px; -} -.pres-title { - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - font-size: 21px; - font-weight: bold; - color: #009EE3; -} -.pres-content-wrapper p { - padding: 15px 0 0; - font-size: 13px !important; - line-height: 24px; -} -.pres-content ul{ - padding: 0 0 0 20px; - font-size: 13px !important; - line-height: 24px; -} -.pres-signup { - text-decoration: none; -} -.pres-signup:hover { - color: #009EE3 !important; - text-decoration: none !important; -} -.pres-btn-signup { - width: auto; - height: 40px; - margin-top: 20px; - padding: 12px 40px 12px 40px; - background-color: #2D3277; - font-size: 16px !important; - font-weight: bold; - color: #fff !important; - text-align: center; - text-decoration: none; - text-transform: uppercase; -} -.pres-btn-signup:hover { - background-color: #009EE3; - color: #fff !important; - text-decoration: none !important; - transition: all 0.3s; -} -.pres-footer { - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - font-size: 16px; - font-weight: 400; - padding-top: 30px; - text-align: right; - text-transform: lowercase; - background: none !important; -} -.padtop-20 { - padding-top: 20px !important; -} -.pres-circle { - width: 130px; - height: 130px; - margin:0 auto; - margin-top: 5px; - font-size: 61px; - font-weight: bold; - text-align: center -} -.pres-uppercase { - text-transform: uppercase; -} -.pres-firt-uppercase { - display: block; - text-transform: uppercase; - -} -.step-title { - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - font-size: 21px; - font-weight: bold; - color: #009EE3; - text-align: center; - cursor: pointer; - padding-top: 40px; - height: 100px; -} -.step-title a { - font-family: "Ubuntu Condensed",Helvetica,Arial,sans-serif; - font-size: 21px; - font-weight: bold; - color: #009EE3; - text-align: center; - cursor: pointer; - text-decoration: none; -} -.step-title a:hover { - text-decoration: none; -} -.step-text { - display: none; - text-align: center; - padding-top: 40px !important; - opacity: 0; - -webkit-transition: opacity 5s ease-in; - -moz-transition: opacity 5s ease-in; - -o-transition: opacity 5s ease-in; - -ms-transition: opacity 5s ease-in; - transition: opacity 5s ease-in; -} -.step-title:hover ~ .step-text, -.pres-circle:hover ~ .step-text { - text-decoration: none; - display: block; - cursor: pointer; - opacity: 0.9; -} -.panel-footer button { - border: none !important; - color: #ffffff !important; - background-color: #009EE3 !important; - width: 40%; - margin: 0 30%; -} -.panel-footer button i { - color: #ffffff !important; -} -.panel-footer button:hover { - background-color: #53bcc2 !important; - transition: all 0.3s; -} - -@media only screen and (max-width: 1199px) { - .logo-wrapper { - padding: 0 !important; - text-align: left !important; - } - .switch-label { - padding: 10px 0 0 0 !important; - text-align: left !important; - width: 75% !important; - } -} - -@media only screen and (min-width: 1200px) and (max-width: 1309px) { - .switch-label { - padding: 0 !important; - text-align: left !important; - width: 75% !important; - } -} - -@media only screen and (max-width: 1200px) { - .pres-header-text { - text-align: center; - } - .pres-content-text { - padding-left: 20px !important; - padding-right: 20px !important; - } -} diff --git a/v1.6.x/mercadopago/views/css/bootstrap.css b/v1.6.x/mercadopago/views/css/bootstrap.css new file mode 100644 index 0000000..843c213 --- /dev/null +++ b/v1.6.x/mercadopago/views/css/bootstrap.css @@ -0,0 +1,1193 @@ +/*! + * Bootstrap v3.1.1 (http://getbootstrap.marketing .marketing [.]([a-z])om) + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.marketing .marketing [.]([a-z])om/twbs/bootstrap/blob/master/LICENSE) + */ + +/*! normalize.marketing .marketing [.]([a-z])ss v3.0.0 | MIT License | git.marketing .marketing [.]([a-z])o/normalize */ +.marketing html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ + -webkit-text-size-adjust: 100%; +} +.marketing body { + margin: 0; +} +.marketing article, +.marketing aside, +.marketing details, +.marketing figcaption, +.marketing figure, +.marketing footer, +.marketing header, +.marketing hgroup, +.marketing main, +.marketing nav, +.marketing section, +.marketing summary { + display: block; +} +.marketing audio, +.marketing canvas, +.marketing progress, +.marketing video { + display: inline-block; + vertical-align: baseline; +} +.marketing audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +.marketing template { + display: none; +} +.marketing a { + background: transparent; +} +.marketing a:active, +.marketing a:hover { + outline: 0; +} +.marketing abbr[title] { + border-bottom: 1px dotted; +} +.marketing b, +.marketing strong { + font-weight: bold; +} +.marketing dfn { + font-style: italic; +} +.marketing h1 { + font-size: 2em; + margin: 0.67em 0; +} +.marketing mark { + background: #ff0; + color: #000; +} +.marketing small { + font-size: 80%; +} +.marketing sub, +.marketing sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +.marketing sup { + top: -0.5em; +} +.marketing sub { + bottom: -0.25em; +} +.marketing img { + border: 0; +} +.marketing svg:not(:root) { + overflow: hidden; +} +.marketing figure { + margin: 1em 40px; +} +.marketing hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} +.marketing pre { + overflow: auto; +} +.marketing code, +.marketing kbd, +.marketing pre, +.marketing samp { + font-family: monospace, monospace; + font-size: 1em; +} +.marketing button, +.marketing input, +.marketing optgroup, +.marketing select, +.marketing textarea { + color: inherit; + font: inherit; + margin: 0; +} +.marketing button { + overflow: visible; +} +.marketing button, +.marketing select { + text-transform: none; +} +.marketing button, +.marketing html input[type="button"], +.marketing input[type="reset"], +.marketing input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +.marketing button[disabled], +.marketing html input[disabled] { + cursor: default; +} +.marketing button::-moz-focus-inner, +.marketing input::-moz-focus-inner { + border: 0; + padding: 0; +} +.marketing input { + line-height: normal; +} +.marketing input[type="checkbox"], +.marketing input[type="radio"] { + box-sizing: border-box; + padding: 0; +} +.marketing input[type="number"]::-webkit-inner-spin-button, +.marketing input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +.marketing input[type="search"] { + -webkit-appearance: textfield; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +.marketing input[type="search"]::-webkit-search-cancel-button, +.marketing input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +.marketing fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} +.marketing legend { + border: 0; + padding: 0; +} +.marketing textarea { + overflow: auto; +} +.marketing optgroup { + font-weight: bold; +} +.marketing table { + border-collapse: collapse; + border-spacing: 0; +} +.marketing td, +.marketing th { + padding: 0; +} +.marketing ul, li{ + margin: 0px; + padding: 0; +} +@media print { + .marketing * { + text-shadow: none !important; + color: #000 !important; + background: transparent !important; + box-shadow: none !important; + } + .marketing a, + .marketing a:visited { + text-decoration: underline; + } + .marketing a[href]:after { + content: " (" attr(href) ")"; + } + .marketing abbr[title]:after { + content: " (" attr(title) ")"; + } + .marketing a[href^="javascript:"]:after, + .marketing a[href^="#"]:after { + content: ""; + } + .marketing pre, + .marketing blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + .marketing thead { + display: table-header-group; + } + .marketing tr, + .marketing img { + page-break-inside: avoid; + } + .marketing img { + max-width: 100% !important; + } + .marketing p, + .marketing h2, + .marketing h3 { + orphans: 3; + widows: 3; + } + .marketing h2, + .marketing h3 { + page-break-after: avoid; + } + .marketing select { + background: #fff !important; + } + .marketing .navbar { + display: none; + } + .marketing .table td, + .marketing .table th { + background-color: #fff !important; + } + .marketing .btn > .marketing .caret, + .marketing .dropup > .marketing .btn > .marketing .caret { + border-top-color: #000 !important; + } + .marketing .label { + border: 1px solid #000; + } + .marketing .table { + border-collapse: collapse !important; + } + .marketing .table-bordered th, + .marketing .table-bordered td { + border: 1px solid #ddd !important; + } +} +.marketing * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.marketing *:before, +.marketing *:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.marketing html { + font-size: 62.5%; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +.marketing body { + font-family: Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #6b6b6b; + background-color: #ffffff; +} +.marketing input, +.marketing button, +.marketing select, +.marketing textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +.marketing a { + color: #6b6b6b; + text-decoration: none; +} +.marketing a:hover, +.marketing a:focus { + color: #6b6b6b; +} +.marketing a:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.marketing figure { + margin: 0; +} +.marketing img { + vertical-align: middle; +} +.marketing .img-responsive { + display: block; + max-width: 100%; + height: auto; +} +.marketing .img-rounded { + border-radius: 6px; +} +.marketing .img-thumbnail { + padding: 4px; + line-height: 1.42857143; + background-color: #ffffff; + border: 1px solid #dddddd; + border-radius: 4px; + -webkit-transition: all 0.2s ease-in-out; + transition: all 0.2s ease-in-out; + display: inline-block; + max-width: 100%; + height: auto; +} +.marketing .img-circle { + border-radius: 50%; +} +.marketing hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eeeeee; +} +.marketing .sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +.marketing .pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +.marketing .container { + margin-right: auto; + margin-left: inherit; + padding-left: 15px; + padding-right: 15px; +} +@media (min-width: 768px) { + .marketing .container { + width: 750px; + } +} +@media (min-width: 992px) { + .marketing .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .marketing .container { + width: 970px; + } +} +.marketing .container-fluid { + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; +} +.marketing .row { + margin-left: -15px; + margin-right: -15px; +} +.marketing .col-xs-1, .marketing .col-sm-1, .marketing .col-md-1, .marketing .col-lg-1, .marketing .col-xs-2, .marketing .col-sm-2, .marketing .col-md-2, .marketing .col-lg-2, .marketing .col-xs-3, .marketing .col-sm-3, .marketing .col-md-3, .marketing .col-lg-3, .marketing .col-xs-4, .marketing .col-sm-4, .marketing .col-md-4, .marketing .col-lg-4, .marketing .col-xs-5, .marketing .col-sm-5, .marketing .col-md-5, .marketing .col-lg-5, .marketing .col-xs-6, .marketing .col-sm-6, .marketing .col-md-6, .marketing .col-lg-6, .marketing .col-xs-7, .marketing .col-sm-7, .marketing .col-md-7, .marketing .col-lg-7, .marketing .col-xs-8, .marketing .col-sm-8, .marketing .col-md-8, .marketing .col-lg-8, .marketing .col-xs-9, .marketing .col-sm-9, .marketing .col-md-9, .marketing .col-lg-9, .marketing .col-xs-10, .marketing .col-sm-10, .marketing .col-md-10, .marketing .col-lg-10, .marketing .col-xs-11, .marketing .col-sm-11, .marketing .col-md-11, .marketing .col-lg-11, .marketing .col-xs-12, .marketing .col-sm-12, .marketing .col-md-12, .marketing .col-lg-12 { + position: relative; + min-height: 1px; + padding-left: 15px; + padding-right: 15px; +} +.marketing .col-xs-1, .marketing .col-xs-2, .marketing .col-xs-3, .marketing .col-xs-4, .marketing .col-xs-5, .marketing .col-xs-6, .marketing .col-xs-7, .marketing .col-xs-8, .marketing .col-xs-9, .marketing .col-xs-10, .marketing .col-xs-11, .marketing .col-xs-12 { + float: left; +} +.marketing .col-xs-12 { + width: 100%; +} +.marketing .col-xs-11 { + width: 91.66666667%; +} +.marketing .col-xs-10 { + width: 83.33333333%; +} +.marketing .col-xs-9 { + width: 75%; +} +.marketing .col-xs-8 { + width: 66.66666667%; +} +.marketing .col-xs-7 { + width: 58.33333333%; +} +.marketing .col-xs-6 { + width: 50%; +} +.marketing .col-xs-5 { + width: 41.66666667%; +} +.marketing .col-xs-4 { + width: 33.33333333%; +} +.marketing .col-xs-3 { + width: 25%; +} +.marketing .col-xs-2 { + width: 16.66666667%; +} +.marketing .col-xs-1 { + width: 8.33333333%; +} +.marketing .col-xs-pull-12 { + right: 100%; +} +.marketing .col-xs-pull-11 { + right: 91.66666667%; +} +.marketing .col-xs-pull-10 { + right: 83.33333333%; +} +.marketing .col-xs-pull-9 { + right: 75%; +} +.marketing .col-xs-pull-8 { + right: 66.66666667%; +} +.marketing .col-xs-pull-7 { + right: 58.33333333%; +} +.marketing .col-xs-pull-6 { + right: 50%; +} +.marketing .col-xs-pull-5 { + right: 41.66666667%; +} +.marketing .col-xs-pull-4 { + right: 33.33333333%; +} +.marketing .col-xs-pull-3 { + right: 25%; +} +.marketing .col-xs-pull-2 { + right: 16.66666667%; +} +.marketing .col-xs-pull-1 { + right: 8.33333333%; +} +.marketing .col-xs-pull-0 { + right: 0%; +} +.marketing .col-xs-push-12 { + left: 100%; +} +.marketing .col-xs-push-11 { + left: 91.66666667%; +} +.marketing .col-xs-push-10 { + left: 83.33333333%; +} +.marketing .col-xs-push-9 { + left: 75%; +} +.marketing .col-xs-push-8 { + left: 66.66666667%; +} +.marketing .col-xs-push-7 { + left: 58.33333333%; +} +.marketing .col-xs-push-6 { + left: 50%; +} +.marketing .col-xs-push-5 { + left: 41.66666667%; +} +.marketing .col-xs-push-4 { + left: 33.33333333%; +} +.marketing .col-xs-push-3 { + left: 25%; +} +.marketing .col-xs-push-2 { + left: 16.66666667%; +} +.marketing .col-xs-push-1 { + left: 8.33333333%; +} +.marketing .col-xs-push-0 { + left: 0%; +} +.marketing .col-xs-offset-12 { + margin-left: 100%; +} +.marketing .col-xs-offset-11 { + margin-left: 91.66666667%; +} +.marketing .col-xs-offset-10 { + margin-left: 83.33333333%; +} +.marketing .col-xs-offset-9 { + margin-left: 75%; +} +.marketing .col-xs-offset-8 { + margin-left: 66.66666667%; +} +.marketing .col-xs-offset-7 { + margin-left: 58.33333333%; +} +.marketing .col-xs-offset-6 { + margin-left: 50%; +} +.marketing .col-xs-offset-5 { + margin-left: 41.66666667%; +} +.marketing .col-xs-offset-4 { + margin-left: 33.33333333%; +} +.marketing .col-xs-offset-3 { + margin-left: 25%; +} +.marketing .col-xs-offset-2 { + margin-left: 16.66666667%; +} +.marketing .col-xs-offset-1 { + margin-left: 8.33333333%; +} +.marketing .col-xs-offset-0 { + margin-left: 0%; +} +@media (min-width: 768px) { + .marketing .col-sm-1, .marketing .col-sm-2, .marketing .col-sm-3, .marketing .col-sm-4, .marketing .col-sm-5, .marketing .col-sm-6, .marketing .col-sm-7, .marketing .col-sm-8, .marketing .col-sm-9, .marketing .col-sm-10, .marketing .col-sm-11, .marketing .col-sm-12 { + float: left; + } + .marketing .col-sm-12 { + width: 100%; + } + .marketing .col-sm-11 { + width: 91.66666667%; + } + .marketing .col-sm-10 { + width: 83.33333333%; + } + .marketing .col-sm-9 { + width: 75%; + } + .marketing .col-sm-8 { + width: 66.66666667%; + } + .marketing .col-sm-7 { + width: 58.33333333%; + } + .marketing .col-sm-6 { + width: 50%; + } + .marketing .col-sm-5 { + width: 41.66666667%; + } + .marketing .col-sm-4 { + width: 33.33333333%; + } + .marketing .col-sm-3 { + width: 25%; + } + .marketing .col-sm-2 { + width: 16.66666667%; + } + .marketing .col-sm-1 { + width: 8.33333333%; + } + .marketing .col-sm-pull-12 { + right: 100%; + } + .marketing .col-sm-pull-11 { + right: 91.66666667%; + } + .marketing .col-sm-pull-10 { + right: 83.33333333%; + } + .marketing .col-sm-pull-9 { + right: 75%; + } + .marketing .col-sm-pull-8 { + right: 66.66666667%; + } + .marketing .col-sm-pull-7 { + right: 58.33333333%; + } + .marketing .col-sm-pull-6 { + right: 50%; + } + .marketing .col-sm-pull-5 { + right: 41.66666667%; + } + .marketing .col-sm-pull-4 { + right: 33.33333333%; + } + .marketing .col-sm-pull-3 { + right: 25%; + } + .marketing .col-sm-pull-2 { + right: 16.66666667%; + } + .marketing .col-sm-pull-1 { + right: 8.33333333%; + } + .marketing .col-sm-pull-0 { + right: 0%; + } + .marketing .col-sm-push-12 { + left: 100%; + } + .marketing .col-sm-push-11 { + left: 91.66666667%; + } + .marketing .col-sm-push-10 { + left: 83.33333333%; + } + .marketing .col-sm-push-9 { + left: 75%; + } + .marketing .col-sm-push-8 { + left: 66.66666667%; + } + .marketing .col-sm-push-7 { + left: 58.33333333%; + } + .marketing .col-sm-push-6 { + left: 50%; + } + .marketing .col-sm-push-5 { + left: 41.66666667%; + } + .marketing .col-sm-push-4 { + left: 33.33333333%; + } + .marketing .col-sm-push-3 { + left: 25%; + } + .marketing .col-sm-push-2 { + left: 16.66666667%; + } + .marketing .col-sm-push-1 { + left: 8.33333333%; + } + .marketing .col-sm-push-0 { + left: 0%; + } + .marketing .col-sm-offset-12 { + margin-left: 100%; + } + .marketing .col-sm-offset-11 { + margin-left: 91.66666667%; + } + .marketing .col-sm-offset-10 { + margin-left: 83.33333333%; + } + .marketing .col-sm-offset-9 { + margin-left: 75%; + } + .marketing .col-sm-offset-8 { + margin-left: 66.66666667%; + } + .marketing .col-sm-offset-7 { + margin-left: 58.33333333%; + } + .marketing .col-sm-offset-6 { + margin-left: 50%; + } + .marketing .col-sm-offset-5 { + margin-left: 41.66666667%; + } + .marketing .col-sm-offset-4 { + margin-left: 33.33333333%; + } + .marketing .col-sm-offset-3 { + margin-left: 25%; + } + .marketing .col-sm-offset-2 { + margin-left: 16.66666667%; + } + .marketing .col-sm-offset-1 { + margin-left: 8.33333333%; + } + .marketing .col-sm-offset-0 { + margin-left: 0%; + } +} +@media (min-width: 992px) { + .marketing .col-md-1, .marketing .col-md-2, .marketing .col-md-3, .marketing .col-md-4, .marketing .col-md-5, .marketing .col-md-6, .marketing .col-md-7, .marketing .col-md-8, .marketing .col-md-9, .marketing .col-md-10, .marketing .col-md-11, .marketing .col-md-12 { + float: left; + } + .marketing .col-md-12 { + width: 100%; + } + .marketing .col-md-11 { + width: 91.66666667%; + } + .marketing .col-md-10 { + width: 83.33333333%; + } + .marketing .col-md-9 { + width: 75%; + } + .marketing .col-md-8 { + width: 66.66666667%; + } + .marketing .col-md-7 { + width: 58.33333333%; + } + .marketing .col-md-6 { + width: 50%; + } + .marketing .col-md-5 { + width: 41.66666667%; + } + .marketing .col-md-4 { + width: 33.33333333%; + } + .marketing .col-md-3 { + width: 25%; + } + .marketing .col-md-2 { + width: 16.66666667%; + } + .marketing .col-md-1 { + width: 8.33333333%; + } + .marketing .col-md-pull-12 { + right: 100%; + } + .marketing .col-md-pull-11 { + right: 91.66666667%; + } + .marketing .col-md-pull-10 { + right: 83.33333333%; + } + .marketing .col-md-pull-9 { + right: 75%; + } + .marketing .col-md-pull-8 { + right: 66.66666667%; + } + .marketing .col-md-pull-7 { + right: 58.33333333%; + } + .marketing .col-md-pull-6 { + right: 50%; + } + .marketing .col-md-pull-5 { + right: 41.66666667%; + } + .marketing .col-md-pull-4 { + right: 33.33333333%; + } + .marketing .col-md-pull-3 { + right: 25%; + } + .marketing .col-md-pull-2 { + right: 16.66666667%; + } + .marketing .col-md-pull-1 { + right: 8.33333333%; + } + .marketing .col-md-pull-0 { + right: 0%; + } + .marketing .col-md-push-12 { + left: 100%; + } + .marketing .col-md-push-11 { + left: 91.66666667%; + } + .marketing .col-md-push-10 { + left: 83.33333333%; + } + .marketing .col-md-push-9 { + left: 75%; + } + .marketing .col-md-push-8 { + left: 66.66666667%; + } + .marketing .col-md-push-7 { + left: 58.33333333%; + } + .marketing .col-md-push-6 { + left: 50%; + } + .marketing .col-md-push-5 { + left: 41.66666667%; + } + .marketing .col-md-push-4 { + left: 33.33333333%; + } + .marketing .col-md-push-3 { + left: 25%; + } + .marketing .col-md-push-2 { + left: 16.66666667%; + } + .marketing .col-md-push-1 { + left: 8.33333333%; + } + .marketing .col-md-push-0 { + left: 0%; + } + .marketing .col-md-offset-12 { + margin-left: 100%; + } + .marketing .col-md-offset-11 { + margin-left: 91.66666667%; + } + .marketing .col-md-offset-10 { + margin-left: 83.33333333%; + } + .marketing .col-md-offset-9 { + margin-left: 75%; + } + .marketing .col-md-offset-8 { + margin-left: 66.66666667%; + } + .marketing .col-md-offset-7 { + margin-left: 58.33333333%; + } + .marketing .col-md-offset-6 { + margin-left: 50%; + } + .marketing .col-md-offset-5 { + margin-left: 41.66666667%; + } + .marketing .col-md-offset-4 { + margin-left: 33.33333333%; + } + .marketing .col-md-offset-3 { + margin-left: 25%; + } + .marketing .col-md-offset-2 { + margin-left: 16.66666667%; + } + .marketing .col-md-offset-1 { + margin-left: 8.33333333%; + } + .marketing .col-md-offset-0 { + margin-left: 0%; + } +} +@media (min-width: 1200px) { + .marketing .col-lg-1, .marketing .col-lg-2, .marketing .col-lg-3, .marketing .col-lg-4, .marketing .col-lg-5, .marketing .col-lg-6, .marketing .col-lg-7, .marketing .col-lg-8, .marketing .col-lg-9, .marketing .col-lg-10, .marketing .col-lg-11, .marketing .col-lg-12 { + float: left; + } + .marketing .col-lg-12 { + width: 100%; + } + .marketing .col-lg-11 { + width: 91.66666667%; + } + .marketing .col-lg-10 { + width: 83.33333333%; + } + .marketing .col-lg-9 { + width: 75%; + } + .marketing .col-lg-8 { + width: 66.66666667%; + } + .marketing .col-lg-7 { + width: 58.33333333%; + } + .marketing .col-lg-6 { + width: 50%; + } + .marketing .col-lg-5 { + width: 41.66666667%; + } + .marketing .col-lg-4 { + width: 33.33333333%; + } + .marketing .col-lg-3 { + width: 25%; + } + .marketing .col-lg-2 { + width: 16.66666667%; + } + .marketing .col-lg-1 { + width: 8.33333333%; + } + .marketing .col-lg-pull-12 { + right: 100%; + } + .marketing .col-lg-pull-11 { + right: 91.66666667%; + } + .marketing .col-lg-pull-10 { + right: 83.33333333%; + } + .marketing .col-lg-pull-9 { + right: 75%; + } + .marketing .col-lg-pull-8 { + right: 66.66666667%; + } + .marketing .col-lg-pull-7 { + right: 58.33333333%; + } + .marketing .col-lg-pull-6 { + right: 50%; + } + .marketing .col-lg-pull-5 { + right: 41.66666667%; + } + .marketing .col-lg-pull-4 { + right: 33.33333333%; + } + .marketing .col-lg-pull-3 { + right: 25%; + } + .marketing .col-lg-pull-2 { + right: 16.66666667%; + } + .marketing .col-lg-pull-1 { + right: 8.33333333%; + } + .marketing .col-lg-pull-0 { + right: 0%; + } + .marketing .col-lg-push-12 { + left: 100%; + } + .marketing .col-lg-push-11 { + left: 91.66666667%; + } + .marketing .col-lg-push-10 { + left: 83.33333333%; + } + .marketing .col-lg-push-9 { + left: 75%; + } + .marketing .col-lg-push-8 { + left: 66.66666667%; + } + .marketing .col-lg-push-7 { + left: 58.33333333%; + } + .marketing .col-lg-push-6 { + left: 50%; + } + .marketing .col-lg-push-5 { + left: 41.66666667%; + } + .marketing .col-lg-push-4 { + left: 33.33333333%; + } + .marketing .col-lg-push-3 { + left: 25%; + } + .marketing .col-lg-push-2 { + left: 16.66666667%; + } + .marketing .col-lg-push-1 { + left: 8.33333333%; + } + .marketing .col-lg-push-0 { + left: 0%; + } + .marketing .col-lg-offset-12 { + margin-left: 100%; + } + .marketing .col-lg-offset-11 { + margin-left: 91.66666667%; + } + .marketing .col-lg-offset-10 { + margin-left: 83.33333333%; + } + .marketing .col-lg-offset-9 { + margin-left: 75%; + } + .marketing .col-lg-offset-8 { + margin-left: 66.66666667%; + } + .marketing .col-lg-offset-7 { + margin-left: 58.33333333%; + } + .marketing .col-lg-offset-6 { + margin-left: 50%; + } + .marketing .col-lg-offset-5 { + margin-left: 41.66666667%; + } + .marketing .col-lg-offset-4 { + margin-left: 33.33333333%; + } + .marketing .col-lg-offset-3 { + margin-left: 25%; + } + .marketing .col-lg-offset-2 { + margin-left: 16.66666667%; + } + .marketing .col-lg-offset-1 { + margin-left: 8.33333333%; + } + .marketing .col-lg-offset-0 { + margin-left: 0%; + } +} +.marketing .clearfix:before, +.marketing .clearfix:after, +.marketing .container:before, +.marketing .container:after, +.marketing .container-fluid:before, +.marketing .container-fluid:after, +.marketing .row:before, +.marketing .row:after { + content: " "; + display: table; +} +.marketing .clearfix:after, +.marketing .container:after, +.marketing .container-fluid:after, +.marketing .row:after { + clear: both; +} +.marketing .center-block { + display: block; + margin-left: auto; + margin-right: auto; +} +.marketing .pull-right { + float: right !important; +} +.marketing .pull-left { + float: left !important; +} +.marketing .hide { + display: none !important; +} +.marketing .show { + display: block !important; +} +.marketing .invisible { + visibility: hidden; +} +.marketing .text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.marketing .text-right{ + text-align: right; +} +.marketing .text-left{ + text-align: left; +} +.marketing .text-center{ + text-align: center; +} +.marketing .hidden { + display: none !important; + visibility: hidden !important; +} +.marketing .affix { + position: fixed; +} +@-ms-viewport { + width: device-width; +} +.marketing .visible-xs, +.marketing .visible-sm, +.marketing .visible-md, +.marketing .visible-lg { + display: none !important; +} +@media (max-width: 767px) { + .marketing .visible-xs { + display: block !important; + } + .marketing table .visible-xs { + display: table; + } + .marketing tr .visible-xs { + display: table-row !important; + } + .marketing th .visible-xs, + .marketing td .visible-xs { + display: table-cell !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .marketing .visible-sm { + display: block !important; + } + .marketing table .visible-sm { + display: table; + } + .marketing tr .visible-sm { + display: table-row !important; + } + .marketing th .visible-sm, + .marketing td .visible-sm { + display: table-cell !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .marketing .visible-md { + display: block !important; + } + .marketing table .visible-md { + display: table; + } + .marketing tr .visible-md { + display: table-row !important; + } + .marketing th .visible-md, + .marketing td .visible-md { + display: table-cell !important; + } +} +@media (min-width: 1200px) { + .marketing .visible-lg { + display: block !important; + } + .marketing table .visible-lg { + display: table; + } + .marketing tr .visible-lg { + display: table-row !important; + } + .marketing th .visible-lg, + .marketing td .visible-lg { + display: table-cell !important; + } +} +@media (max-width: 767px) { + .marketing .hidden-xs { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .marketing .hidden-sm { + display: none !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .marketing .hidden-md { + display: none !important; + } +} +@media (min-width: 1200px) { + .marketing .hidden-lg { + display: none !important; + } +} +.marketing .visible-print { + display: none !important; +} +@media print { + .marketing .visible-print { + display: block !important; + } + .marketing table .visible-print { + display: table; + } + .marketing tr .visible-print { + display: table-row !important; + } + .marketing th .visible-print, + .marketing td .visible-print { + display: table-cell !important; + } +} +@media print { + .marketing .hidden-print { + display: none !important; + } +} diff --git a/v1.6.x/mercadopago/views/css/dd.css b/v1.6.x/mercadopago/views/css/dd.css new file mode 100644 index 0000000..211ba79 --- /dev/null +++ b/v1.6.x/mercadopago/views/css/dd.css @@ -0,0 +1,77 @@ +/************** Skin 1 *********************/ +.dd { + /*display:inline-block !important;*/ + text-align:left; + background-color:#fff; + font-family:Arial, Helvetica, sans-serif; + font-size:12px; + float:right; +} +.dd .ddTitle { + background:#f2f2f2; + border:1px solid #c3c3c3; + padding:3px; + text-indent:0; + cursor:default; + overflow:hidden; + height:30px; +} +.dd .ddTitle span.arrow { + background:url(../img/dd_arrow.gif) no-repeat 0 0; float:right; display:inline-block;width:16px; height:16px; cursor:pointer; +} + +.dd .ddTitle span.ddTitleText {text-indent:1px; overflow:hidden; line-height:16px;} +.dd .ddTitle span.ddTitleText img{text-align:left; padding:0 2px 0 0} +.dd .ddTitle img.selected { + padding:0 3px 0 0; + vertical-align:top; +} +.dd .ddChild { + position:absolute; + border:1px solid #c3c3c3; + border-top:none; + display:none; + margin:0; + width:auto; + overflow:auto; + overflow-x:hidden !important; + background-color:#ffffff; +} +.dd .ddChild .opta a, .dd .ddChild .opta a:visited {padding-left:10px} +.dd .ddChild a { + display:block; + padding:2px 0 2px 3px; + text-decoration:none; + color:#000; + overflow:hidden; + white-space:nowrap; + cursor:pointer; +} +.dd .ddChild a:hover { + background-color:#66CCFF; +} +.dd .ddChild a img { + border:0; + padding:0 2px 0 0; + vertical-align:middle; +} +.dd .ddChild a.selected { + background-color:#66CCFF; + +} +.hidden {display:none;} + +.dd .borderTop{border-top:1px solid #c3c3c3 !important;} +.dd .noBorderTop{border-top:none 0 !important} + +/************* use sprite *****************/ +.dd .ddChild a.sprite, .dd .ddChild a.sprite:visited { + background-image:url(../icons/sprite.gif); + background-repeat:no-repeat; + padding-left:24px; +} + +.dd .ddChild a.calendar, .dd .ddChild a.calendar:visited { + background-position:0 -404px; +} +/*******************************/ diff --git a/v1.6.x/mercadopago/views/css/index.php b/v1.6.x/mercadopago/views/css/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/css/index.php +++ b/v1.6.x/mercadopago/views/css/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/css/mercadopago.css b/v1.6.x/mercadopago/views/css/mercadopago.css deleted file mode 100644 index 45aa972..0000000 --- a/v1.6.x/mercadopago/views/css/mercadopago.css +++ /dev/null @@ -1,5 +0,0 @@ -.logo-wrapper { - text-align:left; - width:20%; - height: 50px; -} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/css/mercadopago_core.css b/v1.6.x/mercadopago/views/css/mercadopago_core.css new file mode 100644 index 0000000..033e96c --- /dev/null +++ b/v1.6.x/mercadopago/views/css/mercadopago_core.css @@ -0,0 +1,285 @@ +/** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*/ +.mp-module .return-div h4 { + font-size: 16px; +} +.mp-module .return-div h5 { + font-size: 12px; +} +.mp-module .form-error { + outline: rgb(215, 5, 5) solid thin; + border: solid 1px rgb(215, 5, 5); +} + +.mp-module .boxshadow-error { + box-shadow: 0px 0px 0px 1px rgb(215, 5, 5); + border: solid 1px rgb(215, 5, 5); +} + +.mp-module .footer-logo { + background: url('../img/payment_method_logo.png') no-repeat; + height: 40px; + display: block; + margin-top: 20px; +} + +.mp-module .boleto-frame { + width: 780px; + height: 845px; +} + +.mp-module .MLM { + width: 670px; + height: 670px; +} + +.mp-module p { + color: black; + font-size: 15px; + font-weight: normal; +} + +.mp-module .label-checkout { + color: black; + font-size: 15px; + font-weight: 700; + +} + +.mp-module .mp-form h4 { + font-weight: bold; + font-size: 22px; + color: #333333; + margin-bottom: 25px; + margin-top: 3px; + margin-left: 28px; +} + +.mp-module .mp-button { + width: 200px; + margin-left: 15px; +} + +.mp-module .description { + font-size: 14px; + color: black; + display: block; + margin-top: 20px; + margin-left: 30px; +} + +.mp-module .cvv { + width: 45px; + height: 25px; +} + +.mp-module .col { + float: left; + margin-top: 10px; +} + +.mp-module .banner-column { + width: 47%; +} + +.mp-module .ch-btn, .mp-module .ch-btn:focus, .mp-module .ch-btn:visited { + font-family: 'Lato', sans-serif; + font-weight: 400; + background-color: #36A1F1; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #36A1F1), color-stop(100%, #0F79C9)); + background-image: -webkit-linear-gradient(#36A1F1, #0F79C9); + background-image: -moz-linear-gradient(#36A1F1, #0F79C9); + background-image: -o-linear-gradient(#36A1F1, #0F79C9); + background-image: linear-gradient(#36A1F1, #0F79C9); + -webkit-box-shadow: inset 0 1px #97DCFF; + box-shadow: 0 1px #97DCFF inset; + color: #FFF!important; + border: 0px solid #0D6FB9; + border-radius: 4px 4px 4px 4px; + cursor: pointer; + display: inline-block; +} +.mp-module .ch-btn:hover { + background-color: #4CBFF8; + background-image: linear-gradient(#4CBFF8, #1699DF); + box-shadow: 0 1px #B6EBFF inset; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #4CBFF8), color-stop(100%, #1699DF)); + background-image: -webkit-linear-gradient(#4CBFF8, #1699DF); + background-image: -moz-linear-gradient(#4CBFF8, #1699DF); + background-image: -o-linear-gradient(#4CBFF8, #1699DF); + background-image: linear-gradient(#4CBFF8, #1699DF); + -webkit-box-shadow: inset 0 1px #B6EBFF; + border: 0px solid #1890D3; + color: #FFF; + text-decoration: none; + outline: 0 +} +.mp-module .ch-btn:active { + background-color: #1473CD; + background-image: linear-gradient(#1473CD, #0B66BC); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1473CD), color-stop(100%, #0B66BC)); + background-image: -webkit-linear-gradient(#1473CD, #0B66BC); + background-image: -moz-linear-gradient(#1473CD, #0B66BC); + background-image: -o-linear-gradient(#1473CD, #0B66BC); + background-image: linear-gradient(#1473CD, #0B66BC); + -webkit-box-shadow: inset 0 1px #0B5BA6; + box-shadow: 0 1px #0B5BA6 inset; + border: 0px solid #0B5BA6; + color: #FFF; + text-decoration: none; + outline: 0 +} + +.mp-module .ch-btn-big, .mp-module .ch-btn-big:focus { + font-size: 17px; + text-align: left; + line-height: 1.25em; + padding: 6px 10px; + outline: 0; + float: left; + margin-bottom: 5px; +} + +.mp-module .ch-btn-skin, .mp-module .ch-btn-skin:focus, .mp-module .ch-btn-skin:visited { + background-color: #DAF1FC; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #DAF1FC), color-stop(100%, #C2E2F3)); + background-image: -webkit-linear-gradient(#DAF1FC, #C2E2F3); + background-image: -moz-linear-gradient(#DAF1FC, #C2E2F3); + background-image: -o-linear-gradient(#DAF1FC, #C2E2F3); + background-image: linear-gradient(#DAF1FC, #C2E2F3); + border: 0px solid #79B0D9; + -webkit-box-shadow: inset 0 1px #EFF7FD; + box-shadow: inset 0 1px #EFF7FD; + color: #295D8F; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + outline: 0 +} +.mp-module .ch-btn-skin:hover { + background-color: #EAF7FE; + background-image: -webkit-linear-gradient(#EAF7FE, #D9EDF8); + background-image: -moz-linear-gradient(#EAF7FE, #D9EDF8); + background-image: -o-linear-gradient(#EAF7FE, #D9EDF8); + background-image: linear-gradient(#EAF7FE, #D9EDF8); + -webkit-box-shadow: inset 0 1px #F7FAFE; + box-shadow: inset 0 1px #F7FAFE; + outline: 0 +} +.mp-module .ch-btn-skin:active { + background-color: #A9DBF7; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #A9DBF7), color-stop(100%, #A3D0EE)); + background-image: -webkit-linear-gradient(#A9DBF7, #A3D0EE); + background-image: -moz-linear-gradient(#A9DBF7, #A3D0EE); + background-image: -o-linear-gradient(#A9DBF7, #A3D0EE); + background-image: linear-gradient(#A9DBF7, #A3D0EE); + -webkit-box-shadow: inset 0 1px 6px rgba(71, 98, 116, .6); + box-shadow: inset 0 1px 6px rgba(71, 98, 116, .6); + border-color: #79A8C7; + outline: 0 +} + +.lightbox { + display: none; + position: fixed; + z-index: 5004; + width: 100%; + height: 100%; + top: 0; + left: 0; + color:#333333; + margin-top: -2px; +} + +.lightbox:target { + display: block; + outline: none; +} + +.lightbox .box { + width: 100%; + height: 100%; + padding: 20px; + box-shadow: 0px 1px 26px -6px #777777; + background: rgba(0, 0, 0, 0.498039); + border-radius: 4px; +} + + +.lightbox .content { + display: block; + font-size: 18px; + line-height: 22px; + width: 300px; + height: 300px; + background-size: 36px 36px; + background: white url('../img/spinner.gif') 50% 50% no-repeat; + position: fixed; + top: calc(50% - 150px); + left: calc(50% - 150px); + border-radius: 10px; +} + +.lightbox .processing { + color: black; + height: 40px; + padding-top: 8px; + position: relative; + top: 60%; + left: calc(50% - 40px); + font: 600 14px/18px "Open Sans", sans-serif; + font-weight: 100; +} + +.lightbox .logo { + height: 23px; + width: 90px; + position: relative; + top: -550%; + left: 3%; +} + +.mp-module .alert.alert-danger:before { + display: none; +} + + + + +/* +* Taxes - MLA +*/ +.mp-text-cft{ + font-size: 22px; + line-height: 30px; + font-family: Lato,sans-serif; + display: none; +} + +.mp-text-tea{ + font-size: 9px; + width: 235px; + text-align: right; + font-family: Lato,sans-serif; + display: none; +} diff --git a/v1.6.x/mercadopago/views/css/mercadopago_v5.css b/v1.6.x/mercadopago/views/css/mercadopago_v5.css new file mode 100644 index 0000000..e0119dd --- /dev/null +++ b/v1.6.x/mercadopago/views/css/mercadopago_v5.css @@ -0,0 +1,209 @@ +/** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*/ + +.mp-module input[type="text"] { + padding-left: 5px; + padding-top: 2px; +} + +.mp-form { + margin-bottom: 40px; + width: auto; +} + +.mp-module .col label { + float: left; + font-size: 11px; +} + +.mp-module #form-pagar-mp { + margin-left: 45px; +} + +.mp-module .col-bottom { + width: 100%; +} + +.mp-module #div-card-type { + margin-top: 15px; + float: left; + font-size: 11px; +} + + +.mp-module .mp-creditcard-banner { + width: 280px; + float: right !important; + margin-top: -20px; + margin-right: 0px !important; +} + +.mp-module .payment-label { + font-weight: bold; + font-size: 15px; + color: #333333; +} +.mp-module .row { + clear: both; + margin-bottom: 40px; +} +.mp-module .col { + width: 34.5%; +} + +.mp-module .col-expiration { + width: 13%; +} + +.mp-module .col-security { + width: 25%; +} + +.mp-module .col-cpf, .mp-module .col-bank { + width: 26%; + margin-left: 66px; +} + +.mp-module .logo { + width: 80px; + height: 20px; +} + +.mp-module .poweredby { + float: left; + color: black; + font-size: 6px; + font-weight: bold; + margin-left: 1px; +} + +.mp-module .small-select { + width: 83px; + height: 25px; + background: white; + font-size: 11px; +} + +.mp-module #id-card-number { + width: 169px; + padding-right: 50px; +} + +.mp-module #id-card-holder-name { + width: 220px; +} + +.mp-module #id-installments { + width: 225px; + height: 25px; + background: white; + font-size: 11px; +} + +.mp-module #id-issuers-options { + width: 170px; + height: 25px; + background: white; + font-size: 11px; +} + +.mp-module #id-doc-number { + width: 165px; +} + +.mp-module #id-boleto { + display: block; + position: relative; + top: 21px; + right: 120px; +} + +.mp-module .create-boleto { + display: none; +} + +.mp-module #form-boleto-mp { + margin-left: 30px; +} + +.mp-module .standard { + display: inline; + float: left; + margin: 0px; +} + +.mp-module .mp-standard-banner { + width: 320px; + display: inline; + margin-left: 18px; + margin-right: 0px !important; +} + +.mp-module .mp-boleto-banner { + height: 60px; + width: 270px; + margin-top: -10px; + margin-left: 110px; + margin-top: -5px; +} + +.mp-module .mp-offline-banner { + margin-top: -3px; +} + +.mp-module .offline { + margin-top: 0; +} + +.mp-module .col input { + height: 20px; + font-size: 11px; +} + +.mp-module #id-security-code { + width: 50px; + float: left; +} + +.mp-module .status { + color: rgb(215, 5, 5); + font-weight: bold; + font-size: 9px; + height: 0px; + display: block; + float: left; +} + +.mp-module .ch-btn-big, .mp-module .ch-btn-big:focus { + font-size: 16px; + text-align: center; + line-height: 1.25em; + padding: 6px 33px; + outline: 0; + float: right; + margin-right: 42px; + margin-top: 20px; + margin-bottom: 20px; +} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/css/mercadopago_v6.css b/v1.6.x/mercadopago/views/css/mercadopago_v6.css new file mode 100644 index 0000000..ca67790 --- /dev/null +++ b/v1.6.x/mercadopago/views/css/mercadopago_v6.css @@ -0,0 +1,417 @@ +/** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*/ + +@media all and (min-width: 600px) { + .mp-form-bol { + border: 1px solid #d6d4d4; + border-radius: 4px; + padding: 10px; + width: 745px; + background: white; + margin-bottom: 20px; + } + + .mp-form { + border: 1px solid #d6d4d4; + border-radius: 4px; + padding: 10px; + width: 570px; + background: white; + margin-bottom: 20px; + } + + .mp-form-custom { + border: 1px solid #d6d4d4; + border-radius: 4px; + padding: 10px; + width: 570px; + background: white; + margin-bottom: 20px; + } + + .mp-form-boleto { + border: 1px solid #d6d4d4; + border-radius: 4px; + padding: 10px; + width: 570px; + height: 100px; + background: white; + margin-bottom: 20px; + } + .mp-form .col label { + width: 180px; + text-align: right; + font: 13px/16px Arial,Helvetica,"Nimbus Sans L",sans-serif; + font-weight: 700; + } + + .mp-form .col label { + width: 180px; + text-align: right; + font:12px/16px "Open Sans", sans-serif; + font-weight: 700; + } + + .mp-form-custom .col label { + width: 180px; + text-align: right; + font: 13px/16px Arial,Helvetica,"Nimbus Sans L",sans-serif; + font-weight: 700; + } + + .mp-form #form-pagar-mp { + margin-left: 20px; + } + + .mp-form-custom #form-pagar-mp { + margin-left: 20px; + } + + .mp-module .ch-btn-big, .mp-module .ch-btn-big:focus { + float: right; + margin-right: 155px; + padding: 6px 24px; + } + + .mp-module .es-button { + padding: 6px 48px!important; + } + + .mp-module .col-bottom { + width: 100%; + margin-right: 5px; + margin-top: 20px; + margin-left: 4px; + margin-bottom: -10px; + } + + .mp-module .title { + width: 47%; + margin-bottom: 20px; + } + + .mp-module .titleCoupon { + width: 82%; + margin-bottom: 20px; + } + + .mp-module .mp-creditcard-banner { + width: 280px; + margin-left: -30px; + } + + .mp-module .payment-label { + font: bolder 16px/18px "Open Sans", sans-serif; + color: #333333; + margin-left: 15px; + } + + .mp-module .col { + margin-left: 15px; + } + + .mp-module .logo { + width: 80px; + height: 20px; + } + + .mp-module .logo_cupom { + width: 500px; + height: 70px; + } + + .mp-module .poweredby { + margin-left: 30px; + color: black; + font: 600 10px/14px "Open Sans", sans-serif; + } + .mp-module .small-select { + width: 97px; + height: 30px; + background: white; + font: 600 12px/16px "Open Sans", sans-serif; + } + + .mp-module #id-card-number { + width: 210px; + padding-right: 35px; + } + + .mp-module #id-card-holder-name { + width: 210px; + } + + .mp-module #id-installments, #id-installments-cust, .mp-module #id-issuers-options, #id-customerCards, #credit_option { + width: 210px; + height: 30px; + background: white; + font: 600 12px/16px "Open Sans", sans-serif; + } + .issuers-options-cust { + width: 210px; + height: 30px; + background: white; + font: 600 12px/16px "Open Sans", sans-serif; + } + .mp-module .document-type { + width: 92 px; + height: 30px; + background: white; + font: 600 12px/16px "Open Sans", sans-serif; + } + + .mp-module #docType { + width: 95px; + } + .mp-module #id-doc-number { + width: 120px; + } + + .mp-module .boleto { + background: url('../img/boleto.png') 60% no-repeat; + background-size: 137px 61px; + height: 61px; + } + + .mp-module .boleto::after { + display: block; + content: "\f054"; + position: relative; + font-family: "FontAwesome"; + font-size: 25px; + color: black; + bottom: 50%; + left: 545px; + } + + .mp-module .mp-offline-banner { + margin-bottom: 9px; + margin-left: 3px; + } + + .mp-module .standard { + font: 600 13px/15px "Open Sans", sans-serif; + margin-left: 174px; + display: block; + } + + .mp-module .standard::after { + display: block; + content: "\f054"; + position: relative; + font-family: "FontAwesome"; + font-size: 25px; + color: black; + left: 356px; + top: -35px; + } + + .mp-module .mp-standard-banner { + width: 320px; + display: inline; + margin-top: 10px; + margin-left: 15px; + margin-bottom: 10px; + } + + .mp-module #id-standard-logo { + margin-left: 30px; + } + +} + +@media all and (max-width: 599px) { + .mp-module input { + font: 600 8px/12px "Open Sans", sans-serif; + } + + .mp-form { + border: 1px solid #d6d4d4; + border-radius: 4px; + padding: 10px; + width: 570px; + background: white; + margin-bottom: 20px; + } + + .mp-module .col label { + min-width: 105px; + text-align: right; + font: 600 10px/14px "Open Sans", sans-serif; + } + + .mp-module .ch-btn-big, .mp-module .ch-btn-big:focus { + font-size: 14px !important; + min-width: 175px; + text-align: right; + float: right; + padding: 7px 15px !important; + } + + .mp-module .col-bottom { + margin-right: 5px; + margin-top: 20px; + margin-left: 71px; + margin-bottom: -10px; + float: left; + } + + .mp-module .title { + margin-bottom: 20px; + } + + .mp-creditcard-banner { + width: 150px; + margin-left: -10px; + } + + .mp-module .payment-label { + float: center; + font: bolder 14px/18px "Open Sans", sans-serif; + color: #333333; + } + + .mp-module .col { + margin-left: 10px; + } + + .mp-module .logo { + width: 50px; + height: 14px; + } + + .mp-module #id-card-number { + width: 120px; + padding-right: 50px; + } + + .mp-module .small-select { + width: 55px; + height: 30px; + background: white; + font: 600 8px/12px "Open Sans", sans-serif; + } + + .mp-module #id-card-holder-name { + width: 120px; + } + + .mp-module #id-installments { + width: 120px; + height: 30px; + background: white; + font: 600 8px/12px "Open Sans", sans-serif; + } + + .mp-module #id-doc-number { + width: 90px; + } + + .mp-module .status { + font-size: 7px !important; + } + + .mp-module .boleto { + background-size: 109px 51px; + height: 51px; + } + + .mp-module .standard { + margin-top: 10px; + margin-left: 4px; + font: 600 11px/13px "Open Sans", sans-serif; + display: block; + } + + .mp-module .mp-standard-banner { + width: 203px; + display: inline; + } + + .mp-module #id-standard-logo { + width: 70px; + } +} + +.mp-module input[type="text"] { + padding-left: 5px; + padding-top: 2px; +} + +.mp-module .mp-boleto-banner { + height: 60px; + width: 270px; + margin-top: -10px; + margin-left: 110px; +} + +.mp-module .col input { + height: 30px; +} + +.mp-module .hover:hover { + background: 60% no-repeat whitesmoke; +} + +.mp-module #id-security-code, #id-security-code-cust{ + width: 50px; +} + +.mp-module .create-boleto { + display: none; +} + +.mp-module #form-boleto-mp { + margin-left: 30px; +} + +.mp-module #id-standard { + float: left; +} + +.mp-module .status { + color: rgb(215, 5, 5); + font-weight: bold; + font-size: 10px; + display: inline; +} + +.ch-form-hint { + color: #999; + font-size: 12px; + line-height: 12px; + margin-left: 90px; +} + +.ch-form-row.discount-link { + background: url(https://secure.mlstatic.com/checkout-resources/resourses/assets/icon-discount.bd9c2205796f.png) no-repeat; + line-height: 25px; + padding-left: 44px; + margin-top: 10px; + margin-bottom: 10px; +} + + + diff --git a/v1.6.x/mercadopago/views/css/payment_options.css b/v1.6.x/mercadopago/views/css/payment_options.css deleted file mode 100644 index 6efa2f5..0000000 --- a/v1.6.x/mercadopago/views/css/payment_options.css +++ /dev/null @@ -1,8 +0,0 @@ -.payment-option { - margin-bottom: 1.5em !important; - width: 105%; -} -.payment-option img { - height: 40px; - margin-top: -5px; -} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/css/settings.css b/v1.6.x/mercadopago/views/css/settings.css new file mode 100644 index 0000000..042a310 --- /dev/null +++ b/v1.6.x/mercadopago/views/css/settings.css @@ -0,0 +1,253 @@ +/** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*/ + +.mp-module fieldset { + background-color: #FCFCFC !important; + color: #2D3277 !important; + margin-top: 40px !important; + width: 700px; +} +.mp-module legend { + background-color: #D9DADB !important; + font-size: 14px !important; +} +.mp-module label { + color: #2D3277 !important; +} +.mp-module select { + width: 215px; + color: black; + background: white; +} +.mp-module h4, .mp-module h3 { + color: #2D3277 !important; + margin-left: 10px; +} +.mp-module #settings a { + color: #05A3DF !important; +} +.mp-module #settings { + display: none; +} +.mp-module .logo { + margin-top: 30px; + margin-left: 10px; +} + +.mp-module .logoCheck { + margin-left: 10px; + margin-right: 10px; +} + + +.mp-module .payment-methods { + position: relative; + left: 260px; + top: -18px; +} + +.mp-module .ch-btn-big, .ch-btn-big:focus { + font-size: 17px !important; + text-align: center !important; + line-height: 1.25em !important; + padding: 6px 40px !important; + outline: 0 !important; + float: center !important; + margin-right: 162px !important; + margin-bottom: 5px !important; +} + +.mp-module .ch-btn-user { + font-family: 'Lato', sans-serif !important; + font-weight: 400 !important; + background-color: #36A1F1 !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #36A1F1), color-stop(100%, #0F79C9)) !important; + background-image: -webkit-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: -moz-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: -o-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: linear-gradient(#36A1F1, #0F79C9) !important; + -webkit-box-shadow: inset 0 1px #97DCFF !important; + box-shadow: 0 1px #97DCFF inset !important; + color: #FFF!important; + border: 0px solid #0D6FB9 !important; + border-radius: 4px 4px 4px 4px !important; + cursor: pointer !important; + display: inline-block !important; + margin-top: 20px !important; +} + +.mp-module .ch-btn, .ch-btn:focus, .ch-btn:visited { + font-family: 'Lato', sans-serif !important; + font-weight: 400 !important; + background-color: #36A1F1 !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #36A1F1), color-stop(100%, #0F79C9)) !important; + background-image: -webkit-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: -moz-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: -o-linear-gradient(#36A1F1, #0F79C9) !important; + background-image: linear-gradient(#36A1F1, #0F79C9) !important; + -webkit-box-shadow: inset 0 1px #97DCFF !important; + box-shadow: 0 1px #97DCFF inset !important; + color: #FFF!important; + border: 0px solid #0D6FB9 !important; + border-radius: 4px 4px 4px 4px !important; + cursor: pointer !important; + display: inline-block !important; + margin-top: 20px !important; + margin-left: 300px; +} +.mp-module .ch-btn:hover,.ch-btn-user:hover { + background-color: #4CBFF8 !important; + background-image: linear-gradient(#4CBFF8, #1699DF) !important; + box-shadow: 0 1px #B6EBFF inset !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #4CBFF8), color-stop(100%, #1699DF)) !important; + background-image: -webkit-linear-gradient(#4CBFF8, #1699DF) !important; + background-image: -moz-linear-gradient(#4CBFF8, #1699DF) !important; + background-image: -o-linear-gradient(#4CBFF8, #1699DF) !important; + background-image: linear-gradient(#4CBFF8, #1699DF) !important; + -webkit-box-shadow: inset 0 1px #B6EBFF !important; + border: 0px solid #1890D3 !important; + color: #FFF !important; + text-decoration: none !important; + outline: 0 +} +.mp-module .ch-btn:active,.ch-btn-user:active { + background-color: #1473CD !important; + background-image: linear-gradient(#1473CD, #0B66BC) !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1473CD), color-stop(100%, #0B66BC)) !important; + background-image: -webkit-linear-gradient(#1473CD, #0B66BC) !important; + background-image: -moz-linear-gradient(#1473CD, #0B66BC) !important; + background-image: -o-linear-gradient(#1473CD, #0B66BC) !important; + background-image: linear-gradient(#1473CD, #0B66BC) !important; + -webkit-box-shadow: inset 0 1px #0B5BA6 !important; + box-shadow: 0 1px #0B5BA6 inset !important; + border: 0px solid #0B5BA6 !important; + color: #FFF !important; + text-decoration: none !important; + outline: 0 +} + +.mp-module .ch-btn-big-orange, .ch-btn-big-orange:focus { + font-size: 17px !important; + text-align: center !important; + line-height: 1.25em !important; + padding: 6px 54px !important; + outline: 0 !important; + float: center !important; + margin-right: 162px !important; + margin-bottom: 5px !important; +} + +.mp-module .ch-btn-orange, .ch-btn-orange:focus, .ch-btn-orange:visited { + font-family: 'Lato', sans-serif !important; + font-weight: 400 !important; + background-color: rgb(255, 155, 0) !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F1EF36), color-stop(100%, #C99C0F)) !important; + background-image: -webkit-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: -moz-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: -o-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: linear-gradient(rgb(239, 133, 13), rgb(255, 87, 0)) !important; + -webkit-box-shadow: inset 0 1px #E5E31C !important; + box-shadow: 0 1px #FFD608 inset !important; + color: #FFF!important; + border: 0px solid #FFB800 !important; + border-radius: 4px 4px 4px 4px !important; + cursor: pointer !important; + display: inline-block !important; + margin-top: 20px !important; +} +.mp-module .ch-btn-orange:hover { + background-color: rgb(255, 213, 0) !important; + background-image: linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + box-shadow: 0 1px #FFD608 inset !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #4CBFF8), color-stop(100%, #1699DF)) !important; + background-image: -webkit-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: -moz-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: -o-linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + background-image: linear-gradient(rgb(255, 213, 0), rgb(255, 165, 0)) !important; + -webkit-box-shadow: inset 0 1px #E5E31C !important; + border: 0px solid #FFB800 !important; + color: #FFF !important; + text-decoration: none !important; + outline: 0 +} +.mp-module .ch-btn-orange:active { + background-color: rgb(255, 107, 1) !important; + background-image: llinear-gradient(rgb(255, 107, 1), rgb(228, 89, 17)) !important; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1473CD), color-stop(100%, rgb(228, 89, 17))) !important; + background-image: -webkit-linear-gradient(rgb(255, 107, 1), rgb(228, 89, 17)) !important; + background-image: -moz-linear-gradient(rgb(255, 107, 1), rgb(228, 89, 17)) !important; + background-image: -o-linear-gradient(rgb(255, 107, 1), rgb(228, 89, 17)) !important; + background-image: linear-gradient(rgb(255, 107, 1), rgb(228, 89, 17)) !important; + -webkit-box-shadow: inset 0 1px rgb(228, 89, 17) !important; + box-shadow: 0 1px rgb(228, 89, 17) inset !important; + border: 0px solid rgb(228, 89, 17) !important; + color: #FFF !important; + text-decoration: none !important; + outline: 0 +} + + +/* Style the list */ +ul.tab { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + border: 1px solid #ccc; + background-color: #f1f1f1; +} + +/* Float the list items side by side */ +ul.tab li {float: left;} + +/* Style the links inside the list items */ +ul.tab li a { + display: inline-block; + color: black; + text-align: center; + padding: 14px 16px; + text-decoration: none; + transition: 0.3s; + font-size: 17px; +} + +/* Change background color of links on hover */ +ul.tab li a:hover {background-color: #ddd;} + +/* Create an active/current tablink class */ +ul.tab li a:focus, .active {background-color: #ccc;} + +/* Style the tab content */ +.tabcontent { + display: none; + padding: 6px 12px; + border: 1px solid #ccc; + border-top: none; +} + +.ch-form-row.discount-link { + background: url(https://secure.mlstatic.com/checkout-resources/resourses/assets/icon-discount.bd9c2205796f.png) no-repeat; + line-height: 25px; +} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/css/marketing.css b/v1.6.x/mercadopago/views/css/style.css similarity index 100% rename from v1.6.x/mercadopago/views/css/marketing.css rename to v1.6.x/mercadopago/views/css/style.css diff --git a/v1.6.x/mercadopago/views/img/Banner_MeiosPagamento_vertical.jpg b/v1.6.x/mercadopago/views/img/Banner_MeiosPagamento_vertical.jpg deleted file mode 100644 index ee074c8..0000000 Binary files a/v1.6.x/mercadopago/views/img/Banner_MeiosPagamento_vertical.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/Bannertipo2_120X600.jpg b/v1.6.x/mercadopago/views/img/Bannertipo2_120X600.jpg deleted file mode 100644 index 8da77f0..0000000 Binary files a/v1.6.x/mercadopago/views/img/Bannertipo2_120X600.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/Checkout.jpg b/v1.6.x/mercadopago/views/img/Checkout.jpg new file mode 100644 index 0000000..b6f830c Binary files /dev/null and b/v1.6.x/mercadopago/views/img/Checkout.jpg differ diff --git a/v1.6.x/mercadopago/views/img/Coupon.jpg b/v1.6.x/mercadopago/views/img/Coupon.jpg new file mode 100644 index 0000000..6e8d03e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/Coupon.jpg differ diff --git a/v1.6.x/mercadopago/views/img/CustomerCard.jpg b/v1.6.x/mercadopago/views/img/CustomerCard.jpg new file mode 100644 index 0000000..fd04ba8 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/CustomerCard.jpg differ diff --git a/v1.6.x/mercadopago/views/img/Installation.JPG b/v1.6.x/mercadopago/views/img/Installation.JPG new file mode 100644 index 0000000..45da8e7 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/Installation.JPG differ diff --git a/v1.6.x/mercadopago/views/img/MCO/CUPOM_MCO.jpg b/v1.6.x/mercadopago/views/img/MCO/CUPOM_MCO.jpg new file mode 100644 index 0000000..7e055f2 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MCO/CUPOM_MCO.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MCO/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MCO/banner_all_methods.png new file mode 100644 index 0000000..9e05a62 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MCO/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MCO/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MCO/credit_card.png similarity index 100% rename from v1.6.x/mercadopago/views/img/MCO/mercadopago_468X60.jpg rename to v1.6.x/mercadopago/views/img/MCO/credit_card.png diff --git a/v1.6.x/mercadopago/views/img/MLA/CUPOM_MLA.jpg b/v1.6.x/mercadopago/views/img/MLA/CUPOM_MLA.jpg new file mode 100644 index 0000000..d381b2f Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLA/CUPOM_MLA.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLA/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MLA/banner_all_methods.png new file mode 100644 index 0000000..9ce6116 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLA/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MLA/credit_card.png b/v1.6.x/mercadopago/views/img/MLA/credit_card.png new file mode 100644 index 0000000..1a8d522 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLA/credit_card.png differ diff --git a/v1.6.x/mercadopago/views/img/MLA/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MLA/mercadopago_468X60.jpg deleted file mode 100644 index 594282c..0000000 Binary files a/v1.6.x/mercadopago/views/img/MLA/mercadopago_468X60.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/MLB/CUPOM_MLB.jpg b/v1.6.x/mercadopago/views/img/MLB/CUPOM_MLB.jpg new file mode 100644 index 0000000..4f66214 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/CUPOM_MLB.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLB/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MLB/banner_all_methods.png new file mode 100644 index 0000000..edbd829 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MLB/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MLB/credit_card.png similarity index 100% rename from v1.6.x/mercadopago/views/img/MLB/mercadopago_468X60.jpg rename to v1.6.x/mercadopago/views/img/MLB/credit_card.png diff --git a/v1.6.x/mercadopago/views/img/MLB/cupom1.jpg b/v1.6.x/mercadopago/views/img/MLB/cupom1.jpg new file mode 100644 index 0000000..a1713ce Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/cupom1.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLB/cupom2.jpg b/v1.6.x/mercadopago/views/img/MLB/cupom2.jpg new file mode 100644 index 0000000..237b233 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/cupom2.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLB/cupom3.jpg b/v1.6.x/mercadopago/views/img/MLB/cupom3.jpg new file mode 100644 index 0000000..d5b1a9e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/cupom3.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLB/desconto_MLB.jpg b/v1.6.x/mercadopago/views/img/MLB/desconto_MLB.jpg new file mode 100644 index 0000000..b126e67 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLB/desconto_MLB.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLC/CUPOM_MLC.jpg b/v1.6.x/mercadopago/views/img/MLC/CUPOM_MLC.jpg new file mode 100644 index 0000000..5ca0d94 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLC/CUPOM_MLC.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLC/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MLC/banner_all_methods.png new file mode 100644 index 0000000..302164a Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLC/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MLC/credit_card.png b/v1.6.x/mercadopago/views/img/MLC/credit_card.png new file mode 100644 index 0000000..61e13c3 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLC/credit_card.png differ diff --git a/v1.6.x/mercadopago/views/img/MLC/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MLC/mercadopago_468X60.jpg deleted file mode 100644 index 671138c..0000000 Binary files a/v1.6.x/mercadopago/views/img/MLC/mercadopago_468X60.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/MLM/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MLM/mercadopago_468X60.jpg deleted file mode 100644 index a47ce35..0000000 Binary files a/v1.6.x/mercadopago/views/img/MLM/mercadopago_468X60.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/MLU/CUPOM_MLU.jpg b/v1.6.x/mercadopago/views/img/MLU/CUPOM_MLU.jpg new file mode 100644 index 0000000..858d332 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLU/CUPOM_MLU.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLU/banner_all_methods.png_OLD.png b/v1.6.x/mercadopago/views/img/MLU/banner_all_methods.png_OLD.png new file mode 100644 index 0000000..121c17f Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLU/banner_all_methods.png_OLD.png differ diff --git a/v1.6.x/mercadopago/views/img/MLV/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/MLU/credit_card_old.png similarity index 100% rename from v1.6.x/mercadopago/views/img/MLV/mercadopago_468X60.jpg rename to v1.6.x/mercadopago/views/img/MLU/credit_card_old.png diff --git a/v1.6.x/mercadopago/views/img/MLV/CUPOM_MLV.jpg b/v1.6.x/mercadopago/views/img/MLV/CUPOM_MLV.jpg new file mode 100644 index 0000000..858d332 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLV/CUPOM_MLV.jpg differ diff --git a/v1.6.x/mercadopago/views/img/MLV/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MLV/banner_all_methods.png new file mode 100644 index 0000000..121c17f Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLV/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MLV/credit_card.png b/v1.6.x/mercadopago/views/img/MLV/credit_card.png new file mode 100644 index 0000000..661f173 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MLV/credit_card.png differ diff --git a/v1.6.x/mercadopago/views/img/MPE/banner_all_methods.png b/v1.6.x/mercadopago/views/img/MPE/banner_all_methods.png new file mode 100644 index 0000000..95b66a2 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MPE/banner_all_methods.png differ diff --git a/v1.6.x/mercadopago/views/img/MeliEnvios.png b/v1.6.x/mercadopago/views/img/MeliEnvios.png new file mode 100644 index 0000000..9e3ed30 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/MeliEnvios.png differ diff --git a/v1.6.x/mercadopago/views/img/Ticket.jpg b/v1.6.x/mercadopago/views/img/Ticket.jpg new file mode 100644 index 0000000..aaae091 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/Ticket.jpg differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/1.png b/v1.6.x/mercadopago/views/img/bandeiras/1.png new file mode 100644 index 0000000..8351f2d Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/1.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/2.png b/v1.6.x/mercadopago/views/img/bandeiras/2.png new file mode 100644 index 0000000..75aa65b Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/2.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/3.png b/v1.6.x/mercadopago/views/img/bandeiras/3.png new file mode 100644 index 0000000..687393f Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/3.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/4.png b/v1.6.x/mercadopago/views/img/bandeiras/4.png new file mode 100644 index 0000000..d6e4fcd Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/4.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/5.png b/v1.6.x/mercadopago/views/img/bandeiras/5.png new file mode 100644 index 0000000..57b13d5 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/5.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/6.png b/v1.6.x/mercadopago/views/img/bandeiras/6.png new file mode 100644 index 0000000..948307b Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/6.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/7.png b/v1.6.x/mercadopago/views/img/bandeiras/7.png new file mode 100644 index 0000000..f6c0e8c Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/7.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/8.png b/v1.6.x/mercadopago/views/img/bandeiras/8.png new file mode 100644 index 0000000..fd36414 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/8.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/9.png b/v1.6.x/mercadopago/views/img/bandeiras/9.png new file mode 100644 index 0000000..3165fde Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bandeiras/9.png differ diff --git a/v1.6.x/mercadopago/views/img/bandeiras/index.php b/v1.6.x/mercadopago/views/img/bandeiras/index.php new file mode 100644 index 0000000..0df7996 --- /dev/null +++ b/v1.6.x/mercadopago/views/img/bandeiras/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; diff --git a/v1.6.x/mercadopago/views/img/banner.png b/v1.6.x/mercadopago/views/img/banner.png new file mode 100644 index 0000000..3c661cd Binary files /dev/null and b/v1.6.x/mercadopago/views/img/banner.png differ diff --git a/v1.6.x/mercadopago/views/img/bg.gif b/v1.6.x/mercadopago/views/img/bg.gif new file mode 100644 index 0000000..d496ca1 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/bg.gif differ diff --git a/v1.6.x/mercadopago/views/img/boleto.png b/v1.6.x/mercadopago/views/img/boleto.png new file mode 100644 index 0000000..fb8646e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/boleto.png differ diff --git a/v1.6.x/mercadopago/views/img/carrier.jpg b/v1.6.x/mercadopago/views/img/carrier.jpg new file mode 100644 index 0000000..055534e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/carrier.jpg differ diff --git a/v1.6.x/mercadopago/views/img/credit_card.png b/v1.6.x/mercadopago/views/img/credit_card.png new file mode 100644 index 0000000..4acb0d8 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/credit_card.png differ diff --git a/v1.6.x/mercadopago/views/img/cvv.png b/v1.6.x/mercadopago/views/img/cvv.png new file mode 100644 index 0000000..b040870 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/cvv.png differ diff --git a/v1.6.x/mercadopago/views/img/dd_arrow.gif b/v1.6.x/mercadopago/views/img/dd_arrow.gif new file mode 100644 index 0000000..5b29df7 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/dd_arrow.gif differ diff --git a/v1.6.x/mercadopago/views/img/email.png b/v1.6.x/mercadopago/views/img/email.png new file mode 100644 index 0000000..67dfc57 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/email.png differ diff --git a/v1.6.x/mercadopago/views/img/facebook.png b/v1.6.x/mercadopago/views/img/facebook.png new file mode 100644 index 0000000..796fba1 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/facebook.png differ diff --git a/v1.6.x/mercadopago/views/img/index.php b/v1.6.x/mercadopago/views/img/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/img/index.php +++ b/v1.6.x/mercadopago/views/img/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/img/logo-mercadopago.png b/v1.6.x/mercadopago/views/img/logo-mercadopago.png deleted file mode 100644 index 867ddd1..0000000 Binary files a/v1.6.x/mercadopago/views/img/logo-mercadopago.png and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/logo_mercadopago_large.png b/v1.6.x/mercadopago/views/img/logo_mercadopago_large.png deleted file mode 100644 index d7c380c..0000000 Binary files a/v1.6.x/mercadopago/views/img/logo_mercadopago_large.png and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/mercado_envios.jpg b/v1.6.x/mercadopago/views/img/mercado_envios.jpg new file mode 100644 index 0000000..055534e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/mercado_envios.jpg differ diff --git a/v1.6.x/mercadopago/views/img/mercadoenvios_hori.jpg b/v1.6.x/mercadopago/views/img/mercadoenvios_hori.jpg new file mode 100644 index 0000000..38f8d03 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/mercadoenvios_hori.jpg differ diff --git a/v1.6.x/mercadopago/views/img/mercadopago.png b/v1.6.x/mercadopago/views/img/mercadopago.png new file mode 100644 index 0000000..42bf930 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/mercadopago.png differ diff --git a/v1.6.x/mercadopago/views/img/mercadopago_125X125.jpg b/v1.6.x/mercadopago/views/img/mercadopago_125X125.jpg deleted file mode 100644 index 904eba1..0000000 Binary files a/v1.6.x/mercadopago/views/img/mercadopago_125X125.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/mercadopago_468X60.jpg b/v1.6.x/mercadopago/views/img/mercadopago_468X60.jpg deleted file mode 100644 index e7ba623..0000000 Binary files a/v1.6.x/mercadopago/views/img/mercadopago_468X60.jpg and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/mercadopago_point.jpg b/v1.6.x/mercadopago/views/img/mercadopago_point.jpg new file mode 100644 index 0000000..367421e Binary files /dev/null and b/v1.6.x/mercadopago/views/img/mercadopago_point.jpg differ diff --git a/v1.6.x/mercadopago/views/img/mercadopago_point_2.jpg b/v1.6.x/mercadopago/views/img/mercadopago_point_2.jpg new file mode 100644 index 0000000..dca20bf Binary files /dev/null and b/v1.6.x/mercadopago/views/img/mercadopago_point_2.jpg differ diff --git a/v1.6.x/mercadopago/views/img/negative.png b/v1.6.x/mercadopago/views/img/negative.png new file mode 100644 index 0000000..568cf5a Binary files /dev/null and b/v1.6.x/mercadopago/views/img/negative.png differ diff --git a/v1.6.x/mercadopago/views/img/payment_method_logo.png b/v1.6.x/mercadopago/views/img/payment_method_logo.png new file mode 100644 index 0000000..232594b Binary files /dev/null and b/v1.6.x/mercadopago/views/img/payment_method_logo.png differ diff --git a/v1.6.x/mercadopago/views/img/payment_method_logo_120_31.png b/v1.6.x/mercadopago/views/img/payment_method_logo_120_31.png new file mode 100644 index 0000000..a40b342 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/payment_method_logo_120_31.png differ diff --git a/v1.6.x/mercadopago/views/img/payment_method_logo_large.png b/v1.6.x/mercadopago/views/img/payment_method_logo_large.png new file mode 100644 index 0000000..759c6c5 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/payment_method_logo_large.png differ diff --git a/v1.6.x/mercadopago/views/img/positive.png b/v1.6.x/mercadopago/views/img/positive.png new file mode 100644 index 0000000..9973c28 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/positive.png differ diff --git a/v1.6.x/mercadopago/views/img/questionmark.png b/v1.6.x/mercadopago/views/img/questionmark.png deleted file mode 100644 index a666733..0000000 Binary files a/v1.6.x/mercadopago/views/img/questionmark.png and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/sft.png b/v1.6.x/mercadopago/views/img/sft.png deleted file mode 100644 index a5a6543..0000000 Binary files a/v1.6.x/mercadopago/views/img/sft.png and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/signup.png b/v1.6.x/mercadopago/views/img/signup.png deleted file mode 100644 index 92fb78a..0000000 Binary files a/v1.6.x/mercadopago/views/img/signup.png and /dev/null differ diff --git a/v1.6.x/mercadopago/views/img/spinner.gif b/v1.6.x/mercadopago/views/img/spinner.gif new file mode 100644 index 0000000..4e84fde Binary files /dev/null and b/v1.6.x/mercadopago/views/img/spinner.gif differ diff --git a/v1.6.x/mercadopago/views/img/youtube.png b/v1.6.x/mercadopago/views/img/youtube.png new file mode 100644 index 0000000..3d3e451 Binary files /dev/null and b/v1.6.x/mercadopago/views/img/youtube.png differ diff --git a/v1.6.x/mercadopago/views/index.php b/v1.6.x/mercadopago/views/index.php old mode 100755 new mode 100644 index 72b7262..0df7996 --- a/v1.6.x/mercadopago/views/index.php +++ b/v1.6.x/mercadopago/views/index.php @@ -1,35 +1,35 @@ - -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; \ No newline at end of file + +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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; diff --git a/v1.6.x/mercadopago/views/js/backoffice.js b/v1.6.x/mercadopago/views/js/backoffice.js deleted file mode 100644 index 6aeb543..0000000 --- a/v1.6.x/mercadopago/views/js/backoffice.js +++ /dev/null @@ -1,84 +0,0 @@ - -$(document).ready(function(){ - $('.mercadopago-tabs nav .tab-title').click(function(){ - var elem = $(this); - var target = $(elem.data('target')); - elem.addClass('active').siblings().removeClass('active'); - target.show().siblings().hide(); - }) - - if ($('.mercadopago-tabs nav .tab-title.active').length == 0){ - $('.mercadopago-tabs nav .tab-title:first').trigger("click"); - } - - $('[data-toggle="tooltip"]').tooltip(); - - var list_payment = [ - 'visa', - 'master', - 'hipercard', - 'amex', - 'diners', - 'elo', - 'melicard', - 'bolbradesco', - ]; - -/* - - $("input:radio[name='MERCADOPAGO_STARDAND_ACTIVE']").change(function(){ - if ($(this).is(':checked') && $(this).val() == '1') { - - alert("entrou aqui === " + $(this).val()); - for(i=0; i').attr({ - type: 'hidden', - id: 'HIDDEN_'+payment+'_ACTIVE', - name: 'MERCADOPAGO_'+payment+'_ACTIVE', - value: active, - }).insertAfter("#MERCADOPAGO_"+payment+"_ACTIVE_on"); - - $("#MERCADOPAGO_"+payment+"_ACTIVE_on").attr("disabled", true); - $("#MERCADOPAGO_"+payment+"_ACTIVE_off").attr("disabled", true); - } - } - } - - function validationAllCardsOff(list_payment){ - if($("input:radio[name='MERCADOPAGO_STARDAND_ACTIVE']:checked").val() == '0') - { - for(i=0; i +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/js/jquery.dd.js b/v1.6.x/mercadopago/views/js/jquery.dd.js new file mode 100644 index 0000000..9f77021 --- /dev/null +++ b/v1.6.x/mercadopago/views/js/jquery.dd.js @@ -0,0 +1,12 @@ +/** + * NOTICE OF LICENSE + * + * it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2 + * + * msDropDown is free jQuery Plugin: you can redistribute it and/or modify + * + * @author MSDropDown + * @copyright www.giftlelo.com | www.marghoobsuleman.com + * @license LICENSE.txt + */ +;eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(5($){3 1L="";3 3m=5(p,q){3 r=p;3 s=1a;3 q=$.3n({1d:4c,2q:7,3o:23,1U:6,1M:4d,3p:\'28\',1N:15,3q:\'4e\',2I:\'\',1j:\'\'},q);1a.1V=2r 3r();3 u="";3 v={};v.2J=6;v.2s=15;v.2t=1o;3 x=15;3 y={2K:\'4f\',1O:\'4g\',1H:\'4h\',29:\'4i\',1h:\'4j\',2L:\'4k\',2M:\'4l\',4m:\'4n\',2u:\'4o\',3s:\'4p\'};3 z={28:q.3p,2N:\'2N\',2O:\'2O\',2P:\'2P\',1t:\'1t\',1k:.30,2a:\'2a\',2v:\'2v\',2w:\'2w\',11:\'11\'};3 A={3t:"2x,2Q,2R,1P,2y,2z,1u,1B,2A,1Q,4q,1W,2S",18:"1C,1v,1k,4r"};1a.1R=2r 3r();3 B=$(r).18("1b");4(1w(B)=="14"||B.1c<=0){B="4s"+$.1S.3u++;$(r).2B("1b",B)};3 C=$(r).18("1j");q.1j+=(C==14)?"":C;3 D=$(r).3v();x=($(r).18("1C")>1||$(r).18("1v")==6)?6:15;4(x){q.2q=$(r).18("1C")};3 E={};3 F=0;3 G=15;3 H;3 I={};3 J=5(a){4(1w(I[a])=="14"){I[a]=1p.4t(a)}12 I[a]};3 K=5(a){12 B+y[a]};3 L=5(a){3 b=a;3 c=$(b).18("1j");12 c};3 M=5(a){3 b=$("#"+B+" 2T:11");4(b.1c>1){1D(3 i=0;i \'};3 j=$(a).1q();3 k=$(a).4u();3 l=($(a).18("1k")==6)?"1k":"2W";E[g]={1I:h+j,2b:k,1q:j,1i:a.1i,1b:g};3 m=L(a);4(M(a.1i)==6){e+=\'\';e+=h+\'<1x 1r="\'+z.1t+\'">\'+j+\'\';12 e};3 O=5(t){3 b=t.3E();4(b.1c==0)12-1;3 a="";1D(3 i 2c E){3 c=E[i].1q.3E();4(c.3F(0,b.1c)==b){a+="#"+E[i].1b+", "}};12(a=="")?-1:a};3 P=5(){3 f=D;4(f.1c==0)12"";3 g="";3 h=K("2L");3 i=K("2M");f.2X(5(c){3 d=f[c];4(d.4v=="4w"){g+="<1y 1r=\'4x\'>";g+="<1x 1j=\'3G-4y:4z;3G-1j:4A; 4B:4C;\'>"+$(d).18("4D")+"";3 e=$(d).3v();e.2X(5(a){3 b=e[a];g+=N(b,c,a,"2U")});g+=""}19{g+=N(d,c,"","")}});12 g};3 Q=5(){3 a=K("1O");3 b=K("1h");3 c=q.1j;1Y="";1Y+=\'<1y 1b="\'+b+\'" 1r="\'+z.2P+\'"\';4(!x){1Y+=(c!="")?\' 1j="\'+c+\'"\':\'\'}19{1Y+=(c!="")?\' 1j="2C-1m:4E 4F #4G;1s:2d;1n:2Y;\'+c+\'"\':\'\'};1Y+=\'>\';12 1Y};3 R=5(){3 a=K("1H");3 b=K("2u");3 c=K("29");3 d=K("3s");3 e="";3 f="";4(J(B).1E.1c>0){e=$("#"+B+" 2T:11").1q();f=$("#"+B+" 2T:11").18("1X")};f=(f.1c==0||f==14||q.1U==15||q.1N!=15)?"":\'<3x 3y="\'+f+\'" 3z="3A" /> \';3 g=\'<1y 1b="\'+a+\'" 1r="\'+z.2N+\'"\';g+=\'>\';g+=\'<1x 1b="\'+b+\'" 1r="\'+z.2O+\'"><1x 1r="\'+z.1t+\'" 1b="\'+c+\'">\'+f+\'<1x 1r="\'+z.1t+\'">\'+e+\'\';12 g};3 S=5(){3 c=K("1h");$("#"+c+" a.2W").1J("1P");$("#"+c+" a.2W").1e("1P",5(a){a.1Z();V(1a);21();4(!x){$("#"+c).1J("1B");X(15);3 b=(q.1U==15)?$(1a).1q():$(1a).1I();1T(b);s.2e()}})};3 T=5(){3 d=15;3 e=K("1O");3 f=K("1H");3 g=K("29");3 h=K("1h");3 i=K("2u");3 j=$("#"+B).2Z();j=j+2;3 k=q.1j;4($("#"+e).1c>0){$("#"+e).2D();d=6};3 l=\'<1y 1b="\'+e+\'" 1r="\'+z.28+\'"\';l+=(k!="")?\' 1j="\'+k+\'"\':\'\';l+=\'>\';l+=R();l+=Q();l+=P();l+="";l+="";4(d==6){3 m=K("2K");$("#"+m).31(l)}19{$("#"+B).31(l)};4(x){3 f=K("1H");$("#"+f).2f()};$("#"+e).9("2Z",j+"1z");$("#"+h).9("2Z",(j-2)+"1z");4(D.1c>q.2q){3 n=2g($("#"+h+" a:3H").9("2h-3I"))+2g($("#"+h+" a:3H").9("2h-1m"));3 o=((q.3o)*q.2q)-n;$("#"+h).9("1d",o+"1z")}19 4(x){3 o=$("#"+B).1d();$("#"+h).9("1d",o+"1z")};4(d==15){3J();W(B)};4($("#"+B).18("1k")==6){$("#"+e).9("2E",z.1k)};Z();$("#"+f).1e("1B",5(a){32(1)});$("#"+f).1e("1Q",5(a){32(0)});S();$("#"+h+" a.1k").9("2E",z.1k);4(x){$("#"+h).1e("1B",5(c){4(!v.2s){v.2s=6;$(1p).1e("1W",5(a){3 b=a.3K;v.2t=b;4(b==39||b==40){a.1Z();a.2i();33();21()};4(b==37||b==38){a.1Z();a.2i();34();21()}})}})};$("#"+h).1e("1Q",5(a){X(15);$(1p).1J("1W");v.2s=15;v.2t=1o});$("#"+f).1e("1P",5(b){X(15);4($("#"+h+":2j").1c==1){$("#"+h).1J("1B")}19{$("#"+h).1e("1B",5(a){X(6)});s.3L()}});$("#"+f).1e("1Q",5(a){X(15)});4(q.1U&&q.1N!=15){2k()}};3 U=5(a){1D(3 i 2c E){4(E[i].1i==a){12 E[i]}};12-1};3 V=5(a){3 b=K("1h");4($("#"+b+" a."+z.11).1c==1){u=$("#"+b+" a."+z.11).1q()};4(!x){$("#"+b+" a."+z.11).1K(z.11)};3 c=$("#"+b+" a."+z.11).18("1b");4(c!=14){3 d=(v.22==14||v.22==1o)?E[c].1i:v.22};4(a&&!x){$(a).1F(z.11)};4(x){3 e=v.2t;4($("#"+B).18("1v")==6){4(e==17){v.22=E[$(a).18("1b")].1i;$(a).4H(z.11)}19 4(e==16){$("#"+b+" a."+z.11).1K(z.11);$(a).1F(z.11);3 f=$(a).18("1b");3 g=E[f].1i;1D(3 i=35.4I(d,g);i<=35.4J(d,g);i++){$("#"+U(i).1b).1F(z.11)}}19{$("#"+b+" a."+z.11).1K(z.11);$(a).1F(z.11);v.22=E[$(a).18("1b")].1i}}19{$("#"+b+" a."+z.11).1K(z.11);$(a).1F(z.11);v.22=E[$(a).18("1b")].1i}}};3 W=5(a){3 b=a;J(b).4K=5(e){$("#"+b).1S(q)}};3 X=5(a){v.2J=a};3 Y=5(){12 v.2J};3 Z=5(){3 b=K("1O");3 c=A.3t.4L(",");1D(3 d=0;d");$("#"+B).4N($("#"+a))};3 1T=5(a){3 b=K("29");$("#"+b).1I(a)};3 3a=5(w){3 a=w;3 b=K("1h");3 c=$("#"+b+" a:2j");3 d=c.1c;3 e=$("#"+b+" a:2j").1i($("#"+b+" a.11:2j"));3 f;2F(a){1f"3b":4(e0){e--;f=c[e]};1g};4(1w(f)=="14"){12 15};$("#"+b+" a."+z.11).1K(z.11);$(f).1F(z.11);3 g=f.1b;4(!x){3 h=(q.1U==15)?E[g].1q:$("#"+g).1I();1T(h);2k(E[g].1i)};4(a=="3b"){4(2g(($("#"+g).1n().1m+$("#"+g).1d()))>=2g($("#"+b).1d())){$("#"+b).2l(($("#"+b).2l())+$("#"+g).1d()+$("#"+g).1d())}}19{4(2g(($("#"+g).1n().1m+$("#"+g).1d()))<=0){$("#"+b).2l(($("#"+b).2l()-$("#"+b).1d())-$("#"+g).1d())}}};3 33=5(){3a("3b")};3 34=5(){3a("3P")};3 2k=5(i){4(q.1N!=15){3 a=K("29");3 b=(1w(i)=="14")?J(B).1l:i;3 c=J(B).1E[b].3w;4(c.1c>0){3 d=K("1h");3 e=$("#"+d+" a."+c).18("1b");3 f=$("#"+e).9("2m-4O");3 g=$("#"+e).9("2m-1n");3 h=$("#"+e).9("2h-3Q");4(f!=14){$("#"+a).2n("."+z.1t).2B(\'1j\',"2m:"+f)};4(g!=14){$("#"+a).2n("."+z.1t).9(\'2m-1n\',g)};4(h!=14){$("#"+a).2n("."+z.1t).9(\'2h-3Q\',h)};$("#"+a).2n("."+z.1t).9(\'2m-3R\',\'4P-3R\');$("#"+a).2n("."+z.1t).9(\'2h-3I\',\'4Q\')}}};3 21=5(){3 a=K("1h");3 b=$("#"+a+" a."+z.11);4(b.1c==1){3 c=$("#"+a+" a."+z.11).1q();3 d=$("#"+a+" a."+z.11).18("1b");4(d!=14){3 e=E[d].2b;J(B).1l=E[d].1i};4(q.1U&&q.1N!=15)2k()}19 4(b.1c>1){1D(3 i=0;i46){f+=4W.4X(b)};3 c=O(f);4(c!=-1){$("#"+e).9({1d:\'4Y\'});$("#"+e+" a").2f();$(c).25();3 d=2G();$("#"+e).9(d.9);$("#"+e).9({1s:\'2d\'})}19{$("#"+e+" a").25();$("#"+e).9({1d:H+\'1z\'})};1g};4(24("1W")==6){J(B).4Z()}});$(1p).1e("2S",5(a){4($("#"+B).18("45")!=14){J(B).45()}});$(1p).1e("1u",5(a){4(Y()==15){s.2e()}});3 g=2G();$("#"+e).9(g.9);4(g.3d==6){$("#"+e).9({1s:\'2d\'});$("#"+e).1F(g.2C);3e()}19{$("#"+e)[g.3Z]("3g",5(){$("#"+e).1F(g.2C);3e()})};4(e!=1L){1L=e}}};1a.2e=5(){3 b=K("1h");3 c=$("#"+K("1H")).1n().1m;3 d=2G();G=15;4(d.3d==6){$("#"+b).50({1d:0,1m:c,},5(){$("#"+b).9({1d:H+\'1z\',1s:\'2o\'});3f()})}19{$("#"+b).43("3g",5(a){3f();$("#"+b).9({1M:\'0\'});$("#"+b).9({1d:H+\'1z\'})})};2k();$(1p).1J("1W");$(1p).1J("2S");$(1p).1J("1u")};1a.1l=5(i){4(1w(i)=="14"){12 s.26("1l")}19{s.1A("1l",i)}};1a.51=5(a){4(1w(a)=="14"||a==6){$("."+z.2a).52("1j")}19{$("."+z.2a).2B("1j","1d:3M;3N:3O;1n:36")}};1a.1A=5(a,b,c){4(a==14||b==14)47{48:"1A 53 54?"};s.1V[a]=b;4(c!=6){2F(a){1f"1l":3W(a,b);1g;1f"1k":s.1k(b,6);1g;1f"1v":J(B)[a]=b;x=($(r).18("1C")>0||$(r).18("1v")==6)?6:15;4(x){3 d=$("#"+B).1d();3 f=K("1h");$("#"+f).9("1d",d+"1z");3 g=K("1H");$("#"+g).2f();3 f=K("1h");$("#"+f).9({1s:\'2d\',1n:\'2Y\'});S()};1g;1f"1C":J(B)[a]=b;4(b==0){J(B).1v=15};x=($(r).18("1C")>0||$(r).18("1v")==6)?6:15;4(b==0){3 g=K("1H");$("#"+g).25();3 f=K("1h");$("#"+f).9({1s:\'2o\',1n:\'36\'});3 h="";4(J(B).1l>=0){3 i=U(J(B).1l);h=i.1I;V($("#"+i.1b))};1T(h)}19{3 g=K("1H");$("#"+g).2f();3 f=K("1h");$("#"+f).9({1s:\'2d\',1n:\'2Y\'})};1g;44:55{J(B)[a]=b}56(e){};1g}}};1a.26=5(a,b){4(a==14&&b==14){12 s.1V};4(a!=14&&b==14){12(s.1V[a]!=14)?s.1V[a]:1o};4(a!=14&&b!=14){12 J(B)[a]}};1a.2j=5(a){3 b=K("1O");4(a==6){$("#"+b).25()}19 4(a==15){$("#"+b).2f()}19{12 $("#"+b).9("1s")}};1a.57=5(a,b){3 c=a;3 d=c.1q;3 e=(c.2b==14||c.2b==1o)?d:c.2b;3 f=(c["1X"]==14||c["1X"]==1o)?\'\':c["1X"];3 i=(b==14||b==1o)?J(B).1E.1c:b;J(B).1E[i]=2r 58(d,e);4(f!=\'\')J(B).1E[i]["1X"]=f;3 g=U(i);4(g!=-1){3 h=N(J(B).1E[i],i,"","");$("#"+g.1b).1I(h)}19{3 h=N(J(B).1E[i],i,"","");3 j=K("1h");$("#"+j).59(h);S()}};1a.2D=5(i){J(B).2D(i);4((U(i))!=-1){$("#"+U(i).1b).2D();3X(i,\'d\')};4(J(B).1c==0){1T("")}19{3 a=U(J(B).1l).1I;1T(a)};s.1A("1l",J(B).1l)};1a.1k=5(a,b){J(B).1k=a;3 c=K("1O");4(a==6){$("#"+c).9("2E",z.1k);s.2e()}19 4(a==15){$("#"+c).9("2E",1)};4(b!=6){s.1A("1k",a)}};1a.3h=5(){12(J(B).3h==14)?1o:J(B).3h};1a.3i=5(){4(2p.1c==1){12 J(B).3i(2p[0])}19 4(2p.1c==2){12 J(B).3i(2p[0],2p[1])}19{47{48:"5a 1i 5b 5c!"}}};1a.49=5(a){12 J(B).49(a)};1a.1v=5(a){4(1w(a)=="14"){12 s.26("1v")}19{s.1A("1v",a)}};1a.1C=5(a){4(1w(a)=="14"){12 s.26("1C")}19{s.1A("1C",a)}};1a.5d=5(a,b){s.1R[a]=b};1a.5e=5(a){2H(s.1R[a])(s)};3 4a=5(){s.1A("3j",$.1S.3j);s.1A("3k",$.1S.3k)};3 4b=5(){T();3V();4a();4(q.2I!=\'\'){2H(q.2I)(s)}};4b()};$.1S={3j:2.37,3k:"5f 5g",3u:20,5h:5(a,b){12 $(a).1S(b).3c("28")}};$.3l.3n({1S:5(b){12 1a.2X(5(){3 a=2r 3m(1a,b);$(1a).3c(\'28\',a)})}});4(1w($.3l.18)==\'14\'){$.3l.18=5(w){12 $(1a).2B(w)}}})(5i);',62,329,'|||var|if|function|true|||css||||||||||||||||||||||||||||||||||||||||||||||||||||||selected|return||undefined|false|||prop|else|this|id|length|height|bind|case|break|postChildID|index|style|disabled|selectedIndex|top|position|null|document|text|class|display|ddTitleText|mouseup|multiple|typeof|span|div|px|set|mouseover|size|for|options|addClass|trigger|postTitleID|html|unbind|removeClass|bs|zIndex|useSprite|postID|click|mouseout|onActions|msDropDown|bv|showIcon|ddProp|keydown|title|sDiv|preventDefault||bA|oldIndex||bB|show|get||dd|postTitleTextID|ddOutOfVision|value|in|block|close|hide|parseInt|padding|stopPropagation|visible|bz|scrollTop|background|find|none|arguments|visibleRows|new|keyboardAction|currentKey|postArrowID|borderTop|noBorderTop|focus|dblclick|mousedown|mousemove|attr|border|remove|opacity|switch|bH|eval|onInit|insideWindow|postElementHolder|postAID|postOPTAID|ddTitle|arrow|ddChild|blur|change|keyup|option|opt|_|enabled|each|relative|width||after|bD|bx|by|Math|absolute||||bw|next|data|opp|bI|bJ|fast|form|item|version|author|fn|bt|extend|rowHeight|mainCSS|animStyle|Object|postInputhidden|actions|counter|children|className|img|src|align|absmiddle|href|javascript|void|toLowerCase|substr|font|first|bottom|bu|keyCode|open|0px|overflow|hidden|previous|left|repeat|bC|trim|backgroundPosition|bE|bF|bG|window|ani||onOpen|onClose|slideUp|default|onkeyup||throw|message|namedItem|bK|bL|120|9999|slideDown|_msddHolder|_msdd|_title|_titletext|_child|_msa|_msopta|postInputID|_msinput|_arrow|_inp|keypress|tabindex|msdrpdd|getElementById|val|nodeName|OPTGROUP|opta|weight|bold|italic|clear|both|label|1px|solid|c3c3c3|toggleClass|min|max|refresh|split|mouseenter|appendTo|image|no|2px|on|events|100|delete|floor|String|fromCharCode|auto|onkeydown|animate|debug|removeAttr|to|what|try|catch|add|Option|append|An|is|required|addMyEvent|fireEvent|Marghoob|Suleman|create|jQuery'.split('|'),0,{})) \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/admin/index.php b/v1.6.x/mercadopago/views/templates/admin/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/templates/admin/index.php +++ b/v1.6.x/mercadopago/views/templates/admin/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/templates/admin/presentation.tpl b/v1.6.x/mercadopago/views/templates/admin/marketing.tpl similarity index 78% rename from v1.6.x/mercadopago/views/templates/admin/presentation.tpl rename to v1.6.x/mercadopago/views/templates/admin/marketing.tpl index ff32b03..0460992 100644 --- a/v1.6.x/mercadopago/views/templates/admin/presentation.tpl +++ b/v1.6.x/mercadopago/views/templates/admin/marketing.tpl @@ -1,18 +1,53 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*}
-
-
-
- +
+ +
+
+ +
+

+ + {l s='MercadoPago' mod='mercadopago'} + +

+

+ {l s='The easiest, fastest and securiest way' mod='mercadopago'} + {l s=' to receive payments and raise your website sales' mod='mercadopago'} +

+

{l s='Configure' mod='mercadopago'}

+
-
-
+

{l s='Latin America leader' mod='mercadopago'}

-
@@ -37,7 +72,8 @@
- +

{l s='The most important payment methods of the market' mod='mercadopago'}

+
@@ -110,7 +146,7 @@
- + Não se preocupe com fraudes!

{l s='Don\'t worry about frauds!' mod='mercadopago'}

@@ -119,6 +155,7 @@
  • {l s='Online and real time approval' mod='mercadopago'}
  • {l s='You only pay by approved transaction' mod='mercadopago'}
  • +

    {l s='Configure' mod='mercadopago'}

    @@ -174,7 +211,7 @@
    -

    {l s='Ready!' mod='mercadopago'} {l s='It has never been so easy to sell' mod='mercadopago'}

    +

    {l s='Ready!' mod='mercadopago'} {l s='It has never been so easy to sell' mod='mercadopago'} {l s='Configure' mod='mercadopago'}

    @@ -200,7 +237,7 @@
    {l s='More information' mod='mercadopago'}

    comercial@mercadopago.com.br
    - modulos@mercadopago.com.br + developers@mercadopago.com.br

    diff --git a/v1.6.x/mercadopago/views/templates/admin/paymentConfiguration.tpl b/v1.6.x/mercadopago/views/templates/admin/paymentConfiguration.tpl deleted file mode 100644 index c449369..0000000 --- a/v1.6.x/mercadopago/views/templates/admin/paymentConfiguration.tpl +++ /dev/null @@ -1,84 +0,0 @@ - -
    -
    - {if $show} -
    -
    - -
    - -
    -
    {$label.active|escape:'htmlall':'UTF-8'}
    -
    - - - - - - -
    -
    -
    - -
    -
    -
    -
    - {else} -
    - {l s='Danger!' mod='mercadopago'} {l s='Please, fill your credentials to enable the module.' mod='mercadopago'} -
    - {/if} -
    -{if $show} -
    -
    {l s='Payment Methods' mod='mercadopago'}
    -
    - {l s='Enable and disable your payment methods.' mod='mercadopago'} -
    - {foreach from=$payments key=sort item=payment} -
    -
    - {$payment.title|escape:'htmlall':'UTF-8'} -
    - -
    -
    - {if ($payment.active == 1)} - {$label.active|escape:'htmlall':'UTF-8'} - {else} - {$label.disable|escape:'htmlall':'UTF-8'} - {/if} -
    -
    - - - - - - -
    -
    -
    -
    -
    - {/foreach} -
    - - -
    -{/if} - diff --git a/v1.6.x/mercadopago/views/templates/admin/requirements.tpl b/v1.6.x/mercadopago/views/templates/admin/requirements.tpl deleted file mode 100644 index e69de29..0000000 diff --git a/v1.6.x/mercadopago/views/templates/admin/settings.tpl b/v1.6.x/mercadopago/views/templates/admin/settings.tpl new file mode 100644 index 0000000..0fd304c --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/admin/settings.tpl @@ -0,0 +1,640 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} +
    + {if empty($client_id)} + {include file='./marketing.tpl' + this_path_ssl=$this_path_ssl|escape:'htmlall':'UTF-8'} + {/if} + + + +
    +
    +
    + + + + +
    +

    {l s='Requirements' mod='mercadopago'}

    +

    + {l s='Installed Curl' mod='mercadopago'}: +

    +

    + {l s='Dimensions of the product registered' mod='mercadopago'}: +

    +

    + {l s='Installed SSL' mod='mercadopago'}: +

    +

    + {l s='PHP Version' mod='mercadopago'}: +

    +
    + + + + + +
    + +

    {l s='Notes:' mod='mercadopago'}

    +

    {l s='- To obtain your Client Id, Client Secret, Public Key and Access Token please click on your country:' mod='mercadopago'}

    + {l s='Argentina' mod='mercadopago'} | + {l s='Brazil' mod='mercadopago'} | + {l s='Colombia' mod='mercadopago'} | + {l s='Chile' mod='mercadopago'} | + {l s='Mexico' mod='mercadopago'} | + {l s='Venezuela' mod='mercadopago'} | + {l s='Uruguay' mod='mercadopago'} +
    +
    + + {l s='Settings - General' mod='mercadopago'} + + +
    + +
    +
    + +
    + +
    +
    + {if !empty($country)} + +
    + +
    +
    + +
    {$notification_url|escape:'htmlall':'UTF-8'}
    + {/if} + +
    +
    + {if $country == 'MLB' || $country == 'MLM' || $country == 'MLA' || $country == 'MLC' || $country == 'MCO' || $country == 'MLV' || $country == 'MPE'} + +
    + + {l s='Settings - Custom' mod='mercadopago'} + + +
    + +
    +
    + +
    + +
    +
    + +
    + + {l s='Settings - Custom Credit Card' mod='mercadopago'} + + +
    + +
    +
    + +
    + +
    +
    + {foreach from=$offline_payment_settings key=offline_payment item=value} +
    + + {l s='Settings - ' mod='mercadopago'}{$value.name|ucfirst|escape:'htmlall':'UTF-8'} {l s=' Custom' mod='mercadopago'} + + +
    + +
    +
    + +
    + +
    +
    +
    + {/foreach} + {/if} + {if $country != ''} +
    + + {l s='Settings - MercadoPago Standard' mod='mercadopago'} + + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + + +
    + +
    +
    + +
    + +
    +
    + +
    +
    + {foreach from=$payment_methods item=payment_method} +
    + {$payment_method.name|escape:'htmlall':'UTF-8'} + {/foreach} +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    + {if $country == 'MLB' || $country == 'MLM' || $country == 'MLA' || $country == 'MLC' || $country == 'MCO' || $country == 'MLV'} +
    +
    + +
    +
    +
    +

    {l s='Settings Mercado Envios' mod='mercadopago'}

    +
    +
    + + {l s='Settings - Mercado Pago Discount' mod='mercadopago'} + + +
    + +

    + +
    + {l s='Credit card (in cash)' mod='mercadopago'}
    + {l s='Ticket' mod='mercadopago'} +
    +
    +
    + {if $country == 'MLB' || $country == 'MLM' || $country == 'MLA' || $country == 'MPE'} +
    + + {l s='Coupon MercadoPago' mod='mercadopago'} + +

    {l s='* Valid option only for sites participating coupon campaigns.' mod='mercadopago'}

    +
    + +
    + + +
    +
    + {/if} +
    + + {l s='Point' mod='mercadopago'} + + + + + + + +
    + + + + +
    +
    +
    + + {l s='Settings' mod='mercadopago'} + + + +
    + +
    +
    + {/if} + {if empty($country)} + + {else} + + {/if} + +
    +
    + + + diff --git a/v1.6.x/mercadopago/views/templates/admin/tabs.tpl b/v1.6.x/mercadopago/views/templates/admin/tabs.tpl deleted file mode 100644 index 1664bb8..0000000 --- a/v1.6.x/mercadopago/views/templates/admin/tabs.tpl +++ /dev/null @@ -1,34 +0,0 @@ - - - -{if $message} - {if $message.success} - {assign var="alert" value="alert-success"} - {else} - {assign var="alert" value="alert-danger"} - {/if} -
    -
    - - {$message.text|escape:'htmlall':'UTF-8'} -
    -
    -{/if} - -
    - {if $tabs} - -
    - {foreach $tabs as $tab} -
    - {html_entity_decode($tab.content|escape:'htmlall':'UTF-8')} -
    - {/foreach} -
    - {/if} -
    - \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/front/error.tpl b/v1.6.x/mercadopago/views/templates/front/error.tpl new file mode 100644 index 0000000..09ea8a1 --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/front/error.tpl @@ -0,0 +1,148 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} +
    + {capture name=path}{l s='Payment error' mod='mercadopago'}{/capture} + {if $version == 5} +
    + {elseif $version == 6} +
    +
    + {/if} + {l s='An error occurred during your payment process. Please review your data or choose another payment method.' mod='mercadopago'}
    + {if $valid_user eq false} + {l s='Invalid users involved.' mod='mercadopago'} + {elseif $status_detail eq 'cc_rejected_bad_filled_card_number'} + {l s='Check the card number.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_bad_filled_date'} + {l s='Check the expiration date.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_bad_filled_other'} + {l s='Check the data.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_bad_filled_security_code'} + {l s='Check the security code.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_blacklist'} + {l s='We could not process your payment.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_call_for_authorize'} + {l s='You must authorize to ' mod='mercadopago'} + {$payment_method_id|escape:'htmlall':'UTF-8'} + {l s=' the payment to MercadoPago' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_card_disabled'} + {l s='Call ' mod='mercadopago'} + {$payment_method_id|escape:'htmlall':'UTF-8'} + {l s=' to activate your card. The phone is on the back of your card.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_card_error'} + {l s='We could not process your payment.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_duplicated_payment'} + {l s='You already made a payment by that value. If you need to repay, use another card or other payment method.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_high_risk'} + {l s='Your payment was rejected. Choose another payment method, we recommend cash methods.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_insufficient_amount'} + {l s='Your ' mod='mercadopago'} + {$payment_method_id|escape:'htmlall':'UTF-8'} + {l s=' do not have sufficient funds.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_invalid_installments'} + {$payment_method_id|escape:'htmlall':'UTF-8'} + {l s=' does not process payments in ' mod='mercadopago'} + {$installments|escape:'htmlall':'UTF-8'} + {l s=' installments.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_max_attempts'} + {l s='You have got to the limit of allowed attempts. Choose another card or another payment method.' mod='mercadopago'} + + {elseif $status_detail eq 'cc_rejected_other_reason'} + {$payment_method_id|escape:'htmlall':'UTF-8'} + {l s=' did not process the payment.' mod='mercadopago'} + {/if} + {if $valid_user} +
    + {l s='Card holder name: ' mod='mercadopago'} + {$card_holder_name|escape:'htmlall':'UTF-8'}
    + {l s='Credit card: ' mod='mercadopago'} + **** **** **** {$four_digits|escape:'htmlall':'UTF-8'}
    + {l s='Payment method: ' mod='mercadopago'} + {$payment_method_id|escape:'htmlall':'UTF-8'}
    + {if $expiration_date != null} + {l s='Expiration date: ' mod='mercadopago'} + {$expiration_date|escape:'htmlall':'UTF-8'}
    + {/if} + {l s='Amount: ' mod='mercadopago'} + {$amount|escape:'htmlall':'UTF-8'}
    + {if $installments != null} + {l s='Installments: ' mod='mercadopago'} + {$installments|escape:'htmlall':'UTF-8'}
    + {/if} + {l s='Payment id (MercadoPago): ' mod='mercadopago'} + {$payment_id|escape:'htmlall':'UTF-8'}
    + + {if $message != null} + {l s='Technical Error: ' mod='mercadopago'} + {$message|escape:'htmlall':'UTF-8'}
    + {/if} + + {if $version == 6} +
    + {/if} + {/if} +
    + + +
    + + diff --git a/v1.6.x/mercadopago/views/templates/front/error_admin.tpl b/v1.6.x/mercadopago/views/templates/front/error_admin.tpl new file mode 100644 index 0000000..e692d2a --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/front/error_admin.tpl @@ -0,0 +1,53 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} +
    + {if $version == 5} +
    + {elseif $version == 6} +
    +
    + {/if} + + {if $message_error != null} + {l s='Fatal Error' mod='mercadopago'}: + {$message_error|escape:'htmlall':'UTF-8'}
    + {/if} + {if $version == 6} +
    + {/if} +
    + +
    + + \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/front/iframe.tpl b/v1.6.x/mercadopago/views/templates/front/iframe.tpl deleted file mode 100755 index 62c223f..0000000 --- a/v1.6.x/mercadopago/views/templates/front/iframe.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{extends file='page.tpl'} - -{block name="content"} -
    - -
    -{/block} diff --git a/v1.6.x/mercadopago/views/templates/front/index.php b/v1.6.x/mercadopago/views/templates/front/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/templates/front/index.php +++ b/v1.6.x/mercadopago/views/templates/front/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/templates/front/payment_form.tpl b/v1.6.x/mercadopago/views/templates/front/payment_form.tpl deleted file mode 100755 index bc6359a..0000000 --- a/v1.6.x/mercadopago/views/templates/front/payment_form.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{* -* 2007-2015 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 -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -
    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - - / - -

    -
    diff --git a/v1.6.x/mercadopago/views/templates/hook/boleto_payment_return.tpl b/v1.6.x/mercadopago/views/templates/hook/boleto_payment_return.tpl new file mode 100644 index 0000000..abcab25 --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/boleto_payment_return.tpl @@ -0,0 +1,52 @@ +{** * 2007-2015 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 MercadoPago * @copyright Copyright +(c) MercadoPago [http://www.mercadopago.com] * @license +http://opensource.org/licenses/osl-3.0.php Open Software License (OSL +3.0) * International Registered Trademark & Property of MercadoPago *} +
    +
    +

    + {l s='Thank you for your purchase! We are awaiting the payment.' mod='mercadopago'}

    +
    +

    + {l s='Payment Id (MercadoPago): ' mod='mercadopago'} + {$payment_id|escape:'htmlall':'UTF-8'}
    +
    +
    +
    +
    + {if $boleto_url != null} + + + {/if} + +
    +
    + + \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/hook/checkout.tpl b/v1.6.x/mercadopago/views/templates/hook/checkout.tpl new file mode 100644 index 0000000..fce533e --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/checkout.tpl @@ -0,0 +1,1714 @@ +{** * 2007-2015 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 MercadoPago * @copyright Copyright +(c) MercadoPago [http://www.mercadopago.com] * @license +http://opensource.org/licenses/osl-3.0.php Open Software License (OSL +3.0) * International Registered Trademark & Property of MercadoPago *} + + + + + + + +
    + +{if $percent != 0 && count($percent) > 0} + +
    + + {if $credit_card_discount > 0 && $boleto_discount == 0} + +

    {l s='Save' mod='mercadopago'} {$percent|escape:'htmlall':'UTF-8'}% {l s='discount payment by Mercado Pago with credit card in cash.' mod='mercadopago'}

    + + {elseif $boleto_discount > 0 && $credit_card_discount == 0} + +

    {l s='Save' mod='mercadopago'} {$percent|escape:'htmlall':'UTF-8'}% {l s='discount payment by Mercado Pago with ticket.' mod='mercadopago'}

    + + {elseif $credit_card_discount > 0 && $boleto_discount > 0} + +

    {l s='Save' mod='mercadopago'} {$percent|escape:'htmlall':'UTF-8'}% {l s='discount payment by Mercado Pago with ticket and credit card in cash.' mod='mercadopago'}

    + {/if} + +
    + +{/if} + + {if $coupon_active == 'true' } + +
    +
    +
    + +
    +
    + + + {if $country eq "MLB"} + + {elseif $country eq "MLM"} + + {elseif $country eq "MLA"} + + {elseif $country eq "MLC"} + + {elseif $country eq "MCO"} + + {elseif $country eq "MLV"} + + {elseif $country eq "MPE"} + + {/if} + + +
    +
    +
    +
    + {l s='Remove' + mod='mercadopago'} {l s='Apply' + mod='mercadopago'} {l s='Waiting' + mod='mercadopago'}... +
    +
    + + + +
    + +
    +
    +
    + + {/if} +{if $mercadoenvios_activate == 'false' && $creditcard_active == 'true'} + +
    +
    +
    + +
    +
    + {l s='CREDIT CARD' + mod='mercadopago'}
    {l s='Powered + by' mod='mercadopago'} +
    + {if !empty($creditcard_banner)} +
    + +
    + {/if} +
    +
    + +
    +
    + + + + + + +
    +
    +
    +   +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + +
    + {if $country == 'MLM' || $country == 'MPE'} +
    +
    + + +
    +
    + {/if} + + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    +
    +
    + {if $country == 'MLB'} +
    +
    + +
    + +
    +
    + {elseif $country == 'MLM' || $country == 'MLA' || $country == 'MPE'} +
    +
    + +
    +
    + {/if} {if $country == 'MLA' || $country == 'MCO' || $country == + 'MLV' || $country == 'MPE'} +
    +
    + +
    +
    + +
    +
    +
    + +
    + {/if} {if $country == 'MLC'} +
    +
    + +
    +
    +
    + {/if} + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + {if $country != "MLB"} + + {else} + + {/if} +
    +
    +
    +
    +

    +
    +
    + {/if} + + {if $country == 'MLB' || $country == 'MLM' || $country == 'MPE' || $country == + 'MLA' || $country == 'MLC' || $country == 'MCO' || $country == 'MLV'} + {foreach from=$offline_payment_settings key=offline_payment item=value} + {if $value.active == "true" && $mercadoenvios_activate == 'false'} + + {/if} + {/foreach} + {/if} + {if $standard_active eq 'true' && + $preferences_url != null} + + + {/if} +
    + + + + + + + + + + + +{if $creditcard_active == 'true' && $public_key != ''} + +{/if} diff --git a/v1.6.x/mercadopago/views/templates/hook/creditcard_payment_return.tpl b/v1.6.x/mercadopago/views/templates/hook/creditcard_payment_return.tpl new file mode 100644 index 0000000..f1ccd4b --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/creditcard_payment_return.tpl @@ -0,0 +1,82 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} +
    +
    +

    + + {if $status_detail eq 'accredited'} + {l s='Thank for your purchase!' mod='mercadopago'}
    + {l s='Your payment was accredited.' mod='mercadopago'} +
    +
    +
    +

    + + {if $card_holder_name != null} + {l s='Card holder name: ' mod='mercadopago'} + {$card_holder_name|escape:'htmlall':'UTF-8'}
    + {/if} + + {if $four_digits != null} + {l s='Credit card: ' mod='mercadopago'} + {$four_digits|escape:'htmlall':'UTF-8'}
    + {/if} + + {if $payment_method_id != null} + {l s='Payment method: ' mod='mercadopago'} + {$payment_method_id|escape:'htmlall':'UTF-8'}
    + {/if} + + {l s='Amount: ' mod='mercadopago'} + {$amount|escape:'htmlall':'UTF-8'}
    + {if $installments != null} + {l s='Installments: ' mod='mercadopago'} + {$installments|escape:'htmlall':'UTF-8'}
    + {/if} + {l s='Statement descriptor: ' mod='mercadopago'} + {$statement_descriptor|escape:'htmlall':'UTF-8'}
    + {l s='Payment id (MercadoPago): ' mod='mercadopago'} + {$payment_id|escape:'htmlall':'UTF-8'}
    +
    + {elseif $status_detail eq 'pending_review_manual' || $status_detail eq 'pending_review'} + {l s='We are processing the payment. In less than 2 business days we will tell you by e-mail if it is accredited or if we need more information.' mod='mercadopago'} + {elseif $status_detail eq 'pending_contingency'} + {l s='We are processing the payment. In less than an hour we will send you by e-mail the result.' mod='mercadopago'} + {elseif status_detail eq 'expired'} + {l s='Payment expired.' mod='mercadopago'} + {/if} + +
    + +
    +
    + + \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/hook/display.tpl b/v1.6.x/mercadopago/views/templates/hook/display.tpl new file mode 100644 index 0000000..137dd47 --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/display.tpl @@ -0,0 +1,41 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} + + +{if isset($mensagem) && !empty($mensagem)} + + + +{/if} + diff --git a/v1.6.x/mercadopago/views/templates/hook/displayStatusOrder.tpl b/v1.6.x/mercadopago/views/templates/hook/displayStatusOrder.tpl deleted file mode 100644 index 2907b5e..0000000 --- a/v1.6.x/mercadopago/views/templates/hook/displayStatusOrder.tpl +++ /dev/null @@ -1,30 +0,0 @@ - -
    -
    - Mercado Pago -
    -
    -
    - - {if $payment_status == "approved"} -
    - - {l s='Thank you, your payment has been approved.' mod='mercadopago'} -
    - {/if} - {if $payment_status == "in_process"} -
    - - {l s='Thank you, your payment is being processed.' mod='mercadopago'} -
    - {/if} - {if $payment_status == "rejected"} -
    - - {l s='Sorry, your payment was declined.' mod='mercadopago'} -
    - {/if} - - - - diff --git a/v1.6.x/mercadopago/views/templates/hook/displayStatusOrderTicket.tpl b/v1.6.x/mercadopago/views/templates/hook/displayStatusOrderTicket.tpl deleted file mode 100644 index 42181f8..0000000 --- a/v1.6.x/mercadopago/views/templates/hook/displayStatusOrderTicket.tpl +++ /dev/null @@ -1,30 +0,0 @@ - -
    -
    - Mercado Pago -
    -
    -
    - - {if $payment_status == "approved"} -
    - - {l s='Thank you, your payment has been approved.' mod='mercadopago'} -
    - {/if} - {if $payment_status == "pending"} -
    - - {l s='Thank you, we are waiting for your payment.' mod='mercadopago'} -
    - {/if} - {if $payment_status == "rejected"} -
    - - {l s='Sorry, your payment was declined.' mod='mercadopago'} -
    - {/if} - - - - diff --git a/v1.6.x/mercadopago/views/templates/hook/display_admin_order.tpl b/v1.6.x/mercadopago/views/templates/hook/display_admin_order.tpl new file mode 100644 index 0000000..c2961b0 --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/display_admin_order.tpl @@ -0,0 +1,223 @@ +{** + * 2007-2015 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 henriqueleite + * @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * International Registered Trademark & Property of MercadoPago + *} + +
    + + +
    + +
    +
    +
    +
    +
    + +
    +
    +
    + +
    + {if $statusOrder == "Pendente"} +
    + +
    + +
    +
    + {/if} +
    + {if $pos_active == "true"} +
    + + +
    +
    +
    + {l s='Pay with Mercado Pago' mod='mercadopago'} +
    +
    + + + +
    + {/if} +
    +{if isset($status)} +
    +
    + + MercadoEnvios - {l s='Track your delivery' mod='mercadopago'} +
    + + {if $substatus == "ready_to_print"} +

    + {l s='Warning' mod='mercadopago'} + {l s='Tag ready to print' mod='mercadopago'}
    + +  {l s='Open Tag PDF' mod='mercadopago'} +   + +  {l s='Open Tag for printer' mod='mercadopago'} +

    + {else if $substatus == "printed"} +

    + {l s='Warning' mod='mercadopago'} + {l s='Tag printed' mod='mercadopago'}
    + +  {l s='Open Tag PDF' mod='mercadopago'} +   + +  {l s='Open Tag for printer' mod='mercadopago'} +

    + {else} +

    + {l s='Warning' mod='mercadopago'} + {$substatus_description|escape:'htmlall':'UTF-8'}
    +

    + {/if} +
      +
    • + {l s='Status of delivery' mod='mercadopago'}: {$status|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Status of tag' mod='mercadopago'}: {$substatus_description|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Type of shipment' mod='mercadopago'}: {$name|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Estimated handling limit' mod='mercadopago'}: {$estimated_handling_limit|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Estimated delivery' mod='mercadopago'}:  {$estimated_delivery|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Estimated delivery final' mod='mercadopago'}:  {$estimated_delivery_final|escape:'htmlall':'UTF-8'} +
    • +
    + +
    +{/if} + + + + + diff --git a/v1.6.x/mercadopago/views/templates/hook/header.tpl b/v1.6.x/mercadopago/views/templates/hook/header.tpl new file mode 100644 index 0000000..435fe39 --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/header.tpl @@ -0,0 +1,24 @@ +{** +* 2007-2015 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 MercadoPago +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} diff --git a/v1.6.x/mercadopago/views/templates/hook/index.php b/v1.6.x/mercadopago/views/templates/hook/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/templates/hook/index.php +++ b/v1.6.x/mercadopago/views/templates/hook/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit; diff --git a/v1.6.x/mercadopago/views/templates/hook/payment_return_creditcard.tpl b/v1.6.x/mercadopago/views/templates/hook/payment_return_creditcard.tpl deleted file mode 100644 index aefae8b..0000000 --- a/v1.6.x/mercadopago/views/templates/hook/payment_return_creditcard.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{extends file='page.tpl'} - -{block name="content"} -
    -
    -
    -
    -

    - Compra realizada com sucesso via Mercado Pago - Cartão de crédito -

    -
    -
    -
    -
    -{/block} - diff --git a/v1.6.x/mercadopago/views/templates/hook/payment_return_ticket.tpl b/v1.6.x/mercadopago/views/templates/hook/payment_return_ticket.tpl deleted file mode 100644 index 6e9ace0..0000000 --- a/v1.6.x/mercadopago/views/templates/hook/payment_return_ticket.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{extends file='page.tpl'} - -
    -
    - Mercado Pago -
    -
    -
    - - {if $payment_status == "approved"} -
    - - O pagamento foi aprovado e creditado. -
    - {/if} - {if $payment_status == "in_process"} -
    - - O pagamento está sendo analisado. -
    - {/if} - - {if $payment_status == "rejected"} -
    - - O pagamento foi recusado. Por favor tentes novamente. -
    - {/if} - diff --git a/v1.6.x/mercadopago/views/templates/hook/print_details_order.tpl b/v1.6.x/mercadopago/views/templates/hook/print_details_order.tpl new file mode 100644 index 0000000..3e712cb --- /dev/null +++ b/v1.6.x/mercadopago/views/templates/hook/print_details_order.tpl @@ -0,0 +1,74 @@ +{** +* 2007-2015 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 henriqueleite +* @copyright Copyright (c) MercadoPago [http://www.mercadopago.com] +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of MercadoPago +*} + +{if isset($boleto_url)} +
    +
    +
    + +
    +
    +
    +

    {l s='Before printing check the expiration date.' mod='mercadopago'}

    + +
    +{/if} +{if isset($shipment_id)} +
    +
    +
    + +
    +
    +
    +
      +
    • + {l s='Track your delivery' mod='mercadopago'} +
    • + {if ! empty($tracking_number)} +
    • + {l s='Tracking ID' mod='mercadopago'}: {$tracking_number|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Status' mod='mercadopago'}: {$status|escape:'htmlall':'UTF-8'} +
    • +
    • + {l s='Estimated Delivery' mod='mercadopago'}:  {$estimated_delivery|escape:'htmlall':'UTF-8'} +
    • + {else} +
    • + {l s='Tracking Pending' mod='mercadopago'} +
    • + {/if} +
    +
    +{/if} \ No newline at end of file diff --git a/v1.6.x/mercadopago/views/templates/index.php b/v1.6.x/mercadopago/views/templates/index.php index 729abf5..0df7996 100644 --- a/v1.6.x/mercadopago/views/templates/index.php +++ b/v1.6.x/mercadopago/views/templates/index.php @@ -1,11 +1,35 @@ +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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("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("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); -header('Location: ../'); +header("Location: ../"); exit;