Checks the payment response integrity.

@param array $data

@return bool
771092
public function checkPaymentResponse(array $data)
    {
        if (!isset($data['MAC'])) {
            return false;
        }

        $data = array_replace([
            'date'        => null,
            'montant'     => null,
            'reference'   => null,
            'texte-libre' => null,
            'code-retour' => null,
            'cvx'         => null,
            'vld'         => null,
            'brand'       => null,
            'status3ds'   => null,
            'numauto'     => null,
            'motifrefus'  => null,
            'originecb'   => null,
            'bincb'       => null,
            'hpancb'      => null,
            'ipclient'    => null,
            'originetr'   => null,
            'veres'       => null,
            'pares'       => null,
        ], $data);

        $macData = [
            $this->config['tpe'],
            $data["date"],
            $data['montant'],
            $data['reference'],
            $data['texte-libre'],
            static::VERSION,
            $data['code-retour'],
            $data['cvx'],
            $data['vld'],
            $data['brand'],
            $data['status3ds'],
            $data['numauto'],
            $data['motifrefus'],
            $data['originecb'],
            $data['bincb'],
            $data['hpancb'],
            $data['ipclient'],
            $data['originetr'],
            $data['veres'],
            $data['pares'],
            null,
        ];

        return strtolower($data['MAC']) === $this->computeMac($macData);
    }
1208989
private function validate($data)
    {
        // null or zero-length values cannot be assigned references
        if (is_null($data) || (is_string($data) && !strlen($data))) {
            return false;
        }

        return true;
    }
967400
protected function isSent($data = null)
  {
    if (!is_null($data)) {
      return true;
    }

    if ($name = $this->getName()) {
      return (bool)$this->getRequest()->get($name);
    }

    foreach ($this->fields as $n => $f) {
      if ($this->checkRequestHasValue($n)) {
        return true;
      }
    }

    return false;
  }
1161241
public function insert(array $data)
    {
        if (false === $this->trigger('before_insert', $this)) {
            return false;
        }

        if($this->dateFormat && $this->updateTime && $this->createTime){
            $time = date('Y-m-d H:i:s', time());
            $data[$this->updateTime] = $time;
            $data[$this->createTime] = $time;
        } else {
            $time =  time();
            $data[$this->updateTime] =  $time;
            $data[$this->createTime] =  $time;
        }

        $response = $this->getQuery()->insert($data);

        if (false === $this->trigger('after_insert', $this)) {
            return false;
        }
        return $response;
    }
1331117
public function charge($data) {

        // JSON post data to object
        $this->data = json_decode($data);

        // Load the customer from email
        $this->customer = $this->customerRepository->get(filter_var($this->data->email, FILTER_SANITIZE_EMAIL));    
        // If customer exists and amount is valid
        if ( (int) $this->customer->getId() > 0 && (float) $this->data->value > 0)  {

            // Prepare the product list
            if ( isset($this->data->products) && is_array($this->data->products) && count($this->data->products) > 0 )  {

                // Submit request
                return (int) $this->submitRequest();
            }
        }

        return false;
    }
1095058
protected function _isPaymentResponseSessionInvalid()
    {
        /** @var OxpsPaymorrowModule $oModule */
        $oModule = oxRegistry::get('OxpsPaymorrowModule');

        // Get Paymorrow response from session
        $aPaymorrowResponse = $oModule->getPaymorrowResponseData();

        // The response must exist and be valid
        return (
            !isset($aPaymorrowResponse['order_status'], $aPaymorrowResponse['response_status']) or
            !in_array($aPaymorrowResponse['order_status'], array('VALIDATED', 'ACCEPTED')) or
            ($aPaymorrowResponse['response_status'] !== 'OK')
        );
    }
