Skip to content

Commit

Permalink
Fix Stripe env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
filipbekic01 committed Sep 22, 2024
1 parent 7236112 commit da0aa17
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public async Task<OperationResult<ChangePlanResponse>> ExecuteAsync(ChangePlanRe

var dc = new Dictionary<string, string>
{
{ StripePlans.ESSENTIALS, "price_1PpyCoKE6sxW2owa2SY4jGXp" },
{ StripePlans.ULTIMATE, "price_1PpyDFKE6sxW2owaWndg9Wxc" }
{ StripePlans.ESSENTIALS, settings.Value.StripeEssentialsPriceId },
{ StripePlans.ULTIMATE, settings.Value.StripeUltimatePriceId }
};

// Get user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public async Task<OperationResult<CreateSubscriptionResponse>> ExecuteAsync(Crea

var dc = new Dictionary<string, string>
{
{ StripePlans.ESSENTIALS, "price_1PpyCoKE6sxW2owa2SY4jGXp" },
{ StripePlans.ULTIMATE, "price_1PpyDFKE6sxW2owaWndg9Wxc" }
{ StripePlans.ESSENTIALS, settings.Value.StripeEssentialsPriceId },
{ StripePlans.ULTIMATE, settings.Value.StripeUltimatePriceId }
};

if (!dc.TryGetValue(request.Dto.Plan.ToLower(), out var priceId))
Expand Down
3 changes: 3 additions & 0 deletions backend/ResQueue/ResQueue/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ public class Settings
public string StripeSecret { get; set; } = null!;
public string StripeSecretWebhook { get; set; } = null!;
public string WebsiteUrl { get; set; } = null!;

public string StripeEssentialsPriceId { get; set; } = null!;
public string StripeUltimatePriceId { get; set; } = null!;
}
6 changes: 4 additions & 2 deletions backend/ResQueue/ResQueue/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"SmtpPort": "25",
"SmtpUsername": "0446e7630b990d",
"SmtpPassword": "cf4a06720b6dd1",
"StripeSecret": "sk_test_51PpxV4KE6sxW2owadyGKDtUF7cDjpCEtD83stbkfbzd7FqPfleW0pWKEmJR6BGr7oLnwIjRAQPCFxQsnMDYOr79h00cKaT8nO1",
"StripeSecretWebhook": "whsec_R3uUedvZktGW61aqe1d5Rrv5mXiMvLen"
"StripeSecret": "sk_test_51Q1suB0313W5fRAAja6UVcEzQ02JyZK3KBkXIdh0VPRZiixYOqkZdNXXRsC9DSXiemxSO2RHIL3ATvZZdsKf3cHi005qp3XCGR",
"StripeSecretWebhook": "whsec_R3uUedvZktGW61aqe1d5Rrv5mXiMvLen",
"StripeEssentialsPriceId": "price_1Q1uCh0313W5fRAACe4u6FGJ",
"StripeUltimatePriceId": "price_1Q1uDh0313W5fRAA9MyIlum8"
}
}
3 changes: 2 additions & 1 deletion frontend/.env.debug
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_URL=http://localhost:5004/api
VITE_STRIPE_PUBLIC_KEY=pk_test_51Q1suB0313W5fRAAfBXGN7WrQIzTG0uzbGUcJH8eDaaw2DxkC3U0WCZh9W5l8IJmJPmcsUP1Zj9Ezc2VwwDYoW0p00dTk7ZQUk
VITE_API_URL=http://localhost:5004/api
4 changes: 2 additions & 2 deletions frontend/.env.prod
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

# No VITE_API_URL since it is deployed on the same server
VITE_STRIPE_PUBLIC_KEY=pk_live_51Q1suB0313W5fRAAxrIQ4gDCLkGKf8zojJm3Vgu79hemGsxVSH4E0mrrR70flcaaYKbTBNDfUhJKBdLB7mXS1U8w00OXSmmuPU
#VITE_API_URL=No URL since it is deployed on the same server
1 change: 1 addition & 0 deletions frontend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ interface ImportMeta {

interface ImportMetaEnv {
readonly VITE_API_URL?: string
readonly VITE_STRIPE_PUBLIC_KEY: string
}
4 changes: 1 addition & 3 deletions frontend/src/composables/stripeComposable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const loadStripeAsync = async () => {
isLoading.value = true

try {
stripe.value = await loadStripe(
'pk_test_51PpxV4KE6sxW2owau69f5U6Fzf5uMnUIgo9gB8WxnCkaix9pcxn9yGr1erlTZjPt2ec7I8X42eKKmNpCgNoaDxw300PVRqNQUe'
)
stripe.value = await loadStripe(import.meta.env.VITE_STRIPE_PUBLIC_KEY)

if (!stripe.value) {
console.error('Failed method loadStripeAsync')
Expand Down

0 comments on commit da0aa17

Please sign in to comment.