// // PaymentsViewModel.swift // wallet // // Created by Adriana Epure on 22.08.2022. // Copyright © 2022 Jason. All rights reserved. // class PaymentsViewModel: ViewModel { let paymentInfo = Observable() func updateBalance(){ self.getWalletBalance() self.getChannelBalance() } func getPaymentDetail(invoice: String){ self.getPaymentInfo(invoice: invoice) { payment in self.paymentInfo.value = payment } onFailure: { error in self.paymentInfo.value = nil } } func sendPayment(invoice: String, completion: @escaping (String) -> Void) { self.payInvoice(invoice: invoice) { response in self.listPayments() self.updateBalance() debugPrint(response.paymentRoute.totalAmt, response.paymentRoute.totalFees, response.paymentError.debugDescription) } onFailure: { error in } } }