feat: produtos

This commit is contained in:
Ricardo Carneiro 2025-07-11 16:52:29 -03:00
parent 1cc8665176
commit fc211367a6
8 changed files with 73 additions and 29 deletions

View File

@ -16,7 +16,8 @@
"Bash(pkill:*)", "Bash(pkill:*)",
"Bash(sudo rm:*)", "Bash(sudo rm:*)",
"Bash(rm:*)", "Bash(rm:*)",
"Bash(curl:*)" "Bash(curl:*)",
"Bash(docker-compose up:*)"
] ]
}, },
"enableAllProjectMcpServers": false "enableAllProjectMcpServers": false

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
@ -24,8 +24,4 @@
<EmbeddedResource Include="Resources\**\*.resx" /> <EmbeddedResource Include="Resources\**\*.resx" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Views\Payment\" />
</ItemGroup>
</Project> </Project>

View File

@ -16,11 +16,6 @@ public class PaymentController : Controller
_authService = authService; _authService = authService;
} }
public IActionResult Plans()
{
return View();
}
[HttpPost] [HttpPost]
public async Task<IActionResult> CreateCheckoutSession(string planType) public async Task<IActionResult> CreateCheckoutSession(string planType)
{ {
@ -44,7 +39,7 @@ public class PaymentController : Controller
catch (Exception ex) catch (Exception ex)
{ {
TempData["Error"] = $"Erro ao processar pagamento: {ex.Message}"; TempData["Error"] = $"Erro ao processar pagamento: {ex.Message}";
return RedirectToAction("Plans"); return RedirectToAction("Pricing", "Home");
} }
} }
@ -57,7 +52,7 @@ public class PaymentController : Controller
public IActionResult Cancel() public IActionResult Cancel()
{ {
TempData["Info"] = "Pagamento cancelado. Você pode tentar novamente quando quiser."; TempData["Info"] = "Pagamento cancelado. Você pode tentar novamente quando quiser.";
return RedirectToAction("Plans"); return RedirectToAction("Pricing", "Home");
} }
[HttpPost] [HttpPost]

View File

@ -0,0 +1 @@
 stripe listen --forward-to localhost:49178/webhook/stripe

View File

