aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2024-04-05 22:04:23 +0200
committerMarc Stibane <marc@taler.net>2024-04-05 22:04:23 +0200
commita54c48846a3b3a7e0da8100edb4f8d73817ee67c (patch)
tree7aa3a8a5868c586c98dc503f8ed84b2a2e5a6278
parentb0461d9ded3dd826e95f409042de67ae329cce4f (diff)
downloadtaler-ios-a54c48846a3b3a7e0da8100edb4f8d73817ee67c.tar.gz
taler-ios-a54c48846a3b3a7e0da8100edb4f8d73817ee67c.tar.bz2
taler-ios-a54c48846a3b3a7e0da8100edb4f8d73817ee67c.zip
ScopeInfo
-rw-r--r--TalerWallet1/Controllers/Controller.swift23
-rw-r--r--TalerWallet1/Model/Model+Exchange.swift21
-rw-r--r--TalerWallet1/Views/Banking/DepositAmountV.swift2
-rw-r--r--TalerWallet1/Views/Banking/ExchangeSectionView.swift4
-rw-r--r--TalerWallet1/Views/Banking/ManualWithdraw.swift97
-rw-r--r--TalerWallet1/Views/Banking/ManualWithdrawDone.swift2
-rw-r--r--TalerWallet1/Views/HelperViews/LoadingView.swift12
-rw-r--r--TalerWallet1/Views/Peer2peer/P2PReadyV.swift2
-rw-r--r--TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift2
-rw-r--r--TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift2
-rw-r--r--TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift2
-rw-r--r--TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift2
-rw-r--r--TalerWallet1/Views/Sheets/Payment/PaymentDone.swift2
-rw-r--r--TalerWallet1/Views/Sheets/Payment/PaymentView.swift2
-rw-r--r--TalerWallet1/Views/Sheets/Refund/RefundURIView.swift2
-rw-r--r--TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift4
-rw-r--r--TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift3
-rw-r--r--TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift2
-rw-r--r--TalerWallet1/Views/Sheets/WithdrawExchangeV.swift11
19 files changed, 98 insertions, 99 deletions
diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift
index 164bdf5..03c6997 100644
--- a/TalerWallet1/Controllers/Controller.swift
+++ b/TalerWallet1/Controllers/Controller.swift
@@ -101,19 +101,16 @@ class Controller: ObservableObject {
// return nil
// }
- if let scopeInfo = exchange.scopeInfo {
- if let info = hasInfo(for: scopeInfo.currency) {
- return info
- }
- do {
- let info = try await model.getCurrencyInfoM(scope: scopeInfo, delay: 0)
- await setInfo(info)
- return info
- } catch {
- return nil
- }
- } else {
- // TODO: Error "Can't get scopeInfo"
+ let scopeInfo = exchange.scopeInfo
+ if let info = hasInfo(for: scopeInfo.currency) {
+ return info
+ }
+ do {
+ let info = try await model.getCurrencyInfoM(scope: scopeInfo, delay: 0)
+ await setInfo(info)
+ return info
+ } catch {
+ return nil
}
} else {
// TODO: Error "Can't get Exchange Info"
diff --git a/TalerWallet1/Model/Model+Exchange.swift b/TalerWallet1/Model/Model+Exchange.swift
index e51caa8..2eeeec5 100644
--- a/TalerWallet1/Model/Model+Exchange.swift
+++ b/TalerWallet1/Model/Model+Exchange.swift
@@ -2,6 +2,11 @@
* This file is part of GNU Taler, ©2022-24 Taler Systems S.A.
* See LICENSE.md
*/
+/**
+ * Model+Exchange
+ *
+ * @author Marc Stibane
+ */
import Foundation
import taler_swift
import SymLog
@@ -30,13 +35,9 @@ enum ExchangeUpdateStatus: String, Codable {
/// The result from wallet-core's ListExchanges
struct Exchange: Codable, Hashable, Identifiable {
static func < (lhs: Exchange, rhs: Exchange) -> Bool {
- if let leftScope = lhs.scopeInfo {
- if let rightScope = rhs.scopeInfo {
- return leftScope < rightScope
- }
- return true // scopeInfo comes first
- }
- return false
+ let leftScope = lhs.scopeInfo
+ let rightScope = rhs.scopeInfo
+ return leftScope < rightScope
}
static func == (lhs: Exchange, rhs: Exchange) -> Bool {
return lhs.exchangeBaseUrl == rhs.exchangeBaseUrl
@@ -47,13 +48,9 @@ struct Exchange: Codable, Hashable, Identifiable {
}
var exchangeBaseUrl: String
- // deprecated, use scopeInfo
- var currency: String? // TODO: remove this
- var scopeInfo: ScopeInfo?
+ var scopeInfo: ScopeInfo
var paytoUris: [String]
var tosStatus: ExchangeTosStatus
- // deprecated, use EntryStatus + UpdateStatus
-// var exchangeStatus: String?
var exchangeEntryStatus: ExchangeEntryStatus
var exchangeUpdateStatus: ExchangeUpdateStatus
var hasNoFees: Bool?
diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift b/TalerWallet1/Views/Banking/DepositAmountV.swift
index 5358d0a..70c3414 100644
--- a/TalerWallet1/Views/Banking/DepositAmountV.swift
+++ b/TalerWallet1/Views/Banking/DepositAmountV.swift
@@ -75,7 +75,7 @@ struct DepositAmountV: View {
let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
if depositStarted {
- LoadingView(url: nil, message: "Depositing...")
+ LoadingView(scopeInfo: nil, message: "Depositing...")
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done" button to dismiss
diff --git a/TalerWallet1/Views/Banking/ExchangeSectionView.swift b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
index 9447798..f162ced 100644
--- a/TalerWallet1/Views/Banking/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
@@ -44,9 +44,7 @@ struct ExchangeSectionView: View {
// let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
let scopeInfo = exchange.scopeInfo
- let currency = scopeInfo?.currency
- ?? exchange.currency
- ?? String(localized: "Unknown", comment: "unknown currency")
+ let currency = scopeInfo.currency
let currencyInfoOpt = controller.info(for: currency) // might be nil
let currencyName = currencyInfoOpt?.scope.currency ?? currency // might be "Unknown"
Section {
diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Banking/ManualWithdraw.swift
index e63e899..6427475 100644
--- a/TalerWallet1/Views/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Banking/ManualWithdraw.swift
@@ -15,7 +15,8 @@ struct ManualWithdraw: View {
private let symLog = SymLogV(0)
let stack: CallStack
let isSheet: Bool
- let exchangeBaseUrl: String
+// let exchangeBaseUrl: String
+ let scopeInfo: ScopeInfo?
@Binding var exchange: Exchange?
@Binding var amountToTransfer: Amount
@@ -32,11 +33,13 @@ struct ManualWithdraw: View {
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
+ let baseURL = exchange?.exchangeBaseUrl
+ ?? scopeInfo?.url
+ ?? String(localized: "Unknown Payment Service")
+
Group {
if let exchange {
- let currency = exchange.scopeInfo?.currency
- ?? exchange.currency
- ?? String(localized: "Unknown", comment: "unknown currency")
+ let currency = exchange.scopeInfo.currency
let currencyInfo = controller.info(for: currency, controller.currencyTicker)
let currencySymbol = currencyInfo.specs.altUnitNames?[0] ?? currency
let navTitle = String(localized: "NavTitle_Withdraw (currency)",
@@ -103,26 +106,29 @@ struct ManualWithdraw: View {
symLog.log("❗️ \(navTitle) onDisappear")
}
} else {
- LoadingView(url: nil, message: exchangeBaseUrl.trimURL())
+ LoadingView(scopeInfo: scopeInfo, message: "Contacting...")
}
- } .task(id: amountToTransfer.value) { // re-run this whenever amountToTransfer changes
- symLog.log("getExchangeByUrl(\(exchangeBaseUrl))")
- if exchange == nil || exchange?.tosStatus != .accepted {
- if let exc = await model.getExchangeByUrl(url: exchangeBaseUrl) {
- exchange = exc
- } else {
- // TODO: Error "Can't get Exchange / Payment Service Provider Info"
+ }
+ .task(id: amountToTransfer.value) { // re-run this whenever amountToTransfer changes
+ symLog.log("getExchangeByUrl(\(scopeInfo?.url))")
+ if let exchangeBaseUrl = scopeInfo?.url {
+ if exchange == nil || exchange?.tosStatus != .accepted {
+ if let exc = await model.getExchangeByUrl(url: exchangeBaseUrl) {
+ exchange = exc
+ } else {
+ // TODO: Error "Can't get Exchange / Payment Service Provider Info"
+ }
}
- }
- if !amountToTransfer.isZero {
- do {
- let details = try await model.getWithdrawalDetailsForAmountM(exchangeBaseUrl,
- amount: amountToTransfer)
- withdrawalAmountDetails = details
-// agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions)
- } catch { // TODO: error
- symLog.log(error.localizedDescription)
- withdrawalAmountDetails = nil
+ if !amountToTransfer.isZero {
+ do {
+ let details = try await model.getWithdrawalDetailsForAmountM(exchangeBaseUrl,
+ amount: amountToTransfer)
+ withdrawalAmountDetails = details
+// agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions)
+ } catch { // TODO: error
+ symLog.log(error.localizedDescription)
+ withdrawalAmountDetails = nil
+ }
}
}
}
@@ -130,27 +136,28 @@ struct ManualWithdraw: View {
}
// MARK: -
#if DEBUG
-struct ManualWithdraw_Previews: PreviewProvider {
- struct StateContainer : View {
- @State private var amountToPreview = Amount(currency: LONGCURRENCY, cent: 510)
- @State private var exchange: Exchange? = Exchange(exchangeBaseUrl: DEMOEXCHANGE,
- scopeInfo: ScopeInfo(type: .exchange, currency: LONGCURRENCY),
- paytoUris: [],
- tosStatus: .accepted,
- exchangeEntryStatus: .ephemeral,
- exchangeUpdateStatus: .ready,
- ageRestrictionOptions: [])
-
- var body: some View {
- ManualWithdraw(stack: CallStack("Preview"), isSheet: false,
- exchangeBaseUrl: DEMOEXCHANGE,
- exchange: $exchange,
- amountToTransfer: $amountToPreview)
- }
- }
-
- static var previews: some View {
- StateContainer()
- }
-}
+//struct ManualWithdraw_Previews: PreviewProvider {
+// struct StateContainer : View {
+// @State private var amountToPreview = Amount(currency: LONGCURRENCY, cent: 510)
+// @State private var exchange: Exchange? = Exchange(exchangeBaseUrl: DEMOEXCHANGE,
+// scopeInfo: ScopeInfo(type: .exchange, currency: LONGCURRENCY),
+// paytoUris: [],
+// tosStatus: .accepted,
+// exchangeEntryStatus: .ephemeral,
+// exchangeUpdateStatus: .ready,
+// ageRestrictionOptions: [])
+//
+// var body: some View {
+// ManualWithdraw(stack: CallStack("Preview"), isSheet: false,
+// scopeInfo: <#ScopeInfo?#>,
+// exchangeBaseUrl: DEMOEXCHANGE,
+// exchange: $exchange,
+// amountToTransfer: $amountToPreview)
+// }
+// }
+//
+// static var previews: some View {
+// StateContainer()
+// }
+//}
#endif
diff --git a/TalerWallet1/Views/Banking/ManualWithdrawDone.swift b/TalerWallet1/Views/Banking/ManualWithdrawDone.swift
index ca312e6..3689416 100644
--- a/TalerWallet1/Views/Banking/ManualWithdrawDone.swift
+++ b/TalerWallet1/Views/Banking/ManualWithdrawDone.swift
@@ -48,7 +48,7 @@ struct ManualWithdrawDone: View {
.interactiveDismissDisabled() // can only use "Done" button to dismiss
// .navigationTitle(navTitle)
} else {
- LoadingView(url: nil, message: exchange.exchangeBaseUrl.trimURL())
+ LoadingView(scopeInfo: nil, message: exchange.exchangeBaseUrl.trimURL())
}
}.onAppear() {
symLog.log("onAppear")
diff --git a/TalerWallet1/Views/HelperViews/LoadingView.swift b/TalerWallet1/Views/HelperViews/LoadingView.swift
index f796025..0248eaf 100644
--- a/TalerWallet1/Views/HelperViews/LoadingView.swift
+++ b/TalerWallet1/Views/HelperViews/LoadingView.swift
@@ -7,7 +7,7 @@ import SymLog
struct LoadingView: View {
private let symLog = SymLogV(0)
- let url:URL?
+ let scopeInfo: ScopeInfo?
let message: String?
// let backButtonHidden: Bool
@@ -25,11 +25,11 @@ struct LoadingView: View {
rotationEnabled.toggle()
}
Spacer()
- if let url {
- if let urlStr = url.host {
- Text(urlStr)
+ if let scopeInfo {
+ if let urlStr = scopeInfo.url {
+ Text(urlStr.trimURL())
} else {
- Text("Error in URL: \(url)")
+ Text(scopeInfo.currency)
}
Spacer()
}
@@ -51,7 +51,7 @@ struct LoadingView: View {
struct LoadingView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
- LoadingView(url: nil, message: "test message") // , backButtonHidden: true)
+ LoadingView(scopeInfo: nil, message: "test message") // , backButtonHidden: true)
.navigationBarTitleDisplayMode(.automatic)
}.navigationViewStyle(.stack)
}
diff --git a/TalerWallet1/Views/Peer2peer/P2PReadyV.swift b/TalerWallet1/Views/Peer2peer/P2PReadyV.swift
index ee26f83..ade1597 100644
--- a/TalerWallet1/Views/Peer2peer/P2PReadyV.swift
+++ b/TalerWallet1/Views/Peer2peer/P2PReadyV.swift
@@ -56,7 +56,7 @@ struct P2PReadyV: View {
#else
let message: String? = nil
#endif
- LoadingView(url: nil, message: message)
+ LoadingView(scopeInfo: nil, message: message)
}
}
.navigationTitle(navTitle)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
index ede5272..f0ae796 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
@@ -24,7 +24,7 @@ struct P2pAcceptDone: View {
#endif
let navTitle = incoming ? String(localized: "Received P2P", comment: "Title, short")
: String(localized: "Paid P2P", comment: "Title, short")
- LoadingView(url: nil, message: "Accepting...")
+ LoadingView(scopeInfo: nil, message: "Accepting...")
.navigationBarBackButtonHidden(true)
// .interactiveDismissDisabled() // can only use "Done" button to dismiss
.navigationTitle(navTitle)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
index 9dbbd04..ca2e431 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
@@ -70,7 +70,7 @@ struct P2pPayURIView: View {
#else
let message: String? = nil
#endif
- LoadingView(url: nil, message: message)
+ LoadingView(scopeInfo: nil, message: message)
.task { do {
symLog.log(".task")
let ppDebitResponse = try await model.preparePeerPullDebitM(url.absoluteString)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
index ee7bb6c..ee63a98 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -79,7 +79,7 @@ struct P2pReceiveURIView: View {
#else
let message: String? = nil
#endif
- LoadingView(url: nil, message: message)
+ LoadingView(scopeInfo: nil, message: message)
}
}
.onAppear() {
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
index 8073cc2..0f6158f 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
@@ -206,7 +206,7 @@ struct PayTemplateV: View {
DebugViewC.shared.setSheetID(SHEET_PAY_TEMPLATE)
}.navigationTitle(navTitle)
} else {
- LoadingView(url: url, message: nil)
+ LoadingView(scopeInfo: nil, message: url.host)
.task {
symLog.log(".task")
let hasParams = queryURL()
diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentDone.swift b/TalerWallet1/Views/Sheets/Payment/PaymentDone.swift
index 2b7f449..69de946 100644
--- a/TalerWallet1/Views/Sheets/Payment/PaymentDone.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PaymentDone.swift
@@ -44,7 +44,7 @@ struct PaymentDone: View {
.interactiveDismissDisabled() // can only use "Done" button to dismiss
.navigationTitle(navTitle)
} else {
- LoadingView(url: nil, message: "Paying...")
+ LoadingView(scopeInfo: nil, message: "Paying...")
.task {
do {
let confirmPayResult = try await model.confirmPayM(transactionId)
diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
index e8d7634..897bcae 100644
--- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
@@ -92,7 +92,7 @@ struct PaymentView: View {
}
.navigationTitle(navTitle)
} else {
- LoadingView(url: url, message: nil)
+ LoadingView(scopeInfo: nil, message: url.host)
.task { // this runs only once
do { // TODO: cancelled
symLog.log(".task")
diff --git a/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift b/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift
index 593b8c2..284d9e7 100644
--- a/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift
+++ b/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift
@@ -34,7 +34,7 @@ struct RefundURIView: View {
suspendAction: model.suspendTransaction,
resumeAction: model.resumeTransaction)
} else {
- LoadingView(url: url, message: nil)
+ LoadingView(scopeInfo: nil, message: url.host)
.task {
do {
symLog.log(".task")
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift
index b10d0c0..d71f08c 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift
@@ -47,8 +47,8 @@ struct WithdrawAcceptDone: View {
.interactiveDismissDisabled() // can only use "Done" button to dismiss
.navigationTitle(navTitle)
} else {
- LoadingView(url: nil, message: exchangeBaseUrl?.trimURL()
- ?? "Bank Confirmation")
+ LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL()
+ ?? "Bank Confirmation")
}
}.onAppear() {
symLog.log("onAppear")
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
index 1c9ada3..82fbb89 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
@@ -73,7 +73,8 @@ struct WithdrawTOSView: View {
}
}
} else {
- LoadingView(url: nil, message: exchangeBaseUrl?.trimURL() ?? "No exchangeBaseUrl!")
+ LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL()
+ ?? "No exchangeBaseUrl!")
.task {
await loadToS(languageCode)
}
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
index 04685d8..49d45ba 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -84,7 +84,7 @@ struct WithdrawURIView: View {
#else
let message: String? = nil
#endif
- LoadingView(url: nil, message: message)
+ LoadingView(scopeInfo: nil, message: message)
}
}
.onAppear() {
diff --git a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
index 484a62e..3c39c1d 100644
--- a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
@@ -27,13 +27,14 @@ struct WithdrawExchangeV: View {
#endif
Group {
if exchange != nil {
- ManualWithdraw(stack: stack.push(), isSheet: true,
- exchangeBaseUrl: exchange!.exchangeBaseUrl,
+ ManualWithdraw(stack: stack.push(),
+ isSheet: true,
+ scopeInfo: exchange!.scopeInfo,
exchange: $exchange,
amountToTransfer: $amountToTransfer)
} else {
// TODO: Error
- LoadingView(url: url, message: "No exchangeBaseUrl!")
+ LoadingView(scopeInfo: nil, message: "No exchangeBaseUrl!")
}
}
.task {
@@ -49,9 +50,7 @@ struct WithdrawExchangeV: View {
if let amount = withdrawExchange.amount {
amountToTransfer = amount
} else {
- let currency = exc.scopeInfo?.currency
- ?? exc.currency
- ?? String(localized: "Unknown", comment: "unknown currency")
+ let currency = exc.scopeInfo.currency
amountToTransfer.setCurrency(currency)
// is already Amount.zero(currency: "")
}