Skip to content

Commit a9db181

Browse files
pc-coholicluelista
authored andcommitted
On failed offline checkins, transmit which events and list IDs were selected
1 parent d4e31ce commit a9db181

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libpretixsync/src/main/java/eu/pretix/libpretixsync/check/AsyncCheckProvider.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AsyncCheckProvider(private val config: ConfigStore, private val dataStore:
4040
this.sentry = sentry
4141
}
4242

43-
private fun storeFailedCheckin(eventSlug: String, listId: Long, error_reason: String, raw_barcode: String, type: TicketCheckProvider.CheckInType, position: Long? = null, item: Long? = null, variation: Long? = null, subevent: Long? = null, nonce: String?) {
43+
private fun storeFailedCheckin(eventSlug: String, listId: Long, error_reason: String, raw_barcode: String, type: TicketCheckProvider.CheckInType, position: Long? = null, item: Long? = null, variation: Long? = null, subevent: Long? = null, nonce: String?, eventsAndCheckinLists: Set<Map.Entry<String, Long>>? = null) {
4444
/*
4545
:<json boolean error_reason: One of ``canceled``, ``invalid``, ``unpaid``, ``product``, ``rules``, ``revoked``,
4646
``incomplete``, ``already_redeemed``, ``blocked``, ``invalid_time``, or ``error``. Required.
@@ -71,6 +71,7 @@ class AsyncCheckProvider(private val config: ConfigStore, private val dataStore:
7171
if (item != null && item > 0) jdoc.put("item", item)
7272
if (variation != null && variation > 0) jdoc.put("variation", variation)
7373
if (subevent != null && subevent > 0) jdoc.put("subevent", subevent)
74+
if (eventsAndCheckinLists != null) jdoc.put("events_and_checkin_lists", eventsAndCheckinLists)
7475

7576
val qo = QueuedCall()
7677
val api = PretixApi.fromConfig(config) // todo: uses wrong http client
@@ -278,7 +279,7 @@ class AsyncCheckProvider(private val config: ConfigStore, private val dataStore:
278279
}
279280
if (decoded == null || event == null) {
280281
val firstentry = eventsAndCheckinLists.entries.first()
281-
storeFailedCheckin(firstentry.key, firstentry.value, "invalid", ticketid, type, nonce = nonce)
282+
storeFailedCheckin(firstentry.key, firstentry.value, "invalid", ticketid, type, nonce = nonce, eventsAndCheckinLists=eventsAndCheckinLists.entries)
282283
return TicketCheckProvider.CheckResult(TicketCheckProvider.CheckResult.Type.INVALID, offline = true)
283284
}
284285
val listId = eventsAndCheckinLists[event.slug] ?: return TicketCheckProvider.CheckResult(TicketCheckProvider.CheckResult.Type.ERROR, "Check-in list not set for event", offline = true)

0 commit comments

Comments
 (0)