Skip to content

Commit 1bc7e8b

Browse files
committed
[server] Add new individual Stripe Price IDs to Gitpod's configuration
1 parent 782a052 commit 1bc7e8b

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

.werft/jobs/build/payment/stripe-configmap.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ metadata:
66
data:
77
config: |
88
{
9-
"usageProductPriceIds": {
9+
"individualUsagePriceIds": {
10+
"EUR": "price_1LiId7GadRXm50o3OayAS2y4",
11+
"USD": "price_1LiIdbGadRXm50o3ylg5S44r"
12+
},
13+
"teamUsagePriceIds": {
1014
"EUR": "price_1LiId7GadRXm50o3OayAS2y4",
1115
"USD": "price_1LiIdbGadRXm50o3ylg5S44r"
1216
}

components/gitpod-protocol/src/protocol.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,8 @@ export interface RepositoryCloneInformation {
815815

816816
export interface CoreDumpConfig {
817817
enabled?: boolean;
818-
softLimit?: number;
819-
hardLimit?: number;
818+
softLimit?: number;
819+
hardLimit?: number;
820820
}
821821

822822
export interface WorkspaceConfig {
@@ -1520,6 +1520,11 @@ export interface Terms {
15201520
readonly formElements?: object;
15211521
}
15221522

1523+
export interface StripeConfig {
1524+
individualUsagePriceIds: { [currency: string]: string };
1525+
teamUsagePriceIds: { [currency: string]: string };
1526+
}
1527+
15231528
export type BillingStrategy = "other" | "stripe";
15241529
export interface CostCenter {
15251530
readonly id: AttributionId;

components/server/ee/src/user/stripe-service.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ export class StripeService {
139139
throw new Error(`Stripe customer '${customerId}' could not be found`);
140140
}
141141
const currency = customer.metadata.preferredCurrency || "USD";
142-
const priceId = this.config?.stripeConfig?.usageProductPriceIds[currency];
142+
// FIXME(janx): Use `individualUsagePriceIds` when subscribing users.
143+
const priceId = this.config?.stripeConfig?.teamUsagePriceIds[currency];
143144
if (!priceId) {
144145
throw new Error(`No Stripe Price ID configured for currency '${currency}'`);
145146
}

components/server/src/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url";
88
import { AuthProviderParams, normalizeAuthProviderParams } from "./auth/auth-provider";
99

10-
import { NamedWorkspaceFeatureFlag } from "@gitpod/gitpod-protocol";
10+
import { NamedWorkspaceFeatureFlag, StripeConfig } from "@gitpod/gitpod-protocol";
1111

1212
import { RateLimiterConfig } from "./auth/rate-limiter";
1313
import { CodeSyncConfig } from "./code-sync/code-sync-service";
@@ -27,7 +27,7 @@ export type Config = Omit<
2727
workspaceDefaults: WorkspaceDefaults;
2828
chargebeeProviderOptions?: ChargebeeProviderOptions;
2929
stripeSecrets?: { publishableKey: string; secretKey: string };
30-
stripeConfig?: { usageProductPriceIds: { [currency: string]: string } };
30+
stripeConfig?: StripeConfig;
3131
builtinAuthProvidersConfigured: boolean;
3232
inactivityPeriodForRepos?: number;
3333
};
@@ -266,7 +266,7 @@ export namespace ConfigFile {
266266
log.error("Could not load Stripe secrets", error);
267267
}
268268
}
269-
let stripeConfig: { usageProductPriceIds: { EUR: string; USD: string } } | undefined;
269+
let stripeConfig: StripeConfig | undefined;
270270
if (config.enablePayment && config.stripeConfigFile) {
271271
try {
272272
stripeConfig = JSON.parse(fs.readFileSync(filePathTelepresenceAware(config.stripeConfigFile), "utf-8"));

0 commit comments

Comments
 (0)