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
251 changes: 39 additions & 212 deletions billing/v1/billing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -806,55 +806,22 @@ service Billing {
};
}

// Validates or imports monthly miscellaneous fees from CSV.
rpc BulkImportMonthlyMiscFees(BulkImportMonthlyMiscFeesRequest) returns (protos.Operation) {
// Validates or imports monthly FreeFormItems from CSV through invoice settings.
rpc BulkImportMonthlyMiscFees(BulkImportMonthlyMiscFeesRequest) returns (MonthlyMiscFeeImportResult) {
option (google.api.http) = {
post: "/v1/monthly-misc-fees:bulkImport"
body: "*"
};
}

// Lists monthly miscellaneous fee rows.
// Lists effective monthly FreeFormItems.
rpc ListMonthlyMiscFees(ListMonthlyMiscFeesRequest) returns (ListMonthlyMiscFeesResponse) {
option (google.api.http) = {
get: "/v1/monthly-misc-fees"
};
}

// Gets a monthly miscellaneous fee row.
rpc GetMonthlyMiscFee(GetMonthlyMiscFeeRequest) returns (MonthlyMiscFee) {
option (google.api.http) = {
get: "/v1/monthly-misc-fees/{row_id}"
};
}

// Exports monthly miscellaneous fee rows using the list filters.
rpc ExportMonthlyMiscFees(ExportMonthlyMiscFeesRequest) returns (ExportMonthlyMiscFeesResponse) {
option (google.api.http) = {
get: "/v1/monthly-misc-fees:export"
};
}

// Gets a completed monthly miscellaneous fee import result.
rpc GetMonthlyMiscFeeImport(GetMonthlyMiscFeeImportRequest) returns (MonthlyMiscFeeImportResult) {
option (google.api.http) = {
get: "/v1/monthly-misc-fee-imports/{import_job_id}"
};
}

// Creates or updates a monthly miscellaneous fee row.
rpc UpsertMonthlyMiscFee(UpsertMonthlyMiscFeeRequest) returns (MonthlyMiscFee) {
option (google.api.http) = {
put: "/v1/monthly-misc-fees/{row_id}"
body: "*"
additional_bindings: {
put: "/v1/monthly-misc-fees"
body: "*"
}
};
}

// Deletes a monthly miscellaneous fee row.
// Deletes one monthly FreeFormItem through invoice settings.
rpc DeleteMonthlyMiscFee(DeleteMonthlyMiscFeeRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/monthly-misc-fees/{row_id}"
Expand Down Expand Up @@ -2914,99 +2881,44 @@ message GetFreeFormatResponse {
}

message GetMonthlyMiscFeeImportTemplateRequest {
// Optional. Template language. Supported values are "en" and "ja". Empty uses the caller's language or server default.
// Optional. Template language. Supported values are "en" and "ja".
string language = 1;
}

message MonthlyMiscFeeImportTemplate {
// Supported import format. Currently "csv".
string format = 1;

// Supported format version. Currently "misc_fee_import_v1".
string format_version = 2;

// CSV header columns in required order.
repeated string headers = 3;

// Example CSV row matching the current format version.
repeated string sample_row = 4;

// Supported modes: "dry-run", "replace-month", and "merge".
repeated string allowed_modes = 5;

// Maximum upload size in bytes.
int64 max_file_size_bytes = 6;

// Maximum data rows accepted per CSV file.
int32 max_rows = 7;

// Field-level validation rules for UI guidance.
repeated MonthlyMiscFeeImportFieldRule field_rules = 8;
}

message MonthlyMiscFeeImportFieldRule {
string field = 1;
bool required = 2;
string format = 3;
string description = 4;
}

message BulkImportMonthlyMiscFeesRequest {
// Required. Selected billing cycle in YYYY-MM form; YYYYMM is accepted and normalized by the server.
// Required. Selected billing cycle in YYYY-MM form; YYYYMM is normalized.
string billing_month = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Uploaded CSV content as normalized UTF-8 text.
string csv_content = 2 [(google.api.field_behavior) = REQUIRED];

// Required. Original upload file name for audit metadata.
// Required. Original upload file name for audit and result display.
string file_name = 3 [(google.api.field_behavior) = REQUIRED];

// Required. One of "dry-run", "replace-month", or "merge". Empty defaults to "dry-run".
string mode = 4;
// Required. "dry-run" validates only; "merge" upserts FreeFormItems by label.
string mode = 4 [(google.api.field_behavior) = REQUIRED];

// Required. Import format. Currently "csv".
string format = 5 [(google.api.field_behavior) = REQUIRED];

// Required. Import format version. Currently "misc_fee_import_v1".
string format_version = 6 [(google.api.field_behavior) = REQUIRED];

// Optional. Idempotency key for write-mode imports.
string idempotency_key = 7;
}

message ListMonthlyMiscFeesRequest {
// Required. Billing cycle in YYYY-MM form; YYYYMM is accepted and normalized by the server.
string billing_month = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Exact billing group ID filter.
string billing_group_id = 2;

// Optional. Case-insensitive billing group name query.
string billing_group_name_query = 3;

// Optional. Case-insensitive item or fee tag query.
string item_query = 4;

// Optional. Source filter, e.g. "csv", "ui", or "migration".
string source = 5;

// Optional. User identifier that last updated the row.
string updated_by = 6;

// Optional. RFC3339 lower bound for updated_at.
string updated_after = 7;

// Optional. RFC3339 upper bound for updated_at.
string updated_before = 8;

// Optional. Page size for pagination. Default and maximum are server-defined.
int32 page_size = 9;

// Optional. Opaque page token from a previous response.
string page_token = 10;

// Optional. Stable sort expression. Defaults to billing_group_name, item_name, row_id.
string sort = 11;
int32 page_size = 5;
string page_token = 6;
}

message ListMonthlyMiscFeesResponse {
Expand All @@ -3015,75 +2927,9 @@ message ListMonthlyMiscFeesResponse {
int32 total_count = 3;
}

message GetMonthlyMiscFeeRequest {
// Required. Server-owned row ID.
string row_id = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Billing month used to reject cross-month access or mutation mistakes.
string billing_month = 2 [(google.api.field_behavior) = REQUIRED];
}

message ExportMonthlyMiscFeesRequest {
// Required. Billing cycle in YYYY-MM form; YYYYMM is accepted and normalized by the server.
string billing_month = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Exact billing group ID filter.
string billing_group_id = 2;

// Optional. Case-insensitive billing group name query.
string billing_group_name_query = 3;

// Optional. Case-insensitive item or fee tag query.
string item_query = 4;

// Optional. Source filter, e.g. "csv", "ui", or "migration".
string source = 5;

// Optional. User identifier that last updated the row.
string updated_by = 6;

// Optional. RFC3339 lower bound for updated_at.
string updated_after = 7;

// Optional. RFC3339 upper bound for updated_at.
string updated_before = 8;

// Optional. Stable sort expression. Defaults to billing_group_name, item_name, row_id.
string sort = 9;
}

message ExportMonthlyMiscFeesResponse {
// CSV file bytes when the export is returned inline.
bytes csv_content = 1;

// Optional staged export reference or direct download URL.
string export_ref = 2;

// Export file name suggested to clients.
string file_name = 3;
}

message GetMonthlyMiscFeeImportRequest {
// Required. Import job ID returned by BulkImportMonthlyMiscFees.
string import_job_id = 1 [(google.api.field_behavior) = REQUIRED];
}

message UpsertMonthlyMiscFeeRequest {
// Optional for create, required for updating an existing server-owned row.
string row_id = 1;

// Required. Full row value to create or update.
MonthlyMiscFee row = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. Idempotency key for UI retry safety.
string idempotency_key = 3;
}

message DeleteMonthlyMiscFeeRequest {
// Required. Server-owned row ID.
// An opaque ID returned by ListMonthlyMiscFees.
string row_id = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Billing month used to reject cross-month deletion mistakes.
string billing_month = 2 [(google.api.field_behavior) = REQUIRED];
}

Expand All @@ -3092,60 +2938,41 @@ message MonthlyMiscFee {
string billing_month = 2;
string billing_group_id = 3;
string billing_group_name = 4;
string item_name = 5;
string quantity = 6;
string unit_cost = 7;
string amount = 8;
string source = 9;
string import_job_id = 10;
string created_by = 11;
string created_at = 12;
string updated_by = 13;
string updated_at = 14;
string vendor = 5;
string item_name = 6;
uint32 quantity = 7;
int64 unit_cost = 8;
int64 amount = 9;
bool enabled = 10;
// One of "saved", "created", or "default".
string source = 11;
}

message MonthlyMiscFeeImportResult {
string import_job_id = 1;
string status = 2;
string mode = 3;
string billing_month = 4;
string file_name = 5;
string file_hash = 6;
int32 total_rows = 7;
int32 valid_rows = 8;
int32 inserted_rows = 9;
int32 updated_rows = 10;
int32 unchanged_rows = 11;
int32 deleted_rows = 12;
int32 failed_rows = 13;
int32 replace_month_existing_rows = 14;
string export_ref = 15;
repeated MonthlyMiscFeeImportRowResult row_results = 16;
string created_by = 17;
string created_at = 18;
string updated_at = 19;
string status = 1;
string billing_month = 2;
string file_name = 3;
int32 total_rows = 4;
int32 valid_rows = 5;
int32 inserted_rows = 6;
int32 updated_rows = 7;
int32 unchanged_rows = 8;
int32 failed_rows = 9;
repeated MonthlyMiscFeeImportRowResult row_results = 10;
}

message MonthlyMiscFeeImportRowResult {
int32 csv_row_number = 1;
string action = 2;
string row_id = 3;
string billing_month = 4;
string billing_group_id = 5;
string billing_group_name = 6;
string item_name = 7;
string quantity = 8;
string unit_cost = 9;
string amount = 10;
MonthlyMiscFeeImportPreviousValue previous_value = 11;
repeated MonthlyMiscFeeValidationError validation_errors = 12;
string note = 13;
}

message MonthlyMiscFeeImportPreviousValue {
string quantity = 1;
string unit_cost = 2;
string amount = 3;
string billing_group_id = 3;
string billing_group_name = 4;
string vendor = 5;
string item_name = 6;
uint32 quantity = 7;
int64 unit_cost = 8;
int64 amount = 9;
bool enabled = 10;
repeated MonthlyMiscFeeValidationError validation_errors = 11;
}

message MonthlyMiscFeeValidationError {
Expand Down
Loading
Loading