Skip to content

Commit

Permalink
feat(frontier): list billing customer invoice
Browse files Browse the repository at this point in the history
Signed-off-by: Kush Sharma <[email protected]>
  • Loading branch information
kushsharma committed Jan 1, 2024
1 parent 6f4477c commit 907f416
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
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 BillingPaymentMethod 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 BillingPaymentMethod {
string id = 1;
string customer_id = 2;
string provider_id = 3;
string type = 4;
string card_brand = 15;
string card_last4 = 16;
string card_exp_month = 17;
string card_exp_year = 18;

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

// Model crud body

message RoleRequestBody {
Expand Down

0 comments on commit 907f416

Please sign in to comment.