Heidelpay/src/Cron/cron_bankaccount.php

53 lines
1.3 KiB
PHP

<?php
use Doctrine\DBAL\DBALException;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
$aParams = array();
if ($argv && is_array($argv) && $argc) {
if (isset($argv[1]) && $argv[1]) {
$aParams['shp'] = $argv[1];
}
if (isset($argv[2]) && $argv[2]) {
$sDate = (string)$argv[2];
if ($sDate) {
$aParams['date'] = substr($sDate, 0, 10);
}
}
$aParams['exec'] = "command_line";
} else {
$aParams['shp'] = $_GET['shp'];
$aParams['date'] = (string)$_GET['date'];
$aParams['key'] = (string)$_GET['key'];
$aParams['exec'] = "url";
}
/**
* Returns shop base path.
*
* @return string
*/
function getShopBasePath()
{
return realpath(dirname(__FILE__) . '/../../../../') . '/';
}
require_once getShopBasePath() . "/bootstrap.php";
/** @var D3\Heidelpay\Models\Bankaccount $oResponse */
$oResponse = oxNew(D3\Heidelpay\Models\Bankaccount::class);
$oResponse->setStartParameters($aParams);
try {
$oResponse->checkBankAccount();
} catch (StandardException $e) {
echo 'Error occurred: ', $e->getMessage(), PHP_EOL, $e->getTraceAsString();
} catch (DBALException $e) {
echo 'DB Error occurred: ', $e->getMessage(), PHP_EOL, $e->getTraceAsString();
}
Registry::getConfig()->pageClose();