Closed draper87 closed 2 years ago
Hello @draper87, thank you for this report. Maybe this could happen if the Braintree module is loaded after Adyen's, even if disabled. We are investigating this to find a different solution to getting the quoteId.
Hello we are getting same error. Wondering how can we fix it. Appreciate if find quick resolution please
Hello @anupwankhede, working on a solution for this, will keep you updated.
Hello,
I can see this issue is closed but we're still reproducing the bug with backend orders on a magento 2.4.3-p1 instance using adyen/module-payment 8.1.1
Error log is :
Error: Call to undefined method PayPal\Braintree\Gateway\Data\Order\OrderAdapter::getQuoteId() in /magento_code/vendor/adyen/module-payment/Gateway/Request/CcBackendAuthorizationDataBuilder.php:54
Do you have any workaround or fix for this issue ? Thanks in advance
@acampos1916
I can still replicate this issue in adyen/module-payment:8.2.3
It is not ideal, but maybe this can be a fix:
1) remove this line from adyen di.xml
<preference for="Magento\Payment\Gateway\Data\Order\OrderAdapter" type="Adyen\Payment\Gateway\Data\Order\OrderAdapter"/>
2) include db connection into "Gateway/Request/CcBackendAuthorizationDataBuilder.php" and get quote_id form sales_order table.
namespace Adyen\Payment\Gateway\Request;
use Adyen\Payment\Helper\StateData;
use Adyen\Payment\Observer\AdyenCcDataAssignObserver;
use Magento\Framework\App\ResourceConnection;
use Magento\Payment\Gateway\Data\PaymentDataObject;
use Magento\Payment\Gateway\Helper\SubjectReader;
use Magento\Payment\Gateway\Request\BuilderInterface;
class CcBackendAuthorizationDataBuilder implements BuilderInterface
{
/**
* @var StateData
*/
private $stateData;
/**
* @var ResourceConnection
*/
private $connection;
public function __construct(StateData $stateData, ResourceConnection $connection)
{
$this->stateData = $stateData;
$this->connection = $connection;
}
/**
* @param array $buildSubject
* @return array
*/
public function build(array $buildSubject): array
{
/** @var PaymentDataObject $paymentDataObject */
$paymentDataObject = SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
$order = $paymentDataObject->getOrder();
$quoteId = $this->getQuoteId($order->getId());
$requestBody = $this->stateData->getStateData($quoteId);
// if installments is set add it into the request
$installments = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) ?: 0;
if ($installments > 0) {
$requestBody['installments']['value'] = $installments;
}
return [
'body' => $requestBody
];
}
/**
* Get quote id
*
* @param int $orderId
* @return int
*/
private function getQuoteId($orderId)
{
$sql = $this->connection->getConnection()
->select()
->from($this->connection->getTableName('sales_order'), ['quote_id'])
->where('entity_id = ?', $orderId);
return (int)$this->connection->getConnection()->fetchOne($sql);
}
}
Hello,
Same issue with Adyen 8.2.3 and Magento EE 2.4.3.
@acampos1916
I can still replicate this issue in adyen/module-payment:8.2.3
It is not ideal, but maybe this can be a fix:
- remove this line from adyen di.xml
<preference for="Magento\Payment\Gateway\Data\Order\OrderAdapter" type="Adyen\Payment\Gateway\Data\Order\OrderAdapter"/>
- include db connection into "Gateway/Request/CcBackendAuthorizationDataBuilder.php" and get quote_id form sales_order table.
namespace Adyen\Payment\Gateway\Request; use Adyen\Payment\Helper\StateData; use Adyen\Payment\Observer\AdyenCcDataAssignObserver; use Magento\Framework\App\ResourceConnection; use Magento\Payment\Gateway\Data\PaymentDataObject; use Magento\Payment\Gateway\Helper\SubjectReader; use Magento\Payment\Gateway\Request\BuilderInterface; class CcBackendAuthorizationDataBuilder implements BuilderInterface { /** * @var StateData */ private $stateData; /** * @var ResourceConnection */ private $connection; public function __construct(StateData $stateData, ResourceConnection $connection) { $this->stateData = $stateData; $this->connection = $connection; } /** * @param array $buildSubject * @return array */ public function build(array $buildSubject): array { /** @var PaymentDataObject $paymentDataObject */ $paymentDataObject = SubjectReader::readPayment($buildSubject); $payment = $paymentDataObject->getPayment(); $order = $paymentDataObject->getOrder(); $quoteId = $this->getQuoteId($order->getId()); $requestBody = $this->stateData->getStateData($quoteId); // if installments is set add it into the request $installments = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) ?: 0; if ($installments > 0) { $requestBody['installments']['value'] = $installments; } return [ 'body' => $requestBody ]; } /** * Get quote id * * @param int $orderId * @return int */ private function getQuoteId($orderId) { $sql = $this->connection->getConnection() ->select() ->from($this->connection->getTableName('sales_order'), ['quote_id']) ->where('entity_id = ?', $orderId); return (int)$this->connection->getConnection()->fetchOne($sql); } }
Not working from backoffice when I tried to create an order.
Hi guys,
Apologies for the delay. I am re-opening this issue since it seems that it is occurring more frequently. Based on the previous comments it seems that it is occurring exclusively on Magento v2.4.3.
Best regards, Jean Adyen
This issue appears at 8.17.0
@Morerice as reported by @Winfle, I too am seeing this on 8.18 when trying to checkout with a 3DS enabled card stored in vault.
The change in 8.17 causes this issue: https://github.com/Adyen/adyen-magento2/blob/b8c9105b80ebd5b42c3023d5e91b88f8ae6e3426/Gateway/Request/RecurringVaultDataBuilder.php#L51
This was changed in: https://github.com/Adyen/adyen-magento2/commit/b660e9dac3f7d5bb0d45e68a3145df6a1f8cde27#diff-0e0587b967adaa49d80ffcf95d7ace94ee9c4d963f5a139a84954c9a0db890ccL36
@acampos1916 Do you need me to open a new issue for this now that it is reintroduced in 8.17 and 8.18?
Describe the bug On a clean install of Magento 2.4.3 with no other third-party plugins other than Adyen 7.2.0, when we try to place an order with Adyen the result is a generic error message "Something went wrong with your request. Please try again later.". After checked the log file var/log/system.log we've discovered this:
main.CRITICAL: Error: Call to undefined method PayPal\Braintree\Gateway\Data\Order\OrderAdapter::getQuoteId() in /var/www/html/vendor/adyen/module-payment/Gateway/Response/StateDataCleanupHandler.php:48 Stack trace:
After checking di.xml of Adyen It seems to me that both Adyen and Braintree are using a preference over the same Class
Magento\Payment\Gateway\Data\Order\OrderAdapter
I'm not sure what's going on here, how can I solve this without uninstall Braintree (actually I tried to disable Braintree's modules and Adyen stop to work).
To Reproduce Steps to reproduce the behavior:
Expected behavior I'm expecting to place the order without getting any error.
Magento version 2.4.3
Plugin version 7.2.0 (test mode)
Screenshots
Desktop (please complete the following information):