Skip to content
API for payment with Simpay SMS Premium Service
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main/java/pl/edu/tirex/simpay/api Exchange Apache HttpClient to Java Http Default API Jul 10, 2017
.gitignore
README.md
pom.xml Change java version to 1.7 (instead of 1.8) Jul 10, 2017

README.md

Simpay-Api

Example API usage:

SimpayApi simpayApi = new SimpayApi("key", "secret");
try
{
    SimpayStatusResponse statusResponse = simpayApi.getStatus(1, 7055, "code");
    if (statusResponse.isSuccess())
    {
        //code is valid
        System.out.println("Code is correct");
    }
    else if (statusResponse.isUsed())
    {
        //code is used [405]
        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(statusResponse.getRespond().getTimeUsed()), ZoneId.systemDefault());
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss dd.MM.yyyy");
        System.out.println("Code has already been used: " + formatter.format(dateTime));
    }
    else if (statusResponse.isNotFound())
    {
        //code is not found [404]
        System.out.println("Code not found");
    }
    else
    {
        //some other errors [< 200]
        SimpayError error = statusResponse.getError();
        System.out.println("Undefined error: " + error.getName() + " [" + error.getCode() + "]");
    }
}
catch (IOException e)
{
    //problem with connection
    e.printStackTrace();
}
You can’t perform that action at this time.