aboutsummaryrefslogtreecommitdiff
path: root/merchant-lib/src/main
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2021-08-27 16:43:46 +0200
committerTorsten Grote <t@grobox.de>2021-08-27 16:43:46 +0200
commitb663081104dc38df462c30d7dfc90e435ef3cf6c (patch)
treefce942ffc2eedfdb2a32ef4aa4f838c9b65e25c6 /merchant-lib/src/main
parent06f16a7477b337f07526285b65a7f3003b814d33 (diff)
downloadtaler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.gz
taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.tar.bz2
taler-android-b663081104dc38df462c30d7dfc90e435ef3cf6c.zip
Update libraries and do associated maintenance
Diffstat (limited to 'merchant-lib/src/main')
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt10
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/Response.kt2
2 files changed, 6 insertions, 6 deletions
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt b/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
index a467c41..0d22f91 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
@@ -35,7 +35,7 @@ import net.taler.merchantlib.Response.Companion.response
class MerchantApi(
private val httpClient: HttpClient = getDefaultHttpClient(),
- private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
+ private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO,
) {
suspend fun getConfig(baseUrl: String): Response<ConfigResponse> = withContext(ioDispatcher) {
@@ -46,7 +46,7 @@ class MerchantApi(
suspend fun postOrder(
merchantConfig: MerchantConfig,
- orderRequest: PostOrderRequest
+ orderRequest: PostOrderRequest,
): Response<PostOrderResponse> = withContext(ioDispatcher) {
response {
httpClient.post(merchantConfig.urlFor("private/orders")) {
@@ -59,7 +59,7 @@ class MerchantApi(
suspend fun checkOrder(
merchantConfig: MerchantConfig,
- orderId: String
+ orderId: String,
): Response<CheckPaymentResponse> = withContext(ioDispatcher) {
response {
httpClient.get(merchantConfig.urlFor("private/orders/$orderId")) {
@@ -70,7 +70,7 @@ class MerchantApi(
suspend fun deleteOrder(
merchantConfig: MerchantConfig,
- orderId: String
+ orderId: String,
): Response<Unit> = withContext(ioDispatcher) {
response {
httpClient.delete(merchantConfig.urlFor("private/orders/$orderId")) {
@@ -91,7 +91,7 @@ class MerchantApi(
suspend fun giveRefund(
merchantConfig: MerchantConfig,
orderId: String,
- request: RefundRequest
+ request: RefundRequest,
): Response<RefundResponse> = withContext(ioDispatcher) {
response {
httpClient.post(merchantConfig.urlFor("private/orders/$orderId/refund")) {
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt b/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
index 1b63900..6fd0e37 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/Response.kt
@@ -70,7 +70,7 @@ class Response<out T> private constructor(
}
private suspend fun getExceptionString(e: ResponseException): String {
- val response = e.response ?: return e.toString()
+ val response = e.response
return try {
val error: Error = response.receive()
"Error ${error.code}: ${error.hint}"