Computing > 1 - Understanding the platform > Credit and Credit limit

1.3 Credit and Credit limit

Each cloud service account has a credit which allows you to create and buy various available objects and services.  The credit is unique and can be spent on all the datacenters.

Using the WsEndUser GetCredit method you can check the credit associated with the account specified during authentication. In addition to the remaining credit, the GetCredit method lets you display the credit limit value accorded. In the case of a credit limit, the remaining credit can be negative up to a maximum of the value of the credit limit (for example, with a credit limit of 1.000 Euro, the credit may reach a minimum value of -1.000 euro). In the case of a zero credit limit, the minimum credit permitted is 0 Euro.

Here is an example of how the user's associated credit is retrieved
//IWsEndUser.GetCredit Method (c# .NET)
private static Decimal[] GetUserCredit(WsEndUserClient client)
{
    //the remaining credit and the credit limit
    Decimal[] userCredit = new Decimal[2];

    try
    {
        //calls the GetCredit method, 
        //getting a WsResultOfCredit object  
        WsResultOfCredit result = client.GetCredit();

        if (result.Success)
        {
            Credit credit = client.GetCredit().Value;
            //the remaining credit
            userCredit[0] = credit.Value;
            //the credit limit
            userCredit[1] = credit.OverdraftLimit;
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        //relaunches the generic error 
        throw new ApplicationException(ex.Message);
    }

    return userCredit;
}
//IWsEndUser.GetCredit Method (JAVA)
private static BigDecimal[] GetUserCredit(IWsEndUser client)
{
    //the remaining credit and the credit limit
    BigDecimal[] userCredit = new BigDecimal[2];

    try
    {
        //calls the GetCredit method, 
        //getting a WsResultOfCredit object  
        WsResultOfCredit result = client.getCredit();

        if (result.isSuccess())
        {
            Credit credit = client.getCredit().getValue();
            //the remaining credit
            userCredit[0] = credit.getValue();
            //the credit limit
            userCredit[1] = credit.getOverdraftLimit();
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //prints the generic error 
        System.out.println(ex);
    }

    return userCredit;
}

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl

API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl