1
0
mirror of synced 2024-11-25 06:26:05 +03:00
This commit is contained in:
Alexey Chelnakov 2018-06-16 19:16:34 +03:00
parent 9233e287e4
commit 246da86c1b
2 changed files with 53 additions and 3 deletions

View File

@ -0,0 +1,45 @@
<?php
namespace AtolOnlineClient;
use AtolOnlineClient\Configuration\Connection;
use AtolOnlineClient\Response\OperationResponse;
use JMS\Serializer\DeserializationContext;
use JMS\Serializer\SerializerBuilder;
class AtolOnline
{
private $serializer;
public function __construct()
{
$this->serializer = SerializerBuilder::create()->build();
}
public function createConfiguration()
{
return new Configuration();
}
public function deserializeOperationResponse($response)
{
return $this->serializer->deserialize(
$response,
OperationResponse::class,
'json',
DeserializationContext::create()->setGroups(['post'])
);
}
/**
* @param $client
* @param Connection $connection
* @param $isDebug
* @return AtolOnlineApi
*/
public function getApi($client, Connection $connection, $isDebug)
{
return new AtolOnlineApi($client, $connection, $isDebug);
}
}

View File

@ -42,11 +42,11 @@ class Configuration implements ConfigurationInterface
$connection->login = $connectionItem['login'];
$connection->pass = $connectionItem['pass'];
$connection->group = $connectionItem['group'];
$connection->legalEntity = $connectionItem['legalEntity'];
// $connection->legalEntity = $connectionItem['legalEntity'];
$connection->sno = $connectionItem['sno'];
$connection->enabled = (bool) $connectionItem['enabled'];
$connection->paymentTypes = $connectionItem['paymentTypes'];
$connection->paymentStatuses = $connectionItem['paymentStatuses'];
// $connection->paymentTypes = $connectionItem['paymentTypes'];
// $connection->paymentStatuses = $connectionItem['paymentStatuses'];
$connection->ofd = $connectionItem['ofd'];
$connection->version = $connectionItem['version'];
$this->connections[] = $connection;
@ -143,4 +143,9 @@ class Configuration implements ConfigurationInterface
return false;
}
protected function postLoadConfiguration()
{
}
}