Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
[change] (MAGE2-311) Add measures to avoid unexpected errors due fore…
Browse files Browse the repository at this point in the history
…ign payment type.
  • Loading branch information
sixer1182 committed May 8, 2020
1 parent 796abb0 commit 31f8a0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Block/Info/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ public function printAdditionalInformationHtml()
}

if (! empty($this->transactionInfo->getJsonResponse())) {
return $this->getMethod()->additionalPaymentInformation($this->transactionInfo->getJsonResponse());
$methodInstance = $this->getMethod();
if (\is_callable([$methodInstance, 'additionalPaymentInformation'])) {
return $methodInstance->additionalPaymentInformation(
$this->transactionInfo->getJsonResponse()
);
}

$this->_logger->debug('heidelpay: Could not retrieve additionalPaymentInformation for class: \"' . \get_class($methodInstance) . '\".');
}

return '';
Expand Down
13 changes: 8 additions & 5 deletions Controller/Index/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,20 @@ protected function updateSessionData($quoteId, Order $order, array $data)
$checkoutSession->clearHelperData();

// set QuoteIds
$checkoutSession->setLastQuoteId($quoteId)
->setLastSuccessQuoteId($quoteId);
$checkoutSession->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId);

// set OrderIds
$checkoutSession->setLastOrderId($order->getId())
->setLastRealOrderId($order->getIncrementId())
->setLastOrderStatus($order->getStatus());

$additionalPaymentInformation = $order->getPayment()
->getMethodInstance()
->additionalPaymentInformation($data);
$methodInstance = $order->getPayment()->getMethodInstance();
$additionalPaymentInformation = '';
if (\is_callable([$methodInstance, 'additionalPaymentInformation'])) {
$additionalPaymentInformation = $methodInstance->additionalPaymentInformation($data);
} else {
$this->_logger->error('heidelpay - The payment method seems to be from a different plugin.');
}

$checkoutSession->setHeidelpayInfo($additionalPaymentInformation);
}
Expand Down

0 comments on commit 31f8a0f

Please sign in to comment.