예제 #1
0
 public function testPaymentReviewRegisterPaymentAuthorization()
 {
     $this->_orderMock->expects($this->any())->method('getPayment')->will($this->returnSelf());
     $this->_orderMock->expects($this->any())->method('canFetchPaymentReviewUpdate')->will($this->returnValue(true));
     $this->_orderMock->expects($this->once())->method('registerPaymentReviewAction')->with('update', true)->will($this->returnSelf());
     $this->_ipn->processIpnRequest();
 }
예제 #2
0
 public function testPaymentReviewRegisterPaymentFraud()
 {
     $paymentMock = $this->getMock('\\Magento\\Sales\\Model\\Order\\Payment', ['getAdditionalInformation', '__wakeup', 'registerCaptureNotification'], [], '', false);
     $paymentMock->expects($this->any())->method('getAdditionalInformation')->will($this->returnValue([]));
     $paymentMock->expects($this->any())->method('registerCaptureNotification')->will($this->returnValue(true));
     $this->_orderMock->expects($this->any())->method('getPayment')->will($this->returnValue($paymentMock));
     $this->_orderMock->expects($this->any())->method('canFetchPaymentReviewUpdate')->will($this->returnValue(true));
     $this->_orderMock->expects($this->once())->method('getState')->will($this->returnValue(Order::STATE_PENDING_PAYMENT));
     $this->_paypalInfo->expects($this->once())->method('importToPayment')->with(['payment_status' => 'pending', 'pending_reason' => 'fraud', 'collected_fraud_filters' => ['Maximum Transaction Amount']], $paymentMock);
     $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->_ipn = $objectHelper->getObject('Magento\\Paypal\\Model\\Ipn', ['configFactory' => $this->configFactory, 'logAdapterFactory' => $this->getMock('Magento\\Framework\\Logger\\AdapterFactory', [], [], '', false), 'curlFactory' => $this->curlFactory, 'orderFactory' => $this->_orderMock, 'paypalInfo' => $this->_paypalInfo, 'data' => ['payment_status' => 'Pending', 'pending_reason' => 'fraud', 'fraud_management_pending_filters_1' => 'Maximum Transaction Amount']]);
     $this->_ipn->processIpnRequest();
     $this->assertEquals('IPN "Pending"', $paymentMock->getPreparedMessage());
 }
예제 #3
0
 public function testRegisterPaymentDenial()
 {
     /** @var \Magento\Sales\Model\Order\Payment $paymentMock */
     $paymentMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\Order\\Payment')->setMethods(['getAdditionalInformation', 'setTransactionId', 'setNotificationResult', 'setIsTransactionClosed', 'deny'])->disableOriginalConstructor()->getMock();
     $paymentMock->expects($this->exactly(6))->method('getAdditionalInformation')->willReturn([]);
     $paymentMock->expects($this->once())->method('setTransactionId')->willReturnSelf();
     $paymentMock->expects($this->once())->method('setNotificationResult')->willReturnSelf();
     $paymentMock->expects($this->once())->method('setIsTransactionClosed')->willReturnSelf();
     $paymentMock->expects($this->once())->method('deny')->with(false)->willReturnSelf();
     $this->_orderMock->expects($this->exactly(4))->method('getPayment')->will($this->returnValue($paymentMock));
     $this->_paypalInfo->expects($this->once())->method('importToPayment')->with(['payment_status' => 'denied'], $paymentMock);
     $objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->_ipn = $objectHelper->getObject('Magento\\Paypal\\Model\\Ipn', ['configFactory' => $this->configFactory, 'curlFactory' => $this->curlFactory, 'orderFactory' => $this->_orderMock, 'paypalInfo' => $this->_paypalInfo, 'data' => ['payment_status' => 'Denied']]);
     $this->_ipn->processIpnRequest();
 }