mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Implement sendPayment notification command
This commit is contained in:
parent
b18991b9fb
commit
7587a60387
6 changed files with 90 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue