/**
  * @dataProvider providerHandleRequest
  */
 public function testHandleRequest($sShopOwnerPayPal, $aResponseFromPayPal, $blRequestHandledExpected, $OrderStatusAfterRequest, $blFailureMessageExist, $sTransactionIdPayPal, $dPaymentAmountPayPal, $sPaymentCurrencyPayPal, $sPaymentStatusPayPal, $sTransactionIdShop, $dPaymentAmountShop, $sPaymentCurrencyShop, $PaymentStatusAfterRequest)
 {
     $sOrderId = '__handleRequest_order';
     $this->_preparePayPalRequest($sShopOwnerPayPal, $sPaymentStatusPayPal, $sTransactionIdPayPal, $dPaymentAmountPayPal, $sPaymentCurrencyPayPal);
     $oOrder = $this->_createPayPalOrder($sOrderId);
     $this->_createOrderPayment($sOrderId, $sTransactionIdShop, $dPaymentAmountShop, $sPaymentCurrencyShop);
     // Mock curl so we do not call PayPal to check if request originally from PayPal.
     $oIPNRequestVerifier = $this->_createPayPalResponse($aResponseFromPayPal);
     $oPayPalIPNHandler = new oePayPalIPNHandler();
     $oPayPalIPNHandler->setIPNRequestVerifier($oIPNRequestVerifier);
     $blRequestHandled = $oPayPalIPNHandler->handleRequest();
     $oOrder->load();
     $oPayment = new oePayPalOrderPayment();
     $oPayment->loadByTransactionId($sTransactionIdShop);
     $this->assertEquals($blRequestHandledExpected, $blRequestHandled, 'Request is not handled as expected.');
     $this->assertEquals($PaymentStatusAfterRequest, $oPayment->getStatus(), 'Status did not change to one returned from PayPal.');
     $this->assertEquals($OrderStatusAfterRequest, $oOrder->getPaymentStatus(), 'Status did not change to one returned from PayPal.');
     $this->assertEquals($dPaymentAmountShop, $oPayment->getAmount(), 'Payment amount should not change to get from PayPal.');
     $this->assertEquals($sPaymentCurrencyShop, $oPayment->getCurrency(), 'Payment currency should not change to get from PayPal.');
     if (!$blFailureMessageExist) {
         $this->assertEquals(0, count($oPayment->getCommentList()), 'There should be no failure comment.');
     } else {
         $aComments = $oPayment->getCommentList();
         $aComments = $aComments->getArray();
         $sComment = $aComments[0]->getComment();
         // Failure comment should have all information about request and original payment.
         $blCommentHasAllInformation = strpos($sComment, (string) $dPaymentAmountPayPal) !== false && strpos($sComment, (string) $sPaymentCurrencyPayPal) !== false && strpos($sComment, (string) $dPaymentAmountShop) !== false && strpos($sComment, (string) $sPaymentCurrencyShop) !== false;
         $this->assertEquals(1, count($aComments), 'There should failure comment.');
         $this->assertTrue($blCommentHasAllInformation, 'Failure comment should have all information about request and original payment: ' . $sComment);
     }
 }
 /**
  * Test case for oePayPalIPNHandler::handleRequest()
  * Handler should return false if called without PayPal request data.
  */
 public function testHandleRequest_emptyData_false()
 {
     $oPayPalIPNHandler = new oePayPalIPNHandler();
     $blResult = $oPayPalIPNHandler->handleRequest();
     $this->assertEquals(false, $blResult);
 }