Esempio n. 1
0
 /**
  * @dataProvider handleMessagesDataProvider
  */
 public function testHandle($message, $rulesString, $existingFrauds, $expectedMessage)
 {
     $this->responseMock->expects($this->atLeastOnce())->method('getData')->willReturnMap([[FraudHandler::RESPONSE_MESSAGE, null, $message], [FraudHandler::FRAUD_RULES_XML, null, $rulesString], ['result', null, Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER]]);
     $this->paymentMock->expects($this->once())->method('getAdditionalInformation')->with(Info::FRAUD_FILTERS)->willReturn($existingFrauds);
     $this->paypalInfoManagerMock->expects($this->once())->method('importToPayment')->with([Info::FRAUD_FILTERS => $expectedMessage]);
     $this->fraudHandler->handle($this->paymentMock, $this->responseMock);
 }
Esempio n. 2
0
 /**
  * Check attempting to read invalid XML file (XXE XML)
  */
 public function testHandleXXEXml()
 {
     $file = __DIR__ . '/_files/xxe-xml.txt';
     $rulesString = str_replace('{file}', $file, $this->getRulesXmlString('xxe_fps_prexmldata.xml'));
     $this->responseMock->expects($this->atLeastOnce())->method('getData')->willReturnMap([[FraudHandler::RESPONSE_MESSAGE, null, 'New fraud message'], [FraudHandler::FRAUD_RULES_XML, null, $rulesString], ['result', null, Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER]]);
     $this->paymentMock->expects($this->once())->method('getAdditionalInformation')->with(Info::FRAUD_FILTERS)->willReturn(['Total Purchase Price Ceiling' => 'Existing fraud message', 'RESPMSG' => 'Existing fraud message']);
     $this->paypalInfoManagerMock->expects($this->once())->method('importToPayment')->with([Info::FRAUD_FILTERS => ['RESPMSG' => 'Existing fraud message', 'Total Purchase Price Ceiling' => 'Existing fraud message']]);
     $this->fraudHandler->handle($this->paymentMock, $this->responseMock);
 }