-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathwizard_ajax.php
49 lines (40 loc) · 1.48 KB
/
wizard_ajax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$config_path = dirname(__FILE__).'/../../config/config.inc.php';
$module_path = dirname(__FILE__).'/sellermania.php';
// Set _PS_ADMIN_DIR_ define
define('_PS_ADMIN_DIR_', getcwd());
// Keep going if config script is found
if (file_exists($config_path))
{
include($config_path);
include($module_path);
$sm_key = Configuration::get("SM_SECRET_KEY");
$method = Tools::getValue('method');
$key = Tools::getValue('key');
if ($key !== $sm_key) {
die("Authentication Error");
}
$sellermania = new Sellermania();
switch ($method) {
case "test_api":
$testApiResult = $sellermania->wz_testConnectionApi(Tools::getValue('email'), Tools::getValue('token'), Tools::getValue('endpoint'));
echo $testApiResult;
break;
case "get_available_marketplaces":
$availableMarketplacesResult = $sellermania->wz_getAvailableMarketplaces(Tools::getValue('email'), Tools::getValue('token'), Tools::getValue('endpoint'));
echo $availableMarketplacesResult;
break;
case "get_carriers_for_marketplaces":
$availableMarketplacesResult = $sellermania->wz_getShippingCarriersForMarketplaces();
echo $availableMarketplacesResult;
break;
case "order_status":
$id_order_status = $sellermania->wz_createCustomStatus();
echo $id_order_status;
break;
default:
exit;
}
}
else
die('ERROR');