function processPayment(uint moneyValue, bytes refData) private
    {
        if (msg.sender == laxmi)
        {
            totalSelfInvest = totalSelfInvest.add(moneyValue);
            emit LogSelfInvestment(moneyValue);
            return;
        }

        if (moneyValue == 0)
        {
            preparePayment();
            return;
        }

        if (moneyValue < minimalDeposit)
        {
            totalPenalty = totalPenalty.add(moneyValue);
            emit LogMinimalDepositPayment(msg.sender, moneyValue, totalPenalty);

            return;
        }

        checkLimits(moneyValue);

        address referrer = bytesToAddress(refData);

        if (user[msg.sender].balance > 0 ||
        refData.length != 20 ||
        (!isUnlimitedContractInvest && moneyValue > getCurrentMaximalDeposit()) ||
        referrer != laxmi &&
        (
        user[referrer].balance <= 0 ||
        referrer == msg.sender)
        )
        {
            uint amount = moneyValue.mul(procReturn).div(procKoef);

            totalPenalty = totalPenalty.add(moneyValue.sub(amount));

            emit LogPenaltyPayment(msg.sender, user[msg.sender].balance, refData.length, referrer, user[referrer].balance, moneyValue, amount, totalPenalty);

            msg.sender.transfer(amount);

            return;
        }



        uint nDay = getCurrentDay();

        uint restDepositPerDay = getDayRestDepositLimit(nDay);

        uint addDeposit = moneyValue;


        if (!isUnlimitedDayInvest && moneyValue > restDepositPerDay)
        {
            uint returnDeposit = moneyValue.sub(restDepositPerDay);

            uint returnAmount = returnDeposit.mul(procReturn).div(procKoef);

            addDeposit = addDeposit.sub(returnDeposit);

            totalPenalty = totalPenalty.add(returnDeposit.sub(returnAmount));

            emit LogExceededRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, returnDeposit, returnAmount, totalPenalty, addDeposit);

            msg.sender.transfer(returnAmount);
        }

        usedDeposit[nDay] = usedDeposit[nDay].add(addDeposit);

        emit LogUsedRestDepositPerDay(msg.sender, referrer, moneyValue, nDay, restDepositPerDay, addDeposit, usedDeposit[nDay]);


        registerInvestor(referrer);
        sendOwnerFee(addDeposit);
        calcBonusReferrers(referrer, addDeposit);
        updateInvestBalance(addDeposit);
    }