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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.jpg binary
*.tar filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
9 changes: 9 additions & 0 deletions errors/billing/not-enabled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name = "BILLING_NOT_ENABLED"
description = "Billing not enabled."
http_status = 400
---

# Billing Not Enabled

Billing is not enabled.
64 changes: 0 additions & 64 deletions fern/definition/cloud/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,6 @@ types:
docs: Represent a resource's readable display name.
type: string

GroupBillingSummary:
docs: A group billing summary.
properties:
games:
docs: A list of multiple game lobby expenses.
type: list<GameLobbyExpenses>
balance:
docs: A group's available balance.
type: double

GameLobbyExpenses:
docs: Game lobby expenses.
properties:
Expand Down Expand Up @@ -402,60 +392,6 @@ types:
docs: The bank routing number of this group's bank source.
type: string

GroupBillingInvoice:
docs: A group's billing invoice.
properties:
csv_url:
docs: A URL to this invoice's CSV breakdown.
type: string
pdf_url:
docs: A URL to this invoice's PDF document.
type: string
period_start_ts:
docs: RFC3339 timestamp.
type: datetime
period_end_ts:
docs: RFC3339 timestamp.
type: datetime

GroupBillingPayment:
docs: A group's billing payment.
properties:
amount:
docs: Payment amount (in hundredths USD, 100 = $1.00).
type: double
description:
docs: A description of this payment.
type: optional<string>
from_invoice:
docs: Whether or not this payment is from an invoice.
type: boolean
created_ts:
docs: RFC3339 timestamp.
type: datetime
status: GroupBillingStatus

GroupBillingStatus:
docs: A value denoting the status of a billing transfer.
enum:
- succeeded
- processing
- refunded

GroupBillingTransfer:
docs: A group's billing transfer.
properties:
amount:
docs: Payment amount (in hundredths USD, 100 = $1.00).
type: long
description:
docs: A description of this transfer.
type: optional<string>
created_ts:
docs: RFC3339 timestamp.
type: datetime
status: GroupBillingStatus

RegionTier:
docs: A region server tier.
properties:
Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/config/src/ns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl Default for Cdn {
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
pub struct RivetBilling {
region_price_ids: HashMap<String, String>,
pub dynamic_servers_capacity_price_id: String,
}

fn default_regions() -> HashMap<String, Region> {
Expand Down
3 changes: 1 addition & 2 deletions lib/util/env/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde::Deserialize;
use std::collections::HashMap;

/// Reads a secret from the env.
///
Expand Down Expand Up @@ -173,7 +172,7 @@ pub fn chirp_service_name() -> &'static str {

#[derive(Deserialize)]
pub struct RivetBilling {
pub region_price_ids: HashMap<String, String>,
pub dynamic_servers_capacity_price_id: String,
}

pub fn billing() -> Option<&'static RivetBilling> {
Expand Down
7 changes: 4 additions & 3 deletions proto/backend/billing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package rivet.backend.billing;

import "proto/common.proto";
import "proto/backend/billing/game_plan.proto";

message GameLobbyMetrics {
rivet.common.Uuid game_id = 1;
Expand All @@ -19,7 +20,7 @@ message RegionTierMetrics {

message Team {
rivet.common.Uuid team_id = 1;
optional string stripe_customer_id = 2;
string stripe_customer_id = 2;
optional int64 payment_method_attached_ts = 3;
optional int64 payment_method_valid_ts = 4;
optional int64 payment_failed_ts = 5;
Expand All @@ -28,6 +29,6 @@ message Team {

message Game {
rivet.common.Uuid game_id = 1;
int64 create_ts = 2;
optional string stripe_customer_id = 3;
rivet.backend.billing.game_plan.GamePlan plan = 2;
}

15 changes: 15 additions & 0 deletions proto/backend/billing/game_plan.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package rivet.backend.billing.game_plan;

import "proto/common.proto";

message GamePlan {
repeated DynamicServersCapacityRegion dynamic_servers_capacity = 1;
}

message DynamicServersCapacityRegion {
rivet.common.Uuid region_id = 1;
uint64 cores = 2;
}

3 changes: 0 additions & 3 deletions proto/backend/game.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ message Game {
optional rivet.common.Uuid banner_upload_id = 11;
optional string banner_file_name = 12;
optional upload.Provider banner_provider = 16;

optional string plan_code = 13;
optional rivet.common.Uuid subscription_id = 14;
}

message Version {
Expand Down
2 changes: 1 addition & 1 deletion scripts/fern/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ EOF
# Build libraries
#
# See https://github.com/fern-api/fern-typescript/blob/3b1c33781bbd726cee26a21c1ff3464eeae70cad/README.md?plain=1#L379
(cd sdks/typescript && yarn install && yarn build) &
(cd sdks/typescript && yarn install && yarn pack -f archive.tgz) &

# Generate OpenAPI clients
(./scripts/openapi/gen_spec_compat.sh && ./scripts/openapi/gen_rust.sh) &
Expand Down
78 changes: 0 additions & 78 deletions sdks/go/cloud/groups/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
context "context"
json "encoding/json"
errors "errors"
fmt "fmt"
uuid "github.com/google/uuid"
io "io"
http "net/http"
sdk "sdk"
Expand Down Expand Up @@ -112,79 +110,3 @@ func (c *Client) Validate(ctx context.Context, request *cloud.ValidateGroupReque
}
return response, nil
}

// Converts the given group into a developer group.
func (c *Client) ConvertGroup(ctx context.Context, groupId uuid.UUID) error {
baseURL := "https://api.rivet.gg"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"cloud/groups/%v/convert", groupId)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
if err != nil {
return err
}
apiError := core.NewAPIError(statusCode, errors.New(string(raw)))
decoder := json.NewDecoder(bytes.NewReader(raw))
switch statusCode {
case 500:
value := new(sdk.InternalError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
case 429:
value := new(sdk.RateLimitError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
case 403:
value := new(sdk.ForbiddenError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
case 408:
value := new(sdk.UnauthorizedError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
case 404:
value := new(sdk.NotFoundError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
case 400:
value := new(sdk.BadRequestError)
value.APIError = apiError
if err := decoder.Decode(value); err != nil {
return apiError
}
return value
}
return apiError
}

if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
Headers: c.header,
ErrorDecoder: errorDecoder,
},
); err != nil {
return err
}
return nil
}
Loading