Checks whether Empty payment is available.

@param object $user
@param double $basketPrice
@param string $shippingId

@return bool
348188
protected function isEmptyPaymentValid($user, $basketPrice, $shippingId)
    {
        $valid = true;

        $emptyPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
        $emptyPayment->load('oxempty');
        if (!$emptyPayment->isValidPayment(null, null, $user, $basketPrice, $shippingId)) {
            $valid = false;
        }

        return $valid;
    }
352501
private function isValidPaymentId($paymentId)
    {
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = DatabaseProvider::getMaster();

        $paymentModel = oxNew(EshopPayment::class);
        $tableName = $paymentModel->getViewName();

        $sql = "
            select
                1 
            from 
                {$tableName}
            where 
                {$tableName}.oxid = {$masterDb->quote($paymentId)}
                and {$paymentModel->getSqlActiveSnippet()}
        ";

        return (bool) $masterDb->getOne($sql);
    }
807515
private function isAddressBillingAddress(array $addressData, TdbDataExtranetUser $user)
    {
        if (false === isset($addressData['id'])) {
            return false;
        }
        if ($addressData['id'] !== $user->fieldDefaultBillingAddressId) {
            return false;
        }

        return true;
    }
1211128
public function IsAvailable()
    {
        $bIsValid = true;
        $bIsValid = ($bIsValid && $this->IsActive());
        $bIsValid = ($bIsValid && $this->isValidForCurrentPortal());
        $bIsValid = ($bIsValid && $this->IsValidForCurrentUser());
        $bIsValid = ($bIsValid && $this->IsValidForBasket());

        return $bIsValid;
    }
910079
public function submit(UserInterface $user, $locale, &$orderWasSubmitted = true, &$originalCart = null)
    {
        $orderWasSubmitted = true;

        $cart = $this->getUserCart($user, $locale, null, false, true);
        $originalCart = $cart;

        // In case of errors, do not submit cart.
        if (count($cart->getCartErrorCodes()) > 0) {
            $orderWasSubmitted = false;

            return $cart;
        }

        $orderWasSubmitted = $this->submitCartDirectly($cart, $user, $locale);

        return $this->getUserCart($user, $locale);
    }
604188
public function isSuperiorThen($user)
    {
        if( ! $this->maxRole()) return false;
        if( ! $user->maxRole()) return true;
        return $this->maxRole()->order > $user->maxRole()->order;
    }
1286360
public function ValidateBasketContents($sMessageManager = null)
    {
        /*
         * do not validate basket if returning from an interrupted payment call since the order
         * creation has already begun (items saved, stock reduced). revalidating may remove items from the basket due to zero stock
         * which is of course not intended since the stock has been reserved via the creation process of the order
         *
         */
        if (TdbShopPaymentHandler::ExecutePaymentInterrupted()) {
            return true;
        }
        if (is_null($sMessageManager)) {
            $sMessageManager = MTShopBasketCore::MSG_CONSUMER_NAME;
        }
        $this->GetBasketArticles()->Refresh();
        $bIsValid = $this->GetBasketArticles()->ValidateBasketContents($sMessageManager);
        /**
         * validate the vouchers as they were stored in the session and
         * maybe could be used by an other order (when vouchers with the same code exist).
         */
        $bBasketVouchersValidated = $this->CheckBasketVoucherAvailable($sMessageManager);
        if (!$bIsValid) {
            $this->RecalculateBasket();
        }

        return $bIsValid;
    }
987850
@Override
	public List<CommerceOrder> findByUserId(long userId) {
		return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
944491
public function checkPayment($transaction_id)
    {
        // Check arguments
        if (null === $transaction_id || !is_string($transaction_id) || strlen(trim($transaction_id)) == 0) {
            throw new \InvalidArgumentException('Transaction ID should be a string.');
        }

        // Params
        $params = array(
            'partnerid' => $this->partnerId,
            'transaction_id' => $transaction_id,
        );

        // Do request
        $response = $this->request('check-status/', $params);

        // Gather data
        if ($response->order === null) {
            throw new MollieException('Unexpected response');
        }
        $transactionId = (string) $response->order->transaction_id;
        $amount = (int) $response->order->amount;
        $paid = ((string) $response->order->paid == 'true');
        $status = (string) $response->order->status;

        // Return TransactionStatus
        return new TransactionStatus($amount, $paid, $transactionId, $status);
    }
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;
    }
