黑名单检查
@param string|array $account
@param string $checkType
@return BaseResponse
@throws Exception\TIMException
773653
public function blackCheck($account, $checkType = Constants::BLACK_CHECK_RESULT_TYPE_BOTH)
    {
        $request = new CheckBlackRequest($this->identifier, $account, $checkType);
        $response = new BaseResponse();
        return $this->client->sendRequest($request, $response);
    }
1185952
public function createAccountWithdrawal(Account $account, Withdrawal $withdrawal, array $params = [])
    {
        $data = $this->mapper->fromWithdrawal($withdrawal);
        $this->postAndMap($account->getResourcePath().'/withdrawals', $data + $params, 'toWithdrawal', $withdrawal);
    }
188380
public function createAccountDeposit(Account $account, Deposit $deposit, array $params = [])
    {
        $data = $this->mapper->fromDeposit($deposit);
        $this->postAndMap($account->getResourcePath().'/deposits', $data + $params, 'toDeposit', $deposit);
    }
1342259
protected function parseAccount($account)
    {
        // Separate the account by it's account and permission list.
        $parts = explode(':', trim($account));

        // We should receive exactly two parts of a permission
        // listing, otherwise we'll return null.
        if (count($parts) === 2) {
            $account = new Account($parts[0]);

            $acl = $this->parseAccessControlList($parts[1]);

            $account->setPermissions($acl);

            return $account;
        }

        return null;
    }
296774
public function create($account = NULL, $params = array()) {
    if(is_string($account)) {
      $json = trim($account);
    } else if(is_array($account)) {
      $json = json_encode($account);
    } else {
      throw new Services_Zencoder_Exception(
        'Account parameters required to create account.');
    }
    return new Services_Zencoder_Account($this->proxy->createData("account", $json, $params));
  }
611651
protected function setAccount($account)
	{
		if (empty($account))
		{
			throw new \InvalidArgumentException("Label can't contain empty strings");
		}

		$this->label .= str_replace('%40', '@', rawurlencode($account));
	}
883879
public function userCanCreateInAnySite(AccountInterface $account, $type)
    {
        // Check for global contribs
        if ($this->userCanCreate($account, $type)) {
            return true;
        }

        // Iterate over all sites, check if type creation is possible in context
        $sites = $this->manager->loadOwnSites($account);
        foreach ($sites as $site) {
            if ($this->userCanCreateInSite($account, $type, $site)) {
                return true;
            }
        }

        return false;
    }
1361101
protected function findGroupsForAccountUsingGroupAttribute(Entity\AccountNode $account)
    {
        $findValue = $account->getDn();

        switch ($this->getConfiguration()->getGroupMembersAttributeMappingType()) {
            case Enum\GroupMembersMappingType::USERNAME:
                $findValue = $account->getUsername();
                break;

            case Enum\GroupMembersMappingType::UNIQUE_ID:
                $findValue = $account->getUniqueId();
                break;
        }

        return $this->searchNodes(
            $this->buildFilter(
                new Filter\StringFilter($this->getConfiguration()->getGroupMembersAttribute() . '=' . Filter\AbstractFilter::escapeValue($findValue))
            )
        );
    }
1321950
public function push($amount = null, $number = null, $reference = null, $command = null, $account = null)
    {
        $account = $account ?: $this->account;
        $configs = (new ConfigurationRepository)->useAccount($account);

        if (!$configs->getAccountKey('sandbox')) {
            throw new ErrorException('Cannot simulate a transaction in the live environment.');
        }

        $shortCode = $configs->getAccountKey('lnmo.shortcode');

        $body = [
            'CommandID'     => $command ?: $this->command,
            'Amount'        => $amount ?: $this->amount,
            'Msisdn'        => $number ?: $this->number,
            'ShortCode'     => $shortCode,
            'BillRefNumber' => $reference ?: $this->reference,
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_SIMULATE, $account),
                $account
            );

            return json_decode($response->getBody());
        } catch (RequestException $exception) {
            return json_decode($exception->getResponse()->getBody());
        }
    }
632760
public static function authenticate($account = null)
    {
        $configs = (new ConfigurationRepository)->useAccount($account);
        $key = $configs->getAccountKey('key');
        $secret = $configs->getAccountKey('secret');
        $cacheKey = self::AC_TOKEN . "{$key}{$secret}";

        if ($token = Core::instance()->cache()->get($cacheKey)) {
            return $token;
        }

        try {
            $response = self::makeRequest($key, $secret, $account);
            $body = json_decode($response->getBody());
            self::saveCredentials($cacheKey, $body);

            return $body->access_token;
        } catch (RequestException $exception) {
            $message = $exception->getResponse() ?
               $exception->getResponse()->getReasonPhrase() :
               $exception->getMessage();

            throw self::generateException($message);
        }
    }
246563
public function checkAccess(AccountInterface $account) {
    $cart = $this->cartStorage;

    if (empty($cart) || $cart->isEmpty()) {
      return AccessResult::forbidden('Invalid cart');
    }

    return AccessResult::allowedIfHasPermission($account, 'access checkout');
  }
