aboutsummaryrefslogtreecommitdiff
path: root/merchant-lib/src/main
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-08-03 13:31:26 -0300
committerTorsten Grote <t@grobox.de>2020-08-03 13:31:26 -0300
commit5b1163311192e9adf15ef3d626c72812e638f90c (patch)
tree5d3a7c7c9aa2153507f8328c81e4d0f7d8cf78c9 /merchant-lib/src/main
parent89f8c6a6d590ab3a702f80fbe50c2e9dd67d4bf8 (diff)
downloadtaler-android-5b1163311192e9adf15ef3d626c72812e638f90c.tar.gz
taler-android-5b1163311192e9adf15ef3d626c72812e638f90c.tar.bz2
taler-android-5b1163311192e9adf15ef3d626c72812e638f90c.zip
[pos] improve payment processing
- cancel orders that have been abandoned and will not be paid - show unpaid orders in history (in case one makes it through) - set deadlines when creating orders in case it helps with enabling refunds
Diffstat (limited to 'merchant-lib/src/main')
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt5
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/OrderHistory.kt3
-rw-r--r--merchant-lib/src/main/java/net/taler/merchantlib/PostOrderRequest.kt6
3 files changed, 9 insertions, 5 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 db37586..96892f5 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/MerchantApi.kt
@@ -29,7 +29,6 @@ import io.ktor.http.HttpHeaders.Authorization
import io.ktor.http.contentType
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration
-import net.taler.common.ContractTerms
import net.taler.merchantlib.Response.Companion.response
class MerchantApi(private val httpClient: HttpClient) {
@@ -40,12 +39,12 @@ class MerchantApi(private val httpClient: HttpClient) {
suspend fun postOrder(
merchantConfig: MerchantConfig,
- contractTerms: ContractTerms
+ orderRequest: PostOrderRequest
): Response<PostOrderResponse> = response {
httpClient.post(merchantConfig.urlFor("private/orders")) {
header(Authorization, "ApiKey ${merchantConfig.apiKey}")
contentType(Json)
- body = PostOrderRequest(contractTerms)
+ body = orderRequest
} as PostOrderResponse
}
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/OrderHistory.kt b/merchant-lib/src/main/java/net/taler/merchantlib/OrderHistory.kt
index 718bde5..b1ff5b1 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/OrderHistory.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/OrderHistory.kt
@@ -41,6 +41,9 @@ data class OrderHistoryEntry(
// the summary of the order
val summary: String,
+ // if the order has been paid
+ val paid: Boolean,
+
// whether some part of the order is refundable
val refundable: Boolean
)
diff --git a/merchant-lib/src/main/java/net/taler/merchantlib/PostOrderRequest.kt b/merchant-lib/src/main/java/net/taler/merchantlib/PostOrderRequest.kt
index 4854a80..783dd19 100644
--- a/merchant-lib/src/main/java/net/taler/merchantlib/PostOrderRequest.kt
+++ b/merchant-lib/src/main/java/net/taler/merchantlib/PostOrderRequest.kt
@@ -25,12 +25,14 @@ import kotlinx.serialization.Serializer
import kotlinx.serialization.json.JsonInput
import kotlinx.serialization.json.JsonObject
import net.taler.common.ContractTerms
+import net.taler.common.Duration
@Serializable
data class PostOrderRequest(
@SerialName("order")
- val contractTerms: ContractTerms
-
+ val contractTerms: ContractTerms,
+ @SerialName("refund_delay")
+ val refundDelay: Duration? = null
)
@Serializable