@ -26,6 +26,9 @@
} }
else else
{ {
<a asp-controller="Auth" asp-action="Login" class="btn btn-outline-light btn-lg px-4">
Entrar
</a>
<a asp-controller="Auth" asp-action="Login" class="btn btn-light btn-lg px-4"> <a asp-controller="Auth" asp-action="Login" class="btn btn-light btn-lg px-4">
Começar Grátis Começar Grátis
</a> </a>

View File

@ -100,7 +100,7 @@
@if (User.Identity?.IsAuthenticated == true) @if (User.Identity?.IsAuthenticated == true)
{ {
<form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post"> <form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post">
<input type="hidden" name="planType" value="basic" /> <input type="hidden" name="planType" value="Basic" />
<button type="submit" class="btn btn-outline-primary w-100">Escolher Básico</button> <button type="submit" class="btn btn-outline-primary w-100">Escolher Básico</button>
</form> </form>
} }
@ -154,7 +154,7 @@
@if (User.Identity?.IsAuthenticated == true) @if (User.Identity?.IsAuthenticated == true)
{ {
<form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post"> <form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post">
<input type="hidden" name="planType" value="professional" /> <input type="hidden" name="planType" value="Professional" />
<button type="submit" class="btn btn-warning w-100">Escolher Profissional</button> <button type="submit" class="btn btn-warning w-100">Escolher Profissional</button>
</form> </form>
} }
@ -212,7 +212,7 @@
@if (User.Identity?.IsAuthenticated == true) @if (User.Identity?.IsAuthenticated == true)
{ {
<form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post"> <form asp-controller="Payment" asp-action="CreateCheckoutSession" method="post">
<input type="hidden" name="planType" value="premium" /> <input type="hidden" name="planType" value="Premium" />
<button type="submit" class="btn btn-primary w-100 fw-bold">Escolher Premium</button> <button type="submit" class="btn btn-primary w-100 fw-bold">Escolher Premium</button>
</form> </form>
} }
@ -343,3 +343,51 @@
</div> </div>
</div> </div>
</div> </div>
@if (TempData["Success"] != null)
{
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast show" role="alert">
<div class="toast-header">
<i class="fas fa-check-circle text-success me-2"></i>
<strong class="me-auto">Sucesso</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
</div>
<div class="toast-body">
@TempData["Success"]
</div>
</div>
</div>
}
@if (TempData["Error"] != null)
{
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast show" role="alert">
<div class="toast-header">
<i class="fas fa-exclamation-triangle text-warning me-2"></i>
<strong class="me-auto">Atenção</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
</div>
<div class="toast-body">
@TempData["Error"]
</div>
</div>
</div>
}
@if (TempData["Info"] != null)
{
<div class="toast-container position-fixed top-0 end-0 p-3">
<div class="toast show" role="alert">
<div class="toast-header">
<i class="fas fa-exclamation-triangle text-primary me-2"></i>
<strong class="me-auto">Atenção</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
</div>
<div class="toast-body">
@TempData["Info"]
</div>
</div>
</div>
}

View File

@ -11,14 +11,14 @@
"DatabaseName": "BCardsDB" "DatabaseName": "BCardsDB"
}, },
"Stripe": { "Stripe": {
"PublishableKey": "pk_test_your_publishable_key_here", "PublishableKey": "pk_test_51RjUmIBMIadsOxJVP4bWc54pHEOSf5km1hpOkOBSoGVoKxI46N4KSWtevpXCSq68OjFazBuXmPJGBwZ1KDN5MNJy003lj1YmAS",
"SecretKey": "sk_test_your_secret_key_here", "SecretKey": "sk_test_51RjUmIBMIadsOxJVeqsMFxnZ8ePR7d8IbnaF4sAwBVJv9rrfODPEQ2C9fF3beoABpITdfzEk0ZDzGTTQfvKv63xI00PeZoABGO",
"WebhookSecret": "whsec_your_webhook_secret_here" "WebhookSecret": "whsec_8d189c137ff170ab5e62498003512b9d073e2db50c50ed7d8712b7ef11a37543"
}, },
"Authentication": { "Authentication": {
"Google": { "Google": {
"ClientId": "your_google_client_id", "ClientId": "472850008574-nmeepbdt4hunsk5c8krpbdmd3olc4jv6.apps.googleusercontent.com",
"ClientSecret": "your_google_client_secret" "ClientSecret": "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"
}, },
"Microsoft": { "Microsoft": {
"ClientId": "b411606a-e574-4f59-b7cd-10dd941b9fa3", "ClientId": "b411606a-e574-4f59-b7cd-10dd941b9fa3",
@ -27,22 +27,22 @@
}, },
"Plans": { "Plans": {
"Basic": { "Basic": {
"PriceId": "price_basic_monthly", "PriceId": "price_1RjUskBMIadsOxJVgLwlVo1y",
"Price": 9.90, "Price": 9.90,
"MaxLinks": 5, "MaxLinks": 5,
"Features": ["basic_themes", "simple_analytics"] "Features": [ "basic_themes", "simple_analytics" ]
}, },
"Professional": { "Professional": {
"PriceId": "price_professional_monthly", "PriceId": "price_1RjUv9BMIadsOxJVORqlM4E9",
"Price": 24.90, "Price": 24.90,
"MaxLinks": 15, "MaxLinks": 15,
"Features": ["all_themes", "advanced_analytics", "custom_domain"] "Features": [ "all_themes", "advanced_analytics", "custom_domain" ]
}, },
"Premium": { "Premium": {
"PriceId": "price_premium_monthly", "PriceId": "price_1RjUw0BMIadsOxJVmdouNV1g",
"Price": 29.90, "Price": 29.90,
"MaxLinks": -1, "MaxLinks": -1,
"Features": ["custom_themes", "full_analytics", "multiple_domains", "priority_support"] "Features": [ "custom_themes", "full_analytics", "multiple_domains", "priority_support" ]
} }
} }
} }