/** * Make a new request via the SDK to validate the address. * * @param AddressInterface * @return IValidationResult */ protected function makeRequestForAddress(AddressInterface $address) { try { /** @var \eBayEnterprise\RetailOrderManagement\Api\IBidirectionalApi */ $api = $this->httpApiFactory->create($this->scopeConfig); /** @var \eBayEnterprise\RetailOrderManagement\Payload\Address\IValidationReply */ $response = $api->setRequestBody($this->sdkHelper->prepareSdkRequest($api->getRequestBody(), $address, $this->scopeConfig))->send()->getResponseBody(); // @TODO evaluate log level for each of these, some may be more severe - // UnsupportedOperation and UnsupportedHttpAction - or less severe // - maybe NetworkError. } catch (NetworkError $e) { $this->logger->warning($e); return $this->exceptionResultFactory->create(['originalAddress' => $address, 'failureException' => $e]); } catch (UnsupportedOperation $e) { $this->logger->error($e); return $this->exceptionResultFactory->create(['originalAddress' => $address, 'failureException' => $e]); } catch (UnsupportedHttpAction $e) { $this->logger->error($e); return $this->exceptionResultFactory->create(['originalAddress' => $address, 'failureException' => $e]); } $result = $this->resultFactory->create(['replyPayload' => $response, 'originalAddress' => $address]); $this->session->setResultForAddress($address, $result)->setCurrentResult($result); return $result; }
public function getValidationId() { return $this->result ? $this->result->getId() : null; }