Adding a resource to Webservice in Prestashop
$10-30 USD
Bezahlt bei Lieferung
We are trying to add a new web-service resource from a module.
We can add it as a resource in the back-end, so it's visible. But we can't reach it on the URL:
[url removed, login to view]
We get 500 internal error. And with debug enabled:
Fatal error: Class 'QuickpayAPI' not found in /var/www/[url removed, login to view] on line 479
We can access all the default web-service resources of course.
Here is the code for the module:
<?php
class QuickpayAPICore extends ObjectModel {
public $exec_id;
public $id_cart;
public $trans_id;
public $order_id;
public static $definition = array(
'table' => 'quickpay_execution',
'primary' => 'exec_id',
'fields' => array(
'exec_id' => array('type' => self::TYPE_INT, 'required' => true),
'id_cart' => array('type' => self::TYPE_INT, 'required' => true),
'trans_id' => array('type' => self::TYPE_INT),
'order_id' => array('type' => self::TYPE_STRING)
)
);
protected $webserviceParameters = array();
}
?>
Placed: /modules/quickpay/override/classes
Filename: [url removed, login to view]
The web-service:
<?php
class WebserviceRequest extends WebserviceRequestCore {
public static function getResources(){
$resources = parent::getResources();
$resources['quickpay'] = array('description' => 'Quikpay Details', 'class' => 'QuickpayAPI');
ksort($resources);
return $resources;
}
}
?>
Placed: /modules/quickpay/override/classes/webservice
Filename: [url removed, login to view]
So why can't we reach the resource. We have added it to the API account.
What are we missing here to be able to access these resources via web-service?
Projekt-ID: #10188126