Final check balance function

@return \Phalcon\Http\Client\Response|string|void
@throws BaseException
490048
final public function balance()
    {

        // check balance
        $response = $this->client()->{$this->config->getRequestMethod()}($this->config->getBalanceUri(),
            $this->config->getProviderConfig());

        // return response
        return $this->getResponse($response);
    }
428183
public function getBasicResponse()
    {
        // Default the basic response
        if ($this->basicResponse === null) {
            $this->basicResponse = function () {
                if (headers_sent()) {
                    throw new RuntimeException('Attempting basic auth after headers have already been sent.');
                }

                header('WWW-Authenticate: Basic');
                header('HTTP/1.0 401 Unauthorized');

                echo 'Invalid credentials.';
                exit;
            };
        }

        $response = $this->basicResponse;

        return $response();
    }
197847
public function run_check() {
		$r = $this->run();

		if ( $r->return_code || !empty( $r->STDERR ) ) {
			throw new \RuntimeException( $r );
		}

		return $r;
	}
850904
public function execute()
    {
        parent::execute();

        $balanceSvc = new HpsGiftCardService($this->service->servicesConfig());
        if ($this->token != null && ($this->token instanceof HpsTokenData)) {
            if ($this->card == null) {
                $this->card = new HpsGiftCard();
            }
            $this->card->tokenValue = $this->token->tokenValue;
        }
        return $balanceSvc->balance(
            $this->card
        );
    }
918439
public function validate()
    {
        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
            $this->_logger->log("Invalid request method", Icepay_Api_Logger::ERROR);
            return false;
        };

        $this->_logger->log(sprintf("Postback: %s", serialize($_POST)), Icepay_Api_Logger::TRANSACTION);

        /* @since version 1.0.2 */
        foreach ($this->getPostbackResponseFields() as $obj => $param) {
            $this->data->$obj = (isset($_POST[$param])) ? $_POST[$param] : "";
        }

        if ($this->isVersionCheck())
            return false;

        if (!Icepay_Parameter_Validation::merchantID($this->data->merchant)) {
            $this->_logger->log("Merchant ID is not numeric: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!Icepay_Parameter_Validation::amount($this->data->amount)) {
            $this->_logger->log("Amount is not numeric: {$this->data->amount}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->_merchantID != $this->data->merchant) {
            $this->_logger->log("Invalid Merchant ID: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!in_array(strtoupper($this->data->status), array(
                    Icepay_StatusCode::OPEN,
                    Icepay_StatusCode::AUTHORIZED,
                    Icepay_StatusCode::SUCCESS,
                    Icepay_StatusCode::ERROR,
                    Icepay_StatusCode::REFUND,
                    Icepay_StatusCode::CHARGEBACK
                ))) {
            $this->_logger->log("Unknown status: {$this->data->status}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->generateChecksumForPostback() != $this->data->checksum) {
            $this->_logger->log("Checksum does not match", Icepay_Api_Logger::ERROR);
            return false;
        }
        return true;
    }
228821
public function check() 
    {
        $url = self::HOST . self::CHECK;
        $params = $this->get_default_params();
        $result = $this->request($url, $params);

        return $result;
    }
165031
public function check()
    {
        foreach($this->classes as $class) {
            $ret = $this->_check($class);
            if ($ret === false) {
                echo 'Database need migration' . PHP_EOL;
                break;
            }
        }

        return $ret;
    }
209764
public function getBalance()
    {
        $resource = 'campaigns/' . $this->campaignId . '/balance.json';

        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));

        $decodedResponseBody = $this->getDecodedBody($response->getBody());

        $getBalanceResponse = new Models\GetBalanceResponse($decodedResponseBody);
        return $getBalanceResponse->getBalance();
    }
173873
private function _DoBaseValidation()
	{
		$lenfunction = $this->_phreezer->DataAdapter->ConnectionSetting->Multibyte
			? 'mb_strlen'
			: 'strlen';
		
		if (!$this->_base_validation_complete)
		{
			$fms = $this->_phreezer->GetFieldMaps(get_class($this));

			foreach ($fms as $fm)
			{
				$prop = $fm->PropertyName;

				if ($fm->FieldType == FM_TYPE_DECIMAL && is_numeric($fm->FieldSize)) {
					// decimal validation needs to be treated differently than whole numbers
					
					$values = explode('.',(string)$this->$prop,2);
					$right = count($values) > 1 ? strlen((string)$values[1]) : 0;
					$left = strlen((string)$values[0]);

					$limits = explode('.',(string)$fm->FieldSize,2);
					$limitRight = count($limits) > 1 ? (int)$limits[1] : 0;
					$limitLeft = (int)$limits[0] - $limitRight;
					
					if ($left > $limitLeft || $right > $limitRight) {
						$this->AddValidationError($prop,"$prop exceeds the maximum length of " . $fm->FieldSize . "");
					}
					
				}
				elseif (is_numeric($fm->FieldSize) && ($lenfunction($this->$prop) > $fm->FieldSize))
				{
					$this->AddValidationError($prop,"$prop exceeds the maximum length of " . $fm->FieldSize . "");
				}

				if ($this->$prop == "" && ($fm->DefaultValue || $fm->IsAutoInsert) )
				{
					// these fields are auto-populated so we don't need to validate them unless
					// a specific value was provided
				}
				else
				{
					switch ($fm->FieldType)
					{
						case FM_TYPE_INT:
						case FM_TYPE_SMALLINT:
						case FM_TYPE_TINYINT:
						case FM_TYPE_MEDIUMINT:
						case FM_TYPE_BIGINT:
						case FM_TYPE_DECIMAL:
							if (!is_numeric($this->$prop))
							{
								$this->AddValidationError($prop,"$prop is not a valid number");
							}
							break;
						case FM_TYPE_DATE:
						case FM_TYPE_DATETIME:
							if (strtotime($this->$prop) === '')
							{
								$this->AddValidationError($prop,"$prop is not a valid date/time value.");
							}
							break;
						case FM_TYPE_ENUM:
							if ( !in_array($this->$prop, $fm->GetEnumValues()) )
							{
								$this->AddValidationError($prop,"$prop is not valid value. Allowed values: " . implode(', ',$fm->GetEnumValues()) );
							}
							break;
						default:
							break;
					}
				}
			}
		}

		// print_r($this->_val_errors);

		$this->_base_validation_complete = true;
	}
