@param string $id
@param string $userContact
@param int    $taxSystem
@param string $paymentAddress

@return Check
433324
public static function createBuy($id, $userContact, $taxSystem, $paymentAddress=null)
    {
        return new static($id, $userContact, static::INTENT_BUY, $taxSystem, $paymentAddress);
    }
645548
function searchPayment(filters, offset, limit) {
    var callback = preConditions.getCallback(arguments[arguments.length - 1]);

    showWarning();

    if (!isNaN(offset)) filters.offset = offset;
    if (!isNaN(limit)) filters.limit = limit;

    return paymentModule.oldSearch({
      qs: filters
    }, callback);
  }
362892
public function onContactPostToUser(UserContactEvent $e) 
    {			
        $content = $e->getParam('content');
        $email = $e->getParam('email');
        $siteUrl = $e->getParam('siteurl');

        // something got really wrong if we get here...
        if(null === $email || null === $content) { 
        	return;
        }

        $transport = $this->getServiceLocator()->get('mailer.mail.transport.smtp');
        $message = $this->getServiceLocator()->get('mailer.mail.message.contactconfirm');
        $message->configure(array(
            'to' => $email,
            'message' => $content,
            'siteurl' => $siteUrl,
        	'cdnurl' => $this->getModuleOptions()->getCdnUrl(),
            'siteName' => $this->getModuleOptions()->getSiteName()
        ));
        $transport->send($message);
        
        return $this;
    }
478074
protected function _isInvalidKcp($paymentMethod, $amountValue)
    {
        if ($paymentMethod == Adyen_Payment_Model_Adyen_Hpp::KCP_CREDITCARD
            || $paymentMethod == Adyen_Payment_Model_Adyen_Hpp::KCP_BANKTRANSFER
        ) {
            if ($amountValue == 0) {
                return true;
            }
        }

        return false;
    }
615219
public function checkAccess($user_id, $roles)
    {
        if ($this->isRoot($user_id)) {
            return true;
        }
        if (is_array($roles)) {
            return $this->hasRoles($user_id, $roles);
        } elseif (strpos($roles, '|') !== false) {
            return $this->hasAnyRole($user_id, explode('|', $roles));
        } else {
            return $this->hasRoles($user_id, explode('&', $roles));
        }
    }
628162
protected static function deletePaymentTransactionByIdAsyncWithHttpInfo($payment_transaction_id) 
    {
        $returnType = '';  
        $request = self::deletePaymentTransactionByIdRequest($payment_transaction_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
1027253
private function checkSession($user_id, $user_sid, $touch = false)
    {
        $user_id = (int)$user_id;
        if (!defined('USER_ID')) {
            define('USER_ID', $user_id);
        }

        // Prolong session
        if ($touch) {
            $sessions = new UsersSessionEntityRepository();
            $sessions->setWhereSid($user_sid);
            /**
             * @var UsersSessionEntity $session
             */
            $session = $sessions->getFirstObjectFromCollection();
            if ($session) {
                $session->setTs(NOW);
                $session->save();
            }
        }

        // Check session for current user exists
        $sessions = new UsersSessionEntityRepository();
        $sessions->setWhereUserId($user_id);
        $sessions->setWhereSid($user_sid);
        $sessions->addWhereFieldIsHigherOrEqual('ts', NOW - CFG_SESSION_KEEP_ALIVE_SECONDS);

        return $sessions->hasAnyObjectInCollection();
    }
1201651
public function findAddress($customerId, $addressId)
    {
        $response = $this
            ->createQueryBuilder('c')
            ->select(
                ['c', 'a']
            )
            ->innerJoin('c.addresses', 'a')
            ->where('c.id = :customerId')
            ->andWhere('a.id = :addressId')
            ->setParameter('customerId', $customerId)
            ->setParameter('addressId', $addressId)
            ->setMaxResults(1)
            ->getQuery()
            ->getResult();

        if (!empty($response)) {
            /**
             * @var CustomerInterface $customer
             */
            $customer = reset($response);
            $addresses = $customer->getAddresses();
            if ($addresses) {
                return $addresses->first();
            }
        }

        return false;
    }
117730
public function checkAction(Request $request, $id, $repository)
    {
        $entityIsLocked = false;
        $message = '';

        /** @var LockableEntityInterface $entity */
        $entity = $this->getEntityManager()->getRepository($repository)->find($id);

        try {
            /** @var EntityVersionLockService $entityVersionLockservice */
            $entityVersionLockService = $this->get('kunstmaan_entity.admin_entity.entity_version_lock_service');

            $entityIsLocked = $entityVersionLockService->isEntityLocked($this->getUser(), $entity);

            if ($entityIsLocked) {
                $user = $entityVersionLockService->getUsersWithEntityVersionLock($entity, $this->getUser());
                $message = $this->get('translator')->trans('kuma_admin_list.edit.flash.locked', array('%user%' => implode(', ', $user)));
            }
        } catch (AccessDeniedException $ade) {
        }

        return new JsonResponse(['lock' => $entityIsLocked, 'message' => $message]);
    }
1048739
public function isCountryAllowedForUser($userId, $country)
    {

        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.user = :userId')
            ->setParameter('userId', $userId)
            ->getQuery();

        $data = $query->getResult();
        $return = false;

        foreach ($data as $availableCountries) {
            /** @var \PServerCore\Entity\AvailableCountries $availableCountries */
            if ($availableCountries->getCntry() == $country) {
                $return = true;
                break;
            }
        }
        return $return;
    }
1095431
public function isChildOf($user_id, $fk) {
        if (!$user_id || !$fk) {
            return false;
        }

        try {
            $aros = $this->node(array(
                'model' => USER_MODEL,
                'foreign_key' => $user_id
            ));
        } catch (Exception $e) {
            return false;
        }

        if ($aros) {
            foreach ($aros as $aro) {
                if (is_string($fk) && $aro['RequestObject']['alias'] == $fk) {
                    return true;
                } else if (is_numeric($fk) && $aro['RequestObject']['id'] == $fk) {
                    return true;
                }
            }
        }

        return false;
    }
641318
public function processAddresses($contact, $addresses)
    {
        $getAddressId = function($addressRelation) {
            return $addressRelation->getAddress()->getId();
        };

        $delete = function($addressRelation) use ($contact) {
            $this->removeAddressRelation($contact, $addressRelation);

            return true;
        };

        $update = function($addressRelation, $matchedEntry) use ($contact) {
            $address = $addressRelation->getAddress();
            $result = $this->updateAddress($address, $matchedEntry, $isMain);
            if ($isMain) {
                $this->unsetMain($this->getAddressRelations($contact));
            }
            $addressRelation->setMain($isMain);

            return $result;
        };

        $add = function($addressData) use ($contact) {
            $address = $this->createAddress($addressData, $isMain);
            $this->addAddress($contact, $address, $isMain);

            return true;
        };

        $entities = $this->getAddressRelations($contact);

        $result = $this->processSubEntities(
            $entities,
            $addresses,
            $getAddressId,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        // check if main exists, else take first address
        $this->checkAndSetMainAddress($this->getAddressRelations($contact));

        return $result;
    }
806335
public function isPaymentOther($idSalesOrder, $idSalesOrderItem)
    {
        $statusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
        if (empty($statusLogs)) {
            return false;
        }

        /** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $statusLog */
        $statusLog = array_shift($statusLogs);

        $statuses = [
            PayoneTransactionStatusConstants::TXACTION_PAID,
            PayoneTransactionStatusConstants::TXACTION_APPOINTED,
            PayoneTransactionStatusConstants::TXACTION_UNDERPAID,
        ];
        if (in_array($statusLog->getStatus(), $statuses)) {
            return false;
        }

        $this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);

        return true;
    }
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);
    }
