/**
  * Denormalizes data back into an object of the given class.
  *
  * @param mixed $data data to restore
  * @param string $class the expected class to instantiate
  * @param string $format format the given data was extracted from
  * @param array $context options available to the denormalizer
  *
  * @return object
  */
 public function denormalize($data, $class, $format = null, array $context = array())
 {
     $this->format = $format;
     $this->context = $context;
     $request = new PaymentRequest();
     $array = new SafeArrayAccess($data);
     $request->addTimestamp($array['@timestamp'])->addType($array['@type'])->addMerchantId($array['merchantid'])->addAccount($array['account'])->addChannel($array['channel'])->addOrderId($array['orderid'])->addHash($array['sha1hash'])->addPaymentsReference($array['pasref'])->addAuthCode($array['authcode'])->addRefundHash($array['refundhash'])->addMobile($array['mobile'])->addToken($array['token'])->addPayerReference($array['payerref'])->addPaymentMethod($array['paymentmethod'])->addPaymentData($this->denormalizePaymentData($array))->addPayer($this->denormalizePayer($array))->addReasonCode($array['reasoncode']);
     $request->setCard($this->denormaliseCard($array));
     $autoSettle = $this->denormaliseAutoSettle($array);
     if ($autoSettle != null) {
         $request->addAutoSettle($autoSettle);
     }
     $fraudFilter = $this->denormaliseFraudFilter($array);
     if ($fraudFilter != null) {
         $request->addFraudFilter($fraudFilter);
     }
     $recurring = $this->denormaliseRecurring($array);
     if ($recurring != null) {
         $request->addRecurring($recurring);
     }
     $tssInfo = $this->denormaliseTssInfo($array);
     if ($tssInfo != null) {
         $request->addTssInfo($tssInfo);
     }
     $mpi = $this->denormaliseMpi($array);
     if ($mpi != null) {
         $request->addMpi($mpi);
     }
     $dccInfo = $this->denormaliseDccInfo($array);
     if ($dccInfo != null) {
         $request->addDccInfo($dccInfo);
     }
     $request->setAmount($this->denormaliseAmount($array));
     $request->setComments($this->denormaliseComments($array));
     return $request;
 }