Skip to content

Commit c82aedc

Browse files
authored
Merge pull request #429 from code-payments/fix/give-kin-submit-failure-points
fix(givekin): remove points of failure around exchange rates and CurrencyCode lookup
2 parents a098902 + 4786453 commit c82aedc

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

app/src/main/java/com/getcode/view/main/giveKin/GiveKinSheetViewModel.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,11 @@ class GiveKinSheetViewModel @Inject constructor(
110110
if (checkBalanceLimit() || checkSendLimit()) return null
111111

112112
val amountFiat = uiModel.amountModel.amountDouble
113-
val amountKin = uiModel.amountModel.amountKin
114-
115-
val currencyCode = CurrencyCode
116-
.tryValueOf(uiModel.currencyModel.selectedCurrency?.code) ?: return null
117113

118114
exchange.fetchRatesIfNeeded()
119-
val rate = exchange.rateFor(currencyCode) ?: return null
115+
val rate = exchange.entryRate
120116

121-
return KinAmount.fromFiatAmount(amountKin, amountFiat, rate.fx, currencyCode)
117+
return KinAmount.fromFiatAmount(amountFiat, rate)
122118
}
123119

124120
override fun onAmountChanged(lastPressedBackspace: Boolean) {

0 commit comments

Comments
 (0)