taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

PosDestination.kt (1714B)


      1 /*
      2  * This file is part of GNU Taler
      3  * (C) 2026 Taler Systems S.A.
      4  *
      5  * GNU Taler is free software; you can redistribute it and/or modify it under the
      6  * terms of the GNU General Public License as published by the Free Software
      7  * Foundation; either version 3, or (at your option) any later version.
      8  *
      9  * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
     10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11  * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License along with
     14  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 
     17 package net.taler.merchantpos
     18 
     19 import net.taler.merchantpos.config.ConfigManager
     20 import net.taler.merchantpos.config.InitialOrderScreen
     21 
     22 sealed class PosDestination(
     23     val route: String,
     24 ) {
     25     data object AmountEntry : PosDestination("amount-entry")
     26     data object Order : PosDestination("order")
     27     data object History : PosDestination("history")
     28     data object Settings : PosDestination("settings")
     29     data object Config : PosDestination("config")
     30     data object ConfigFetcher : PosDestination("config-fetcher")
     31     data object ProcessPayment : PosDestination("process-payment")
     32     data object PaymentSuccess : PosDestination("payment-success")
     33     data object Refund : PosDestination("refund")
     34     data object RefundUri : PosDestination("refund-uri")
     35 }
     36 
     37 fun ConfigManager.initialDestination(): PosDestination {
     38     return when (initialOrderScreen) {
     39         InitialOrderScreen.AmountEntry -> PosDestination.AmountEntry
     40         InitialOrderScreen.Inventory -> PosDestination.Order
     41     }
     42 }