commit ef29e9adf3ddecc52d139ce36912ba054e63f120 parent 54403a382dd0302559d591d7e66e1f11ed818c34 Author: Marc Stibane <marc@taler.net> Date: Fri, 13 Sep 2024 09:25:16 +0200 PaymentInsufficientBalanceDetails Diffstat:
| M | TalerWallet1/Backend/WalletBackendError.swift | | | 35 | +++++++++++++++++++++++++++++++++++ |
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/TalerWallet1/Backend/WalletBackendError.swift b/TalerWallet1/Backend/WalletBackendError.swift @@ -27,6 +27,39 @@ struct ErrorResponse: Codable { var detail: String? = nil } + +struct InsufficientBalanceDetailsPerExchange: Codable { + var balanceAvailable: Amount + var balanceMaterial: Amount + var balanceExchangeDepositable: Amount + var balanceAgeAcceptable: Amount + var balanceReceiverAcceptable: Amount + var balanceReceiverDepositable: Amount + var maxEffectiveSpendAmount: Amount + /// Exchange doesn't have global fees configured for the relevant year, p2p payments aren't possible. + var missingGlobalFees: Bool +} + +/// Detailed reason for why the wallet's balance is insufficient. +struct PaymentInsufficientBalanceDetails: Codable { + /// Amount requested by the merchant. + var amountRequested: Amount + /// Balance of type "available" (see balance.ts for definition). + var balanceAvailable: Amount + /// Balance of type "material" (see balance.ts for definition). + var balanceMaterial: Amount + /// Balance of type "age-acceptable" (see balance.ts for definition). + var balanceAgeAcceptable: Amount + /// Balance of type "merchant-acceptable" (see balance.ts for definition). + var balanceReceiverAcceptable: Amount + /// Balance of type ... + var balanceReceiverDepositable: Amount + var balanceExchangeDepositable: Amount + /// Maximum effective amount that the wallet can spend, when all fees are paid by the wallet. + var maxEffectiveSpendAmount: Amount + var perExchange: [String : InsufficientBalanceDetailsPerExchange] +} + /// Information supplied by the backend describing an error. struct WalletBackendResponseError: Codable { /// Numeric error code defined defined in the GANA gnu-taler-error-codes registry. @@ -45,6 +78,8 @@ struct WalletBackendResponseError: Codable { /// English diagnostic message that can give details for the instance of the error. var message: String? = nil + + var insufficientBalanceDetails: PaymentInsufficientBalanceDetails? = nil } extension WalletCore {