Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontier): list billing customer invoice #328

Merged
merged 1 commit into from
Jan 1, 2024
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
28 changes: 27 additions & 1 deletion raystack/frontier/v1beta1/frontier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1608,14 +1608,23 @@ service FrontierService {
}

rpc ListBillingTransactions(ListBillingTransactionsRequest) returns (ListBillingTransactionsResponse) {
option (google.api.http) = {get: "/v1beta1/billing/{billing_id}/transactions"};
option (google.api.http) = {get: "/v1beta1/organizations/{org_id}/billing/{billing_id}/transactions"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Transaction";
summary: "List billing transactions";
description: "List all transactions of a billing account.";
};
}

// Invoice
rpc ListInvoices(ListInvoicesRequest) returns (ListInvoicesResponse) {
option (google.api.http) = {get: "/v1beta1/organizations/{org_id}/billing/{billing_id}/invoices"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Invoice";
summary: "List invoices";
description: "List all invoices of a billing account.";
};
}
}

// Billing
Expand Down Expand Up @@ -1647,11 +1656,16 @@ message GetBillingAccountRequest {
string id = 1 [(validate.rules).string.min_len = 1];

string org_id = 2 [(validate.rules).string.min_len = 1];

bool with_payment_methods = 3;
}

message GetBillingAccountResponse {
// Billing account
BillingAccount billing_account = 1;

// List of payment methods
repeated PaymentMethod payment_methods = 2;
}

message UpdateBillingAccountRequest {
Expand Down Expand Up @@ -1827,6 +1841,7 @@ message FeatureRequestBody {
string plan_id = 4;
repeated Price prices = 5;
int64 credit_amount = 7;
string behavior = 8;

google.protobuf.Struct metadata = 20;
}
Expand Down Expand Up @@ -1913,6 +1928,17 @@ message UpdatePlanResponse {
Plan plan = 1;
}

message ListInvoicesRequest {
string org_id = 1 [(validate.rules).string.min_len = 3];
// ID of the billing account to list invoices for
string billing_id = 2 [(validate.rules).string.min_len = 1];
}

message ListInvoicesResponse {
// List of invoices
repeated Invoice invoices = 1;
}

// Authentication

message GetJWKsRequest {}
Expand Down
33 changes: 33 additions & 0 deletions raystack/frontier/v1beta1/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ message Feature {

repeated Price prices = 7;
int64 credit_amount = 8;
string behavior = 9;

google.protobuf.Struct metadata = 20;
google.protobuf.Timestamp created_at = 21;
Expand Down Expand Up @@ -694,6 +695,38 @@ message Usage {
google.protobuf.Timestamp updated_at = 22;
}

message Invoice {
string id = 1;
string customer_id = 2;
string provider_id = 3;
string state = 4;
string currency = 5;
int64 amount = 6;
string hosted_url = 7;

// The date on which payment for this invoice is due
google.protobuf.Timestamp due_date = 8;
// The date when this invoice is in effect.
google.protobuf.Timestamp effective_at = 9;

google.protobuf.Struct metadata = 20;
google.protobuf.Timestamp created_at = 21;
}

message PaymentMethod {
string id = 1;
string customer_id = 2;
string provider_id = 3;
string type = 4;
string card_brand = 15;
string card_last4 = 16;
int64 card_expiry_month = 17;
int64 card_expiry_year = 18;

google.protobuf.Struct metadata = 20;
google.protobuf.Timestamp created_at = 21;
}

// Model crud body

message RoleRequestBody {
Expand Down
Loading