Permission to query balance through the ACCOUNTS endpoint.

@param bool $retrieve_financial_info

@throws \Moip\Exceptions\InvalidArgumentException

@return \Moip\Auth\Connect $this
5898
public function setRetrieveFinancialInfo($retrieve_financial_info)
    {
        if (!is_bool($retrieve_financial_info)) {
            throw new InvalidArgumentException('$retrieve_financial_info deve ser boolean, foi passado '.gettype($retrieve_financial_info));
        }

        if ($retrieve_financial_info === true) {
            $this->setScope(self::RETRIEVE_FINANCIAL_INFO);
        }

        return $this;
    }
349499
public function balance($auth_token, $report_type_uid, $detailed = false)
    {
        return new B2BResponse($this->client->apiRequest(
            'get',
            sprintf('user/balance/%s', urlencode($report_type_uid)),
            [
                '_detailed' => (bool) $detailed ? 'true' : 'false',
            ],
            [
                'Authorization' => (string) $auth_token,
            ],
            $this->client->isTest() ? new Response(
                200,
                $this->getTestingResponseHeaders(),
                str_replace(
                    [
                        '%domain%',
                        '%default_report_type_uid%',
                    ],
                    [
                        AuthToken::extractDomainFromToken($auth_token),
                        $report_type_uid,
                    ],
                    file_get_contents(__DIR__ . '/balance.json')
                )
            ) : null
        ));
    }
1233907
public function request($callbackURL, $Amount, $Description, $Email = null, $Mobile = null, $additionalData = null)
    {
        $inputs = [
            'MerchantID'  => $this->merchantID,
            'CallbackURL' => $callbackURL,
            'Amount'      => $Amount,
            'Description' => $Description,
        ];
        if (!is_null($Email)) {
            $inputs['Email'] = $Email;
        }
        if (!is_null($Mobile)) {
            $inputs['Mobile'] = $Mobile;
        }
        if (!is_null($additionalData)) {
            $inputs['AdditionalData'] = $additionalData;
            $results = $this->driver->requestWithExtra($inputs);
        } else {
            $results = $this->driver->request($inputs);
        }

        if (empty($results['Authority'])) {
            $results['Authority'] = null;
        }
        $this->Authority = $results['Authority'];

        return $results;
    }
180918
protected function userPayment()
	{
		$this->authority = Input::get('Authority');
		$status = Input::get('Status');

		if ($status == 'OK') {
			return true;
		}

		$this->transactionFailed();
		$this->newLog(-22, ZarinpalException::$errors[-22]);
		throw new ZarinpalException(-22);
	}
1124405
public function setRequestLocation(bool $requestLocation = null): self
    {
        $this->requestLocation = $requestLocation;

        if ($requestLocation === true) {
            $this->requestContact = null;
        }

        return $this;
    }
773955
public static AccountInfo adaptAccountInfo(
      MercadoBitcoinBaseTradeApiResult<MercadoBitcoinAccountInfo> accountInfo, String userName) {

    // Adapt to XChange DTOs
    Balance brlBalance = new Balance(Currency.BRL, accountInfo.getTheReturn().getFunds().getBrl());
    Balance btcBalance = new Balance(Currency.BTC, accountInfo.getTheReturn().getFunds().getBtc());
    Balance ltcBalance = new Balance(Currency.LTC, accountInfo.getTheReturn().getFunds().getLtc());

    return new AccountInfo(userName, new Wallet(brlBalance, btcBalance, ltcBalance));
  }
53046
public function getAccountInfo($reset = false)
    {
        if (!isset($this->accountInfo) || $reset) {
            $url = $this->accountsEndpoint . 'me';
            try {
                $this->accountInfo = $this->simpleGet($url);
            }
            catch (BadResponseException $e) {
                throw ApiResponseException::create($e->getRequest(), $e->getResponse(), $e->getPrevious());
            }
        }

        return $this->accountInfo;
    }
283665
public function setConnect($model, $relation_name = null, $group_by = null)
    {
        $this->connect = collect();
        $this->connect->model = $model;
        $this->connect->relation_name = $relation_name;
        $this->connect->group_by = $group_by;

        return $this;
    }
