From c6333bce94ae52454bcc90b79987baf96576da83 Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Sat, 18 Nov 2023 08:06:30 +0100 Subject: [PATCH] feat: added finalize invoice --- src/resources/invoice_ext.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/resources/invoice_ext.rs b/src/resources/invoice_ext.rs index 5d1f8daaf..6fe9f6b47 100644 --- a/src/resources/invoice_ext.rs +++ b/src/resources/invoice_ext.rs @@ -16,6 +16,17 @@ impl Invoice { client.get_query("/invoices/upcoming", ¶ms) } + /// Finalizes an invoice. + /// + /// For more details see . + pub fn finalize( + client: &Client, + invoice_id: &InvoiceId, + params: FinalizeInvoiceParams, + ) -> Response { + client.post_form(&format!("/invoices/{}/finalize", invoice_id), params) + } + /// Pays an invoice. /// /// For more details see . @@ -94,3 +105,9 @@ impl<'a> InvoiceSearchParams<'a> { InvoiceSearchParams { query: String::new(), limit: None, page: None, expand: &[] } } } + +#[derive(Clone, Debug, Default, Serialize)] +pub struct FinalizeInvoiceParams { + #[serde(skip_serializing_if = "Option::is_none")] + auto_advance: Option, +}