diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift index c0cb7a66..d1ec1304 100644 --- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift +++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift @@ -45,6 +45,13 @@ struct WithdrawAcceptView: View { scope: nil) { // TODO: scope withdrawalDetails = details } + // The exchange entry this view was handed may have been read before wallet-core + // had contacted that payment service for the first time: its currency is then + // "UNKNOWN" and its tosStatus "missing-tos". Asking for the withdrawal details + // makes wallet-core fetch it, so read the entry again now that it is known. + if exchange.exchangeUpdateStatus != .ready { + await reloadExchange() + } // agePicker.setAges(ages: details?.ageRestrictionOptions) } else { // TODO: error symLog.log("no exchangeBaseUrl or no exchange") @@ -60,8 +67,13 @@ struct WithdrawAcceptView: View { ZStack { // there is only _one_ Z item ever - use ZStack to ensure .task is run only _once_ when exchange is switched if let exchange2 = exchange { // there should always be an exchange... VStack { + // "no ToS to accept" can only be believed once the payment service has been + // fetched; before that, missing-tos merely means "not known yet", and treating + // it as accepted skipped the terms and offered "Confirm Withdrawal" at once + let isFetched = exchange2.exchangeUpdateStatus == .ready + || exchange2.exchangeUpdateStatus == .readyUpdate let tosAccepted = exchange2.tosStatus == .accepted - || exchange2.tosStatus == .missingTos // no ToS to accept + || (exchange2.tosStatus == .missingTos && isFetched) // no ToS to accept if !tosAccepted { ToSButtonView(stack: stack.push(), exchangeBaseUrl: exchange2.exchangeBaseUrl,