Skip to content

Commit

Permalink
feat: added finalize invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
oco-adam committed Dec 1, 2023
1 parent 65dbec6 commit c6333bc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/resources/invoice_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ impl Invoice {
client.get_query("/invoices/upcoming", &params)
}

/// Finalizes an invoice.
///
/// For more details see <https://stripe.com/docs/api/invoices/finalize.>.
pub fn finalize(
client: &Client,
invoice_id: &InvoiceId,
params: FinalizeInvoiceParams,
) -> Response<Invoice> {
client.post_form(&format!("/invoices/{}/finalize", invoice_id), params)
}

/// Pays an invoice.
///
/// For more details see <https://stripe.com/docs/api#pay_invoice.>.
Expand Down Expand Up @@ -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<bool>,
}

0 comments on commit c6333bc

Please sign in to comment.