89734
protected function acquireAccessToken()
    {
        $accessToken = null;

        if ($this->refreshTokenGrantType) {
            // Get an access token using the stored refresh token.
            if ($this->refreshToken) {
                $this->refreshTokenGrantType->setRefreshToken($this->refreshToken->getToken());
            }
            if ($this->refreshTokenGrantType->hasRefreshToken()) {
                $accessToken = $this->refreshTokenGrantType->getToken();
            }
        }

        if (!$accessToken && $this->grantType) {
            // Get a new access token.
            $accessToken = $this->grantType->getToken();
        }

        return $accessToken ?: null;
    }
990171
public function acquireAccessToken()
  {
    $request = new Request(
        self::METADATA_AUTH_URL,
        'GET',
        array(
          'Metadata-Flavor' => 'Google'
        )
    );
    $request->disableGzip();
    $response = $this->client->getIo()->makeRequest($request);

    if ($response->getResponseHttpCode() == 200) {
      $this->setAccessToken($response->getResponseBody());
      $this->token['created'] = time();
      return $this->getAccessToken();
    } else {
      throw new Exception(
          sprintf(
              "Error fetching service account access token, message: '%s'",
              $response->getResponseBody()
          ),
          $response->getResponseHttpCode()
      );
    }
  }
593488
private function loadDatabaseConnection($is_query_log_enabled = false)
    {
        /**
         * Setup for 'illuminate/database'
         */
        $capsule = new Manager;
        $capsule->addConnection($this->default_definitions['settings.db']);
        $capsule->setAsGlobal();
        $capsule->bootEloquent();

        $connection = $capsule::connection();

        if ($is_query_log_enabled)
        {
            $connection->enableQueryLog();
        }
    }
53617
public function refresh()
    {
        $query = [
            'appid' => $this->appid,
            'grant_type' => 'refresh_token',
            'refresh_token' => $this['refresh_token'],
        ];

        $response = Http::request('GET', static::REFRESH)
            ->withQuery($query)
            ->send();

        if (0 != $response['errcode']) {
            throw new \Exception($response['errmsg'], $response['errcode']);
        }

        // update new access_token from ArrayCollection
        parent::__construct($response->toArray());

        return $this;
    }
821880
public function setAuth($client_token, $client_secret, $access_token)
    {
        $this->auth = array(
            'client_token' => trim($client_token),
            'client_secret' => trim($client_secret),
            'access_token' => trim($access_token),
        );
        return $this;
    }
801794
def get_balance(self, acc_id, site='Pro'):
        
        assert site in ['Pro', 'HADAX']
        path = f'/v1{"/" if site == "Pro" else "/hadax/"}account/accounts/{acc_id}/balance'
        # params = {'account-id': self.acct_id}
        params = {}

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_get(params, path))

            return handle

        return _wrapper
323397
static public function askForUserConfirmation(bool $throwException = false): bool {
		echo "\n######################################################\n\n";
		echo "Are you sure that you want to import data to the following instance?! \n\n ";
		echo "Type 'yes' to continue! \n\n";
		echo self::get('sparqlUrl') . "\n";
		echo self::get('fedoraApiUrl') . "\n";
		$handle = fopen ("php://stdin","r");
		$line = trim(fgets($handle));
		fclose($handle);
		if ($line !== 'yes' && $throwException) {
			throw new RuntimeException('Configuration revoked by the user');
		}
		return $line === 'yes';
	}
628243
public function issueAccessToken()
    {
        $grantType = $this->getRequest()->request->get('grant_type');
        if (is_null($grantType)) {
            throw new Exception\InvalidRequestException('grant_type');
        }

        // Ensure grant type is one that is recognised and is enabled
        if (!in_array($grantType, array_keys($this->grantTypes))) {
            throw new Exception\UnsupportedGrantTypeException($grantType);
        }

        // Complete the flow
        return $this->getGrantType($grantType)->completeFlow();
    }
347590
public function useAccount($account = null)
    {
        $account = $account ?: Core::instance()->getConfig('default');

        if (!Core::instance()->getConfig("accounts.{$account}")) {
            throw new Exception('Invalid account selected');
        }

        $this->account = $account;

        return $this;
    }