-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
130 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea/ | ||
target/ | ||
*.iml | ||
*.iml | ||
dependency-reduced-pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
# Simpay-Api | ||
# Simpay-Api | ||
|
||
Example API usage: | ||
```java | ||
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(); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
src/main/java/pl/edu/tirex/simpay/api/SimpayException.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/pl/edu/tirex/simpay/api/connection/SimpayStatusRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package pl.edu.tirex.simpay.api.connection; | ||
|
||
import pl.edu.tirex.simpay.api.models.SimpayStatusParameters; | ||
|
||
public class SimpayStatusRequest extends SimpayRequest<SimpayStatusParameters> | ||
{ | ||
public SimpayStatusRequest(SimpayStatusParameters parameters) | ||
{ | ||
super(parameters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tirex/simpay/api/models/SimpayStatus.java → ...x/simpay/api/models/SimpayStatusType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package pl.edu.tirex.simpay.api.models; | ||
|
||
public enum SimpayStatus | ||
public enum SimpayStatusType | ||
{ | ||
OK, | ||
USED; | ||
|
This file was deleted.
Oops, something went wrong.