예제 #1
0
 /**
  * @param CredentialsInterface $credentials
  * @param string               $data
  * @param string|null          $signatureHeader Signature can be null when notifyUrl starts with https
  *
  * @return OrderNotification
  */
 public function process(CredentialsInterface $credentials, $data, $signatureHeader = null)
 {
     if (null !== $signatureHeader) {
         $this->validateSignature($credentials, $data, $signatureHeader);
     }
     return $this->serializer->fromJson($data, self::ORDER_NOTIFICATION_CLASS);
 }
 /**
  * @param MessageInterface $curlResponse
  * @param string           $responseClass
  *
  * @return object
  * @throws RequestProcessException
  */
 private function deserialize(MessageInterface $curlResponse, $responseClass)
 {
     try {
         return $this->serializer->fromJson($curlResponse->getContent(), $responseClass);
     } catch (SerializerException $exception) {
         throw new RequestProcessException(sprintf('Exception %s was thrown during deserialization. Message: "%s"', get_class($exception), $exception->getMessage()), $exception->getCode(), $exception);
     }
 }
예제 #3
0
 /**
  * Will return order serializable parameters in ascending order.
  *
  * @param  OrderInterface $order
  * @return array
  */
 public function getSortedParameters(OrderInterface $order)
 {
     $json = $this->serializer->toJson($order);
     return $this->serializer->fromJson($json, 'array');
 }
 public function let(SerializerInterface $serializer, OrderInterface $order)
 {
     $serializer->toJson($order)->willReturn(self::EXAMPLE_STRING);
     $serializer->fromJson(self::EXAMPLE_STRING, 'array')->willReturn([]);
     $this->beConstructedWith($serializer);
 }