Skips delivery address validation when payment==bestitamazon

@param oxUser $oUser user object

@return int
@throws oxSystemComponentException
558938
public function validateDeliveryAddress($oUser)
    {
        $oBasket = $this->_getContainer()->getSession()->getBasket();

        if ($oBasket && (string)$oBasket->getPaymentId() === 'bestitamazon') {
            return 0;
        } else {
            return parent::validateDeliveryAddress($oUser);
        }
    }
108115
protected function _OxpsPaymorrowOxOrder_finalizeOrder_parent( oxBasket $oBasket, $oUser,
                                                                   $blRecalculatingOrder = false )
    {
        return parent::finalizeOrder( $oBasket, $oUser, $blRecalculatingOrder );
    }
907856
protected function _savePaymorrowUserPaymentData( oxOrder $oOrder, $oPmResponseHandler )
    {
        $aPmResponse = $oPmResponseHandler->getResponse();

        $oUserPaymentId = $oOrder->oxorder__oxpaymentid->value;

        /** @var OxpsPaymorrowOxUserPayment|oxUserPayment $oUserPayment */
        $oUserPayment = oxNew( 'oxuserpayment' );
        $oUserPayment->load( $oUserPaymentId );

        $sPmBankName = $aPmResponse[self::PAYMORROW_RESPONSE_BANK_NAME];
        $sPmIbanCode = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_IBAN];
        $sPmBicCode  = $aPmResponse[self::PAYMORROW_RESPONSE_SDD_BIC];
        $sPmOrderId  = $aPmResponse[self::PAYMORROW_RESPONSE_ORDER_ID];

        $oUserPayment->setPaymorrowBankName( $sPmBankName );
        $oUserPayment->setPaymorrowIBAN( $sPmIbanCode );
        $oUserPayment->setPaymorrowBIC( $sPmBicCode );
        $oUserPayment->setPaymorrowOrderId( $sPmOrderId );

        return $oUserPayment->save();
    }
1013333
public function sendOrderEmailToUser($oOrder, $sSubject = null)
    {
        self::$blSendToUserWasCalled = true;
        self::$oUserOrder = $oOrder;

        return self::$blRetValue;
    }
1078277
public function onOrderExecute($oBasket, $iSuccess)
    {

        if (is_numeric($iSuccess) && $iSuccess != 2 && $iSuccess <= 3) {
            //adding user to particular customer groups
            $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $dMidlleCustPrice = (float) $myConfig->getConfigParam('sMidlleCustPrice');
            $dLargeCustPrice = (float) $myConfig->getConfigParam('sLargeCustPrice');

            $this->addToGroup('oxidcustomer');
            $dBasketPrice = $oBasket->getPrice()->getBruttoPrice();
            if ($dBasketPrice < $dMidlleCustPrice) {
                $this->addToGroup('oxidsmallcust');
            }
            if ($dBasketPrice >= $dMidlleCustPrice && $dBasketPrice < $dLargeCustPrice) {
                $this->addToGroup('oxidmiddlecust');
            }
            if ($dBasketPrice >= $dLargeCustPrice) {
                $this->addToGroup('oxidgoodcust');
            }

            if ($this->inGroup('oxidnotyetordered')) {
                $this->removeFromGroup('oxidnotyetordered');
            }
        }
    }
391105
public function checkVatId($user, $invAddress)
    {
        if ($this->_hasRequiredParametersForVatInCheck($invAddress)) {
            $country = $this->_getCountry($invAddress['oxuser__oxcountryid']);

            if ($country && $country->isInEU()) {
                $vatInValidator = $this->getCompanyVatInValidator($country);

                /** @var \OxidEsales\Eshop\Application\Model\CompanyVatIn $oVatIn */
                $oVatIn = oxNew('oxCompanyVatIn', $invAddress['oxuser__oxustid']);

                if (!$vatInValidator->validate($oVatIn)) {
                    /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
                    $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
                    $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_' . $vatInValidator->getError()));

                    return $this->addValidationError("oxuser__oxustid", $exception);
                }
            }
        } elseif ($invAddress['oxuser__oxustid'] && !$invAddress['oxuser__oxcompany']) {
            /** @var \OxidEsales\Eshop\Core\Exception\InputException $exception */
            $exception = oxNew(\OxidEsales\Eshop\Core\Exception\InputException::class);
            $exception->setMessage(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('VAT_MESSAGE_COMPANY_MISSING'));

            return $this->addValidationError("oxuser__oxcompany", $exception);
        }
    }
