コード例 #1
0
 /**
  * @covers \Magento\Paypal\Model\Payflowpro::capture
  */
 public function testCaptureWithBuildPlaceRequest()
 {
     $paymentMock = $this->getPaymentMock();
     $orderMock = $this->getOrderMock();
     // test case to build basic request
     $paymentMock->expects(static::once())->method('getAdditionalInformation')->with('pnref')->willReturn(false);
     $paymentMock->expects(static::once())->method('getParentTransactionId')->willReturn(false);
     $paymentMock->expects(static::exactly(2))->method('getOrder')->willReturn($orderMock);
     $response = $this->execGatewayRequest();
     $amount = 23.03;
     $this->payflowpro->capture($paymentMock, $amount);
     static::assertEquals($response['pnref'], $paymentMock->getTransactionId());
     static::assertFalse((bool) $paymentMock->getIsTransactionPending());
 }
コード例 #2
0
ファイル: Transparent.php プロジェクト: rafaelstz/magento2
 /**
  * Capture payment
  *
  * @param InfoInterface|Payment $payment
  * @param float $amount
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  * @throws \Magento\Framework\Exception\State\InvalidTransitionException
  */
 public function capture(InfoInterface $payment, $amount)
 {
     /** @var Payment $payment */
     $token = $payment->getAdditionalInformation(self::PNREF);
     parent::capture($payment, $amount);
     if ($token && !$payment->getAuthorizationTransaction()) {
         $this->createPaymentToken($payment, $token);
     }
     return $this;
 }