]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java
Implement sendPayment notification command
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / ManagerImpl.java
index f2d080fd91e829bf40adfc27da5e64fdf796bbbb..ed7ae86b09a67a3460185e8b66a73b43f1b38db0 100644 (file)
@@ -638,6 +638,20 @@ class ManagerImpl implements Manager {
         return sendMessage(messageBuilder, recipients);
     }
 
+    @Override
+    public SendMessageResults sendPaymentNotificationMessage(
+            byte[] receipt, String note, RecipientIdentifier.Single recipient
+    ) throws IOException {
+        final var paymentNotification = new SignalServiceDataMessage.PaymentNotification(receipt, note);
+        final var payment = new SignalServiceDataMessage.Payment(paymentNotification);
+        final var messageBuilder = SignalServiceDataMessage.newBuilder().withPayment(payment);
+        try {
+            return sendMessage(messageBuilder, Set.of(recipient));
+        } catch (NotAGroupMemberException | GroupNotFoundException | GroupSendingNotAllowedException e) {
+            throw new AssertionError(e);
+        }
+    }
+
     @Override
     public SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException {
         var messageBuilder = SignalServiceDataMessage.newBuilder().asEndSessionMessage();