141528
public function ValidateUserInput()
    {
        $bIsValid = parent::ValidateUserInput();

        if ($bIsValid) {
            $oMsgManager = TCMSMessageManager::GetInstance();
            $required = array('iban');
            if (!self::isGermanIBAN($this->aPaymentUserData['iban'])) {
                $required[] = 'bic';
            }
            foreach ($required as $field) {
                if (!isset($this->aPaymentUserData[$field]) || empty($this->aPaymentUserData[$field])) {
                    $oMsgManager->AddMessage(self::MSG_MANAGER_NAME.'-'.$field, 'ERROR-USER-REQUIRED-FIELD-MISSING');
                    $bIsValid = false;
                }
            }
        }
        if ($bIsValid) {
            $bIsValid = $this->validateIBAN($this->aPaymentUserData['iban']) && $bIsValid;
            $bIsValid = $this->validateBIC($this->aPaymentUserData['bic']) && $bIsValid;
        }

        return $bIsValid;
    }
753072
public function executePayment($dAmount, &$oOrder)
    {
        $this->_iLastErrorNo = null;
        $this->_sLastError = null;

        if (!$this->_isActive()) {
            return true; // fake yes
        }

        // proceed with no payment
        // used for other countries
        if (@$this->_oPaymentInfo->oxuserpayments__oxpaymentsid->value == 'oxempty') {
            return true;
        }

        return false;
    }
793814
protected function _addOrderHistoryData( array $aData, oxUser $oUser )
    {
        /** @var oxList $oOrdersList */
        $oOrdersList = $oUser->getOrders( 10 );

        if ( empty( $oOrdersList ) or !$oOrdersList->count() ) {
            return $aData;
        }

        $sFieldPrefix = 'customer_history_%d_%s';
        $iItemNumber  = 1;

        foreach ( $oOrdersList as $oOrder ) {
            /** @var OxpsPaymorrowOxOrder|oxOrder $oOrder */

            $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderDate' )]     = $oOrder->getOrderDate();
            $aData[sprintf( $sFieldPrefix, $iItemNumber, 'totalAmount' )]   = $oOrder->getTotalOrderSum();
            $aData[sprintf( $sFieldPrefix, $iItemNumber, 'paymentMethod' )] = $oOrder->getPaymentMethodName();
            $aData[sprintf( $sFieldPrefix, $iItemNumber, 'orderStatus' )]   = $oOrder->getOrderStatus();

            $iItemNumber++;
        }

        return $aData;
    }
133651
public function getSerie()
    {
        if ($this->_oSerie !== null) {
            return $this->_oSerie;
        }
        $oSerie = oxNew(\OxidEsales\Eshop\Application\Model\VoucherSerie::class);
        if (!$oSerie->load($this->oxvouchers__oxvoucherserieid->value)) {
            throw oxNew(\OxidEsales\Eshop\Core\Exception\ObjectException::class);
        }
        $this->_oSerie = $oSerie;

        return $oSerie;
    }
1158198
public function ValidateUserInput()
    {
        $bIsValid = parent::ValidateUserInput();

        if ($bIsValid) {
            $oMsgManager = TCMSMessageManager::GetInstance();

            if (!array_key_exists('accountOwner', $this->aPaymentUserData) || empty($this->aPaymentUserData['accountOwner'])) {
                $oMsgManager->AddMessage(self::MSG_MANAGER_NAME.'-accountOwner', 'ERROR-USER-REQUIRED-FIELD-MISSING');
                $bIsValid = false;
            }

            if (!array_key_exists('accountNr', $this->aPaymentUserData) || empty($this->aPaymentUserData['accountNr'])) {
                $oMsgManager->AddMessage(self::MSG_MANAGER_NAME.'-accountNr', 'ERROR-USER-REQUIRED-FIELD-MISSING');
                $bIsValid = false;
            }

            if (!array_key_exists('bankNr', $this->aPaymentUserData) || empty($this->aPaymentUserData['bankNr'])) {
                $oMsgManager->AddMessage(self::MSG_MANAGER_NAME.'-bankNr', 'ERROR-USER-REQUIRED-FIELD-MISSING');
                $bIsValid = false;
            }
        }

        return $bIsValid;
    }
75462
protected function ValidateGivenUserData($oUser)
    {
        $bIsValid = true;
        $oMessages = TCMSMessageManager::GetInstance();
        $aRequiredFields = array('data_extranet_salutation_id', 'firstname', 'lastname', 'street', 'postalcode', 'city', 'data_country_id');
        foreach ($aRequiredFields as $sField) {
            $sValue = trim($oUser->sqlData[$sField]);

            if (!array_key_exists($sField, $oUser->sqlData) || empty($sValue)) {
                $bIsValid = false;
                $oMessages->AddMessage(TdbDataExtranetUser::MSG_FORM_FIELD.'-'.$sField, 'ERROR-USER-REQUIRED-FIELD-MISSING');
            }
        }

        return $bIsValid;
    }
