public function getResourceDictionariesFromProduct($product, $id_lang)
 {
     $resources = array();
     $resource = array('Id' => 'Description', 'Type' => 'HTML', 'ContentUrl' => CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'overrides/cms/product_description.php?id_product=' . (int) $product->id . '&');
     $resources[] = $resource;
     // all done
     return $resources;
 }
 public function Handle_GetPaymentMethod($order)
 {
     $method = array();
     $method['Title'] = 'PayPal';
     $method['Description'] = 'Pay with your PayPal account';
     $method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/icon.png';
     // config the handling module in the mobile engine
     $method['Module'] = 'WebPaymentActivity';
     $params = array();
     // new paypal module (3.4.5)
     if (defined('WPS') && defined('HSS') && defined('ECS')) {
         $paypal_method = (int) Configuration::get('PAYPAL_PAYMENT_METHOD');
         if ($paypal_method == WPS || $paypal_method == ECS) {
             $cancel_url = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/express_checkout/cancel.php';
             $params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/express_checkout/payment.php?express_checkout=payment_cart&current_shop_url=' . urlencode($cancel_url) . '&';
             $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
             $params['CancelTrigger'] = $cancel_url;
         }
     }
     // old paypal module (2.8.6)
     if (defined('_PAYPAL_INTEGRAL_EVOLUTION_') && defined('_PAYPAL_INTEGRAL_EVOLUTION_') && defined('_PAYPAL_INTEGRAL_EVOLUTION_')) {
         if (Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_INTEGRAL_EVOLUTION_) {
             // integral_evolution/paypal.tpl
             $params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/integral_evolution/redirect.php';
             $params['CompleteTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__ . 'order-confirmation.php';
             $params['CancelTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__;
         } elseif (Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_INTEGRAL_ or Configuration::get('PAYPAL_PAYMENT_METHOD') == _PAYPAL_OPTION_PLUS_) {
             if ($this->_isPayPalAPIAvailable()) {
                 // payment/payment.tpl
                 $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/payment/submit.php';
                 $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order-confirmation.php';
                 $params['CancelTrigger'] = PayPal::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'order';
                 // either order.php or order-opc.php
                 $params['RedirectTrigger'] = array('Trigger' => CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/payment/submit.php', 'Redirect' => CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/payment/error.php');
             } else {
                 // standard/paypal.tpl
                 $params['Url'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/paypal/standard/redirect.php';
                 $params['CompleteTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__ . 'order-confirmation.php';
                 $params['CancelTrigger'] = PayPal::getShopDomain(true, true) . __PS_BASE_URI__;
             }
         }
     }
     // very old paypal (2.0 and below)
     if (empty($params)) {
         $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/paypal/old/hookpayment.php';
         $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order-confirmation.php';
         $params['CancelTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
     }
     $method['ModuleParameters'] = $params;
     return $method;
 }
 public function Handle_GetPaymentMethod($order)
 {
     $method = array();
     $method['Title'] = 'Adyen';
     $method['Description'] = 'Pay with your credit card';
     $method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/adyen/icon.png';
     // config the handling module in the mobile engine
     $method['Module'] = 'WebPaymentActivity';
     $params = array();
     $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/adyen/submit.php';
     $params['CompleteTrigger'] = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order-confirmation.php';
     $method['ModuleParameters'] = $params;
     return $method;
 }
 public function Handle_GetPaymentMethod($order)
 {
     $method = array();
     $method['Title'] = 'Servired';
     $method['Description'] = 'Pay with your credit card';
     $method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/servired/icon.png';
     // config the handling module in the mobile engine
     $method['Module'] = 'WebPaymentActivity';
     $params = array();
     $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/servired/hookpayment.php';
     $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
     $method['ModuleParameters'] = $params;
     return $method;
 }
 public function hijackPage()
 {
     if (CartAPI_Handlers_Helpers::isAppixiaMobileEngine()) {
         // allow to disable hijacking by addinging a url parameter (appixiaignore=1&)
         if (isset($_REQUEST['appixiaignore']) && $_REQUEST['appixiaignore']) {
             return;
         }
         // perform the hijack
         $url = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
         $redirectTo = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/appixiacartapi/pagehook.php?q=' . urlencode($url);
         header('Location: ' . $redirectTo);
         exit;
     }
 }
 public function Handle_GetPaymentMethod($order)
 {
     $method = array();
     $method['Title'] = 'Pago con tarjeta';
     $method['Description'] = 'Conexion segura con Pasat 4B';
     $method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/cuatrob/icon.png';
     // config the handling module in the mobile engine
     $method['Module'] = 'WebPaymentActivity';
     $params = array();
     $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/cuatrob/submit.php';
     $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'modules/cuatrob/resultado.php';
     $method['ModuleParameters'] = $params;
     return $method;
 }
 public function Handle_GetPaymentMethod($order)
 {
     $method = array();
     $method['Title'] = 'BankWire';
     $method['Description'] = 'Pay with a bank wire transfer';
     $method['ThumbnailUrl'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/bankwire/icon.png';
     // config the handling module in the mobile engine
     $method['Module'] = 'WebPaymentActivity';
     $params = array();
     $params['Url'] = $params['Url'] = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/bankwire/validation.php';
     $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order-confirmation.php';
     $params['CancelTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl() . 'order.php';
     $method['ModuleParameters'] = $params;
     return $method;
 }
 public static function updateShippingMethodDictionary(&$method)
 {
     global $cart;
     // this module is the return url to add the kiala order (with the point) after selection
     $returnUrl = CartAPI_Handlers_Helpers::getCartApiHomeUrl() . 'modules/kiala/return.php?';
     $address = new Address($cart->id_address_delivery);
     $kiala_request = new KialaRequest();
     $url = $kiala_request->getSearchRequest($address, $cart->id_lang, $returnUrl);
     $method['Module'] = 'WebShippingActivity';
     $params = array();
     $params['Url'] = $url;
     $params['CompleteTrigger'] = CartAPI_Handlers_Helpers::getShopBaseUrl();
     // return.php redirects there after finishing
     $method['ModuleParameters'] = $params;
 }
 public function afterBuyerRegister($customer, $buyerInfo)
 {
     global $cookie;
     // send an email just like in the Prestashop AuthController
     if (!property_exists('Customer', 'is_guest') || !$customer->is_guest) {
         Mail::Send((int) $cookie->id_lang, 'account', CartAPI_Handlers_Helpers::compatibilityMailTranslate('Welcome!', (int) $cookie->id_lang), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname . ' ' . $customer->lastname);
     }
     // run the Prestashop hook
     if (_PS_VERSION_ < '1.5') {
         Module::hookExec('createAccount', array('_POST' => $_POST, 'newCustomer' => $customer));
     } else {
         Hook::exec('actionCustomerAccountAdd', array('_POST' => $_POST, 'newCustomer' => $customer));
     }
 }
 public function addSubtitleFromProduct($encoder, &$item, $product)
 {
     if ($product->description_short) {
         $subtitle = $product->description_short;
         $subtitle = CartAPI_Handlers_Helpers::removeHtmlTags($subtitle);
         $encoder->addString($item, 'Subtitle', $subtitle);
     }
 }
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/engine/Engine.php';
require_once dirname(__FILE__) . '/engine/Helpers.php';
require_once dirname(__FILE__) . '/Helpers.php';
// handle the request
$request = CartAPI_Engine::handleRequest();
if ($request === false) {
    die('ERROR');
}
CartAPI_Handlers_Helpers::preInit($request['metadata']);
require_once dirname(__FILE__) . '/../../init.php';
CartAPI_Handlers_Helpers::setServerNotices();
// mark as an appixia mobile endpoint
// TODO: add some validation of user agent and such, or maybe move this line to the app itself alltogether (maybe should originate from the server at all)
CartAPI_Handlers_Helpers::setAppixiaMobileEngine();
// define all supported operations
$request_router = array('GetSingleItem' => 'Items', 'GetItemList' => 'Items', 'GetCategoryList' => 'Categories', 'BuyerLogin' => 'Login', 'BuyerRegister' => 'Login', 'GetOrderUpdate' => 'Order', 'GetShippingMethods' => 'Order', 'GetPaymentMethods' => 'Order');
// find the correct operation handler
$operation = $request['metadata']['X-OPERATION'];
$func_name = 'Handle_' . $operation;
$handler = $request_router[$operation];
$handler_filename = $handler . '.php';
$class_name = 'CartAPI_Handlers_' . $handler;
// load the correct file
if (!file_exists(dirname(__FILE__) . '/overrides/' . $handler_filename)) {
    // load the base
    require_once dirname(__FILE__) . '/' . $handler_filename;
} else {
    // load the override
    $class_name = 'CartAPI_Handlers_Override_' . $handler;
示例#12
0
 public function validateGlobalCartDiscounts(&$errors, $reportErrors = false)
 {
     global $cart, $cookie;
     if (_PS_VERSION_ < '1.5') {
         // code taken from CartController preProcess()
         $discounts = $cart->getDiscounts();
         foreach ($discounts as $discount) {
             $discountObj = new Discount((int) $discount['id_discount'], (int) $cookie->id_lang);
             if ($error = $cart->checkDiscountValidity($discountObj, $discounts, $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $cart->getProducts())) {
                 $cart->deleteDiscount((int) $discount['id_discount']);
                 $cart->update();
                 // reportErrors added to accomodate the initial checkDiscountValidity() in the beginning of CartController preProcess()
                 if ($reportErrors) {
                     $errors[] = CartAPI_Handlers_Helpers::removeHtmlTags($error);
                     return false;
                 }
             }
         }
     } else {
         // code taken from CartController processChangeProductInCart()
         $more_errors = CartRule::autoRemoveFromCart();
         if (count($more_errors) && $reportErrors) {
             $errors = array_merge($errors, $more_errors);
             return false;
         }
     }
     return true;
 }
 public static function removeHtmlTags($from)
 {
     if (is_array($from)) {
         $res = array();
         foreach ($from as $string) {
             $res[] = CartAPI_Handlers_Helpers::removeHtmlTagsFromString($string);
         }
         return $res;
     } else {
         return CartAPI_Handlers_Helpers::removeHtmlTagsFromString($from);
     }
 }
<?php

include dirname(__FILE__) . '/../../../../config/config.inc.php';
// preInit registers smarty l2 which we need for cross-tpl translations
// normally translations would only work if we rename success.tpl to payment_return.tpl
// if we want our own tpl name, we can "steal" translations from other tpl files using our l2
include_once dirname(__FILE__) . '/../../Helpers.php';
CartAPI_Handlers_Helpers::preInit();
require_once dirname(__FILE__) . '/../../../../init.php';
include dirname(__FILE__) . '/bankwire.php';
// create an instance of the payment module
$bankwire = new CartAPI_Module_BankWire();
// get some extra params
$cartOrder = getCartOrder();
if ($cartOrder === FALSE) {
    die("ERROR: Cannot get cart order");
}
$orderTotal = $cartOrder->total_paid;
$cartCurrency = new Currency((int) $cartOrder->id_currency);
// set some smarty params
$smarty->assign(array('total_to_pay' => Tools::displayPrice($orderTotal, $cartCurrency, false), 'bankwireDetails' => nl2br2($bankwire->details), 'bankwireAddress' => nl2br2($bankwire->address), 'bankwireOwner' => $bankwire->owner, 'id_order' => (int) $cartOrder->id));
// output
$smarty->force_compile = true;
// remove after tpl debug
$smarty->display(dirname(__FILE__) . '/success.tpl');
//////////////////////////////////////////////////////////////////////////
function getCartOrder()
{
    global $cart;
    $id_order = Order::getOrderByCartId((int) $cart->id);
    if (!$id_order) {
 public function getImageUrl($name, $id_category, $type)
 {
     global $link;
     $url = $link->getCatImageLink($name, $id_category, $type);
     if (CartAPI_Handlers_Helpers::isAbsoluteUrl($url)) {
         return $url;
     }
     // new prestashop versions (above 1.5) return an absolute url in getCatImageLink
     if (method_exists('Link', 'getMediaLink')) {
         return $link->getMediaLink($url);
     } else {
         return CartAPI_Handlers_Helpers::getShopDomain() . $url;
     }
     // older prestashop versions don't support media servers
 }
* 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 info@appixia.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize the module for your
* needs please look at the /overrides module directory or refer to
* http://kb.appixia.com for more information.
*
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/Helpers.php';
$url = CartAPI_Handlers_Helpers::getShopDomain() . $_REQUEST['q'];
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-family: Helvetica,Arial,sans-serif; font-size: 13px;">

<iframe src="bridge://SendMessageToParent/Url?<?php 
echo urlencode($url);
?>
" width="0" height="0" frameborder="0"></iframe>

<p><b>The Appixia Prestashop module has intercepted the display of this page.</b></p>
<p>You are seeing this message because:</p>