diff --git a/Bulky.Utility/StripeSettings.cs b/Bulky.Utility/StripeSettings.cs new file mode 100644 index 0000000..5b8438d --- /dev/null +++ b/Bulky.Utility/StripeSettings.cs @@ -0,0 +1,8 @@ +namespace BookBazaar.Utility +{ + public class StripeSettings + { + public string SecretKey { get; set; } + public string PublishableKey { get; set; } + } +} diff --git a/BulkyWeb/Areas/Customer/Controllers/CartController.cs b/BulkyWeb/Areas/Customer/Controllers/CartController.cs index 2f9958b..4e1c3c4 100644 --- a/BulkyWeb/Areas/Customer/Controllers/CartController.cs +++ b/BulkyWeb/Areas/Customer/Controllers/CartController.cs @@ -121,7 +121,8 @@ public IActionResult SummaryPOST() if (applicationUser.CompanyId.GetValueOrDefault() == 0) { //it is a regular customer account and we need to capture payment - //stripe logic + //adyen logic + //var options = new AdyenPaymentOptions() } diff --git a/BulkyWeb/BookBazaar.csproj b/BulkyWeb/BookBazaar.csproj index e77271e..c9c4143 100644 --- a/BulkyWeb/BookBazaar.csproj +++ b/BulkyWeb/BookBazaar.csproj @@ -17,6 +17,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/BulkyWeb/Program.cs b/BulkyWeb/Program.cs index 965f4e0..7783be8 100644 --- a/BulkyWeb/Program.cs +++ b/BulkyWeb/Program.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.EntityFrameworkCore; +using Stripe; var builder = WebApplication.CreateBuilder(args); @@ -13,6 +14,7 @@ builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); +builder.Services.Configure(builder.Configuration.GetSection("Stripe")); builder.Services.AddIdentity().AddEntityFrameworkStores().AddDefaultTokenProviders(); builder.Services.ConfigureApplicationCookie(options => { @@ -36,7 +38,7 @@ app.UseHttpsRedirection(); app.UseStaticFiles(); - +StripeConfiguration.ApiKey = builder.Configuration.GetSection("Stripe:SecretKey").Get(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/BulkyWeb/appsettings.json b/BulkyWeb/appsettings.json index e214491..c04c302 100644 --- a/BulkyWeb/appsettings.json +++ b/BulkyWeb/appsettings.json @@ -8,5 +8,9 @@ "AllowedHosts": "*", "ConnectionStrings": { "DefaultConnection": "Server=.;Database=Bulky;Trusted_Connection=True; TrustServerCertificate=True" + }, + "Stripe": { + "SecretKey": "sk_test_51QBwYZAp4ASQ4CvpOMhUjEQC0kGQiEIMq11E5hhhKLZMyEixiWevtN2F8rgNfHOBNU4sizZgiPnnxBkJhmGwYJfm00o49xyO4G", + "PublishableKey": "pk_test_51QBwYZAp4ASQ4CvpCLbh03xF3omkVlTRoWR4hQ8mlBwplhWn7I6LBPKQT5GXS0SeR7ZAy181xxLnPI5mrwuNWyVw00vezNAAly" } }