mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
add JsonPayment (#808)
This commit is contained in:
parent
d13d150fe1
commit
5cd5697aea
5 changed files with 59 additions and 0 deletions
|
@ -101,6 +101,7 @@ public record MessageEnvelope(
|
|||
boolean hasProfileKey,
|
||||
Optional<Reaction> reaction,
|
||||
Optional<Quote> quote,
|
||||
Optional<Payment> payment,
|
||||
List<Attachment> attachments,
|
||||
Optional<Long> remoteDeleteId,
|
||||
Optional<Sticker> sticker,
|
||||
|
@ -130,6 +131,9 @@ public record MessageEnvelope(
|
|||
Optional.ofNullable(dataMessage.getQuote()
|
||||
.transform(q -> Quote.from(q, recipientResolver, addressResolver, fileProvider))
|
||||
.orNull()),
|
||||
Optional.ofNullable(dataMessage.getPayment()
|
||||
.transform(p -> p.getPaymentNotification().isPresent() ? Payment.from(p) : null)
|
||||
.orNull()),
|
||||
dataMessage.getAttachments()
|
||||
.transform(a -> a.stream()
|
||||
.map(as -> Attachment.from(as, fileProvider))
|
||||
|
@ -229,6 +233,12 @@ public record MessageEnvelope(
|
|||
}
|
||||
}
|
||||
|
||||
public record Payment(String note, byte[] receipt) {
|
||||
static Payment from(SignalServiceDataMessage.Payment payment) {
|
||||
return new Payment(payment.getPaymentNotification().get().getNote(), payment.getPaymentNotification().get().getReceipt());
|
||||
}
|
||||
}
|
||||
|
||||
public record Mention(RecipientAddress recipient, int start, int length) {
|
||||
|
||||
static Mention from(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue