Skip to content

Commit

Permalink
feat(frontier): APIs to filter projects explicitly added (#326)
Browse files Browse the repository at this point in the history
- API to have delegated checkout(bypass billing engine)

Signed-off-by: Kush Sharma <[email protected]>
  • Loading branch information
kushsharma authored Dec 9, 2023
1 parent dec3dbe commit 28bea25
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
31 changes: 30 additions & 1 deletion raystack/frontier/v1beta1/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@ service AdminService {
description: "Adds a user to a platform.";
};
}

// Checkout
rpc DelegatedCheckout(DelegatedCheckoutRequest) returns (DelegatedCheckoutResponse) {
option (google.api.http) = {
post: "/v1beta1/admin/organizations/{org_id}/billing/{billing_id}/checkouts",
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Checkout";
summary: "Checkout a feature or subscription";
description: "Checkout a feature to buy it one time or start a subscription plan on a billing account manually. It bypasses billing engine.";
};
}
}

message ListAllUsersRequest {
Expand Down Expand Up @@ -493,4 +506,20 @@ message AddPlatformUserRequest {
];
}

message AddPlatformUserResponse {}
message AddPlatformUserResponse {}

message DelegatedCheckoutRequest {
string org_id = 1 [(validate.rules).string.min_len = 3];
// ID of the billing account to update the subscription for
string billing_id = 2 [(validate.rules).string.min_len = 1];

// Subscription to create
CheckoutSubscriptionBody subscription_body = 10;
// Feature to buy
CheckoutFeatureBody feature_body = 11;
}

message DelegatedCheckoutResponse {
// Checkout session
CheckoutSession checkout_session = 1;
}
17 changes: 8 additions & 9 deletions raystack/frontier/v1beta1/frontier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1790,15 +1790,6 @@ message CheckFeatureEntitlementResponse {
bool status = 1;
}

message CheckoutSubscriptionBody {
string plan = 1;
int32 trail_days = 2;
}

message CheckoutFeatureBody {
string feature = 1;
}

message CreateCheckoutRequest {
string org_id = 1 [(validate.rules).string.min_len = 3];
// ID of the billing account to update the subscription for
Expand Down Expand Up @@ -2110,6 +2101,14 @@ message ListProjectsByCurrentUserRequest {
// query params are set as with_permissions=get&with_permissions=delete
// to be represented as array
repeated string with_permissions = 2;

// Note: this is a bad design and would recommend against using this filter
// It is used to list only projects which are explicitly given permission
// to user. A user could get permission to access a project either via getting
// access from organization level role or a group. But for some reason we want
// only users who could have inherited these permissions from top but we only
// want explictly added ones.
bool non_inherited = 3;
}

message ListProjectsByCurrentUserResponse {
Expand Down
9 changes: 9 additions & 0 deletions raystack/frontier/v1beta1/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -700,4 +700,13 @@ message PreferenceRequestBody {
pattern: "^[A-Za-z0-9-_]+$"
}];
string value = 3;
}

message CheckoutSubscriptionBody {
string plan = 1;
int32 trail_days = 2;
}

message CheckoutFeatureBody {
string feature = 1;
}

0 comments on commit 28bea25

Please sign in to comment.