1273289
public function refresh($account)
    {
        $identity = $this->identity($account);

        return $this->findByIdentity([$identity => $account->$identity]);
    }
1011565
public function setAccountSearchDn($accountSearchDn)
    {
        if ($accountSearchDn === null) {
            $this->accountSearchDn = null;
            return;
        }

        $accountSearchDn = $this->normalizeDn($accountSearchDn, '$accountSearchDn');

        if (Dn::isChildOf($accountSearchDn, $this->baseDn)) {
            $this->accountSearchDn = $accountSearchDn;
        } else {
            throw new Exception\InvalidArgumentException('$accountSearchDn must be a child of baseDn');
        }
        $this->onConfigChanged();
    }
177770
public function getSaldo(SEPAAccount $account)
    {
        $dialog = $this->getDialog();
        $dialog->syncDialog();
        $dialog->initDialog();

        switch ((int) $dialog->getHksalMaxVersion()) {
            case 4:
            case 5:
                $hksalAccount = new Deg(
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    static::DEFAULT_COUNTRY_CODE, $account->getBlz()
                );
                $hksalAccount->addDataElement($account->getAccountNumber());
                $hksalAccount->addDataElement($account->getSubAccount());
                $hksalAccount->addDataElement(static::DEFAULT_COUNTRY_CODE);
                $hksalAccount->addDataElement($account->getBlz());
                break;
            case 6:
                $hksalAccount = new Ktv(
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    new Kik(280, $account->getBlz())
                );
                break;
            case 7:
                $hksalAccount = new Kti(
                    $account->getIban(),
                    $account->getBic(),
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    new Kik(280, $account->getBlz())
                );
                break;
            default:
                throw new \Exception('Unsupported HKSAL version: ' . $dialog->getHksalMaxVersion());
        }

        $message = new Message(
            $this->bankCode,
            $this->username,
            $this->pin,
            $dialog->getSystemId(),
            $dialog->getDialogId(),
            $dialog->getMessageNumber(),
            array(
                new HKSAL($dialog->getHksalMaxVersion(), 3, $hksalAccount, HKSAL::ALL_ACCOUNTS_N)
            ),
            array(
                AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms()
            )
        );

        $response = $dialog->sendMessage($message);
        $response = new GetSaldo($response->rawResponse);

        return $response->getSaldoModel();
    }
777556
public function showAction(Request $request, Account $account)
    {
        $this->get('white_october_breadcrumbs')
            ->addItem('Home',
                $this->get('router')->generate('_homepage')
            )
            ->addItem('Accounts',
                $this->get('router')->generate('phospr_account')
            )
        ;

        $treePath = $this->get('phospr.account_handler')
            ->getTreePath($account)
        ;

        foreach ($treePath as $node) {
            if ($node->getLvl()) {
                $this->get('white_october_breadcrumbs')
                    ->addItem($node->getName(),
                        $this->get('router')->generate('phospr_account_show', array(
                            'path' => $node->getPath()
                    )))
                ;
            }
        }

        $calculatedBalance = 0;

        foreach ($account->getPostings() as $posting) {
            $calculatedBalance += $posting->getAmount();

            $posting->setCalculatedBalance($calculatedBalance);
        }

        $journal = $this->get('phospr.journal_handler')->createJournal();

        $form = $this->createForm(new SimpleJournalType(), $journal);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->get('doctrine')->getManager();

            $amount  = $form->getData()->getCreditAmount();
            $amount -= $form->getData()->getDebitAmount();

            $ph = $this->get('phospr.posting_handler');

            $form->getData()->addPosting($ph->createPosting($account, $amount));
            $form->getData()->addPosting($ph->createPosting(
                $form->getData()->getOffsetAccount(),
                -1*$amount
            ));

            $em->persist($form->getData());
            $em->flush();

            return $this->redirect($this->generateUrl(
                'phospr_account_show', array('path' => $account->getPath())
            ));
        }

        return array(
            'account' => $account,
            'form'    => $form->createView(),
        );
    }
1192110
public function submit($shortCode = null, $confirmationURL = null, $validationURL = null, $onTimeout = null, $account = null)
    {
        $account = $account ?: $this->account;

        if ($onTimeout) {
            $this->onTimeout($onTimeout);
        }

        $body = [
            'ShortCode'       => $shortCode ?: $this->shortCode,
            'ResponseType'    => $onTimeout ?: $this->onTimeout,
            'ConfirmationURL' => $confirmationURL ?: $this->confirmationURL,
            'ValidationURL'   => $validationURL ?: $this->validationURL
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_REGISTER, $account),
                $account
            );

            return \json_decode($response->getBody());
        } catch (RequestException $exception) {
            $message = $exception->getResponse() ?
               $exception->getResponse()->getReasonPhrase() :
               $exception->getMessage();

            throw new Exception($message);
        }
    }
1257739
public function add($account)
    {
        if (is_array($account)) {
            $this->collection[] = new Account($account);
        } elseif (is_object($account) && $account instanceof Account) {
            $this->collection[] = $account;
        }

        return $this;
    }