148487
protected function verifyPayment()
    {
        try {

            /** Get the payment ID before session clear **/
            $payment_id = \Session::get('paypal_payment_id');
            /** clear the session payment ID **/
            \Session::forget('paypal_payment_id');
            if (!$this->refId() || !$this->trackingCode()) {
                return false;
            }
            $payment = Payment::get($payment_id, $this->_api_context);
            /** PaymentExecution object includes information necessary **/
            /** to execute a PayPal account payment. **/
            /** The payer_id is added to the request query parameters **/
            /** when the user is redirected from paypal back to your site **/
            $execution = new PaymentExecution();
            $execution->setPayerId($this->refId);
            /**Execute the payment **/
            $result = $payment->execute($execution, $this->_api_context);
            /** dd($result);exit; /** DEBUG RESULT, remove it later **/
            if ($result->getState() == 'approved') {

                /** it's all right **/
                /** Here Write your database logic like that insert record or value in database if you want **/

//            \Session::put('success','Payment success');
                return true;
            }

            return false;
        } catch (\Exception $e) {
            $this->transactionFailed();
            $this->newLog('PaypalException', $e->getMessage());
            throw $e;
        }
    }
953054
protected function mapBillingAddressToPersonalContainer(PersonalContainer $personalContainer, SpyPaymentPayone $paymentEntity)
    {
        $orderEntity = $paymentEntity->getSpySalesOrder();
        $billingAddressEntity = $orderEntity->getBillingAddress();
        $personalContainer->setCountry($billingAddressEntity->getCountry()->getIso2Code());
        $personalContainer->setFirstName($billingAddressEntity->getFirstName());
        $personalContainer->setLastName($billingAddressEntity->getLastName());
        $personalContainer->setSalutation($billingAddressEntity->getSalutation());
        $personalContainer->setCompany($billingAddressEntity->getCompany());
        $personalContainer->setStreet(implode(' ', [$billingAddressEntity->getAddress1(), $billingAddressEntity->getAddress2()]));
        $personalContainer->setAddressAddition($billingAddressEntity->getAddress3());
        $personalContainer->setZip($billingAddressEntity->getZipCode());
        $personalContainer->setCity($billingAddressEntity->getCity());
        $personalContainer->setEmail($billingAddressEntity->getEmail());
        $personalContainer->setTelephoneNumber($billingAddressEntity->getPhone());
        $personalContainer->setLanguage($this->getStandardParameter()->getLanguage());
        $personalContainer->setPersonalId($orderEntity->getCustomerReference());
    }
607265
public function isValidPayment($aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId)
    {
        /** @var OxpsPaymorrowOxPayment|oxPayment $this */

        $blIsValid = (bool) $this->_OxpsPaymorrowOxPayment_isValidPayment_parent(
            $aDynValue, $sShopId, $oUser, $dBasketPrice, $sShipSetId
        );

        $iErrorCode = (int) $this->getPaymentErrorNumber();

        // In case it is Paymorrow payment method unset error code and tell than validation passed.
        if ($this->isPaymorrowActive() and !$blIsValid and ($iErrorCode === 1)) {
            $this->_iPaymentError = null;

            return true;
        }

        return $blIsValid;
    }