2024-12-20 23:45:55 +01:00
|
|
|
<?php
|
|
|
|
|
2024-12-29 00:46:28 +01:00
|
|
|
/**
|
|
|
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view
|
|
|
|
* the LICENSE file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
|
|
|
*/
|
|
|
|
|
2024-12-20 23:45:55 +01:00
|
|
|
namespace D3\KlicktippPhpClient\Resources;
|
|
|
|
|
|
|
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
2024-12-21 19:25:33 +01:00
|
|
|
use GuzzleHttp\RequestOptions;
|
2024-12-20 23:45:55 +01:00
|
|
|
|
|
|
|
class Account extends Model
|
|
|
|
{
|
|
|
|
/**
|
2024-12-29 00:46:28 +01:00
|
|
|
* @throws BaseException
|
2024-12-20 23:45:55 +01:00
|
|
|
*/
|
|
|
|
public function login(): array
|
|
|
|
{
|
2024-12-29 00:46:28 +01:00
|
|
|
return $this->connection->requestAndParse(
|
2024-12-20 23:45:55 +01:00
|
|
|
'POST',
|
2024-12-29 00:46:28 +01:00
|
|
|
'account/login.json',
|
2024-12-20 23:45:55 +01:00
|
|
|
[
|
2024-12-21 19:25:33 +01:00
|
|
|
RequestOptions::FORM_PARAMS => [
|
2024-12-20 23:45:55 +01:00
|
|
|
'username' => $this->connection->getClientKey(),
|
2024-12-29 00:46:28 +01:00
|
|
|
'password' => $this->connection->getSecretKey(),
|
|
|
|
],
|
2024-12-20 23:45:55 +01:00
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-12-29 00:46:28 +01:00
|
|
|
* @throws BaseException
|
2024-12-20 23:45:55 +01:00
|
|
|
*/
|
|
|
|
public function logout(): bool
|
|
|
|
{
|
|
|
|
$response = $this->connection->requestAndParse(
|
|
|
|
'POST',
|
2024-12-29 00:46:28 +01:00
|
|
|
'account/logout.json'
|
2024-12-20 23:45:55 +01:00
|
|
|
);
|
|
|
|
|
2024-12-29 00:46:28 +01:00
|
|
|
return (bool)current($response);
|
2024-12-20 23:45:55 +01:00
|
|
|
}
|
|
|
|
}
|