1174947
protected function verifyPayment()
	{

		$fields = array(
			'MerchantID' => $this->config->get('gateway.zarinpal.merchant-id'),
			'Authority' => $this->refId,
			'Amount' => $this->amount,
		);

		try {
			$soap = new SoapClient($this->serverUrl, ['encoding' => 'UTF-8']);
			$response = $soap->PaymentVerification($fields);

		} catch (\SoapFault $e) {
			$this->transactionFailed();
			$this->newLog('SoapFault', $e->getMessage());
			throw $e;
		}

		if ($response->Status != 100 && $response->Status != 101) {
			$this->transactionFailed();
			$this->newLog($response->Status, ZarinpalException::$errors[$response->Status]);
			throw new ZarinpalException($response->Status);
		}

		$this->trackingCode = $response->RefID;
		$this->transactionSucceed();
		$this->newLog($response->Status, Enum::TRANSACTION_SUCCEED_TEXT);
		return true;
	}
688170
public function paymentMethod(array $condition, array $data)
    {
        if (!isset($data['order']['payment'])) {
            return false;
        }

        return $this->compare($data['order']['payment'], $condition['value'], $condition['operator']);
    }
584069
protected function isRecord($data)
    {
        if ($data instanceof Collection) {
            return false;
        }

        $keys = array_keys($data);
        return (in_array('id', $keys, true) || in_array('name', $keys, true));
    }
992886
protected final function validateUpdateData(array $data = null) {
		if ($data === null && isset($this->_formData)) {
			$data = $this->_formData;
		}
		if ($this->rules) {
			$newRules = [];
			foreach ($data as $key => $v) {
				if (isset($this->rules[ $key ])) {
					$newRules[ $key ] = $this->rules[ $key ];
				}
			}
			if ($newRules) {
				return $this->validateData($newRules, $data);
			}
		}

		return true;
	}
733952
protected function validate(array $data = array())
    {
        $id = auth()->user()->id;
        if (empty($data)) {
            return false;
        }
        if ((int) array_get($data, 'secondary_user_id') !== $id) {
            return false;
        }

        $primary = array_get($data, 'primary_user_id');
        if ($primary === null) {
            return false;
        }
        return true;
    }
1314461
protected function isDataValid($data)
    {
        $this->parser->setData($data);
        $this->parser->parseData();

        return $this->parser->isValid();
    }
647527
public function match(array $data): bool
    {
        $result = $this->checkMatchArray($data, $this->matchArray);
        if ($result && isset($data['fieldConfig']['config']['foreign_table'])) {
            $result = true;
        } else {
            $result = false;
        }
        return $result;
    }
238970
protected function validate(array &$data)
    {
        $messages = [];
        if (!empty($data['errors']) && !empty($data['activity']) && !empty($data['requests'])) {
            array_push($messages, ['warning', trans('It is recommended to periodically clean system logs.')]);
        }
        $data = array_merge($data, ['messages' => $messages]);
        return $data;
    }
221633
public function check($data)
	{
		$failure  = 0;
		$messages = array();

		if (is_string($data))
		{
			$data = array('text' => $data);
		}

		$data = $this->prepareData($data);

		foreach ($this->detectors as $id => $detector)
		{
			$spam = false;
			$msg  = null;

			try
			{
				if ($detector->detect($data))
				{
					$spam = true;

					if ($detector->message())
					{
						$messages[] = $detector->message();
					}

					$failure++;
				}

				$msg = $detector->message();
			}
			catch (Exception $e)
			{
				$this->setError($e->getMessage());
			}

			$this->mark($id, $spam, $msg);
		}

		$result = new Result($failure > 0, $messages);

		return $result;
	}
966801
private function isRemoteImage(array $data)
    {
        return isset($data['image']['file']) && is_string($data['image']['file']) &&
            (!strncasecmp('http://', $data['image']['file'], 7) || !strncasecmp('https://', $data['image']['file'], 8));
    }
293703
final public function validate($data)
    {
        if ($this->_walk && (is_array($data) || is_object($data))) {
            $arr = (array)$data;

            foreach ($arr as $value) {
                if ($this->validate($value) ===  false) {
                    return false;
                }
            }
        } else {
            $context = $this->_chain->getContext();
            $context->data = $data;

            $result = $this->_chain->run('validate', $context);

            if ($result ===  false) {
                return false;
            }
        }

        return true;
    }