taler-android

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

OutgoingState.kt (2693B)


      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.SerialName
     20 import kotlinx.serialization.Serializable
     21 import net.taler.common.Amount
     22 import net.taler.common.Timestamp
     23 import net.taler.wallet.backend.TalerErrorInfo
     24 import net.taler.wallet.exchanges.ExchangeTosStatus
     25 import net.taler.wallet.payment.PaymentInsufficientBalanceDetails
     26 
     27 sealed class OutgoingState
     28 
     29 data object OutgoingIntro : OutgoingState()
     30 
     31 data object OutgoingChecking : OutgoingState()
     32 
     33 data class OutgoingChecked(
     34     val amountRaw: Amount,
     35     val amountEffective: Amount,
     36     val exchangeBaseUrl: String,
     37     val tosStatus: ExchangeTosStatus?,
     38 ) : OutgoingState()
     39 
     40 data object OutgoingCreating : OutgoingState()
     41 
     42 data class OutgoingResponse(
     43     val transactionId: String,
     44 ) : OutgoingState()
     45 
     46 data class OutgoingError(
     47     val info: TalerErrorInfo,
     48 ) : OutgoingState()
     49 
     50 @Serializable
     51 data class CheckPeerPullCreditResponse(
     52     val exchangeBaseUrl: String,
     53     val amountRaw: Amount,
     54     val amountEffective: Amount,
     55 )
     56 
     57 @Serializable
     58 data class CheckPeerPullCreditResult(
     59     val exchangeBaseUrl: String,
     60     val amountRaw: Amount? = null,
     61     val amountEffective: Amount? = null,
     62     val tosStatus: ExchangeTosStatus?,
     63 )
     64 
     65 @Serializable
     66 data class InitiatePeerPullPaymentResponse(
     67     val transactionId: String,
     68 )
     69 
     70 @Serializable
     71 sealed class CheckPeerPushDebitResponse {
     72     @Serializable
     73     @SerialName("ok")
     74     data class CheckPeerPushDebitOkResponse(
     75         val amountRaw: Amount,
     76         val amountEffective: Amount,
     77         val exchangeBaseUrl: String,
     78         val maxExpirationDate: Timestamp,
     79     ) : CheckPeerPushDebitResponse()
     80 
     81     @Serializable
     82     @SerialName("insufficient-balance")
     83     data class CheckPeerPushDebitInsufficientBalanceResponse(
     84         val insufficientBalanceDetails: PaymentInsufficientBalanceDetails,
     85     ) : CheckPeerPushDebitResponse()
     86 }
     87 
     88 @Serializable
     89 data class InitiatePeerPushDebitResponse(
     90     val exchangeBaseUrl: String,
     91     val transactionId: String,
     92 )