@@ -562,24 +562,17 @@ class NotificationService: UNNotificationServiceExtension {
562562 }
563563
564564 // Send the payment
565- let paymentId = Lightning_kmpUUID . companion. randomUUID ( )
566- // do {
567- // try await peer.betterPayOffer(
568- // paymentId: paymentId,
569- // amount: cardRequest.amount,
570- // offer: cardRequest.offer,
571- // payerKey: Lightning_randomKey(),
572- // payerNote: nil,
573- // fetchInvoiceTimeoutInSeconds: 30
574- // )
575- // } catch {
576- // log.error("peer.betterPayOffer(): error: \(error)")
577- // }
565+ do {
566+ try await peer. payUnsolicitedInvoice ( invoice: cardRequest. invoice)
567+ } catch {
568+ log. error ( " peer.payUnsolicitedInvoice(): error: \( error) " )
569+ }
578570
579571 // Wait for the outgoing payment to complete
572+ let paymentHash = cardRequest. invoice. paymentHash
580573 business. paymentsManager. lastCompletedPaymentPublisher ( ) . sink { payment in
581574 if let lnPayment = payment as? Lightning_kmpLightningOutgoingPayment {
582- if lnPayment. id == paymentId {
575+ if lnPayment. details . paymentHash == cardRequest . invoice . paymentHash {
583576 self . sentPayment = lnPayment
584577 log. debug ( " sentPayment = \( lnPayment) " )
585578
@@ -638,14 +631,14 @@ class NotificationService: UNNotificationServiceExtension {
638631 updateBestAttemptContent_unknown ( )
639632 }
640633
641- case . pendingSettlement:
642- updateBestAttemptContent_incomingPayment ( )
643-
644- case . withdrawRequest:
645- updateBestAttemptContent_outgoingPayment ( )
646-
647- case . unknown:
648- updateBestAttemptContent_incomingPayment ( )
634+ case . pendingSettlement:
635+ updateBestAttemptContent_incomingPayment ( )
636+
637+ case . withdrawRequest:
638+ updateBestAttemptContent_outgoingPayment ( )
639+
640+ case . unknown:
641+ updateBestAttemptContent_incomingPayment ( )
649642 }
650643
651644 contentHandler ( bestAttemptContent)
0 commit comments