mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-28 10:04:21 +01:00
Implement sendPayment notification command
This commit is contained in:
@@ -141,6 +141,10 @@ public interface Manager extends Closeable {
|
||||
Set<RecipientIdentifier> recipients
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPaymentNotificationMessage(
|
||||
byte[] receipt, String note, RecipientIdentifier.Single recipient
|
||||
) throws IOException;
|
||||
|
||||
SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
|
||||
|
||||
void deleteRecipient(RecipientIdentifier.Single recipient);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user