Example #1
0
 /**
  * @return CallbackResponse
  */
 public function call()
 {
     $xml = simplexml_load_string($this->postedData['xml']);
     /** @var CallbackResponse $response */
     $response = ResponseSerializer::serialize(CallbackResponse::class, $xml->Body, false, $xml->Header);
     $response->shopOrderId = $this->postedData['shop_orderid'];
     $response->currency = $this->postedData['currency'];
     $response->type = $this->postedData['type'];
     $response->embeddedWindow = (bool) $this->postedData['embedded_window'];
     $response->amount = (double) $this->postedData['amount'];
     $response->transactionId = $this->postedData['transaction_id'];
     $response->paymentId = $this->postedData['payment_id'];
     $response->shopOrderId = $this->postedData['shop_orderid'];
     $response->nature = $this->postedData['nature'];
     $response->requireCapture = $this->postedData['require_capture'];
     $response->paymentStatus = $this->postedData['payment_status'];
     $response->maskedCreditCard = $this->postedData['masked_credit_card'];
     $response->blacklistToken = $this->postedData['blacklist_token'];
     $response->creditCardToken = $this->postedData['credit_card_token'];
     $response->status = $this->postedData['status'];
     return $response;
 }
Example #2
0
 /**
  * Deserialize XML to object
  *
  * @param \SimpleXMLElement $xml
  * @return AbstractResponse
  */
 public function deserialize(\SimpleXMLElement $xml = null)
 {
     $object = clone $this;
     if ($xml) {
         $this->attributeSetter($object, $xml);
         try {
             $this->elementSetter($object, trim((string) $xml), $xml);
         } catch (\InvalidArgumentException $e) {
         }
         /** @var \SimpleXMLElement $child */
         foreach ($xml->children() as $child) {
             if (isset($this->childs[$child->getName()])) {
                 $builder = $this->childs[$child->getName()];
                 $data = ResponseSerializer::serialize($builder['class'], $child, $builder['array']);
             } else {
                 $data = trim((string) $child);
                 $this->attributeSetter($object, $child);
             }
             $this->elementSetter($object, $data, $child);
         }
     }
     return $object;
 }
 /**
  * Handle response
  *
  * @param Request $request
  * @param Response $response
  * @return ReservationOfFixedAmountResponse
  */
 protected function handleResponse(Request $request, Response $response)
 {
     $body = (string) $response->getBody();
     $xml = simplexml_load_string($body);
     return ResponseSerializer::serialize(ReservationOfFixedAmountResponse::class, $xml->Body, false, $xml->Header);
 }
Example #4
0
 /**
  * Handle response
  *
  * @param Request $request
  * @param Response $response
  * @return Transaction[]
  */
 protected function handleResponse(Request $request, Response $response)
 {
     $body = (string) $response->getBody();
     $xml = simplexml_load_string($body);
     return ResponseSerializer::serialize(Transaction::class, $xml->Body->Transactions, 'Transaction', $xml->Header);
 }