@@ -116,7 +116,6 @@ import { EntitlementService, MayStartWorkspaceResult } from "../../../src/billin
116
116
import { BillingMode } from "@gitpod/gitpod-protocol/lib/billing-mode" ;
117
117
import { BillingModes } from "../billing/billing-mode" ;
118
118
import { UsageServiceDefinition } from "@gitpod/usage-api/lib/usage/v1/usage.pb" ;
119
- import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server" ;
120
119
import { BillingServiceClient , BillingServiceDefinition } from "@gitpod/usage-api/lib/usage/v1/billing.pb" ;
121
120
122
121
@injectable ( )
@@ -2112,48 +2111,20 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
2112
2111
2113
2112
const billingEmail = User . getPrimaryEmail ( user ) ;
2114
2113
const billingName = attrId . kind === "team" ? team ! . name : User . getName ( user ) ;
2115
-
2116
- const isCreateStripeCustomerOnUsageEnabled = await getExperimentsClientForBackend ( ) . getValueAsync (
2117
- "createStripeCustomersOnUsage" ,
2118
- false ,
2119
- {
2120
- user : user ,
2121
- teamId : team ? team . id : undefined ,
2122
- } ,
2123
- ) ;
2124
- if ( isCreateStripeCustomerOnUsageEnabled ) {
2114
+ try {
2125
2115
try {
2126
- try {
2127
- // customer already exists, we don't need to create a new one.
2128
- await this . billingService . getStripeCustomer ( { attributionId } ) ;
2129
- return ;
2130
- } catch ( e ) { }
2131
-
2132
- await this . billingService . createStripeCustomer ( {
2133
- attributionId,
2134
- currency,
2135
- email : billingEmail ,
2136
- name : billingName ,
2137
- } ) ;
2116
+ // customer already exists, we don't need to create a new one.
2117
+ await this . billingService . getStripeCustomer ( { attributionId } ) ;
2138
2118
return ;
2139
- } catch ( error ) {
2140
- log . error ( `Failed to create Stripe customer profile for '${ attributionId } '` , error ) ;
2141
- throw new ResponseError (
2142
- ErrorCodes . INTERNAL_SERVER_ERROR ,
2143
- `Failed to create Stripe customer profile for '${ attributionId } '` ,
2144
- ) ;
2145
- }
2146
- }
2119
+ } catch ( e ) { }
2147
2120
2148
- try {
2149
- if ( ! ( await this . stripeService . findCustomerByAttributionId ( attributionId ) ) ) {
2150
- await this . stripeService . createCustomerForAttributionId (
2151
- attributionId ,
2152
- currency ,
2153
- billingEmail ,
2154
- billingName ,
2155
- ) ;
2156
- }
2121
+ await this . billingService . createStripeCustomer ( {
2122
+ attributionId,
2123
+ currency,
2124
+ email : billingEmail ,
2125
+ name : billingName ,
2126
+ } ) ;
2127
+ return ;
2157
2128
} catch ( error ) {
2158
2129
log . error ( `Failed to create Stripe customer profile for '${ attributionId } '` , error ) ;
2159
2130
throw new ResponseError (
0 commit comments