Package com.akraml.satim.http
Interface SatimHttpClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractHttpClient
HTTP client interface for communicating with the Satim API.
Implementations handle the actual HTTP requests to the payment gateway. Multiple transport options are available (OkHttp, Apache HttpClient, etc.).
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases resources held by this client.@NotNull CompletableFuture<com.google.gson.JsonObject> Performs a GET request.default @NotNull StringReturns the base URL based on current mode.@NotNull StringReturns the API password.@NotNull StringReturns the merchant terminal ID.@NotNull StringReturns the API username.booleanReturns whether test mode is enabled.@NotNull CompletableFuture<com.google.gson.JsonObject> Performs a POST request.default SatimHttpClientself()@NotNull SatimHttpClientwithTestMode(boolean testMode) Enables or disables test mode.
-
Field Details
-
USER_AGENT
- See Also:
-
-
Method Details
-
getUsername
Returns the API username. -
getPassword
Returns the API password. -
getTerminalId
Returns the merchant terminal ID. -
isTestMode
boolean isTestMode()Returns whether test mode is enabled. -
withTestMode
Enables or disables test mode.- Parameters:
testMode-truefor sandbox,falsefor production- Returns:
- this client for method chaining
-
getBaseUrl
Returns the base URL based on current mode. -
get
@NotNull @NotNull CompletableFuture<com.google.gson.JsonObject> get(@NotNull @NotNull String endpoint, @Nullable @Nullable com.google.gson.JsonObject params) Performs a GET request.- Parameters:
endpoint- the API endpointparams- query parameters, ornull- Returns:
- future containing the JSON response
-
post
@NotNull @NotNull CompletableFuture<com.google.gson.JsonObject> post(@NotNull @NotNull String endpoint, @Nullable @Nullable com.google.gson.JsonObject params) Performs a POST request.- Parameters:
endpoint- the API endpointparams- form parameters, ornull- Returns:
- future containing the JSON response
-
close
void close()Releases resources held by this client.- Specified by:
closein interfaceAutoCloseable
-
self
-