LauLamanApps / iZettleApi

iZettle Api php intergration
MIT License
12 stars 15 forks source link

Error in getPurchaseClient() example #37

Open hanfry1996 opened 5 years ago

hanfry1996 commented 5 years ago

Hello, first at all, thanks for all this code, it's so usefull.

But I tried to run an example like this:

include('vendor/autoload.php');

use GuzzleHttp\Client; use LauLamanApps\IzettleApi\GuzzleIzettleClient; use LauLamanApps\IzettleApi\IzettleClientFactory;

$izettleClient = new GuzzleIzettleClient(new Client(), 'myClientID', 'myClientSecret'); $accessToken = $izettleClient->getAccessTokenFromUserLogin('myemail@email.com', 'mypassword.');

$purchaseClient = IzettleClientFactory::getPurchaseClient($iZettleClient); $library = $purchaseClient->getPurchaseHistory();

This is the error that it gives to me:

Fatal error: Uncaught TypeError: Argument 1 passed to LauLamanApps\IzettleApi\IzettleClientFactory::getPurchaseClient() must implement interface LauLamanApps\IzettleApi\IzettleClientInterface, null given, called in /homepages/35/d696135976/htdocs/print/izettle/pru.php on line 14 and defined in /homepages/35/d696135976/htdocs/print/izettle/src/IzettleClientFactory.php:48 Stack trace: #0 /homepages/35/d696135976/htdocs/print/izettle/pru.php(14): LauLamanApps\IzettleApi\IzettleClientFactory::getPurchaseClient(NULL) #1 {main} thrown in /homepages/35/d696135976/htdocs/print/izettle/src/IzettleClientFactory.php on line 48