Skip to content
Draft
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
@@ -0,0 +1,43 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/common/v1/sponsored_type.proto";
import "sentry_protos/billing/v1/services/contract/v1/billing_config.proto";

// Configuration for a sponsored contract. The presence of this message on a
// BillingConfig indicates the contract is sponsored; its absence means it is
// not.
message SponsorshipConfig {
// Whether this sponsored Contract is eligible to start trials.
bool can_trial = 1;

// Whether this sponsored Contract can checkout.
bool can_checkout = 2;

sentry_protos.billing.v1.common.v1.SponsoredType sponsorship_type = 3;
}

message BillingConfig {
// The number-of-months interval the contract was signed under
// (1 = monthly, 12 = annual). Frozen for the life of the contract.
uint32 month_interval = 1;

// Whether the org is allowed to incur pay-as-you-go usage.
// Credit-card orgs always support payg; invoiced orgs that should
// support it are an explicit override.
bool supports_payg = 2;

// Whether this is a managed (sales-assisted) subscription rather than
// self-serve.
bool is_managed = 3;

// Whether the org has a soft cap: usage past reserved volume is allowed
// (and billed) instead of hard-stopping ingestion.
bool has_soft_cap = 4;

// Sponsorship configuration. Absent means the contract is not sponsored.
optional SponsorshipConfig sponsorship_config = 5;

sentry_protos.billing.v1.services.contract.v1.ChargeConfig charge_config = 6;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/services/contract/v1/retention_config.proto";
import "sentry_protos/billing/v1/services/contract/v2/billing_config.proto";
import "sentry_protos/billing/v1/services/contract/v2/contract_metadata.proto";
import "sentry_protos/billing/v1/services/contract/v2/pricing_config.proto";

message Contract {
ContractMetadata metadata = 1;
BillingConfig billing_config = 2;
PricingConfig pricing_config = 3;
sentry_protos.billing.v1.services.contract.v1.RetentionConfig retention_config = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/services/contract/v1/contract_metadata.proto";

message ContractMetadata {
uint64 id = 1;
uint64 organization_id = 2;
// The set of BillingRules that the BillingRulesEngine has to execute for this contract.
string ruleset_version = 3;
// Catch-all for overrides and information not covered above.
sentry_protos.billing.v1.services.contract.v1.MetadataOptions custom_options = 4;
string package_uid = 5;

optional uint64 previous_id = 6;
}
Comment thread
noahsmartin marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/common/v1/address.proto";
import "sentry_protos/billing/v1/common/v1/sponsored_type.proto";
import "sentry_protos/billing/v1/services/contract/v1/billing_config.proto";
import "sentry_protos/billing/v1/services/contract/v1/invoice.proto";
import "sentry_protos/billing/v1/services/contract/v1/pricing_config.proto";

message CreateContractRequest {
uint64 organization_id = 1;
string package_uid = 2;
repeated sentry_protos.billing.v1.services.contract.v1.UserConfig user_configs = 3;
repeated sentry_protos.billing.v1.services.contract.v1.InvoiceLineItem line_items = 4;
sentry_protos.billing.v1.common.v1.Address address = 5;
// The customer's chosen cadence. Must be one of the package's
// supported_month_intervals. If unset, defaults to the package's first
// supported interval.
uint32 month_interval = 6;

// How the contract is billed. If unset (BILLING_TYPE_UNSPECIFIED), the
// contract defaults to credit-card.
sentry_protos.billing.v1.services.contract.v1.BillingType billing_type = 7;

// Whether usage past reserved volume is allowed (and billed) instead of
// hard-stopping ingestion.
bool has_soft_cap = 8;

// The tax provider's reference for the tax document opened for this invoice.
// When set, the contract service records it on the created invoice as a
// pending tax transaction atomically with invoice creation. Unset means no
// tax document was opened.
optional string tax_transaction_code = 9;

// The sponsored type of the contract. If unset, then this is a non-sponsored
// contract.
optional sentry_protos.billing.v1.common.v1.SponsoredType sponsorship_type = 10;

// The customer's tax registration number (e.g. VAT ID) on file.
optional string tax_number = 11;

// Whether the tax provider placed this invoice under reverse charge.
bool is_reverse_charge = 12;
}

message CreateContractResponse {
uint64 id = 1;
uint64 invoice_id = 2;
string invoice_guid = 3;
bool needs_charge = 4;
uint64 amount_billed = 5;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/services/contract/v2/contract.proto";

message GetAllContractsForOrganizationRequest {
uint64 organization_id = 1;
}

message GetAllContractsForOrganizationResponse {
repeated Contract contracts = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "sentry_protos/billing/v1/date.proto";
import "sentry_protos/billing/v1/services/contract/v2/contract.proto";

message GetContractRequest {
uint64 organization_id = 1;

// If provided, returns the Contract active on this date. Otherwise, returns the current Contract.
sentry_protos.billing.v1.Date date = 2;
}

message GetSpecificContractRequest {
uint64 contract_id = 1;
}

message GetContractResponse {
Contract contract = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "google/protobuf/timestamp.proto";

message GetUninvoicedContractsRequest {
// Returns Contracts whose current billing period ends before this time and
// have not yet been invoiced for the current period.
google.protobuf.Timestamp current_ts = 1;

// Maximum number of contracts to return in the response. If more contracts
// match the request than this limit, the response will have truncated set
// to true.
uint32 max_items = 2;

optional uint32 offset = 3;
}

message GetUninvoicedContractsResponse {
// True if additional matching contracts existed beyond max_items and were
// not included in this response.
bool truncated = 1;
repeated uint64 contract_ids = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.contract.v2;

import "google/protobuf/timestamp.proto";
import "sentry_protos/billing/v1/services/contract/v1/billing_config.proto";
import "sentry_protos/billing/v1/services/contract/v1/pricing_config.proto";

message PricingConfig {
// Determines when to reset quotas and charge the subscription price.
sentry_protos.billing.v1.services.contract.v1.Date billing_period_start_date = 1;
sentry_protos.billing.v1.services.contract.v1.Date billing_period_end_date = 2;

//Determines when the on demand period for invoicing the organization starts and ends, even for annual plans we bill ondemand monthly
sentry_protos.billing.v1.services.contract.v1.Date ondemand_period_start_date = 3;
sentry_protos.billing.v1.services.contract.v1.Date ondemand_period_end_date = 4;
optional google.protobuf.Timestamp usage_watermark_ts = 5;

repeated sentry_protos.billing.v1.services.contract.v1.UserConfig user_config = 6;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.invoicer.v2;

import "sentry_protos/billing/v1/common/v1/pending_change.proto";

// Invoices an immediate mid-term contract change and rolls the contract over
// now. The caller supplies the change to apply (target package/interval and the
// caps taking effect now). The invoicer prices the prorated new-plan charge and
// the credit for unused time on the current plan itself, settles accrued
// pay-as-you-go usage at the current contract's rates, applies monetary grants
// and sales tax, closes the current contract immediately, and opens the new
// contract with the supplied change applied.
message BillContractChangeRequest {
uint64 contract_id = 1;
// The change applied to the new contract: the target package/interval and the
// PAYG caps taking effect now. Reuses the PendingChange shape the rollover
// consumes, but here it applies immediately rather than at a period boundary,
// so the caller does not stage it in the pending-change store.
sentry_protos.billing.v1.common.v1.PendingChange change = 2;

// Whether the requested change should result in a new billing period.
bool start_new_term = 3;
}

message BillContractChangeResponse {
// The invoice that settles the change (and closes the previous contract).
uint64 invoice_id = 1;
}
6 changes: 6 additions & 0 deletions rust/src/_include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub mod sentry_protos {
pub mod v1 {
include!("sentry_protos.billing.v1.services.contract.v1.rs");
}
pub mod v2 {
include!("sentry_protos.billing.v1.services.contract.v2.rs");
}
}
pub mod contract_budget_enforcer {
pub mod v1 {
Expand All @@ -53,6 +56,9 @@ pub mod sentry_protos {
pub mod v1 {
include!("sentry_protos.billing.v1.services.invoicer.v1.rs");
}
pub mod v2 {
include!("sentry_protos.billing.v1.services.invoicer.v2.rs");
}
}
pub mod package {
pub mod v1 {
Expand Down
Loading
Loading