Fixed payment namespacing

This commit is contained in:
2025-06-20 17:42:49 -07:00
parent 3d4c9d8cd9
commit 91e58fa267
4 changed files with 24 additions and 104 deletions
@@ -1,12 +1,7 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using MistoxWebsite.Server.Controllers.Payment;
using MistoxWebsite.Server.Services.DatabaseService;
using MistoxWebsite.Shared;
using Newtonsoft.Json;
using Stripe;
using Stripe.Climate;
using Stripe.Tax;
using MistoxWebsite.Server.Entities;
namespace MistoxWebsite.Server.Controllers {
[ApiController]
@@ -24,7 +19,7 @@ namespace MistoxWebsite.Server.Controllers {
public async Task<string> GetPaymentKey( [FromQuery] string userID ) {
string OrderNumber = Guid.NewGuid().ToString().Substring(0,10);
Shared.Account? acc = await _databaseService.GetAccount(userID);
Account? acc = await _databaseService.GetAccount(userID);
if (acc != null) {
List<Cart> cart = await _databaseService.GetCart(acc);
@@ -51,11 +46,11 @@ namespace MistoxWebsite.Server.Controllers {
try {
const string endpointSecret = "whsec_HCO7uv2BPIPmUPOiSg9tfwLZul8usCGG";
string body = await new StreamReader(Request.Body).ReadToEndAsync();
Event e = EventUtility.ConstructEvent( body, Request.Headers["Stripe-Signature"], endpointSecret );
Stripe.Event e = Stripe.EventUtility.ConstructEvent( body, Request.Headers["Stripe-Signature"], endpointSecret );
if( e.Type == "payment_intent.succeeded" ) {
// Extract Data from payment confirm
PaymentIntent intent = (PaymentIntent)e.Data.Object;
Stripe.PaymentIntent intent = (Stripe.PaymentIntent)e.Data.Object;
string orderNumber = "";
int userID = 0;
List<int> productIDs = new List<int>();
@@ -84,7 +79,7 @@ namespace MistoxWebsite.Server.Controllers {
}
// Clear the cart
Shared.Account account = new Shared.Account{
Account account = new() {
ID = userID
};
await _databaseService.ClearCart( account );