add get and update endpoint for account, use constants
Dieser Commit ist enthalten in:
Ursprung
ebbd7300e7
Commit
3f624cfb05
195
src/Entities/Account.php
Normale Datei
195
src/Entities/Account.php
Normale Datei
@ -0,0 +1,195 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace D3\KlicktippPhpClient\Entities;
|
||||||
|
|
||||||
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||||
|
use D3\KlicktippPhpClient\Resources\Account as AccountEndpoint;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
|
class Account extends ArrayCollection
|
||||||
|
{
|
||||||
|
private ?AccountEndpoint $endpoint;
|
||||||
|
|
||||||
|
public function __construct(array $elements = [], ?AccountEndpoint $endpoint = null)
|
||||||
|
{
|
||||||
|
$this->endpoint = $endpoint;
|
||||||
|
parent::__construct($elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::UID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::STATUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTier(): int
|
||||||
|
{
|
||||||
|
return (int) $this->get(AccountEndpoint::TIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsergroup(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::USERGROUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmail(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::EMAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFirstname(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::FIRSTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLastname(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::LASTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCompany(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::COMPANY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWebsite(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::WEBSITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStreet(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::STREET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCity(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::CITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getState(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::STATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getZIP(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::ZIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCountry(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::COUNTRY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhone(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::PHONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFax(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::FAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAffiliateId(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::AFFILIATE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccessRights(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::ACCESS_RIGHTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSenders(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::SENDERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGmailPreview(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::GMAIL_PREVIEW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLimits(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::LIMITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreferences(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::PREFERENCES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSettings(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::SETTINGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canShowOtherAccountInfo(): bool
|
||||||
|
{
|
||||||
|
return (bool) $this->get(AccountEndpoint::SHOW_OTHER_ACCOUNT_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canShowSupportInfo(): bool
|
||||||
|
{
|
||||||
|
return (bool) $this->get(AccountEndpoint::SHOW_SUPPORT_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSupport(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::SUPPORT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLanguage(): string
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::LANGUAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSegments(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::SEGMENTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomerData(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::CUSTOMER_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubscriptionInfo(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::SUBSCRIPTION_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActivePayments(): ArrayCollection
|
||||||
|
{
|
||||||
|
return $this->get(AccountEndpoint::ACTIVE_PAYMENTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null|bool
|
||||||
|
* @throws BaseException
|
||||||
|
*/
|
||||||
|
public function persist(): ?bool
|
||||||
|
{
|
||||||
|
return $this->endpoint?->update();
|
||||||
|
}
|
||||||
|
}
|
@ -15,11 +15,46 @@
|
|||||||
|
|
||||||
namespace D3\KlicktippPhpClient\Resources;
|
namespace D3\KlicktippPhpClient\Resources;
|
||||||
|
|
||||||
|
use D3\KlicktippPhpClient\Entities\Account as AccountEntity;
|
||||||
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||||
use GuzzleHttp\RequestOptions;
|
use GuzzleHttp\RequestOptions;
|
||||||
|
|
||||||
class Account extends Model
|
class Account extends Model
|
||||||
{
|
{
|
||||||
|
public const UID = 'uid';
|
||||||
|
public const STATUS = 'status';
|
||||||
|
public const TIER = 'tier';
|
||||||
|
public const USERGROUP = 'usergroup';
|
||||||
|
public const EMAIL = 'email';
|
||||||
|
public const FIRSTNAME = 'firstname';
|
||||||
|
public const LASTNAME = 'lastname';
|
||||||
|
public const COMPANY = 'company';
|
||||||
|
public const WEBSITE = 'website';
|
||||||
|
public const STREET = 'street';
|
||||||
|
public const CITY = 'city';
|
||||||
|
public const STATE = 'state';
|
||||||
|
public const ZIP = 'zip';
|
||||||
|
public const COUNTRY = 'country';
|
||||||
|
public const PHONE = 'phone';
|
||||||
|
public const FAX = 'fax';
|
||||||
|
public const AFFILIATE_ID = 'affid';
|
||||||
|
public const ACCESS_RIGHTS = 'access';
|
||||||
|
public const SENDERS = 'senders';
|
||||||
|
public const GMAIL_PREVIEW = 'gmailPreview';
|
||||||
|
public const LIMITS = 'limits';
|
||||||
|
public const PREFERENCES = 'preferences';
|
||||||
|
public const SETTINGS = 'settings';
|
||||||
|
public const SHOW_OTHER_ACCOUNT_INFO = 'showOtherAccountInfo';
|
||||||
|
public const SHOW_SUPPORT_INFO = 'showSupportInfo';
|
||||||
|
public const SUPPORT = 'support';
|
||||||
|
public const LANGUAGE = 'language';
|
||||||
|
public const SEGMENTS = 'segments';
|
||||||
|
public const CUSTOMER_DATA = 'customerData';
|
||||||
|
public const SUBSCRIPTION_INFO = 'subscriptionInfo';
|
||||||
|
public const ACTIVE_PAYMENTS = 'activePayments';
|
||||||
|
public const USERNAME = 'username';
|
||||||
|
public const PASSWORD = 'password';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws BaseException
|
* @throws BaseException
|
||||||
*/
|
*/
|
||||||
@ -30,8 +65,8 @@ class Account extends Model
|
|||||||
'account/login.json',
|
'account/login.json',
|
||||||
[
|
[
|
||||||
RequestOptions::FORM_PARAMS => [
|
RequestOptions::FORM_PARAMS => [
|
||||||
'username' => $this->connection->getClientKey(),
|
self::USERNAME => $this->connection->getClientKey(),
|
||||||
'password' => $this->connection->getSecretKey(),
|
self::PASSWORD => $this->connection->getSecretKey(),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -49,4 +84,30 @@ class Account extends Model
|
|||||||
|
|
||||||
return (bool)current($response);
|
return (bool)current($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws BaseException
|
||||||
|
*/
|
||||||
|
public function get(): AccountEntity
|
||||||
|
{
|
||||||
|
$data = $this->connection->requestAndParse(
|
||||||
|
'GET',
|
||||||
|
'account.json'
|
||||||
|
);
|
||||||
|
|
||||||
|
return new AccountEntity($data, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws BaseException
|
||||||
|
*/
|
||||||
|
public function update(): bool
|
||||||
|
{
|
||||||
|
return (bool) current(
|
||||||
|
$this->connection->requestAndParse(
|
||||||
|
'GET',
|
||||||
|
'account.json'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
namespace D3\KlicktippPhpClient\tests\integration\Resources;
|
namespace D3\KlicktippPhpClient\tests\integration\Resources;
|
||||||
|
|
||||||
|
use D3\KlicktippPhpClient\Entities\Account as AccountEntity;
|
||||||
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
use D3\KlicktippPhpClient\Exceptions\BaseException;
|
||||||
use D3\KlicktippPhpClient\Resources\Account;
|
use D3\KlicktippPhpClient\Resources\Account;
|
||||||
use D3\KlicktippPhpClient\tests\integration\IntegrationTestCase;
|
use D3\KlicktippPhpClient\tests\integration\IntegrationTestCase;
|
||||||
@ -57,11 +58,11 @@ class AccountTest extends IntegrationTestCase
|
|||||||
"sessid": "nFnp4uLZCnc3dIEl9PrXgjoUuaJSyJIKpLyU9HH5rxw",
|
"sessid": "nFnp4uLZCnc3dIEl9PrXgjoUuaJSyJIKpLyU9HH5rxw",
|
||||||
"session_name": "SSESS5bc3b84d3f2031474d7722e94851cff5",
|
"session_name": "SSESS5bc3b84d3f2031474d7722e94851cff5",
|
||||||
"account": {
|
"account": {
|
||||||
"uid": "12345",
|
"'.Account::UID.'": "12345",
|
||||||
"status": "1",
|
"'.Account::STATUS.'": "1",
|
||||||
"usergroup": "16",
|
"'.Account::USERGROUP.'": "16",
|
||||||
"email": "info@mydomain.com",
|
"'.Account::EMAIL.'": "info@mydomain.com",
|
||||||
"username": "KTAPIdev",
|
"'.Account::USERNAME.'": "KTAPIdev",
|
||||||
"firstname": "Developer",
|
"firstname": "Developer",
|
||||||
"lastname": "Klicktipper",
|
"lastname": "Klicktipper",
|
||||||
"company": "Customer GmbH",
|
"company": "Customer GmbH",
|
||||||
@ -79,11 +80,11 @@ class AccountTest extends IntegrationTestCase
|
|||||||
'sessid' => 'nFnp4uLZCnc3dIEl9PrXgjoUuaJSyJIKpLyU9HH5rxw',
|
'sessid' => 'nFnp4uLZCnc3dIEl9PrXgjoUuaJSyJIKpLyU9HH5rxw',
|
||||||
'session_name' => 'SSESS5bc3b84d3f2031474d7722e94851cff5',
|
'session_name' => 'SSESS5bc3b84d3f2031474d7722e94851cff5',
|
||||||
'account' => [
|
'account' => [
|
||||||
'uid' => '12345',
|
Account::UID => '12345',
|
||||||
'status' => '1',
|
Account::STATUS => '1',
|
||||||
'usergroup' => '16',
|
Account::USERGROUP => '16',
|
||||||
'email' => 'info@mydomain.com',
|
Account::EMAIL => 'info@mydomain.com',
|
||||||
'username' => 'KTAPIdev',
|
Account::USERNAME => 'KTAPIdev',
|
||||||
'firstname' => 'Developer',
|
'firstname' => 'Developer',
|
||||||
'lastname' => 'Klicktipper',
|
'lastname' => 'Klicktipper',
|
||||||
'company' => 'Customer GmbH',
|
'company' => 'Customer GmbH',
|
||||||
@ -130,4 +131,75 @@ class AccountTest extends IntegrationTestCase
|
|||||||
yield 'success' => [new Response(200, [], '[true]'), true];
|
yield 'success' => [new Response(200, [], '[true]'), true];
|
||||||
yield 'already logged out' => [new Response(406, [], '["Benutzer nicht eingeloggt."]'), false, true];
|
yield 'already logged out' => [new Response(406, [], '["Benutzer nicht eingeloggt."]'), false, true];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @covers \D3\KlicktippPhpClient\Resources\Account::get
|
||||||
|
* @dataProvider getDataProvider
|
||||||
|
*/
|
||||||
|
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
|
||||||
|
{
|
||||||
|
$sut = new Account($this->getConnectionMock($response));
|
||||||
|
|
||||||
|
if ($expectException) {
|
||||||
|
$this->expectException(BaseException::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = $this->callMethod(
|
||||||
|
$sut,
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(AccountEntity::class, $return);
|
||||||
|
$this->assertSame($expected, $return->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDataProvider(): Generator
|
||||||
|
{
|
||||||
|
yield 'success' => [new Response(200, [], '{
|
||||||
|
"'.Account::UID.'": "1084633",
|
||||||
|
"'.Account::STATUS.'": "1",
|
||||||
|
"'.Account::TIER.'": 1000,
|
||||||
|
"'.Account::USERGROUP.'": "16",
|
||||||
|
"'.Account::EMAIL.'": "mymail@mydomain.com"
|
||||||
|
}'), [
|
||||||
|
Account::UID => "1084633",
|
||||||
|
Account::STATUS => "1",
|
||||||
|
Account::TIER => 1000,
|
||||||
|
Account::USERGROUP => "16",
|
||||||
|
Account::EMAIL => "mymail@mydomain.com",
|
||||||
|
]];
|
||||||
|
yield 'access denied' => [new Response(403, [], '["API Zugriff verweigert"]'), null, true];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @covers \D3\KlicktippPhpClient\Resources\Account::update
|
||||||
|
* @dataProvider updateDataProvider
|
||||||
|
*/
|
||||||
|
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
|
||||||
|
{
|
||||||
|
$sut = new Account($this->getConnectionMock($response));
|
||||||
|
|
||||||
|
if ($expectException) {
|
||||||
|
$this->expectException(BaseException::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$expected,
|
||||||
|
$this->callMethod(
|
||||||
|
$sut,
|
||||||
|
'update',
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateDataProvider(): Generator
|
||||||
|
{
|
||||||
|
yield 'success' => [new Response(200, [], '[true]'), true];
|
||||||
|
yield 'access denied' => [new Response(403, [], '["Access denied for user"]'), null, true];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
187
tests/unit/Entities/AccountTest.php
Normale Datei
187
tests/unit/Entities/AccountTest.php
Normale Datei
@ -0,0 +1,187 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace D3\KlicktippPhpClient\tests\unit\Entities;
|
||||||
|
|
||||||
|
use D3\KlicktippPhpClient\Entities\Account;
|
||||||
|
use D3\KlicktippPhpClient\Resources\Account as AccountEndpoint;
|
||||||
|
use D3\KlicktippPhpClient\tests\TestCase;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
class AccountTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->entity = new Account(
|
||||||
|
[
|
||||||
|
AccountEndpoint::UID => "1094633",
|
||||||
|
AccountEndpoint::STATUS => "1",
|
||||||
|
AccountEndpoint::TIER => 10000,
|
||||||
|
AccountEndpoint::USERGROUP => "16",
|
||||||
|
AccountEndpoint::USERNAME => "myUsername",
|
||||||
|
AccountEndpoint::EMAIL => "myemail@mydomain.com",
|
||||||
|
AccountEndpoint::FIRSTNAME => "John",
|
||||||
|
AccountEndpoint::LASTNAME => "Doe",
|
||||||
|
AccountEndpoint::COMPANY => "ShopCompany",
|
||||||
|
AccountEndpoint::WEBSITE => "https://mywebsite.com",
|
||||||
|
AccountEndpoint::STREET => "Unter den Linden 20",
|
||||||
|
AccountEndpoint::CITY => "Berlin",
|
||||||
|
AccountEndpoint::STATE => "",
|
||||||
|
AccountEndpoint::ZIP => "01100",
|
||||||
|
AccountEndpoint::COUNTRY => "DE",
|
||||||
|
AccountEndpoint::PHONE => "",
|
||||||
|
AccountEndpoint::FAX => "",
|
||||||
|
AccountEndpoint::AFFILIATE_ID => "197030",
|
||||||
|
AccountEndpoint::ACCESS_RIGHTS => [
|
||||||
|
"administer klicktipp" => false,
|
||||||
|
"access facebook audience" => false,
|
||||||
|
"access translation translater" => false,
|
||||||
|
"access translation admin" => false,
|
||||||
|
"use whitelabel domain" => false,
|
||||||
|
"access email editor" => true,
|
||||||
|
"access user segments" => false,
|
||||||
|
"access feature limiter" => true,
|
||||||
|
],
|
||||||
|
AccountEndpoint::SENDERS => [
|
||||||
|
"email" => [
|
||||||
|
"myemail@mydomain.com" => "myemail@mydomain.com (ohne DKIM Signatur – eingeschränkte Zustellbarkeit)",
|
||||||
|
],
|
||||||
|
"reply_email" => [
|
||||||
|
"myemail@mydomain.com" => "myemail@mydomain.com",
|
||||||
|
],
|
||||||
|
"sms" => [],
|
||||||
|
"defaultEmail" => "myemail@mydomain.com",
|
||||||
|
"defaultReplyEmail" => "myemail@mydomain.com",
|
||||||
|
"domains" => [],
|
||||||
|
"providers" => [],
|
||||||
|
"previewEmails" => [],
|
||||||
|
],
|
||||||
|
AccountEndpoint::GMAIL_PREVIEW => "gmail-inspector@klick-tipp.team",
|
||||||
|
AccountEndpoint::LIMITS => [
|
||||||
|
"automation" => "10",
|
||||||
|
"statistics" => "5",
|
||||||
|
],
|
||||||
|
AccountEndpoint::PREFERENCES => [
|
||||||
|
"colors" => [
|
||||||
|
"start" => "yellow-dark",
|
||||||
|
"decision" => "violet-dark",
|
||||||
|
"goal" => "",
|
||||||
|
"goto" => "violet-dark",
|
||||||
|
"wait" => "",
|
||||||
|
"start automation" => "yellow-dark",
|
||||||
|
"stop automation" => "pink-dark",
|
||||||
|
"exit" => "pink-dark",
|
||||||
|
"restart" => "pink-dark",
|
||||||
|
"email" => "blue-dark",
|
||||||
|
"sms" => "blue-dark",
|
||||||
|
"notify by email" => "blue-dark",
|
||||||
|
"notify by sms" => "blue-dark",
|
||||||
|
"outbound" => "blue-dark",
|
||||||
|
"facebook audience add" => "blue-dark",
|
||||||
|
"tagging" => "green-dark",
|
||||||
|
"untagging" => "pink-dark",
|
||||||
|
"unsubscribe" => "pink-dark",
|
||||||
|
"setfield" => "green-dark",
|
||||||
|
"detect name" => "green-dark",
|
||||||
|
"detect gender" => "green-dark",
|
||||||
|
"fullcontact" => "green-dark",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
AccountEndpoint::SETTINGS => [
|
||||||
|
"PlainTextContentByUser" => 0,
|
||||||
|
],
|
||||||
|
AccountEndpoint::SHOW_OTHER_ACCOUNT_INFO => false,
|
||||||
|
AccountEndpoint::SHOW_SUPPORT_INFO => false,
|
||||||
|
AccountEndpoint::SUPPORT => [
|
||||||
|
"username" => "klicktipp_account_username",
|
||||||
|
"switchAccountsLink" => [
|
||||||
|
"href" => "https://app.klicktipp.com/user/me/subaccount/switch",
|
||||||
|
"title" => "Unterkonto wechseln",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
AccountEndpoint::LANGUAGE => "de",
|
||||||
|
AccountEndpoint::SEGMENTS => [],
|
||||||
|
AccountEndpoint::CUSTOMER_DATA => [
|
||||||
|
"isActive" => true,
|
||||||
|
"email" => "myemail@mydomain.com",
|
||||||
|
"firstName" => "John",
|
||||||
|
"lastName" => "Doe",
|
||||||
|
"zipcode" => "01100",
|
||||||
|
"city" => "Berlin",
|
||||||
|
"street" => "Unter den Linden 20",
|
||||||
|
"country" => "DE",
|
||||||
|
"company" => "ShopCompany",
|
||||||
|
"product" => "KlickTipp Deluxe 10.000",
|
||||||
|
"order_id" => "",
|
||||||
|
"weight" => "1010",
|
||||||
|
"tier" => "10000",
|
||||||
|
"period" => 67,
|
||||||
|
"digistore_affiliate_name" => "",
|
||||||
|
"tracking_pixels" => "",
|
||||||
|
"apikeys" => false,
|
||||||
|
"subscriber_key" => "3xtlh8zavzz04zdc45",
|
||||||
|
"addOns" => [],
|
||||||
|
],
|
||||||
|
AccountEndpoint::SUBSCRIPTION_INFO => [
|
||||||
|
"category" => "Account Platinum",
|
||||||
|
"tier" => "10000",
|
||||||
|
"term" => "monatlich",
|
||||||
|
"period" => 67,
|
||||||
|
"productID" => "107",
|
||||||
|
"title" => "KlickTipp Deluxe 10.000",
|
||||||
|
"weight" => "1010",
|
||||||
|
"orderID" => "",
|
||||||
|
"machineCategory" => "klick-tipp-account-platinum",
|
||||||
|
"emailAddress" => "myemail@mydomain.com",
|
||||||
|
"groupId" => "16",
|
||||||
|
"aMemberId" => "179045",
|
||||||
|
],
|
||||||
|
AccountEndpoint::ACTIVE_PAYMENTS => [],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @covers \D3\KlicktippPhpClient\Entities\Account::__construct
|
||||||
|
*/
|
||||||
|
public function testConstruct(): void
|
||||||
|
{
|
||||||
|
$elements = [
|
||||||
|
'key1' => 'value1',
|
||||||
|
'key2' => 'value2',
|
||||||
|
];
|
||||||
|
|
||||||
|
$endpoint = $this->getMockBuilder(AccountEndpoint::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$sut = new Account($elements, $endpoint);
|
||||||
|
|
||||||
|
$this->assertSame(
|
||||||
|
$elements,
|
||||||
|
$sut->toArray()
|
||||||
|
);
|
||||||
|
$this->assertSame(
|
||||||
|
$endpoint,
|
||||||
|
$this->getValue($sut, 'endpoint')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren