Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions lago-client/examples/credit_note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}

// Step 6: Filter credit notes by customer
if let Some(customer) = &invoice.customer {
if let Some(ref external_id) = customer.external_id {
println!("\n=== Filtering credit notes by customer ===");
let filter = CreditNoteFilter::new().with_external_customer_id(external_id.clone());
let request = ListCreditNotesRequest::new().with_filters(filter);
let filtered = client.list_credit_notes(Some(request)).await?;
println!(
"Found {} credit notes for customer '{}'",
filtered.credit_notes.len(),
external_id
);
}
if let Some(customer) = &invoice.customer
&& let Some(ref external_id) = customer.external_id
{
println!("\n=== Filtering credit notes by customer ===");
let filter = CreditNoteFilter::new().with_external_customer_id(external_id.clone());
let request = ListCreditNotesRequest::new().with_filters(filter);
let filtered = client.list_credit_notes(Some(request)).await?;
println!(
"Found {} credit notes for customer '{}'",
filtered.credit_notes.len(),
external_id
);
}

// Step 7: Filter by reason
Expand Down
21 changes: 10 additions & 11 deletions lago-client/examples/invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);

// Example 3: List invoices for the same customer
if let Some(customer) = &first_invoice.customer {
if let Some(customer_id) = &customer.external_id {
let list_customer_request = ListCustomerInvoicesRequest::new(customer_id.clone());
let customer_invoices =
client.list_customer_invoices(list_customer_request).await?;
println!(
"\nCustomer {} has {} invoices",
customer_id,
customer_invoices.invoices.len()
);
}
if let Some(customer) = &first_invoice.customer
&& let Some(customer_id) = &customer.external_id
{
let list_customer_request = ListCustomerInvoicesRequest::new(customer_id.clone());
let customer_invoices = client.list_customer_invoices(list_customer_request).await?;
println!(
"\nCustomer {} has {} invoices",
customer_id,
customer_invoices.invoices.len()
);
}

// Example 4: Update an invoice's metadata
Expand Down
Loading
Loading