/**
  * @param PayURequestInterface   $payURequest
  * @param ConfigurationInterface $configuration
  *
  * @return object
  * @throws HttpStatusParserException         when status code is not 200
  * @throws InvalidRequestDataObjectException when request data object is invalid
  */
 public function process(PayURequestInterface $payURequest, ConfigurationInterface $configuration)
 {
     if ($this->shouldValidate) {
         $this->validate($payURequest->getDataObject());
     }
     $curlResponse = $this->client->sendRequest($configuration, $payURequest);
     $this->httpStatusParser->parse($curlResponse);
     return $this->responseDeserializer->deserializeResponse($curlResponse, $payURequest);
 }
 /**
  * @param ConfigurationInterface $configuration
  * @param PayURequestInterface   $request
  *
  * @return Request
  */
 public function build(ConfigurationInterface $configuration, PayURequestInterface $request)
 {
     $curlRequest = new Request();
     if (PayURequestInterface::METHOD_POST === $request->getMethod()) {
         $curlRequest->setContent($this->serializer->toJson($request->getDataObject()));
     }
     $curlRequest->setHost(sprintf('%s://%s/', $configuration->getProtocol(), $configuration->getDomain()));
     $curlRequest->setResource(sprintf('%s/%s/%s', $configuration->getPath(), $configuration->getVersion(), $request->getPath()));
     $curlRequest->setMethod($request->getMethod());
     $this->addHeaders($curlRequest, $configuration);
     return $curlRequest;
 }