Skip to content
Closed
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package sentry_protos.billing.v1.services.charge.v1;

import "sentry_protos/billing/v1/services/charge/v1/charge.proto";

message Charge {
uint64 amount_cents = 1;
bool paid = 2;
Expand All @@ -17,3 +19,22 @@ message ListChargesForInvoiceRequest {
message ListChargesForInvoiceResponse {
repeated Charge charges = 1;
}

// Batched variant for paginated invoice surfaces. Returns
// ``PlatformCharge`` (the canonical projection, with embedded refunds via
// ``PlatformCharge.refunds``) for every charge tied to any of the
// requested invoices, so callers get full per-invoice charge + refund
// state in one round trip. Avoids the N+1 of fetching refunds or
// charges per invoice when rendering paginated invoice lists.
message ListChargesForInvoiceIdsRequest {
repeated uint64 invoice_ids = 1;
}

message ListChargesForInvoiceIdsResponse {
// Flat list of charges across all requested invoices, ordered by
// ``(invoice_id, date_added)`` ascending. Each ``PlatformCharge``
// carries its ``invoice_id`` and embedded ``refunds``; group by
// ``charge.invoice_id`` to reconstruct per-invoice state. Invoices
// with no charges simply don't appear.
repeated PlatformCharge charges = 1;
}
21 changes: 21 additions & 0 deletions rust/src/sentry_protos.billing.v1.services.charge.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@ pub struct ListChargesForInvoiceResponse {
#[prost(message, repeated, tag = "1")]
pub charges: ::prost::alloc::vec::Vec<Charge>,
}
/// Batched variant for paginated invoice surfaces. Returns
/// `PlatformCharge` (the canonical projection, with embedded refunds via
/// `PlatformCharge.refunds`) for every charge tied to any of the
/// requested invoices, so callers get full per-invoice charge + refund
/// state in one round trip. Avoids the N+1 of fetching refunds or
/// charges per invoice when rendering paginated invoice lists.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListChargesForInvoiceIdsRequest {
#[prost(uint64, repeated, tag = "1")]
pub invoice_ids: ::prost::alloc::vec::Vec<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChargesForInvoiceIdsResponse {
/// Flat list of charges across all requested invoices, ordered by
/// `(invoice_id, date_added)` ascending. Each `PlatformCharge`
/// carries its `invoice_id` and embedded `refunds`; group by
/// `charge.invoice_id` to reconstruct per-invoice state. Invoices
/// with no charges simply don't appear.
#[prost(message, repeated, tag = "1")]
pub charges: ::prost::alloc::vec::Vec<PlatformCharge>,
}
/// Lists every recorded refund associated with the charges for a single
/// platform invoice. Callers in the presentation layer use this to render
/// invoice-level refund state without crossing the charge service boundary.
Expand Down
Loading