137792
public function sync()
    {
        // @todo Add support for filtering.
        $query = [
            'clientId' => $this->clientId,
            'form' => 'cjson',
            'schema' => '1.10',
        ];

        if ($this->authenticatedClient->hasAccount()) {
            $query['account'] = (string) $this->authenticatedClient->getAccount()->getMpxId();
        }

        return $this->authenticatedClient->requestAsync('GET', $this->uri, [
            'query' => $query,
        ])->then(function (ResponseInterface $response) {
            $data = \GuzzleHttp\json_decode($response->getBody(), true);

            return $data[0]['id'];
        });
    }
1223398
public function validate()
    {
        if ($this->_amount === null) {
            $this->setValidationError('Payment amount not specified');
            return false;
        }

        $value = $this->_amount->getValue();
        if (empty($value) || $value <= 0.0) {
            $this->setValidationError('Invalid payment amount value: '.$value);
            return false;
        }

        if ($this->_receipt !== null && $this->_receipt->notEmpty()) {
            $email = $this->_receipt->getEmail();
            $phone = $this->_receipt->getPhone();
            if (empty($email) && empty($phone)) {
                $this->setValidationError('Both email and phone values are empty in receipt');
                return false;
            }
        }

        return true;
    }
707552
public function performCheck()
    {
        $result = new PreconditionResult();
        if (version_compare(PHP_VERSION, static::MINIMUM_PHP_VERSION) < 0) {
            $result
                ->setState(PreconditionResult::STATE_FAILED)
                ->setMessage(t('concrete5 requires at least PHP version %1$s (you are running PHP version %2$s).', static::MINIMUM_PHP_VERSION, PHP_VERSION))
            ;
        } else {
            $result->setMessage(t('you are running PHP version %s', PHP_VERSION));
        }

        return $result;
    }
757213
protected function verifyPayment()
	{
		$fields = array(
			'terminalId' => $this->config->get('gateway.mellat.terminalId'),
			'userName' => $this->config->get('gateway.mellat.username'),
			'userPassword' => $this->config->get('gateway.mellat.password'),
			'orderId' => $this->transactionId(),
			'saleOrderId' => $this->transactionId(),
			'saleReferenceId' => $this->trackingCode()
		);

		try {
			$soap = new SoapClient($this->serverUrl);
			$response = $soap->bpVerifyRequest($fields);

		} catch (\SoapFault $e) {
			$this->transactionFailed();
			$this->newLog('SoapFault', $e->getMessage());
			throw $e;
		}

		if ($response->return != '0') {
			$this->transactionFailed();
			$this->newLog($response->return, MellatException::$errors[$response->return]);
			throw new MellatException($response->return);
		}

		return true;
	}
600395
protected function verifyPayment()
    {
        try {
            $soap = new SoapClient($this->serverUrl);
            $response = $soap->verification(
                $this->config->get('gateway.jahanpay.api'),
                $this->amount,
                $this->refId
            );

        } catch(\SoapFault $e) {
            $this->transactionFailed();
            $this->newLog('SoapFault', $e->getMessage());
            throw $e;
        }

        if (intval($response) == 1) {
            $this->transactionSucceed();
            $this->newLog($response, Enum::TRANSACTION_SUCCEED_TEXT);
            return true;
        }

        $this->transactionFailed();
        $this->newLog($response, JahanPayException::$errors[$response]);
        throw new JahanPayException($response);
    }
458984
public function check()
	{
		$this->checked	= TRUE;
		$this->methods	= array();
		$matches		= array();
		$content		= FS_File_Reader::load( $this->fileName );
		if( preg_match( "@class @i", $content ) )
			if( preg_match_all( "@\tfunction (& *)?([a-z][a-z0-9]+)@i", $content, $matches ) )
				foreach( $matches[2] as $match )
					$this->methods[]	= $match;
		return empty( $this->methods );
	}
470601
public function getBalance()
    {
        $request = $this->apiRequestFactory->createRequest('GET', $this->getBaseUri() . '/profile/balance');
        $response = $this->httpClient->sendRequest($request);

        $result = $this->getResult($response, Balance::class);

        if ($result instanceof Balance) {
            return $result->getBalance();
        }

        return $result;
    }
985570
def get_balance(self):
        
        
        response = util.call_api("merchant/{0}/balance".format(self.identifier), self.build_basic_request(),
                                 base_url=self.service_url)
        json_response = json.loads(response)
        self.parse_error(json_response)
        return json_response.get('balance')