Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix: remove hard coded test stripe price id (#437)
Will Hutchinson2e71c2013005
diff --git a/infra/stacks/authentication-service/Pulumi.dev.yaml b/infra/stacks/authentication-service/Pulumi.dev.yamlindex e369e876ed..fa0c5fe84c 100644--- a/infra/stacks/authentication-service/Pulumi.dev.yaml+++ b/infra/stacks/authentication-service/Pulumi.dev.yaml@@ -15,3 +15,4 @@ config:authentication-service:google_client_secret_key: google-client-secret-devauthentication-service:macro_api_token_private_secret_key: macro-api-token-private-key-devauthentication-service:stripe_webhook_secret_key: stripe-webhook-secret-dev+ authentication-service:stripe_price_id: stripe-price-id-devdiff --git a/infra/stacks/authentication-service/Pulumi.prod.yaml b/infra/stacks/authentication-service/Pulumi.prod.yamlindex c71c661c05..4dce1c118b 100644--- a/infra/stacks/authentication-service/Pulumi.prod.yaml+++ b/infra/stacks/authentication-service/Pulumi.prod.yaml@@ -15,3 +15,4 @@ config:authentication-service:google_client_secret_key: google-client-secret-prodauthentication-service:macro_api_token_private_secret_key: macro-api-token-private-key-prodauthentication-service:stripe_webhook_secret_key: stripe-webhook-secret-prod+ authentication-service:stripe_price_id: stripe-price-id-proddiff --git a/infra/stacks/authentication-service/index.ts b/infra/stacks/authentication-service/index.tsindex fddb044262..45e7a81a46 100644--- a/infra/stacks/authentication-service/index.ts+++ b/infra/stacks/authentication-service/index.ts@@ -95,6 +95,12 @@ const googleClientSecretKeyArn: pulumi.Output<string> = aws.secretsmanager.getSecretVersionOutput({ secretId: GOOGLE_CLIENT_SECRET_KEY }).apply((secret) => secret.arn);+const STRIPE_PRICE_ID_KEY = config.require(`stripe_price_id`);++const stripePriceIdArn: pulumi.Output<string> = aws.secretsmanager+ .getSecretVersionOutput({ secretId: STRIPE_PRICE_ID_KEY })+ .apply((secret) => secret.arn);+const MACRO_API_TOKEN_PRIVATE_SECRET_KEY = config.require(`macro_api_token_private_secret_key`);@@ -120,6 +126,7 @@ const secretKeyArns = [pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenPublicKeyArn}`,pulumi.interpolate`${macroApiTokenSecretPrivateKeyArn}`,pulumi.interpolate`${stripeWebhookSecretKeyArn}`,+ pulumi.interpolate`${stripePriceIdArn}`,];const vpc = get_coparse_api_vpc();@@ -265,6 +272,10 @@ const service = new AuthenticationService('authentication-service', {name: 'STRIPE_WEBHOOK_SECRET_KEY',value: pulumi.interpolate`${stripeWebhookSecretKeyArn}`,},+ {+ name: 'STRIPE_PRICE_ID',+ value: pulumi.interpolate`${STRIPE_PRICE_ID_KEY}`,+ },],});diff --git a/rust/cloud-storage/authentication_service/src/config.rs b/rust/cloud-storage/authentication_service/src/config.rsindex a61b996efd..658f828c2b 100644--- a/rust/cloud-storage/authentication_service/src/config.rs+++ b/rust/cloud-storage/authentication_service/src/config.rs@@ -64,6 +64,9 @@ pub struct Config {/// The search event queuepub search_event_queue: String,++ /// The stripe price id for the professional subscription+ pub stripe_price_id: String,}impl Config {@@ -118,6 +121,9 @@ impl Config {let search_event_queue =std::env::var("SEARCH_EVENT_QUEUE").context("SEARCH_EVENT_QUEUE must be provided")?;+ let stripe_price_id =+ std::env::var("STRIPE_PRICE_ID").context("STRIPE_PRICE_ID must be provided")?;+Ok(Config {base_url,database_url,@@ -138,6 +144,7 @@ impl Config {notification_service_url,notification_queue,search_event_queue,+ stripe_price_id,environment,})}diff --git a/rust/cloud-storage/authentication_service/src/main.rs b/rust/cloud-storage/authentication_service/src/main.rsindex d2b4fedfe1..1db94a59cb 100644--- a/rust/cloud-storage/authentication_service/src/main.rs+++ b/rust/cloud-storage/authentication_service/src/main.rs@@ -114,6 +114,15 @@ async fn main() -> anyhow::Result<()> {.to_string(),};+ let stripe_price_id = match config.environment {+ Environment::Local => config.stripe_price_id.clone(),+ _ => secretsmanager_client+ .get_secret_value(&config.stripe_price_id)+ .await+ .context("unable to get stripe price id")?+ .to_string(),+ };+let auth_client = crate::service::fusionauth_client::FusionAuthClient::new(fusionauth_api_key,config.fusionauth_client_id.clone(),@@ -188,7 +197,7 @@ async fn main() -> anyhow::Result<()> {);let teams_repo_impl = TeamRepositoryImpl::new(db.clone());- let customer_repo_impl = CustomerRepositoryImpl::new(stripe_client.clone());+ let customer_repo_impl = CustomerRepositoryImpl::new(stripe_client.clone(), &stripe_price_id);let teams_service_impl = TeamServiceImpl::new(teams_repo_impl,diff --git a/rust/cloud-storage/teams/src/domain/model.rs b/rust/cloud-storage/teams/src/domain/model.rsindex 5c11173f61..34ee692a55 100644--- a/rust/cloud-storage/teams/src/domain/model.rs+++ b/rust/cloud-storage/teams/src/domain/model.rs@@ -186,11 +186,9 @@ pub enum RemoveUserFromTeamError {/// Arguments for creating a subscription#[derive(Debug, Clone)]-pub struct CreateSubscriptionArgs<'a> {+pub struct CreateSubscriptionArgs {/// The customer idpub customer_id: stripe::CustomerId,- /// The price id- pub price_id: &'a str,/// The quantitypub quantity: u64,/// The metadata to attach to the subscriptiondiff --git a/rust/cloud-storage/teams/src/domain/team_service.rs b/rust/cloud-storage/teams/src/domain/team_service.rsindex bf2f01f4e1..707399a4b9 100644--- a/rust/cloud-storage/teams/src/domain/team_service.rs+++ b/rust/cloud-storage/teams/src/domain/team_service.rs@@ -105,7 +105,6 @@ where.customer_repository.create_subscription(CreateSubscriptionArgs {customer_id,- price_id: "price_1PnSgXJaD7zvQeOBfSYgOmZc",quantity: invited.len() as u64,metadata: Some(vec![diff --git a/rust/cloud-storage/teams/src/outbound/customer_repo.rs b/rust/cloud-storage/teams/src/outbound/customer_repo.rsindex 48b6aaca1f..75d9e9fdbd 100644--- a/rust/cloud-storage/teams/src/outbound/customer_repo.rs+++ b/rust/cloud-storage/teams/src/outbound/customer_repo.rs@@ -14,13 +14,16 @@ use crate::domain::{pub struct CustomerRepositoryImpl {/// The underlying stripe::Client connected to stripe.client: Arc<stripe::Client>,+ /// The price id for the professional subscription+ stripe_price_id: String,}impl CustomerRepositoryImpl {/// Creates a new instance of CustomerRepositoryImpl- pub fn new(stripe_client: stripe::Client) -> Self {+ pub fn new(stripe_client: stripe::Client, stripe_price_id: &str) -> Self {Self {client: Arc::new(stripe_client),+ stripe_price_id: stripe_price_id.to_string(),}}}@@ -28,12 +31,12 @@ impl CustomerRepositoryImpl {impl CustomerRepository for CustomerRepositoryImpl {async fn create_subscription(&self,- args: CreateSubscriptionArgs<'_>,+ args: CreateSubscriptionArgs,) -> Result<stripe::SubscriptionId, CustomerError> {// Create the subscriptionlet mut params = CreateSubscription::new(args.customer_id);params.items = Some(vec![CreateSubscriptionItems {- price: Some(args.price_id.to_string()),+ price: Some(self.stripe_price_id.clone()),quantity: Some(args.quantity),..Default::default()}]);