From e986d8666d2a82636dd943b67640a222ec87ab85 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Fri, 28 Jun 2024 12:15:57 -0700 Subject: [PATCH] CU-8685awfkp fixing session bug and updating stripe.net --- Core/Resgrid.Model/Resgrid.Model.csproj | 2 +- Core/Resgrid.Services/Resgrid.Services.csproj | 2 +- .../Resgrid.Web.ServicesCore.csproj | 2 +- .../User/Controllers/SubscriptionController.cs | 2 +- .../Areas/User/Views/Subscription/Index.cshtml | 18 +++++++++++++++++- Web/Resgrid.WebCore/Resgrid.WebCore.csproj | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Core/Resgrid.Model/Resgrid.Model.csproj b/Core/Resgrid.Model/Resgrid.Model.csproj index 8b3f0871..822f9f29 100644 --- a/Core/Resgrid.Model/Resgrid.Model.csproj +++ b/Core/Resgrid.Model/Resgrid.Model.csproj @@ -41,7 +41,7 @@ - + diff --git a/Core/Resgrid.Services/Resgrid.Services.csproj b/Core/Resgrid.Services/Resgrid.Services.csproj index 882f8f32..ab00c895 100644 --- a/Core/Resgrid.Services/Resgrid.Services.csproj +++ b/Core/Resgrid.Services/Resgrid.Services.csproj @@ -11,7 +11,7 @@ - + diff --git a/Web/Resgrid.Web.ServicesCore/Resgrid.Web.ServicesCore.csproj b/Web/Resgrid.Web.ServicesCore/Resgrid.Web.ServicesCore.csproj index bd239032..b8d11334 100644 --- a/Web/Resgrid.Web.ServicesCore/Resgrid.Web.ServicesCore.csproj +++ b/Web/Resgrid.Web.ServicesCore/Resgrid.Web.ServicesCore.csproj @@ -76,7 +76,7 @@ - + diff --git a/Web/Resgrid.WebCore/Areas/User/Controllers/SubscriptionController.cs b/Web/Resgrid.WebCore/Areas/User/Controllers/SubscriptionController.cs index d1f9546a..ad3c21a1 100644 --- a/Web/Resgrid.WebCore/Areas/User/Controllers/SubscriptionController.cs +++ b/Web/Resgrid.WebCore/Areas/User/Controllers/SubscriptionController.cs @@ -630,7 +630,7 @@ public async Task GetStripeSession(int id, int count, Cancellatio return Json(new { - SessionId = session, + SessionId = session.SessionId, HasActiveSub = hasActiveSub }); } diff --git a/Web/Resgrid.WebCore/Areas/User/Views/Subscription/Index.cshtml b/Web/Resgrid.WebCore/Areas/User/Views/Subscription/Index.cshtml index 298482b3..8ca17900 100644 --- a/Web/Resgrid.WebCore/Areas/User/Views/Subscription/Index.cshtml +++ b/Web/Resgrid.WebCore/Areas/User/Views/Subscription/Index.cshtml @@ -474,7 +474,7 @@ const packs = amount / 10; $.ajax({ - url: resgrid.absoluteBaseUrl + '/User/Subscription/GetStripeSession?id=' + id + '&count=' + amount, + url: resgrid.absoluteBaseUrl + '/User/Subscription/GetStripeSession?id=' + id + '&count=' + packs, contentType: 'application/json', type: 'GET' }).done(function (data) { @@ -486,10 +486,26 @@ // If `redirectToCheckout` fails due to a browser or network // error, display the localized error message to your customer // using `result.error.message`. + + swal({ + title: "Purchase Error", + text: "Error redirecting to Stripe for checkout. Stripe error: " + result.error.message, + icon: "error", + buttons: true, + dangerMode: false + }); }); } } }); + } else { + swal({ + title: "Cannot Purchase", + text: "Resgrid includes 10 entities for free for all departments. Please select a entity count greater then 10 to purchase.", + icon: "warning", + buttons: true, + dangerMode: false + }); } } diff --git a/Web/Resgrid.WebCore/Resgrid.WebCore.csproj b/Web/Resgrid.WebCore/Resgrid.WebCore.csproj index 9c9de9f1..19697a8f 100644 --- a/Web/Resgrid.WebCore/Resgrid.WebCore.csproj +++ b/Web/Resgrid.WebCore/Resgrid.WebCore.csproj @@ -70,7 +70,7 @@ - +