Closed zyberland closed 4 years ago
The browser console errors do not explain the underlying problem that Prestashop throws an error on. Please provide some errorlog from the webserver, in relation to the error that prestashop produces, in order to help us understand what actually goes wrong.
Here is the Onpay log information. We also forgot to mention that the shop we are making is a multistore solution with two stores and we are getting errors in both stores. We get the same "500 Internal Server Error" in both stores, but primary store shows a incomplete page with the order information whereas the other only show the actual error message.
After enabling DEBUG mode in Prestashop and trying again, the following errors were shown on the page in the browser: Exceptions Type error: Argument 1 passed to OnPay\API\Transaction\SimpleTransaction::setLinks() must be of the type array, null given, called in /var/www/clients/client888/web9999/web/prestashop/modules/onpay/vendor/onpayio/php-sdk/src/API/TransactionService.php on line 34
Exception Stack Trace
Symfony\Component\Debug\Exception\ FatalThrowableError in modules/onpay/vendor/onpayio/php-sdk/src/API/Transaction/SimpleTransaction.php (line 38)
/**
* @internal Shall not be used outside the library
* @param array $links
*/
public function setLinks(array $links) {
foreach ($links as $rel => $link) {
$linkItem = new Link($rel, $link);
$this->links[] = $linkItem;
}
}
[-] SimpleTransaction->setLinks(null) in modules/onpay/vendor/onpayio/php-sdk/src/API/TransactionService.php (line 34)
*/
public function getTransaction($identifier) {
$result = $this->api->get('transaction/' . urlencode($identifier));
$detailedTransaction = new DetailedTransaction($result['data']);
$detailedTransaction->setLinks($result['links']);
return $detailedTransaction;
}
/**
* @param null $page
[-] TransactionService->getTransaction('') in modules/onpay/onpay.php (line 304)
$details = [];
try {
foreach ($payments as $payment) {
$onpayInfo = $onPayAPI->transaction()->getTransaction($payment->transaction_id);
$amount = $this->currencyHelper->minorToMajor($onpayInfo->amount, $onpayInfo->currencyCode, ',');
$chargable = $onpayInfo->amount - $onpayInfo->charged;
$chargable = $this->currencyHelper->minorToMajor($chargable, $onpayInfo->currencyCode, ',');
$refunded = $this->currencyHelper->minorToMajor($onpayInfo->refunded, $onpayInfo->currencyCode, ',');
$charged = $this->currencyHelper->minorToMajor($onpayInfo->charged, $onpayInfo->currencyCode, ',');
[-] onpay->hookAdminOrder(array('id_order' => 37, 'smarty' => object(Smarty_Internal_Template), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 4)) in classes/Hook.php (line 970)
return $output;
}
public static function coreCallHook($module, $method, $params)
{
return $module->{$method}($params);
}
public static function coreRenderWidget($module, $hook_name, $params)
{
return $module->renderWidget($hook_name, $params);
[-] HookCore::coreCallHook(object(onpay), 'hookadminOrder', array('id_order' => 37, 'smarty' => object(Smarty_Internal_Template), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 4)) in classes/Hook.php (line 359)
if (is_callable(array($module, 'hook' . $hookName))) {
return Hook::coreCallHook($module, 'hook' . $hookName, $hookArgs);
}
foreach (Hook::getHookAliasesFor($hookName) as $hook) {
if (is_callable(array($module, 'hook' . $hook))) {
return Hook::coreCallHook($module, 'hook' . $hook, $hookArgs);
}
}
return '';
}
[-] HookCore::callHookOn(object(onpay), 'displayAdminOrder', array('id_order' => 37, 'smarty' => object(Smarty_Internal_Template), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 4)) in classes/Hook.php (line 907)
if (0 !== $key && true === $chain) {
$hook_args = $output;
}
$display = Hook::callHookOn($moduleInstance, $hook_name, $hook_args);
if ($array_return) {
$output[$moduleInstance->name] = $display;
} else {
if (true === $chain) {
[-] HookCore::exec('displayAdminOrder', array('id_order' => 37, 'smarty' => object(Smarty_Internal_Template), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 4), null) in config/smarty.config.inc.php (line 167)
return $result;
}
unset($hook_params['h']);
return Hook::exec($params['h'], $hook_params, $id_module);
}
function smartyCleanHtml($data)
{
// Prevent xss injection.
[-] smartyHook(array('h' => 'displayAdminOrder', 'id_order' => 37), object(Smarty_Internal_Template)) in classes/Smarty/SmartyLazyRegister.php (line 83)
} else {
$args[] = &$arguments[$a];
}
}
return call_user_func_array($item, $args);
}
}
public static function getInstance($smarty)
{
And under the errors tab was shown the following information: CRITICAL 12:28:30 php Type error: Argument 1 passed to OnPay\API\Transaction\SimpleTransaction::setLinks() must be of the type array, null given, called in /var/www/clients/client888/web9999/web/prestashop/modules/onpay/vendor/onpayio/php-sdk/src/API/TransactionService.php on line 34 Show context Hide trace
FatalThrowableError {#1 ▼
trace: FatalThrowableError {#1} }
CRITICAL 12:28:30 request Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to OnPay\API\Transaction\SimpleTransaction::setLinks() must be of the type array, null given, called in /var/www/clients/client888/web9999/web/prestashop/modules/onpay/vendor/onpayio/php-sdk/src/API/TransactionService.php on line 34" at /var/www/clients/client888/web9999/web/prestashop/modules/onpay/vendor/onpayio/php-sdk/src/API/Transaction/SimpleTransaction.php line 38 Show context Hide trace
FatalThrowableError {#1 ▼
Hope this helps to identify the problem.
The bug has been identified, and we're working on a fix.
The issue has been addressed in https://github.com/onpayio/prestashop/pull/2 New release available: https://github.com/onpayio/prestashop/releases/tag/1.0.1
With prestashop version 1.7.6.1 and this module installed and activated we encountered an issue. When accessing orders in the backoffice, the resulting page looks wrong and ends with the following message: Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
And furthermore there is some error messages in the browser console like the following: ReferenceError: $ is not defined index.php:223:11