diff --git a/src/ApiConnectors/ArticleApiConnector.php b/src/ApiConnectors/ArticleApiConnector.php index d4ba546d..b397edfb 100644 --- a/src/ApiConnectors/ArticleApiConnector.php +++ b/src/ApiConnectors/ArticleApiConnector.php @@ -9,7 +9,6 @@ use PhpTwinfield\Mappers\ArticleMapper; use PhpTwinfield\Office; use PhpTwinfield\Request as Request; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; use PhpTwinfield\Response\Response; use PhpTwinfield\Response\ResponseException; @@ -130,26 +129,6 @@ public function testEqual(HasMessageInterface $returnedObject, HasMessageInterfa return [$equal, $returnedObject]; } - /** - * @param HasMessageInterface $returnedObject - * @return IndividualMappedResponse - */ - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse - { - Assert::IsInstanceOf($returnedObject, Article::class); - - $request_article = new Request\Read\Article(); - $request_article->setOffice($returnedObject->getOffice()) - ->setCode($returnedObject->getCode()); - $response = $this->sendXmlDocument($request_article); - - $mappedResponseCollection = $this->getProcessXmlService()->mapAll([$response], "article", function(Response $response): Article { - return ArticleMapper::map($response, $this->getConnection()); - }); - - return ($mappedResponseCollection[0]); - } - /** * List all articles. * diff --git a/src/ApiConnectors/AssetMethodApiConnector.php b/src/ApiConnectors/AssetMethodApiConnector.php index 823b3920..cba801be 100644 --- a/src/ApiConnectors/AssetMethodApiConnector.php +++ b/src/ApiConnectors/AssetMethodApiConnector.php @@ -9,7 +9,6 @@ use PhpTwinfield\Mappers\AssetMethodMapper; use PhpTwinfield\Office; use PhpTwinfield\Request as Request; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; use PhpTwinfield\Response\Response; use PhpTwinfield\Response\ResponseException; @@ -133,26 +132,6 @@ public function testEqual(HasMessageInterface $returnedObject, HasMessageInterfa return [$equal, $returnedObject]; } - /** - * @param HasMessageInterface $returnedObject - * @return IndividualMappedResponse - */ - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse - { - Assert::IsInstanceOf($returnedObject, AssetMethod::class); - - $request_assetMethod = new Request\AssetMethod(); - $request_assetMethod->setOffice($returnedObject->getOffice()) - ->setCode($returnedObject->getCode()); - $response = $this->sendXmlDocument($request_assetMethod); - - $mappedResponseCollection = $this->getProcessXmlService()->mapAll([$response], "assetmethod", function(Response $response): AssetMethod { - return AssetMethodMapper::map($response); - }); - - return ($mappedResponseCollection[0]); - } - /** * List all asset methods. * diff --git a/src/ApiConnectors/BaseApiConnector.php b/src/ApiConnectors/BaseApiConnector.php index 1a1872cc..c70cc81d 100644 --- a/src/ApiConnectors/BaseApiConnector.php +++ b/src/ApiConnectors/BaseApiConnector.php @@ -262,29 +262,10 @@ public function testSentEqualsResponse(HasEqualInterface $apiConnector, array $s $returnedObject = $testResult[1]; if (!$equal) { - $tempMappedResponse = $apiConnector->sendAll([$returnedObject], true)[0]; - $tempReturnedObject = $tempMappedResponse->unwrap(); - - if ($tempReturnedObject->getResult() == 1) { - $individualMappedResponse = $tempMappedResponse; - $returnedObject = $tempReturnedObject; - - $testResult = $apiConnector->testEqual($returnedObject, $sentObjects[$key]); - $equal = $testResult[0]; - $returnedObject = $testResult[1]; - - if (!$equal || is_a($returnedObject, \PhpTwinfield\Currency::class)) { - sleep(2); - - $tempMappedResponse = $apiConnector->getMappedResponse($returnedObject, $sentObjects[$key]); - $tempReturnedObject = $tempMappedResponse->unwrap(); - - if ($returnedObject->getResult() == 1) { - $individualMappedResponse = $tempMappedResponse; - $returnedObject = $tempReturnedObject; - } - } - } + $apiConnector->sendAll([$returnedObject], true)[0]; + sleep(2); + $sentObjects[$key]->setCode($returnedObject->getCode()); + $individualMappedResponse = $apiConnector->sendAll([$sentObjects[$key]], true)[0]; } } diff --git a/src/ApiConnectors/CurrencyApiConnector.php b/src/ApiConnectors/CurrencyApiConnector.php index 42188182..acbe5bf3 100644 --- a/src/ApiConnectors/CurrencyApiConnector.php +++ b/src/ApiConnectors/CurrencyApiConnector.php @@ -9,7 +9,6 @@ use PhpTwinfield\Mappers\CurrencyMapper; use PhpTwinfield\Office; use PhpTwinfield\Request as Request; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; use PhpTwinfield\Response\Response; use PhpTwinfield\Response\ResponseException; @@ -170,15 +169,6 @@ public function testEqual(HasMessageInterface $returnedObject, HasMessageInterfa return [$equal, $returnedObject]; } - /** - * @param HasMessageInterface $returnedObject - * @return IndividualMappedResponse - */ - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse - { - return $this->sendAll([$sentObject], true)[0]; - } - /** * List all currencies. * diff --git a/src/ApiConnectors/HasEqualInterface.php b/src/ApiConnectors/HasEqualInterface.php index 8b2dbfd8..08fb75d9 100644 --- a/src/ApiConnectors/HasEqualInterface.php +++ b/src/ApiConnectors/HasEqualInterface.php @@ -3,7 +3,6 @@ namespace PhpTwinfield\ApiConnectors; use PhpTwinfield\HasMessageInterface; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; /** @@ -15,6 +14,4 @@ interface HasEqualInterface public function testEqual(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): array; public function sendAll(array $objects, bool $reSend): MappedResponseCollection; - - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse; } diff --git a/src/ApiConnectors/RateApiConnector.php b/src/ApiConnectors/RateApiConnector.php index 9ad8300c..c4895c2c 100644 --- a/src/ApiConnectors/RateApiConnector.php +++ b/src/ApiConnectors/RateApiConnector.php @@ -9,7 +9,6 @@ use PhpTwinfield\Office; use PhpTwinfield\Rate; use PhpTwinfield\Request as Request; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; use PhpTwinfield\Response\Response; use PhpTwinfield\Response\ResponseException; @@ -131,26 +130,6 @@ public function testEqual(HasMessageInterface $returnedObject, HasMessageInterfa return [$equal, $returnedObject]; } - /** - * @param HasMessageInterface $returnedObject - * @return IndividualMappedResponse - */ - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse - { - Assert::IsInstanceOf($returnedObject, Rate::class); - - $request_rate = new Request\Read\Rate(); - $request_rate->setOffice($returnedObject->getOffice()) - ->setCode($returnedObject->getCode()); - $response = $this->sendXmlDocument($request_rate); - - $mappedResponseCollection = $this->getProcessXmlService()->mapAll([$response], "projectrate", function(Response $response): Rate { - return RateMapper::map($response); - }); - - return ($mappedResponseCollection[0]); - } - /** * List all rates. * diff --git a/src/ApiConnectors/VatCodeApiConnector.php b/src/ApiConnectors/VatCodeApiConnector.php index 79b24c88..5bf33578 100644 --- a/src/ApiConnectors/VatCodeApiConnector.php +++ b/src/ApiConnectors/VatCodeApiConnector.php @@ -8,7 +8,6 @@ use PhpTwinfield\Mappers\VatCodeMapper; use PhpTwinfield\Office; use PhpTwinfield\Request as Request; -use PhpTwinfield\Response\IndividualMappedResponse; use PhpTwinfield\Response\MappedResponseCollection; use PhpTwinfield\Response\Response; use PhpTwinfield\Response\ResponseException; @@ -132,25 +131,6 @@ public function testEqual(HasMessageInterface $returnedObject, HasMessageInterfa return [$equal, $returnedObject]; } - /** - * @param HasMessageInterface $returnedObject - * @return IndividualMappedResponse - */ - public function getMappedResponse(HasMessageInterface $returnedObject, HasMessageInterface $sentObject): IndividualMappedResponse - { - Assert::IsInstanceOf($returnedObject, VatCode::class); - - $request_vatCode = new Request\Read\VatCode(); - $request_vatCode->setCode($returnedObject->getCode()); - $response = $this->sendXmlDocument($request_vatCode); - - $mappedResponseCollection = $this->getProcessXmlService()->mapAll([$response], "vat", function(Response $response): VatCode { - return VatCodeMapper::map($response); - }); - - return ($mappedResponseCollection[0]); - } - /** * List all VAT codes. *