All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.message.payment.RequestPaymentMessage Maven / Gradle / Ivy

package it.auties.whatsapp.model.message.payment;

import it.auties.protobuf.annotation.ProtobufMessage;
import it.auties.protobuf.annotation.ProtobufProperty;
import it.auties.protobuf.model.ProtobufType;
import it.auties.whatsapp.model.jid.Jid;
import it.auties.whatsapp.model.message.model.MessageContainer;
import it.auties.whatsapp.model.message.model.MessageType;
import it.auties.whatsapp.model.message.model.PaymentMessage;
import it.auties.whatsapp.model.payment.PaymentBackground;
import it.auties.whatsapp.model.payment.PaymentMoney;
import it.auties.whatsapp.util.Clock;

import java.time.ZonedDateTime;
import java.util.Optional;


/**
 * A model class that represents a message to try to place a {@link PaymentMessage}.
 */
@ProtobufMessage(name = "Message.RequestPaymentMessage")
public record RequestPaymentMessage(
        @ProtobufProperty(index = 1, type = ProtobufType.STRING)
        String currency,
        @ProtobufProperty(index = 2, type = ProtobufType.UINT64)
        long amount1000,
        @ProtobufProperty(index = 3, type = ProtobufType.STRING)
        Jid requestFrom,
        @ProtobufProperty(index = 4, type = ProtobufType.OBJECT)
        Optional noteMessage,
        @ProtobufProperty(index = 5, type = ProtobufType.UINT64)
        long expiryTimestampSeconds,
        @ProtobufProperty(index = 6, type = ProtobufType.OBJECT)
        PaymentMoney amount,
        @ProtobufProperty(index = 7, type = ProtobufType.OBJECT)
        Optional background
) implements PaymentMessage {
    /**
     * Returns when the transaction expires
     *
     * @return an optional
     */
    public Optional expiryTimestamp() {
        return Clock.parseSeconds(expiryTimestampSeconds);
    }

    @Override
    public MessageType type() {
        return MessageType.REQUEST_PAYMENT;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy