Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-functional-tests' into fix-f…
Browse files Browse the repository at this point in the history
…unctional-tests
  • Loading branch information
candemiralp committed Mar 7, 2024
2 parents 1dc6539 + e16d2ae commit afd0114
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Helper/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ private function updateAdyenAttributes(Order $order, Notification $notification)
* the previous notification was authorisation : true do not update pspreference
*/
if (!$notification->isSuccessful()) {
$previousAdyenEventCode = $order->getData('adyen_notification_event_code');
$previousAdyenEventCode = $this->orderRepository
->get($order->getId())
->getData('adyen_notification_event_code');
if ($previousAdyenEventCode != "AUTHORISATION : TRUE") {
$this->updateOrderPaymentWithAdyenAttributes($order->getPayment(), $notification, $additionalData);
}
Expand Down
2 changes: 2 additions & 0 deletions Model/Ui/AdyenCcConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ public function getConfig(): array

$storeId = $this->storeManager->getStore()->getId();
$cardRecurringEnabled = $this->vaultHelper->getPaymentMethodRecurringActive(self::CODE, $storeId);
$methodTitle = $this->configHelper->getConfigData('title', Config::XML_ADYEN_CC, $storeId);

$config['payment']['adyenCc']['methodCode'] = self::CODE;
$config['payment']['adyenCc']['title'] = __($methodTitle);
$config['payment']['adyenCc']['locale'] = $this->adyenHelper->getStoreLocale($storeId);
$config['payment']['adyenCc']['isCardRecurringEnabled'] = $cardRecurringEnabled;
$config['payment']['adyenCc']['icons'] = $this->getIcons();
Expand Down
18 changes: 15 additions & 3 deletions Test/Unit/Helper/WebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Adyen\Payment\Test\Unit\Helper;

use Adyen\Payment\Helper\Webhook;
use Adyen\Payment\Helper\Webhook\AuthorisationWebhookHandler;
use Adyen\Payment\Helper\Webhook\WebhookHandlerInterface;
use Adyen\Payment\Model\Notification;
use Adyen\Payment\Test\Unit\AbstractAdyenTestCase;
Expand All @@ -19,7 +18,6 @@
use Adyen\Payment\Helper\Webhook\WebhookHandlerFactory;
use Adyen\Payment\Logger\AdyenLogger;
use ReflectionMethod;
use ReflectionClass;

class WebhookTest extends AbstractAdyenTestCase
{
Expand Down Expand Up @@ -190,6 +188,7 @@ public function testUpdateAdyenAttributes()
$orderMock = $this->getMockBuilder(Order::class)
->disableOriginalConstructor()
->getMock();
$orderMock->method('getData')->willReturnSelf();

$paymentMock = $this->getMockBuilder(Payment::class)
->disableOriginalConstructor()
Expand All @@ -203,8 +202,21 @@ public function testUpdateAdyenAttributes()
->disableOriginalConstructor()
->getMock();

$orderRepositoryMock = $this->createMock(OrderRepository::class);
$orderRepositoryMock->method('get')->willReturn($orderMock);

// Create an instance of your class
$webhook = $this->createWebhook(null, $serializerMock, null, null, null, $loggerMock, null, null, null);
$webhook = $this->createWebhook(
null,
$serializerMock,
null,
null,
null,
$loggerMock,
null,
null,
$orderRepositoryMock
);

// Set up expectations for the mocked objects
$notificationMock->expects($this->once())
Expand Down

0 comments on commit afd0114

Please sign in to comment.