33 private $paypalInfoManager;
50 $this->paypalInfoManager = $paypalInfoManager;
51 $this->xmlSecurity = $xmlSecurity;
69 $fraudMessages = [
'RESPMSG' =>
$response->getData(self::RESPONSE_MESSAGE)];
70 if (
$response->getData(self::FRAUD_RULES_XML)) {
71 $fraudMessages = array_merge(
73 $this->getFraudRulesDictionary(
$response->getData(self::FRAUD_RULES_XML))
77 $this->paypalInfoManager->importToPayment(
95 private function getFraudRulesDictionary($rulesString)
99 if (!$this->xmlSecurity->scan($rulesString)) {
104 $rulesXml = new \SimpleXMLElement($rulesString);
105 foreach ($rulesXml->{
'rule'} as
$rule) {
106 $rules[(string)
$rule->{
'ruleDescription'}] = (string)
$rule->{
'triggeredMessage'};
108 }
catch (\Exception $e) {
110 libxml_use_internal_errors(
false);
__construct(Info $paypalInfoManager, Security $xmlSecurity)
handle(InfoInterface $payment, DataObject $response)
const RESPONSE_CODE_DECLINED_BY_FILTER
const RESPONSE_CODE_FRAUDSERVICE_FILTER