602710
protected function _getUserGroupFilter($oUser = null)
    {
        $oUser = ($oUser == null) ? $this->getUser() : $oUser;
        $sTable = getViewName('oxactions');
        $sGroupTable = getViewName('oxgroups');

        $aIds = [];
        // checking for current session user which gives additional restrictions for user itself, users group and country
        if ($oUser && count($aGroupIds = $oUser->getUserGroups())) {
            foreach ($aGroupIds as $oGroup) {
                $aIds[] = $oGroup->getId();
            }
        }

        $sGroupSql = count($aIds) ? "EXISTS(select oxobject2action.oxid from oxobject2action where oxobject2action.oxactionid=$sTable.OXID and oxobject2action.oxclass='oxgroups' and oxobject2action.OXOBJECTID in (" . implode(', ', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aIds)) . ") )" : '0';
        return " and (
            select
                if(EXISTS(select 1 from oxobject2action, $sGroupTable where $sGroupTable.oxid=oxobject2action.oxobjectid and oxobject2action.oxactionid=$sTable.OXID and oxobject2action.oxclass='oxgroups' LIMIT 1),
                    $sGroupSql,
                    1)
            ) ";
    }
513029
public function processOrderReference(oxOrder $oOrder, stdClass $oOrderReference)
    {
        $sOrderReferenceStatus = $oOrderReference
            ->OrderReferenceStatus
            ->State;

        //Do re-authorization if order was suspended and now it's opened
        if ($sOrderReferenceStatus === 'Open'
            && (string)$oOrder->getFieldData('oxtransstatus') === 'AMZ-Order-Suspended'
        ) {
            $this->authorize($oOrder);
        } else {
            $oOrder->assign(array('oxtransstatus' => 'AMZ-Order-'.$sOrderReferenceStatus));
            $oOrder->save();
        }
    }
88288
public function AllowDiscountForUser($oUser)
    {
        $bIsValid = $this->AllowDiscountForNonUsers();
        if (!$bIsValid && $oUser) {
            $bIsValid = true;
            $aExtranetGroup = $this->GetFieldDataExtranetGroupWithInverseEmptySelectionLogicIdList();
            if (null === $aExtranetGroup) {
                $bIsValid = false;
            }
            if (true === $bIsValid && count($aExtranetGroup) > 0) {
                $aUserGroups = $oUser->GetMLTIdList('data_extranet_group_mlt');
                $aIntersection = array_intersect($aExtranetGroup, $aUserGroups);
                if (!is_array($aIntersection) || 0 == count($aIntersection)) {
                    $bIsValid = false;
                }
            }

            if ($bIsValid) {
                $aExtranetUser = $this->GetFieldDataExtranetUserWithInverseEmptySelectionLogicIdList();
                if (null === $aExtranetUser || (count($aExtranetUser) > 0 && !in_array($oUser->id, $aExtranetUser))) {
                    $bIsValid = false;
                }
            }
            if ($bIsValid) {
                $aExtranetUserCountry = $this->GetMLTIdList('data_country_mlt');
                if (count($aExtranetUserCountry) > 0) {
                    $oShipping = $oUser->GetShippingAddress();
                    if (!$oShipping || !in_array($oShipping->fieldDataCountryId, $aExtranetUserCountry)) {
                        $bIsValid = false;
                    }
                }
            }
        }

        return $bIsValid;
    }
414044
public function getBasketBundleDiscounts($oBasket, $oUser = null)
    {
        $aList = [];
        $aDiscList = $this->_getList($oUser)->getArray();
        /** @var \OxidEsales\Eshop\Application\Model\Discount $oDiscount */
        foreach ($aDiscList as $oDiscount) {
            if ($oDiscount->isForBundleBasket($oBasket)) {
                $aList[$oDiscount->getId()] = $oDiscount;
            }
        }

        return $aList;
    }
1105217
protected function _isAvailableInOtherOrder($oUser)
    {
        $oSeries = $this->getSerie();
        if (!$oSeries->oxvoucherseries__oxallowuseanother->value) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sSelect = 'select count(*) from ' . $this->getViewName() . ' where oxuserid = ' . $oDb->quote($oUser->oxuser__oxid->value) . ' and ';
            $sSelect .= 'oxvoucherserieid = ' . $oDb->quote($this->oxvouchers__oxvoucherserieid->value) . ' and ';
            $sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ';

            if ($oDb->getOne($sSelect)) {
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
                $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
                $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
                throw $oEx;
            }
        }

        return true;
    }