diff --git a/src/main/java/cc/getportal/command/request/RequestInvoiceParams.java b/src/main/java/cc/getportal/command/request/RequestInvoiceParams.java new file mode 100644 index 0000000..1ddbfb5 --- /dev/null +++ b/src/main/java/cc/getportal/command/request/RequestInvoiceParams.java @@ -0,0 +1,30 @@ +package cc.getportal.command.request; + +import cc.getportal.model.Currency; +import com.google.gson.annotations.SerializedName; +import org.jetbrains.annotations.Nullable; + +/** + * Slim parameters for RequestInvoice command. + * Server (portal-rest) computes exchange rate from amount/currency. + * Request ID is derived from command.id. + */ +public record RequestInvoiceParams( + long amount, + Currency currency, + @SerializedName("expires_at") + String expiresAt, + @Nullable String description, + @Nullable String refund_invoice, + /** Optional request ID. If not provided, the command ID is used by the server. */ + @Nullable String request_id +) { + + public RequestInvoiceParams(long amount, Currency currency, long expiresAt, @Nullable String description, @Nullable String refund_invoice) { + this(amount, currency, String.valueOf(expiresAt), description, refund_invoice, null); + } + + public RequestInvoiceParams(long amount, Currency currency, long expiresAt, @Nullable String description, @Nullable String refund_invoice, @Nullable String requestId) { + this(amount, currency, String.valueOf(expiresAt), description, refund_invoice, requestId); + } +} diff --git a/src/main/java/cc/getportal/command/request/RequestInvoiceRequest.java b/src/main/java/cc/getportal/command/request/RequestInvoiceRequest.java index 2220489..2652041 100644 --- a/src/main/java/cc/getportal/command/request/RequestInvoiceRequest.java +++ b/src/main/java/cc/getportal/command/request/RequestInvoiceRequest.java @@ -1,6 +1,5 @@ package cc.getportal.command.request; -import cc.getportal.model.InvoiceRequestContent; import cc.getportal.command.PortalRequest; import cc.getportal.command.notification.UnitNotification; import cc.getportal.command.response.RequestInvoiceResponse; @@ -11,9 +10,9 @@ public class RequestInvoiceRequest extends PortalRequest subkeys; - private final InvoiceRequestContent content; + private final RequestInvoiceParams content; - public RequestInvoiceRequest(String recipientKey, List subkeys, InvoiceRequestContent content) { + public RequestInvoiceRequest(String recipientKey, List subkeys, RequestInvoiceParams content) { recipient_key = recipientKey; this.subkeys = subkeys; this.content = content;