<?php /** * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ * ############# #####( ###### #####. ###### ############# ############# * ###### #####( ###### #####. ###### ##### ###### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ###### * ############# ############# ############# ############# ##### ###### * ############ ############ ############# ############ ##### ###### * ###### * ############# * ############ * * Adyen Payment module (https://www.adyen.com/) * * Copyright (c) 2015 Adyen BV (https://www.adyen.com/) * See LICENSE.txt for license details. * * Author: Adyen <magento@adyen.com> */ namespace Adyen\Payment\Gateway\Validator; use Magento\Payment\Gateway\Validator\AbstractValidator; class CaptureResponseValidator extends AbstractValidator { /** * @var \Adyen\Payment\Logger\AdyenLogger */ private $adyenLogger; /** * CaptureResponseValidator constructor. * * @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger */ public function __construct( \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory, \Adyen\Payment\Logger\AdyenLogger $adyenLogger ) { $this->adyenLogger = $adyenLogger; parent::__construct($resultFactory); } /** * @param array $validationSubject * @throws \Magento\Framework\Exception\LocalizedException */ public function validate(array $validationSubject) { $response = \Magento\Payment\Gateway\Helper\SubjectReader::readResponse($validationSubject); $isValid = true; $errorMessages = []; if (empty($response['response']) || $response['response'] != '[capture-received]') { $errorMsg = __('Error with capture'); $this->adyenLogger->error($errorMsg); if (!empty($response['error'])) { $this->adyenLogger->error($response['error']); } $errorMessages[] = $errorMsg; } return $this->createResult($isValid, $errorMessages); } }