Files
interblue.pl/modules/GeisLogistic/views/lib/createpickup.php
2024-10-25 14:16:28 +02:00

90 lines
3.5 KiB
PHP

<?php
/**
* 2007-2019 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 <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include (dirname(__file__) . '/../../../../config/config.inc.php');
include (dirname(__file__) . '/../../../../init.php');
const CHARSET = 'UTF-8';
const REPLACE_FLAGS = ENT_COMPAT;
$geistoken = Tools::getValue('geistoken');
if ($geistoken == 'GeisLogistic') {
$apicode = Configuration::get('GEISLOGISTIC_CODE'); // CustomerCode
$apikey = Configuration::get('GEISLOGISTIC_API'); //Password
$geiscount = Tools::getValue('geispick');
$geispickdate = Tools::getValue('geispickdate');
$testmode = Configuration::get('GEISLOGISTIC_TEST');
$country = Configuration::get('GEISLOGISTIC_COUNTRY');
if ($testmode == '0') {
if ($country == 'PL') {
$wsdl = 'https://gclient.geis.pl/GService/GService.svc?wsdl';
}else{
$wsdl = 'https://gclient.geis.cz/GService/GService.svc?wsdl';
}
}else{
if ($country == 'PL') {
$wsdl = 'https://gclient.geis.pl/GServiceTest/GService.svc?wsdl';
}else{
$wsdl = 'https://gclient.geis.cz/GServiceTest/GService.svc?wsdl';
}
}
ini_set("soap.wsdl_cache_enabled", "0");
try
{
$client = new SoapClient($wsdl, array("trace" => 1));
$data['Request']['Header'] = array(
'CustomerCode' => $apicode,
'Language' => $country,
'Password' => $apikey,
);
$data['Request']['RequestObject'] = array(
'CountItems' => $geiscount,
'DateFrom' => $geispickdate,
'DistributionChannel' => Configuration::get('GEISLOGISTIC_CHANNEL'),
);
$data['Request']['RequestObject']['Contact'] = array(
'Email' => Configuration::get('GEISLOGISTIC_EMAILSENDER'),
'FullName' => Configuration::get('GEISLOGISTIC_NAMESENDER'),
'Phone' => Configuration::get('GEISLOGISTIC_PHONESENDER'),
);
$result = $client->CreatePickUp($data);
}
catch (exception $ex)
{
print "BLAD: .$ex->faultcode .$ex->faultstring. \n\n";
$url = htmlspecialchars($_SERVER['HTTP_REFERER']);
print "\n\n <a href='$url'>Powrót</a>";
}
print_r($result->CreatePickUpResult->ErrorMessage);
$url = htmlspecialchars($_SERVER['HTTP_REFERER']);
print "\n\n <a href='$url'>Powrót</a>";
}else{
die();
}