diff --git a/raystack/frontier/v1beta1/frontier.proto b/raystack/frontier/v1beta1/frontier.proto index c3ecaa57..a3dfebf8 100644 --- a/raystack/frontier/v1beta1/frontier.proto +++ b/raystack/frontier/v1beta1/frontier.proto @@ -1646,6 +1646,67 @@ service FrontierService { description: "Get the upcoming invoice of a billing account."; }; } + + // Coupon + rpc CreateCoupon(CreateCouponRequest) returns (CreateCouponResponse) { + option (google.api.http) = { + post: "/v1beta1/billing/coupons", + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "Create coupon"; + description: "Create a new coupon."; + }; + } + + rpc ListCoupons(ListCouponsRequest) returns (ListCouponsResponse) { + option (google.api.http) = {get: "/v1beta1/billing/coupons"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "List coupons"; + description: "List all coupons."; + }; + } + + rpc GetCoupon(GetCouponRequest) returns (GetCouponResponse) { + option (google.api.http) = {get: "/v1beta1/billing/coupons/{id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "Get coupon"; + description: "Get a coupon by ID."; + }; + } + + rpc DeleteCoupon(DeleteCouponRequest) returns (DeleteCouponResponse) { + option (google.api.http) = {delete: "/v1beta1/billing/coupons/{id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "Delete coupon"; + description: "Delete a coupon by ID."; + }; + } + + rpc CreateCouponCode(CreateCouponCodeRequest) returns (CreateCouponCodeResponse) { + option (google.api.http) = { + post: "/v1beta1/billing/coupons/{coupon_id}/codes", + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "Create coupon code"; + description: "Create a new coupon code for a coupon."; + }; + } + + rpc ListCouponCodes(ListCouponCodesRequest) returns (ListCouponCodesResponse) { + option (google.api.http) = {get: "/v1beta1/billing/coupons/{coupon_id}/codes"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "Coupon"; + summary: "List coupon codes"; + description: "List all coupon codes of a coupon."; + }; + } } // Billing @@ -2002,6 +2063,63 @@ message GetUpcomingInvoiceResponse { Invoice invoice = 1; } +message CreateCouponRequest { + // Coupon to create + Coupon coupon = 1; +} + +message CreateCouponResponse { + // Created coupon + Coupon coupon = 1; +} + +message ListCouponsRequest {} + +message ListCouponsResponse { + // List of coupons + repeated Coupon coupons = 1; +} + +message GetCouponRequest { + // ID of the coupon to get + string id = 1 [(validate.rules).string.min_len = 1]; +} + +message GetCouponResponse { + // Coupon + Coupon coupon = 1; +} + +message DeleteCouponRequest { + // ID of the coupon to delete + string id = 1 [(validate.rules).string.min_len = 1]; +} + +message DeleteCouponResponse {} + +message CreateCouponCodeRequest { + string coupon_id = 1 [(validate.rules).string.min_len = 1]; + string code = 2 [(validate.rules).string.min_len = 3]; + + // ID of the billing account to create the coupon code for, if not provided + // it will be applicable to all billing accounts + string billing_id = 3; +} + +message CreateCouponCodeResponse { + // Created coupon code + CouponCode coupon_code = 1; +} + +message ListCouponCodesRequest { + string coupon_id = 1 [(validate.rules).string.min_len = 1]; +} + +message ListCouponCodesResponse { + // List of coupon codes + repeated CouponCode coupon_codes = 1; +} + // Authentication message GetJWKsRequest {} diff --git a/raystack/frontier/v1beta1/models.proto b/raystack/frontier/v1beta1/models.proto index 2a8c44c6..d0b839b9 100644 --- a/raystack/frontier/v1beta1/models.proto +++ b/raystack/frontier/v1beta1/models.proto @@ -658,6 +658,7 @@ message Product { string behavior = 9; repeated Feature features = 10; BehaviorConfig behavior_config = 11; + string provider_id = 12; google.protobuf.Struct metadata = 20; google.protobuf.Timestamp created_at = 21; @@ -757,6 +758,29 @@ message PaymentMethod { google.protobuf.Timestamp created_at = 21; } +message Coupon { + string id = 1; + string provider_id = 2; + string name = 3; + string duration = 4; + // percent_off is a number between 1 and 100 + int64 percent_off = 5; + int64 max_redemptions = 6; + + google.protobuf.Struct metadata = 20; + google.protobuf.Timestamp created_at = 21; + google.protobuf.Timestamp expire_at = 22; +} + +message CouponCode { + string code = 1; + string coupon_id = 2; + + // ID of the billing account to create the coupon code for, if not provided + // it will be applicable to all billing accounts + string billing_id = 3; +} + // Model crud body message RoleRequestBody {