1717use Magento \Checkout \Api \GuestPaymentInformationManagementInterface ;
1818use Magento \Checkout \Api \PaymentInformationManagementInterface ;
1919use Magento \Checkout \Model \Session ;
20+ use Magento \Quote \Api \Data \PaymentExtensionInterface ;
21+ use Magento \Quote \Api \Data \PaymentExtensionFactory ;
2022use Magento \Quote \Model \Quote ;
2123use Magento \Quote \Model \QuoteIdToMaskedQuoteIdInterface ;
2224use Magento \Sales \Model \Order ;
@@ -43,6 +45,8 @@ class CreditCardTest extends AbstractAdyenTestCase
4345 private MockObject $ brandsManager ;
4446 private MockObject $ installmentsManager ;
4547 private MockObject $ quoteIdToMaskedQuoteIdMock ;
48+ private MockObject $ paymentExtensionFactoryMock ;
49+ private MockObject $ paymentExtensionMock ;
4650
4751 private CreditCard $ creditCard ;
4852
@@ -93,6 +97,14 @@ public function setUp(): void
9397 $ this ->quoteIdToMaskedQuoteIdMock = $ this ->getMockBuilder (QuoteIdToMaskedQuoteIdInterface::class)
9498 ->disableOriginalConstructor ()
9599 ->getMock ();
100+ $ this ->paymentExtensionFactoryMock = $ this ->createGeneratedMock (
101+ PaymentExtensionFactory::class,
102+ ['create ' ]
103+ );
104+ $ this ->paymentExtensionMock = $ this ->createGeneratedMock (
105+ PaymentExtensionInterface::class,
106+ ['setAgreementIds ' ]
107+ );
96108
97109 $ this ->context = new Context (
98110 $ this ->checkoutStateDataValidator ,
@@ -120,7 +132,8 @@ public function setUp(): void
120132 $ this ->creditCard = new CreditCard (
121133 $ this ->context ,
122134 $ this ->brandsManager ,
123- $ this ->installmentsManager
135+ $ this ->installmentsManager ,
136+ $ this ->paymentExtensionFactoryMock
124137 );
125138 }
126139
@@ -155,7 +168,12 @@ public function testGetConfiguration()
155168
156169 public function testPlaceOrder ()
157170 {
158- $ data = ['stateData ' => []];
171+ $ data = [
172+ 'stateData ' => [],
173+ 'extension_attributes ' => [
174+ 'agreement_ids ' => ['1 ' , '2 ' ]
175+ ]
176+ ];
159177 $ paymentStatus = 'success ' ;
160178 $ quoteId = '111 ' ;
161179 $ orderId = '123 ' ;
@@ -264,6 +282,10 @@ private function setPlaceOrderCommonExpectations($quoteId)
264282 $ this ->quote ->expects ($ this ->once ())
265283 ->method ('getPayment ' )
266284 ->willReturn ($ this ->payment );
285+
286+ $ this ->paymentExtensionFactoryMock
287+ ->method ('create ' )
288+ ->willReturn ($ this ->paymentExtensionMock );
267289 }
268290
269291 public function testEvaluateCompletion ()
0 commit comments