Skip to content

Commit 7f1e602

Browse files
committed
WIP
1 parent eeb4df8 commit 7f1e602

3 files changed

Lines changed: 17 additions & 24 deletions

File tree

phoenix-ios/phoenix-ios/officers/BusinessManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ class BusinessManager {
800800
do {
801801
try await peer.payUnsolicitedInvoice(invoice: cardRequest.invoice)
802802
} catch {
803-
log.error("peer.payOffer(): error: \(error)")
803+
log.error("peer.payUnsolicitedInvoice(): error: \(error)")
804804
}
805805
}
806806
}

phoenix-ios/phoenix-ios/views/receive/LightningDualView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ struct LightningDualView: View {
15181518
Task { @MainActor in
15191519
do {
15201520
let tuple: KotlinPair<Lightning_kmpBolt12Invoice, Bitcoin_kmpByteVector32> =
1521-
try await peer.requestCardPayment2(
1521+
try await peer.requestCardPayment(
15221522
amount: msat,
15231523
cardHolderOffer: bolt12Offer.offer,
15241524
cardParams: cardParams

phoenix-ios/phoenix-notifySrvExt/NotificationService.swift

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)