Example #1
0
 protected function prepare()
 {
     $this->call->setDate(new DateTime());
     $this->call->setNonce($this->randomizer->getRandom(32));
     if (!in_array($this->call->getMethod(), array('GET')) && count($this->call->getBody())) {
         $serializedBody = $this->serializer->encode($this->call->getBody(), $this->call->getFormat());
         $this->call->setFormattedBody($serializedBody);
         $this->headers->addHeader(new ContentTypeHeader($this->call->getPath(".", false), $this->configuration->getFormat(), $this->call->getVersion()));
     }
     $this->headers->addHeader(new DateHeader($this->call->getDate()));
     $this->headers->addHeader(new AcceptHeader($this->call->getPath(".", false), $this->configuration->getFormat(), $this->call->getVersion()));
     $this->headers->addHeader(new AcceptLanguageHeader($this->call->getLanguage()));
     $serializedHashData = $this->normalizer->normalizeForHasher($this->call, $this->headers);
     $hmac = $this->hasher->getHash($serializedHashData, $this->configuration->getApiSecret());
     $this->headers->addHeader(new XAuthHeader($this->configuration->getCustomerKey(), $this->configuration->getApiKey(), $hmac, $this->call->getNonce()));
 }