@@ -125,15 +125,21 @@ public function testCaptureCorrectId(string $parentTransactionId)
125
125
$ gatewayToken = 'gateway_token ' ;
126
126
$ this ->payment ->expects ($ this ->once ())->method ('getParentTransactionId ' )->willReturn ($ parentTransactionId );
127
127
$ this ->payment ->expects ($ this ->exactly ($ setParentTransactionIdCalls ))->method ('setParentTransactionId ' );
128
- $ this ->payment ->expects ($ this ->exactly ($ setAdditionalInformationCalls ))->method ('setAdditionalInformation ' )->with (Payflowpro::PNREF , $ gatewayToken );
128
+ $ this ->payment ->expects ($ this ->exactly ($ setAdditionalInformationCalls ))
129
+ ->method ('setAdditionalInformation ' )
130
+ ->with (Payflowpro::PNREF , $ gatewayToken );
129
131
$ this ->payment ->expects ($ this ->exactly (4 ))->method ('getAdditionalInformation ' )->withConsecutive (
130
132
['result_code ' ],
131
133
[Payflowpro::PNREF ],
132
134
[Payflowpro::PNREF ],
133
135
[Payflowpro::PNREF ],
134
136
)->willReturn (0 , '' , Payflowpro::PNREF , Payflowpro::PNREF );
135
- $ this ->paymentExtensionAttributes ->expects ($ this ->once ())->method ('getVaultPaymentToken ' )->willReturn ($ this ->paymentToken );
136
- $ this ->paymentToken ->expects ($ this ->exactly ($ getGatewayTokenCalls ))->method ('getGatewayToken ' )->willReturn ($ gatewayToken );
137
+ $ this ->paymentExtensionAttributes ->expects ($ this ->once ())
138
+ ->method ('getVaultPaymentToken ' )
139
+ ->willReturn ($ this ->paymentToken );
140
+ $ this ->paymentToken ->expects ($ this ->exactly ($ getGatewayTokenCalls ))
141
+ ->method ('getGatewayToken ' )
142
+ ->willReturn ($ gatewayToken );
137
143
138
144
$ this ->subject ->capture ($ this ->payment , 100 );
139
145
}
@@ -235,7 +241,7 @@ private function getPaymentConfigInterfaceFactory()
235
241
->disableOriginalConstructor ()
236
242
->getMock ();
237
243
$ this ->paymentConfig = $ this ->getMockBuilder (PaymentConfigInterface::class)
238
- ->setMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' ])
244
+ ->addMethods (['setStoreId ' , 'setMethodInstance ' , 'setMethod ' , 'getBuildNotationCode ' , ' getPaymentAction ' ])
239
245
->getMockForAbstractClass ();
240
246
241
247
$ paymentConfigInterfaceFactory ->method ('create ' )->willReturn ($ this ->paymentConfig );
@@ -345,6 +351,23 @@ private function initPayment()
345
351
{
346
352
$ this ->payment = $ this ->getMockBuilder (Payment::class)
347
353
->disableOriginalConstructor ()
354
+ ->addMethods (['getIsTransactionApproved ' ])
355
+ ->onlyMethods (
356
+ [
357
+ 'setTransactionId ' ,
358
+ 'setIsTransactionClosed ' ,
359
+ 'getCcExpYear ' ,
360
+ 'getCcExpMonth ' ,
361
+ 'getExtensionAttributes ' ,
362
+ 'getOrder ' ,
363
+ 'authorize ' ,
364
+ 'canFetchTransactionInfo ' ,
365
+ 'getParentTransactionId ' ,
366
+ 'setParentTransactionId ' ,
367
+ 'setAdditionalInformation ' ,
368
+ 'getAdditionalInformation '
369
+ ]
370
+ )
348
371
->getMock ();
349
372
$ this ->order = $ this ->getMockBuilder (Order::class)
350
373
->disableOriginalConstructor ()
@@ -360,7 +383,16 @@ private function initPayment()
360
383
$ this ->payment ->method ('getCcExpYear ' )->willReturn ('2019 ' );
361
384
$ this ->payment ->method ('getCcExpMonth ' )->willReturn ('05 ' );
362
385
$ this ->payment ->method ('getExtensionAttributes ' )->willReturn ($ this ->paymentExtensionAttributes );
386
+ $ this ->payment ->method ('getIsTransactionApproved ' )->willReturn (true );
363
387
364
388
return $ this ->payment ;
365
389
}
390
+
391
+ public function testFetchTransactionInfo ()
392
+ {
393
+ $ this ->payment ->method ('canFetchTransactionInfo ' )->willReturn (false );
394
+ $ this ->paymentConfig ->method ('getPaymentAction ' )->willReturn ('authorize ' );
395
+ $ this ->payment ->expects ($ this ->never ())->method ('authorize ' );
396
+ $ this ->subject ->fetchTransactionInfo ($ this ->payment , '123 ' );
397
+ }
366
398
}
0 commit comments