/**
  * Checks whether the given class is supported for denormalization by this normalizer.
  *
  * @param mixed $data Data to denormalize from.
  * @param string $type The class to which the data should be denormalized.
  * @param string $format The format being deserialized from.
  *
  * @return bool
  */
 public function supportsDenormalization($data, $type, $format = null)
 {
     if ($format == "xml" && $type == PaymentData::GetClassName()) {
         return true;
     }
     return false;
 }
 private function denormalizePaymentData($array)
 {
     return $this->serializer->denormalize($array['paymentdata'], PaymentData::GetClassName(), $this->format, $this->context);
 }
 /**
  * Tests conversion of {@link ThreeDSecureRequest} card enrolled to and from XML using setters.
  */
 public function testThreeDSecureCardEnrolledRequestXmlWithSetters()
 {
     $request = new ThreeDSecureRequest();
     $request->setAccount(SampleXmlValidationUtils::CARD_VERIFY_ACCOUNT);
     $request->setMerchantId(SampleXmlValidationUtils::CARD_VERIFY_MERCHANT_ID);
     $paymentData = new PaymentData();
     $paymentData->addCvnNumber(SampleXmlValidationUtils::CARD_PAYMENT_DATA_CVN);
     $request->setPaymentData($paymentData);
     $amount = new Amount();
     $amount->setAmount(SampleXmlValidationUtils::CARD_VERIFY_AMOUNT);
     $amount->setCurrency(SampleXmlValidationUtils::CARD_VERIFY_CURRENCY);
     $request->setAmount($amount);
     $request->setTimeStamp(SampleXmlValidationUtils::CARD_VERIFY_TIMESTAMP);
     $request->setOrderId(SampleXmlValidationUtils::CARD_VERIFY_ORDER_ID);
     $request->setPaymentMethod(SampleXmlValidationUtils::CARD_VERIFY_REF);
     $request->setPayerRef(SampleXmlValidationUtils::CARD_VERIFY_PAYER_REF);
     $request->setHash(SampleXmlValidationUtils::CARD_VERIFY_REQUEST_HASH);
     $request->setType(ThreeDSecureType::VERIFY_STORED_CARD_ENROLLED);
     $autoSettle = new AutoSettle();
     $autoSettle->setFlag(SampleXmlValidationUtils::$CARD_VERIFY_AUTO_SETTLE_FLAG->getFlag());
     $request->setAutoSettle($autoSettle);
     // convert to XML
     $xml = $request->toXml();
     // Convert from XML back to PaymentRequest
     /* @var ThreeDSecureRequest $fromXmlRequest */
     $fromXmlRequest = new ThreeDSecureRequest();
     $fromXmlRequest = $fromXmlRequest->fromXml($xml);
     SampleXmlValidationUtils::checkUnmarshalledVerifyCardEnrolledPaymentRequest($fromXmlRequest, $this);
 }