1349651
public function isLostBasketCustomerEnabled($num, $storeId)
    {
        return $this->scopeConfig->isSetFlag(
            constant('self::XML_PATH_LOSTBASKET_CUSTOMER_ENABLED_' . $num),
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $storeId
        );
    }
476236
public function update(UserPolicy $user, PriceList $price_list)
    {
        if ($user->canDo('pricelist.price_list.edit') && $user->isAdmin()) {
            return true;
        }

        return $price_list->user_id == user_id() && $price_list->user_type == user_type();
    }
408488
public function checkRequiredFields($user, $billingAddress, $deliveryAddress)
    {
        /** @var \OxidEsales\Eshop\Application\Model\RequiredAddressFields $requiredAddressFields */
        $requiredAddressFields = oxNew(\OxidEsales\Eshop\Application\Model\RequiredAddressFields::class);

        /** @var \OxidEsales\Eshop\Application\Model\RequiredFieldsValidator $fieldsValidator */
        $fieldsValidator = oxNew(\OxidEsales\Eshop\Application\Model\RequiredFieldsValidator::class);

        /** @var User $user */
        $user = oxNew(User::class);
        $billingAddress = $this->_setFields($user, $billingAddress);
        $fieldsValidator->setRequiredFields($requiredAddressFields->getBillingFields());
        $fieldsValidator->validateFields($billingAddress);
        $invalidFields = $fieldsValidator->getInvalidFields();

        if (!empty($deliveryAddress)) {
            /** @var \OxidEsales\Eshop\Application\Model\Address $deliveryAddress */
            $deliveryAddress = $this->_setFields(oxNew(\OxidEsales\Eshop\Application\Model\Address::class), $deliveryAddress);
            $fieldsValidator->setRequiredFields($requiredAddressFields->getDeliveryFields());
            $fieldsValidator->validateFields($deliveryAddress);
            $invalidFields = array_merge($invalidFields, $fieldsValidator->getInvalidFields());
        }

        foreach ($invalidFields as $sField) {
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
            $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('ERROR_MESSAGE_INPUT_NOTALLFIELDS'));

            $this->addValidationError($sField, $exception);
        }
    }
806078
public function isPaymentValid()
    {
        $isValid = $this->isPaymentActive();

        if ($isValid && !is_null($this->getPrice())) {
            $isValid = $this->checkPriceRange() && $this->checkMinOrderPrice();
        }

        $user = $this->getUser();
        if ($isValid && $user && $user->hasAccount()) {
            $isValid = $this->checkUserGroup();
        }

        if ($isValid && $user && $this->getCheckCountry()) {
            $isValid = $this->checkUserCountry();
        }

        return $isValid;
    }
269108
public function validateDelivery($basket)
    {
        if ($basket->getPaymentId() == 'oxidpaypal') {
            $shippingId = $basket->getShippingId();
            $basketPrice = $basket->getPrice()->getBruttoPrice();
            $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
            if (!$user->loadUserPayPalUser()) {
                $user = $this->getUser();
            }

            $validState = null;
            if (!$this->isPayPalPaymentValid($user, $basketPrice, $shippingId)) {
                $validState = self::ORDER_STATE_INVALIDDELIVERY;
            }
        } else {
            $validState = parent::validateDelivery($basket);
        }

        return $validState;
    }
59942
public function fee($cityId, $orderAmount)
	{
		$params = compact('cityId', 'orderAmount');
		$requestParams = $this->initRequestParams('fee', $params);
		$this->request('fee', $requestParams);

		return empty($this->error);
	}
872763
protected function userPayment()
	{
		$this->refIf = Input::get('id_get');
		$trackingCode = Input::get('trans_id');

		if (is_numeric($trackingCode) && $trackingCode > 0) {
			$this->trackingCode = $trackingCode;
			return true;
		}

		$this->transactionFailed();
		$this->newLog(-4, PaylineReceiveException::$errors[-4]);
		throw new PaylineReceiveException(-4);
	}