コード例 #1
0
* 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__) . '/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)) {
コード例 #2
0
<?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) {