taler-android

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

IncomingState.kt (2269B)


      1 /*
      2  * This file is part of GNU Taler
      3  * (C) 2022 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.wallet.peer
     18 
     19 import kotlinx.serialization.Serializable
     20 import net.taler.common.Amount
     21 import net.taler.wallet.backend.TalerErrorInfo
     22 
     23 sealed class IncomingState
     24 
     25 data object IncomingChecking : IncomingState()
     26 
     27 open class IncomingTerms(
     28     open val amountRaw: Amount,
     29     open val amountEffective: Amount,
     30     open val contractTerms: PeerContractTerms,
     31     open val id: String,
     32 ) : IncomingState()
     33 
     34 class IncomingTosReview(
     35     override val amountRaw: Amount,
     36     override val amountEffective: Amount,
     37     override val contractTerms: PeerContractTerms,
     38     val exchangeBaseUrl: String,
     39     override val id: String,
     40 ) : IncomingTerms(
     41     amountRaw = amountRaw,
     42     amountEffective = amountEffective,
     43     contractTerms = contractTerms,
     44     id = id,
     45 )
     46 
     47 class IncomingAccepting(s: IncomingTerms) :
     48     IncomingTerms(s.amountRaw, s.amountEffective, s.contractTerms, s.id)
     49 
     50 data class IncomingAccepted(
     51     val transactionId: String,
     52 ) : IncomingState()
     53 
     54 data class IncomingError(
     55     val info: TalerErrorInfo,
     56 ) : IncomingState()
     57 
     58 @Serializable
     59 data class PeerContractTerms(
     60     val summary: String,
     61     val amount: Amount,
     62 )
     63 
     64 @Serializable
     65 data class PreparePeerPullDebitResponse(
     66     val contractTerms: PeerContractTerms,
     67     val amountRaw: Amount,
     68     val amountEffective: Amount,
     69     val transactionId: String,
     70 )
     71 
     72 @Serializable
     73 data class PreparePeerPushCreditResponse(
     74     val contractTerms: PeerContractTerms,
     75     val amountRaw: Amount,
     76     val amountEffective: Amount,
     77     val transactionId: String,
     78     val exchangeBaseUrl: String,
     79 )