sessionTransparent = $sessionTransparent; $this->quoteRepository = $quoteRepository; $this->transparent = $transparent; $this->paymentManagement = $paymentManagement; $this->errorHandler = $errorHandler; $this->logger = $logger; } /** * Returns gateway response data object. * * @param array $gatewayTransactionResponse * @return DataObject */ public function getResponseObject($gatewayTransactionResponse) { $response = new DataObject(); $response = $this->transparent->mapGatewayResponse((array) $gatewayTransactionResponse, $response); $this->logger->debug( (array) $gatewayTransactionResponse, (array) $this->transparent->getDebugReplacePrivateDataKeys(), (bool) $this->transparent->getDebugFlag() ); return $response; } /** * Saves payment information in quote. * * @param DataObject $response * @return void * @throws \InvalidArgumentException */ public function savePaymentInQuote($response) { $quote = $this->quoteRepository->get($this->sessionTransparent->getQuoteId()); $payment = $this->paymentManagement->get($quote->getId()); if (!$payment instanceof Payment) { throw new \InvalidArgumentException("Variable must contain instance of \\Quote\\Payment."); } $payment->setData(OrderPaymentInterface::CC_TYPE, $response->getData(OrderPaymentInterface::CC_TYPE)); $payment->setAdditionalInformation(Payflowpro::PNREF, $response->getData(Payflowpro::PNREF)); $this->errorHandler->handle($payment, $response); $this->paymentManagement->set($quote->getId(), $payment); } }