refactor: inline recordPaymentSuccess()
This commit is contained in:
@@ -183,7 +183,15 @@ class SendViewModel(
|
|||||||
val result = payer.pay(rawRes, lnurl, amountMsat, comment)
|
val result = payer.pay(rawRes, lnurl, amountMsat, comment)
|
||||||
|
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
recordPaymentSuccess(result.getOrThrow(), amountMsat, strings = strings)
|
handlePaymentResult(
|
||||||
|
paymentHash = result.getOrThrow(),
|
||||||
|
amountSats = amountMsat / WalletConstants.MSAT_PER_SAT,
|
||||||
|
bolt11 = null,
|
||||||
|
memo = null,
|
||||||
|
pubkey = null,
|
||||||
|
alias = null,
|
||||||
|
strings = strings,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
_sendState.value = SendState.Error(
|
_sendState.value = SendState.Error(
|
||||||
parseApiError(
|
parseApiError(
|
||||||
@@ -478,27 +486,6 @@ class SendViewModel(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun recordPaymentSuccess(
|
|
||||||
paymentHash : String,
|
|
||||||
amountMsat : Long,
|
|
||||||
bolt11 : String? = null,
|
|
||||||
memo : String? = null,
|
|
||||||
pubkey : String? = null,
|
|
||||||
alias : String? = null,
|
|
||||||
strings : SendStrings,
|
|
||||||
) {
|
|
||||||
val amountSats = amountMsat / WalletConstants.MSAT_PER_SAT
|
|
||||||
handlePaymentResult(
|
|
||||||
paymentHash = paymentHash,
|
|
||||||
amountSats = amountSats,
|
|
||||||
bolt11 = bolt11,
|
|
||||||
memo = memo,
|
|
||||||
pubkey = pubkey,
|
|
||||||
alias = alias,
|
|
||||||
strings = strings,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resolveAliasesInBackground(
|
private fun resolveAliasesInBackground(
|
||||||
payee : String?,
|
payee : String?,
|
||||||
routeHints : List<RouteHintHop>,
|
routeHints : List<RouteHintHop>,
|
||||||
|
|||||||
Reference in New Issue
Block a user