Compare commits
14 Commits
4facacb853
...
b404d4f2d0
Author | SHA1 | Date | |
---|---|---|---|
|
b404d4f2d0 | ||
|
4bf0e7ca45 | ||
|
ef70c2b453 | ||
|
7a07fea68c | ||
|
7a89d78e4a | ||
|
23284fc514 | ||
|
e10a183963 | ||
|
595b6d980c | ||
|
36d34968fd | ||
|
269702f255 | ||
|
4705da96db | ||
|
10abe82b83 | ||
|
185df856cd | ||
|
72e7193580 |
@ -70,6 +70,7 @@ public class InvoiceController : Controller {
|
||||
.Include(x => x.ShippingAddress)
|
||||
.Include(x => x.LinkedAccount)
|
||||
.Include(x => x.Payment)
|
||||
.ThenInclude(x => x.BillingAddress)
|
||||
.Include(x => x.Products)
|
||||
.ThenInclude(y => y.Product)
|
||||
.ToList());
|
||||
@ -77,6 +78,7 @@ public class InvoiceController : Controller {
|
||||
.Include(x => x.ShippingAddress)
|
||||
.Include(x => x.LinkedAccount)
|
||||
.Include(x => x.Payment)
|
||||
.ThenInclude(x => x.BillingAddress)
|
||||
.Include(x => x.Products)
|
||||
.ThenInclude(y => y.Product)
|
||||
.Where(x => x.LinkedAccount != null && x.LinkedAccount.Id == id).ToList());
|
||||
@ -99,7 +101,9 @@ public class InvoiceController : Controller {
|
||||
}
|
||||
|
||||
try {
|
||||
inv = _context.Invoices.Where(x => x.Id == id).Include("ShippingAddress").First();
|
||||
inv = _context.Invoices.Where(x => x.Id == id).Include("ShippingAddress")
|
||||
.Include(x => x.Payment)
|
||||
.ThenInclude(x => x.BillingAddress).First();
|
||||
} catch (Exception e) {
|
||||
_logger.LogError(10, e.Message);
|
||||
return BadRequest();
|
||||
@ -164,16 +168,26 @@ public class InvoiceController : Controller {
|
||||
|
||||
// Charges!
|
||||
StripeConfiguration.ApiKey = _stripeOptions.Value.SecretKey;
|
||||
ChargesModel chr;
|
||||
AddressModel bill = new() {
|
||||
CivicNumber = sinv.BillCivicNumber,
|
||||
Street = sinv.BillStreet,
|
||||
City = sinv.BillCity,
|
||||
Appartment= sinv.BillAppartment,
|
||||
Country= sinv.BillCountry,
|
||||
PostalCode= sinv.BillPostalCode,
|
||||
Province= sinv.BillProvince,
|
||||
};
|
||||
|
||||
chr = new() {
|
||||
ChargesModel chr = new() {
|
||||
Token = sinv.Token,
|
||||
AmountInCents = sinv.AmountInCents,
|
||||
Name = sinv.Name,
|
||||
Phone = sinv.Phone,
|
||||
Email = sinv.Email,
|
||||
Description = sinv.Description,
|
||||
CurrencyCode = sinv.CurrencyCode
|
||||
CurrencyCode = sinv.CurrencyCode,
|
||||
LastFourDigits = sinv.LastFourDigits,
|
||||
BillingAddress = bill
|
||||
};
|
||||
|
||||
inv.Payment = chr;
|
||||
@ -190,13 +204,6 @@ public class InvoiceController : Controller {
|
||||
if (charge.FailureMessage is not null && charge.FailureMessage != "")
|
||||
return Json(charge.ToJson());
|
||||
|
||||
try {
|
||||
_context.Invoices.Update(inv);
|
||||
_context.SaveChanges();
|
||||
} catch (Exception ex) {
|
||||
_logger.LogError(20, ex.Message);
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
|
||||
if (user.Result is not null) { // Gestion de l'adresse client.
|
||||
inv.LinkedAccount = user.Result;
|
||||
|
@ -12,17 +12,18 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
[DbContext(typeof(InventoryContext))]
|
||||
[Migration("20221204170850_Initial-Db")]
|
||||
[Migration("20221212202643_Initial-Db")]
|
||||
partial class InitialDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.10")
|
||||
.HasAnnotation("ProductVersion", "7.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Data.InventoryUser", b =>
|
||||
{
|
||||
@ -103,7 +104,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
Id = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "61f3249f-495f-48c8-ac7e-7d21b3da82c7",
|
||||
ConcurrencyStamp = "88a1532a-3749-409e-8463-7f68f04c2225",
|
||||
Email = "admin@admin.com",
|
||||
EmailConfirmed = false,
|
||||
FirstName = "Roger",
|
||||
@ -111,10 +112,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@ADMIN.COM",
|
||||
NormalizedUserName = "ADMIN",
|
||||
PasswordHash = "AQAAAAEAACcQAAAAELswgBNsSfJwmigdKX2rpHseOEi20F+ZUhxapu80HTnxZamC3lu1hyAGMXj4kQumMw==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEOixAy1U6YTbU41EkE4Yb3isi7ZhI/6YVpmzsfcy2aC2e7olVRw52N7h+ivBX6nSVg==",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "3098997b-a081-41ec-aa08-6cdea0028db7",
|
||||
SecurityStamp = "f1e4d7cd-ff9b-428c-9bbf-a560e4607775",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "Admin"
|
||||
},
|
||||
@ -122,7 +123,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
Id = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "b7103a3b-8f05-462d-9fc0-5d4faa4669dc",
|
||||
ConcurrencyStamp = "12929beb-3cd0-4f28-a965-ecb9d0299c86",
|
||||
Email = "paul@exemple.com",
|
||||
EmailConfirmed = false,
|
||||
FirstName = "Paul",
|
||||
@ -130,10 +131,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "PAUL@EXEMPLE.COM",
|
||||
NormalizedUserName = "PASLA",
|
||||
PasswordHash = "AQAAAAEAACcQAAAAEN68b+gEQV5Vx2grBL94+BzugXFrgXko6KtdY3p/NJN17mk8QCpGlQfJ3BMe040+dg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEN5YIl6BfmRcgns81BzscQa5/UmHzZxkoBraDPod7EFwjxYL0KJCneEimbytwK91lQ==",
|
||||
PhoneNumber = "222-222-2222",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "99183d90-1f1c-4a8e-9891-ea8ab3b714d0",
|
||||
SecurityStamp = "5a5c5690-7ac8-4cb6-8820-b840f5a0e4f6",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "PasLa"
|
||||
});
|
||||
@ -145,7 +146,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Appartment")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -229,11 +230,14 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<long>("AmountInCents")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("BillingAddressId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CurrencyCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -246,6 +250,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastFourDigits")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -260,6 +268,8 @@ namespace GrossesMitainesAPI.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BillingAddressId");
|
||||
|
||||
b.ToTable("ChargesModel");
|
||||
});
|
||||
|
||||
@ -269,7 +279,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.IsRequired()
|
||||
@ -323,7 +333,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9261),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7175),
|
||||
ShippingAddressId = 1,
|
||||
Status = 0
|
||||
},
|
||||
@ -335,7 +345,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9300),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7234),
|
||||
ShippingAddressId = 1,
|
||||
Status = 1
|
||||
},
|
||||
@ -347,7 +357,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9327),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7236),
|
||||
ShippingAddressId = 1,
|
||||
Status = 3
|
||||
},
|
||||
@ -359,7 +369,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9333),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7238),
|
||||
ShippingAddressId = 1,
|
||||
Status = 4
|
||||
},
|
||||
@ -371,7 +381,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9338),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7240),
|
||||
ShippingAddressId = 1,
|
||||
Status = 5
|
||||
},
|
||||
@ -382,7 +392,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
FirstName = "Jérémy",
|
||||
LastName = "Le Petit",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9344),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7242),
|
||||
ShippingAddressId = 2,
|
||||
Status = 0
|
||||
},
|
||||
@ -394,7 +404,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "A.",
|
||||
LinkedAccountId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9357),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7259),
|
||||
ShippingAddressId = 3,
|
||||
Status = 3
|
||||
});
|
||||
@ -406,7 +416,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("InvoiceModelId")
|
||||
.HasColumnType("int");
|
||||
@ -560,7 +570,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
@ -1059,14 +1069,12 @@ namespace GrossesMitainesAPI.Migrations
|
||||
new
|
||||
{
|
||||
Id = "c9e08b20-d8a5-473f-9f52-572eb23c12af",
|
||||
ConcurrencyStamp = "eac9c483-2e9f-4f9e-9b97-dc1c761f76c2",
|
||||
Name = "Administrateur",
|
||||
NormalizedName = "ADMINISTRATEUR"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "1b7b9c55-c746-493a-a24f-3d5ca937298e",
|
||||
ConcurrencyStamp = "fb8da1f2-a9df-4faa-9786-259cbc8c6f1c",
|
||||
Name = "Client",
|
||||
NormalizedName = "CLIENT"
|
||||
});
|
||||
@ -1078,7 +1086,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -1103,7 +1111,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -1202,6 +1210,17 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.HasForeignKey("InventoryUserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Models.ChargesModel", b =>
|
||||
{
|
||||
b.HasOne("GrossesMitainesAPI.Models.AddressModel", "BillingAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("BillingAddressId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BillingAddress");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Models.InvoiceModel", b =>
|
||||
{
|
||||
b.HasOne("GrossesMitainesAPI.Data.InventoryUser", "LinkedAccount")
|
@ -3,10 +3,14 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
@ -50,25 +54,6 @@ namespace GrossesMitainesAPI.Migrations
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChargesModel",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Token = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
AmountInCents = table.Column<long>(type: "bigint", nullable: false),
|
||||
CurrencyCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChargesModel", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
@ -224,6 +209,33 @@ namespace GrossesMitainesAPI.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ChargesModel",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Token = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
AmountInCents = table.Column<long>(type: "bigint", nullable: false),
|
||||
CurrencyCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LastFourDigits = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
BillingAddressId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ChargesModel", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ChargesModel_Addresses_BillingAddressId",
|
||||
column: x => x.BillingAddressId,
|
||||
principalTable: "Addresses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Invoices",
|
||||
columns: table => new
|
||||
@ -297,8 +309,8 @@ namespace GrossesMitainesAPI.Migrations
|
||||
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "1b7b9c55-c746-493a-a24f-3d5ca937298e", "fb8da1f2-a9df-4faa-9786-259cbc8c6f1c", "Client", "CLIENT" },
|
||||
{ "c9e08b20-d8a5-473f-9f52-572eb23c12af", "eac9c483-2e9f-4f9e-9b97-dc1c761f76c2", "Administrateur", "ADMINISTRATEUR" }
|
||||
{ "1b7b9c55-c746-493a-a24f-3d5ca937298e", null, "Client", "CLIENT" },
|
||||
{ "c9e08b20-d8a5-473f-9f52-572eb23c12af", null, "Administrateur", "ADMINISTRATEUR" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
@ -306,8 +318,8 @@ namespace GrossesMitainesAPI.Migrations
|
||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", 0, "b7103a3b-8f05-462d-9fc0-5d4faa4669dc", "paul@exemple.com", false, "Paul", "A.", false, null, "PAUL@EXEMPLE.COM", "PASLA", "AQAAAAEAACcQAAAAEN68b+gEQV5Vx2grBL94+BzugXFrgXko6KtdY3p/NJN17mk8QCpGlQfJ3BMe040+dg==", "222-222-2222", false, "99183d90-1f1c-4a8e-9891-ea8ab3b714d0", false, "PasLa" },
|
||||
{ "ecf7503a-591c-454e-a824-048e10bd0474", 0, "61f3249f-495f-48c8-ac7e-7d21b3da82c7", "admin@admin.com", false, "Roger", "Admin", false, null, "ADMIN@ADMIN.COM", "ADMIN", "AQAAAAEAACcQAAAAELswgBNsSfJwmigdKX2rpHseOEi20F+ZUhxapu80HTnxZamC3lu1hyAGMXj4kQumMw==", "111-111-1111", false, "3098997b-a081-41ec-aa08-6cdea0028db7", false, "Admin" }
|
||||
{ "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", 0, "12929beb-3cd0-4f28-a965-ecb9d0299c86", "paul@exemple.com", false, "Paul", "A.", false, null, "PAUL@EXEMPLE.COM", "PASLA", "AQAAAAIAAYagAAAAEN5YIl6BfmRcgns81BzscQa5/UmHzZxkoBraDPod7EFwjxYL0KJCneEimbytwK91lQ==", "222-222-2222", false, "5a5c5690-7ac8-4cb6-8820-b840f5a0e4f6", false, "PasLa" },
|
||||
{ "ecf7503a-591c-454e-a824-048e10bd0474", 0, "88a1532a-3749-409e-8463-7f68f04c2225", "admin@admin.com", false, "Roger", "Admin", false, null, "ADMIN@ADMIN.COM", "ADMIN", "AQAAAAIAAYagAAAAEOixAy1U6YTbU41EkE4Yb3isi7ZhI/6YVpmzsfcy2aC2e7olVRw52N7h+ivBX6nSVg==", "111-111-1111", false, "f1e4d7cd-ff9b-428c-9bbf-a560e4607775", false, "Admin" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
@ -366,34 +378,26 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{ "c9e08b20-d8a5-473f-9f52-572eb23c12af", "ecf7503a-591c-454e-a824-048e10bd0474" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Invoices",
|
||||
columns: new[] { "Id", "EmailAddress", "FirstName", "LastName", "LinkedAccountId", "PaymentId", "PhoneNumber", "PurchaseDate", "ShippingAddressId", "Status" },
|
||||
values: new object[] { 6, "test@admin.com", "Jérémy", "Le Petit", null, null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9344), 2, 0 });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Invoices",
|
||||
columns: new[] { "Id", "EmailAddress", "FirstName", "LastName", "LinkedAccountId", "PaymentId", "PhoneNumber", "PurchaseDate", "ShippingAddressId", "Status" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9261), 1, 0 },
|
||||
{ 2, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9300), 1, 1 },
|
||||
{ 3, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9327), 1, 3 },
|
||||
{ 4, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9333), 1, 4 },
|
||||
{ 5, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9338), 1, 5 },
|
||||
{ 7, "paul@exemple.com", "Paul", "A.", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", null, "111-111-1111", new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9357), 3, 3 }
|
||||
{ 6, "test@admin.com", "Jérémy", "Le Petit", null, null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7242), 2, 0 },
|
||||
{ 1, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7175), 1, 0 },
|
||||
{ 2, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7234), 1, 1 },
|
||||
{ 3, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7236), 1, 3 },
|
||||
{ 4, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7238), 1, 4 },
|
||||
{ 5, "admin@admin.com", "Roger", "Admin", "ecf7503a-591c-454e-a824-048e10bd0474", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7240), 1, 5 },
|
||||
{ 7, "paul@exemple.com", "Paul", "A.", "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", null, "111-111-1111", new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7259), 3, 3 }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ProductInvoice",
|
||||
columns: new[] { "Id", "InvoiceModelId", "ProductId", "Quantity" },
|
||||
values: new object[] { 16, 6, 20, 4L });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ProductInvoice",
|
||||
columns: new[] { "Id", "InvoiceModelId", "ProductId", "Quantity" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 16, 6, 20, 4L },
|
||||
{ 1, 1, 1, 2L },
|
||||
{ 2, 1, 4, 5L },
|
||||
{ 3, 2, 3, 1L },
|
||||
@ -457,6 +461,11 @@ namespace GrossesMitainesAPI.Migrations
|
||||
unique: true,
|
||||
filter: "[NormalizedUserName] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ChargesModel_BillingAddressId",
|
||||
table: "ChargesModel",
|
||||
column: "BillingAddressId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Invoices_LinkedAccountId",
|
||||
table: "Invoices",
|
||||
@ -483,6 +492,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
column: "ProductId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
@ -513,10 +523,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Addresses");
|
||||
name: "ChargesModel");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ChargesModel");
|
||||
name: "Addresses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUsers");
|
@ -17,10 +17,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.10")
|
||||
.HasAnnotation("ProductVersion", "7.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Data.InventoryUser", b =>
|
||||
{
|
||||
@ -101,7 +101,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
Id = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "61f3249f-495f-48c8-ac7e-7d21b3da82c7",
|
||||
ConcurrencyStamp = "88a1532a-3749-409e-8463-7f68f04c2225",
|
||||
Email = "admin@admin.com",
|
||||
EmailConfirmed = false,
|
||||
FirstName = "Roger",
|
||||
@ -109,10 +109,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@ADMIN.COM",
|
||||
NormalizedUserName = "ADMIN",
|
||||
PasswordHash = "AQAAAAEAACcQAAAAELswgBNsSfJwmigdKX2rpHseOEi20F+ZUhxapu80HTnxZamC3lu1hyAGMXj4kQumMw==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEOixAy1U6YTbU41EkE4Yb3isi7ZhI/6YVpmzsfcy2aC2e7olVRw52N7h+ivBX6nSVg==",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "3098997b-a081-41ec-aa08-6cdea0028db7",
|
||||
SecurityStamp = "f1e4d7cd-ff9b-428c-9bbf-a560e4607775",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "Admin"
|
||||
},
|
||||
@ -120,7 +120,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
{
|
||||
Id = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "b7103a3b-8f05-462d-9fc0-5d4faa4669dc",
|
||||
ConcurrencyStamp = "12929beb-3cd0-4f28-a965-ecb9d0299c86",
|
||||
Email = "paul@exemple.com",
|
||||
EmailConfirmed = false,
|
||||
FirstName = "Paul",
|
||||
@ -128,10 +128,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "PAUL@EXEMPLE.COM",
|
||||
NormalizedUserName = "PASLA",
|
||||
PasswordHash = "AQAAAAEAACcQAAAAEN68b+gEQV5Vx2grBL94+BzugXFrgXko6KtdY3p/NJN17mk8QCpGlQfJ3BMe040+dg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEN5YIl6BfmRcgns81BzscQa5/UmHzZxkoBraDPod7EFwjxYL0KJCneEimbytwK91lQ==",
|
||||
PhoneNumber = "222-222-2222",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "99183d90-1f1c-4a8e-9891-ea8ab3b714d0",
|
||||
SecurityStamp = "5a5c5690-7ac8-4cb6-8820-b840f5a0e4f6",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "PasLa"
|
||||
});
|
||||
@ -143,7 +143,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Appartment")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -227,11 +227,14 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<long>("AmountInCents")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("BillingAddressId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CurrencyCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -244,6 +247,10 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastFourDigits")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -258,6 +265,8 @@ namespace GrossesMitainesAPI.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BillingAddressId");
|
||||
|
||||
b.ToTable("ChargesModel");
|
||||
});
|
||||
|
||||
@ -267,7 +276,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("EmailAddress")
|
||||
.IsRequired()
|
||||
@ -321,7 +330,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9261),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7175),
|
||||
ShippingAddressId = 1,
|
||||
Status = 0
|
||||
},
|
||||
@ -333,7 +342,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9300),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7234),
|
||||
ShippingAddressId = 1,
|
||||
Status = 1
|
||||
},
|
||||
@ -345,7 +354,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9327),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7236),
|
||||
ShippingAddressId = 1,
|
||||
Status = 3
|
||||
},
|
||||
@ -357,7 +366,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9333),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7238),
|
||||
ShippingAddressId = 1,
|
||||
Status = 4
|
||||
},
|
||||
@ -369,7 +378,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "Admin",
|
||||
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9338),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7240),
|
||||
ShippingAddressId = 1,
|
||||
Status = 5
|
||||
},
|
||||
@ -380,7 +389,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
FirstName = "Jérémy",
|
||||
LastName = "Le Petit",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9344),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7242),
|
||||
ShippingAddressId = 2,
|
||||
Status = 0
|
||||
},
|
||||
@ -392,7 +401,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
LastName = "A.",
|
||||
LinkedAccountId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
|
||||
PhoneNumber = "111-111-1111",
|
||||
PurchaseDate = new DateTime(2022, 12, 4, 9, 8, 50, 6, DateTimeKind.Local).AddTicks(9357),
|
||||
PurchaseDate = new DateTime(2022, 12, 12, 12, 26, 42, 867, DateTimeKind.Local).AddTicks(7259),
|
||||
ShippingAddressId = 3,
|
||||
Status = 3
|
||||
});
|
||||
@ -404,7 +413,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("InvoiceModelId")
|
||||
.HasColumnType("int");
|
||||
@ -558,7 +567,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
@ -1057,14 +1066,12 @@ namespace GrossesMitainesAPI.Migrations
|
||||
new
|
||||
{
|
||||
Id = "c9e08b20-d8a5-473f-9f52-572eb23c12af",
|
||||
ConcurrencyStamp = "eac9c483-2e9f-4f9e-9b97-dc1c761f76c2",
|
||||
Name = "Administrateur",
|
||||
NormalizedName = "ADMINISTRATEUR"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = "1b7b9c55-c746-493a-a24f-3d5ca937298e",
|
||||
ConcurrencyStamp = "fb8da1f2-a9df-4faa-9786-259cbc8c6f1c",
|
||||
Name = "Client",
|
||||
NormalizedName = "CLIENT"
|
||||
});
|
||||
@ -1076,7 +1083,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -1101,7 +1108,7 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@ -1200,6 +1207,17 @@ namespace GrossesMitainesAPI.Migrations
|
||||
.HasForeignKey("InventoryUserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Models.ChargesModel", b =>
|
||||
{
|
||||
b.HasOne("GrossesMitainesAPI.Models.AddressModel", "BillingAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("BillingAddressId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BillingAddress");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GrossesMitainesAPI.Models.InvoiceModel", b =>
|
||||
{
|
||||
b.HasOne("GrossesMitainesAPI.Data.InventoryUser", "LinkedAccount")
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace GrossesMitainesAPI.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace GrossesMitainesAPI.Models;
|
||||
public class ChargeReturnModel {
|
||||
public string Token { get; set; }
|
||||
public string Description { get; set; }
|
||||
@ -8,4 +10,6 @@ public class ChargeReturnModel {
|
||||
public string Email { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public int Invoice { get; set; }
|
||||
public string LastFourDigits { get; set; }
|
||||
public AddressModel ShippingAddress { get; set; }
|
||||
}
|
||||
|
@ -11,4 +11,6 @@ public class ChargesModel {
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string LastFourDigits { get; set; }
|
||||
public AddressModel BillingAddress { get; set; }
|
||||
}
|
||||
|
@ -35,4 +35,21 @@ namespace GrossesMitainesAPI.Models;
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string LastFourDigits { get; set; }
|
||||
|
||||
|
||||
[Required, Range(1, int.MaxValue)]
|
||||
public int BillCivicNumber { get; set; }
|
||||
public string? BillAppartment { get; set; }
|
||||
[Required, MinLength(3), MaxLength(50)]
|
||||
public string BillStreet { get; set; }
|
||||
[Required, MinLength(4), MaxLength(50)]
|
||||
public string BillCity { get; set; }
|
||||
[Required, MaxLength(3)]
|
||||
public string BillProvince { get; set; }
|
||||
[Required, MinLength(4), MaxLength(30)]
|
||||
public string BillCountry { get; set; }
|
||||
// Source pour regex: https://stackoverflow.com/questions/15774555/efficient-regex-for-canadian-postal-code-function
|
||||
//[Required, RegularExpression(@"/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i")]
|
||||
public string BillPostalCode { get; set; }
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
"DefaultConnection": "Server=(localdb)\\mssqllocaldb; Database=GrossesMitainesDB; Trusted_Connection=True; MultipleActiveResultSets=true"
|
||||
},
|
||||
"StripeTest": {
|
||||
"PublicKey": "pk_test_",
|
||||
"SecretKey": "sk_test_"
|
||||
"PublicKey": "pk_test_51M8mzOEerenEZcQIUmJIrmsaZeeNlOil2G1JcMvvO68w50MJr8rDwUjVO44a8dDhSlsRH4GdzH9rDqtkg4Rtbzco00NqkHdn3H",
|
||||
"SecretKey": "sk_test_51M8mzOEerenEZcQIyHb9AdeluhDsSy9PaxTeqDq6XUhSRCbbqvReHA2KoFb3a8Ru5PAzMgMlCKmj8UDpLKWzUUmr00rta511y8"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { faTimes } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { weight } from "fontawesome";
|
||||
|
||||
const InvoiceItem = ({ invoice, onCancel }) => {
|
||||
const InvoiceItem = ({ invoice, onCancel, paymentInfos }) => {
|
||||
|
||||
const productTotal = (p) => {
|
||||
return (p.quantity * (p.product.status == 3 || p.product.status == 4 ? p.product.promoPrice : p.product.price))
|
||||
@ -81,9 +82,8 @@ const InvoiceItem = ({ invoice, onCancel }) => {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
console.log(invoice);
|
||||
return (
|
||||
|
||||
<div className="invoice-item-container">
|
||||
<div className="invoice-item-info">
|
||||
{invoice.status != null ?
|
||||
@ -94,12 +94,26 @@ const InvoiceItem = ({ invoice, onCancel }) => {
|
||||
null
|
||||
}
|
||||
<div className="invoice-item-expedition">
|
||||
<b>Adresse d'expédition:</b><br />
|
||||
<b>Adresse d'expédition :</b><br />
|
||||
{invoice.firstName} {invoice.lastName}<br />
|
||||
{invoice.shippingAddress.civicNumber} {invoice.shippingAddress.street} <br />
|
||||
{invoice.shippingAddress.appartment != null ? <>App: {invoice.shippingAddress.appartment} <br /></> : null}
|
||||
{invoice.shippingAddress.city}, {invoice.shippingAddress.province} {invoice.shippingAddress.postalCode}<br />
|
||||
{invoice.shippingAddress.country}<br />
|
||||
{invoice.shippingAddress.country}<br /><br/>
|
||||
{paymentInfos == true && invoice.payment != null ? <>
|
||||
<label style={{"fontWeight": "bold"}}>Informations de paiement :</label><br/>
|
||||
Nom : {invoice.payment.name}<br/>
|
||||
Email : {invoice.payment.email}<br/>
|
||||
Téléphone : {invoice.payment.phone}<br/>
|
||||
Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}<br/><br/>
|
||||
<label style={{"fontWeight": "bold"}}>Adresse de Facturation :</label><br/>
|
||||
{invoice.payment.billingAddress.civicNumber} {invoice.payment.billingAddress.street} <br />
|
||||
{invoice.payment.billingAddress.appartment != null ? <>App: {invoice.payment.billingAddress.appartment} <br /></> : null}
|
||||
{invoice.payment.billingAddress.city}, {invoice.payment.billingAddress.province} {invoice.payment.billingAddress.postalCode}<br />
|
||||
{invoice.payment.billingAddress.country}<br /><br/>
|
||||
</>
|
||||
: null }
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className="invoice-item-products">
|
||||
|
@ -1,6 +1,6 @@
|
||||
import InvoiceItem from "./InvoiceItem";
|
||||
|
||||
const InvoiceList = ({ invoices, onCancel }) => {
|
||||
const InvoiceList = ({ invoices, onCancel, paymentInfos }) => {
|
||||
return (
|
||||
<div className="invoice-list-container">
|
||||
{invoices.map((invoice) => (
|
||||
@ -8,6 +8,7 @@ const InvoiceList = ({ invoices, onCancel }) => {
|
||||
key={invoice.id}
|
||||
invoice={invoice}
|
||||
onCancel={onCancel}
|
||||
paymentInfos={paymentInfos}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
@ -1,6 +1,12 @@
|
||||
import React, { useState } from "react"
|
||||
import React, { useState, useContext, useEffect } from "react"
|
||||
import { CardElement, useElements, useStripe } from "@stripe/react-stripe-js"
|
||||
import { Button } from "react-bootstrap"
|
||||
import { Row, Col, Button, Form } from "react-bootstrap"
|
||||
import Swal from "sweetalert2";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
import { CartContext } from "../components/Cart";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useForm } from "react-hook-form";
|
||||
import Cookies from "universal-cookie";
|
||||
|
||||
const CARD_OPTIONS = {
|
||||
iconStyle: "solid",
|
||||
@ -24,16 +30,84 @@ const CARD_OPTIONS = {
|
||||
|
||||
|
||||
|
||||
const PaymentForm = ({ cost }) => {
|
||||
const PaymentForm = ({ cost, invoice }) => {
|
||||
const navigate = useNavigate();
|
||||
const { register, handleSubmit, setValue, formState: { errors } } = useForm();
|
||||
const cookies = new Cookies();
|
||||
|
||||
const [success, setSuccess] = useState(false);
|
||||
const mySwal = withReactContent(Swal);
|
||||
const [cardName, setCardName] = useState("");
|
||||
const [cardPhone, setCardPhone] = useState("");
|
||||
const [cardEmail, setCardEmail] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const [userAddresses, setUserAddresses] = useState([]);
|
||||
const [currentAdress, setCurrentAdress] = useState({
|
||||
civicNumber: "",
|
||||
appartment: "",
|
||||
street: "",
|
||||
city: "",
|
||||
province: "",
|
||||
country: "",
|
||||
postalCode: ""
|
||||
})
|
||||
|
||||
|
||||
const stripe = useStripe();
|
||||
const elements = useElements();
|
||||
const cart = useContext(CartContext);
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const { error, paymentMethod } = await stripe.createPaymentMethod({
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const userInfo = cookies.get("GMGM");
|
||||
if (userInfo != null && userInfo.LoggedIn == true) {
|
||||
fetch("https://localhost:7292/api/Address", {
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
mode: 'cors'
|
||||
},).then(async (response) => {
|
||||
if (response.ok) {
|
||||
const json = await response.json();
|
||||
setUserAddresses(json);
|
||||
if (json.length >= 1) {
|
||||
setFormAddress(json[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
const setFormAddress = (address) => {
|
||||
setCurrentAdress((e) => {
|
||||
return {
|
||||
...e,
|
||||
civicNumber: address.civicNumber,
|
||||
appartment: address.appartment,
|
||||
street: address.street,
|
||||
city: address.city,
|
||||
province: address.province,
|
||||
country: address.country,
|
||||
postalCode: address.postalCode
|
||||
}
|
||||
});
|
||||
|
||||
setValue("civicNumber", address.civicNumber);
|
||||
setValue("appartment", address.appartment);
|
||||
setValue("street", address.street);
|
||||
setValue("city", address.city);
|
||||
setValue("province", address.province);
|
||||
setValue("country", address.country);
|
||||
setValue("postalCode", address.postalCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const onSubmit = async (e) => {
|
||||
//e.preventDefault();
|
||||
setIsLoading(true);
|
||||
const { error } = await stripe.createPaymentMethod({
|
||||
type: "card",
|
||||
card: elements.getElement(CardElement)
|
||||
})
|
||||
@ -44,32 +118,62 @@ const PaymentForm = ({ cost }) => {
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
const { id } = paymentMethod;
|
||||
stripe.createToken(elements.getElement(CardElement), { name: cardName })
|
||||
.then((result) => {
|
||||
if (!result.error) {
|
||||
invoice.token = result.token.id;
|
||||
invoice.description = `Payement de ${cost} à GM`;
|
||||
invoice.amountInCents = cost;
|
||||
invoice.currencyCode = "CAD";
|
||||
invoice.name = cardName;
|
||||
invoice.email = cardEmail;
|
||||
invoice.phone = cardPhone;
|
||||
invoice.lastFourDigits = result.token.card.last4;
|
||||
invoice.billCivicNumber = currentAdress.civicNumber;
|
||||
invoice.billAppartment = currentAdress.appartment;
|
||||
invoice.billStreet = currentAdress.street;
|
||||
invoice.billCity = currentAdress.city;
|
||||
invoice.billProvince = currentAdress.province;
|
||||
invoice.billCountry = currentAdress.country;
|
||||
invoice.billPostalCode = currentAdress.postalCode;
|
||||
|
||||
const json = JSON.stringify({ amount: cost, stripeId: id });
|
||||
|
||||
|
||||
fetch(`https://localhost:7292/api/Payment`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: json
|
||||
}).then((response) => {
|
||||
if (response.ok) {
|
||||
console.log("Successful payment");
|
||||
setSuccess(true);
|
||||
}
|
||||
else {
|
||||
console.log(response);
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("Error: ", error);
|
||||
})
|
||||
const json = JSON.stringify(invoice);
|
||||
console.log(invoice);
|
||||
|
||||
fetch(`https://localhost:7292/api/Invoice`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: json
|
||||
}).then((response) => {
|
||||
if (response.ok) {
|
||||
mySwal.fire({
|
||||
title: 'Commande envoyée avec succès!',
|
||||
timer: 2000,
|
||||
icon: "success"
|
||||
}).then(
|
||||
() => {
|
||||
cart.emptyCart();
|
||||
navigate('/myInvoices');
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
mySwal.fire({
|
||||
title: 'Erreur!',
|
||||
timer: 2000,
|
||||
icon: "error"
|
||||
}).then(() => {
|
||||
setIsLoading(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(error.message);
|
||||
@ -80,24 +184,113 @@ const PaymentForm = ({ cost }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{!success ?
|
||||
<form onSubmit={handleSubmit}>
|
||||
<fieldset className="FormGroup">
|
||||
<input className="FormRow" placeholder="Cardholder Name" id="cardholder-name" type="text" value={cardName} onChange={e => setCardName(e.target.value)} />
|
||||
<div className="FormRow">
|
||||
<CardElement options={CARD_OPTIONS} />
|
||||
{
|
||||
<Col xl={4}>
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<div style={{ "borderRadius": "5px" }} className="form-container">
|
||||
|
||||
|
||||
<h4 className="text-center">Adresse de Facturation</h4>
|
||||
<div className="Error_color">
|
||||
<div className="formulaire-address">
|
||||
<h5>
|
||||
Adresse
|
||||
<Form.Select onChange={(e) => setFormAddress(userAddresses[e.target.value])}>
|
||||
{userAddresses.map((a, i) => (
|
||||
<option key={a.id} value={i} >{a.civicNumber} {a.street} </option>
|
||||
))}
|
||||
</Form.Select>
|
||||
</h5>
|
||||
<div className="form-group">
|
||||
<label>Numéro civique*: </label>
|
||||
<input type="number" min="0" {...register("civicNumber", { required: true })}
|
||||
value={currentAdress.civicNumber}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, civicNumber: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.civicNumber && errors.civicNumber.type === 'required' && <span>Vous devez entrer une numéro civique!</span>}
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Rue*: </label>
|
||||
<input {...register("street", { required: true, minLength: 3, maxLength: 50 })}
|
||||
value={currentAdress.street}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, street: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.street && errors.street.type === 'required' && <span>Vous devez entrer votre rue!</span>}
|
||||
{errors.street && errors.street.type === 'minLength' && <span>Votre rue doit avoir au moins 3 lettres!</span>}
|
||||
{errors.street && errors.street.type === 'maxLength' && <span>Votre rue doit avoir moins de 51 lettres!</span>}
|
||||
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Numéro d'appartement: </label>
|
||||
<input {...register("appartment", { required: false })}
|
||||
value={currentAdress.appartment}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, appartment: e.target.value } })} />
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Ville*: </label>
|
||||
<input {...register("city", { required: true, minLength: 4, maxLength: 50 })}
|
||||
value={currentAdress.city}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, city: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.city && errors.city.type === 'required' && <span>Vous devez entrer votre ville!</span>}
|
||||
{errors.city && errors.city.type === 'minLength' && <span>Votre ville doit avoir au moins 4 lettres!</span>}
|
||||
{errors.city && errors.city.type === 'maxLength' && <span>Votre ville doit avoir moins de 51 lettres!</span>}
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Province (abréviation)*: </label>
|
||||
<input placeholder="Exemple: QC" {...register("province", { required: true, maxLength: 3 })}
|
||||
value={currentAdress.province}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, province: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.province && errors.province.type === 'required' && <span>Vous devez entrer votre province!</span>}
|
||||
{errors.province && errors.province.type === 'maxLength' && <span>Votre province doit avoir moins de 4 lettres!</span>}
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Pays*: </label>
|
||||
<input {...register("country", { required: true, minLength: 4, maxLength: 30 })}
|
||||
value={currentAdress.country}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, country: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.country && errors.country.type === 'required' && <span>Vous devez entrer votre pays!</span>}
|
||||
{errors.country && errors.country.type === 'minLength' && <span>Votre pays doit avoir au moins 4 lettres!</span>}
|
||||
{errors.cicountryty && errors.country.type === 'maxLength' && <span>Votre pays doit avoir moins de 31 lettres!</span>}
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label>Code postal*: </label>
|
||||
<input {...register("postalCode", { required: true, pattern: /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i })}
|
||||
value={currentAdress.postalCode}
|
||||
onChange={(e) => setCurrentAdress((prev) => { return { ...prev, postalCode: e.target.value } })} />
|
||||
</div>
|
||||
<div>
|
||||
{errors.postalCode && errors.postalCode.type === 'required' && <span>Vous devez entrer votre code postal!</span>}
|
||||
{errors.postalCode && errors.postalCode.type === 'pattern' && <span>Veuillez entrer un code postal valide!</span>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div className="Payment-btn-container">
|
||||
<Button className="Payment-btn" type="submit">Payer</Button>
|
||||
</div>
|
||||
</form>
|
||||
:
|
||||
<div>
|
||||
<h2>
|
||||
L'achat s'est déroulé avec succès
|
||||
</h2>
|
||||
</div>
|
||||
<Col md={12}>
|
||||
<fieldset className="FormGroup">
|
||||
<input className="FormRow cardholder-info" placeholder="Nom sur la carte" id="cardholder-name" type="text" value={cardName} onChange={e => setCardName(e.target.value)} />
|
||||
<input className="FormRow cardholder-info" placeholder="Téléphone de facturation" id="cardholder-phone" type="text" value={cardPhone} onChange={e => setCardPhone(e.target.value)} />
|
||||
<input className="FormRow cardholder-info" placeholder="Addresse courriel de facturation" id="cardholder-email" type="text" value={cardEmail} onChange={e => setCardEmail(e.target.value)} />
|
||||
<div className="FormRow">
|
||||
<CardElement options={CARD_OPTIONS} />
|
||||
</div>
|
||||
</fieldset>
|
||||
<div className="Payment-btn-container">
|
||||
<Button className="Payment-btn" disabled={isLoading} type="submit">Payer</Button>
|
||||
{
|
||||
isLoading && <div>Paiement en cours...</div>
|
||||
}
|
||||
</div>
|
||||
</Col>
|
||||
</form>
|
||||
</Col>
|
||||
}
|
||||
</>
|
||||
)
|
||||
|
@ -7,10 +7,10 @@ const PUBLIC_KEY = "pk_test_51M8mzOEerenEZcQIUmJIrmsaZeeNlOil2G1JcMvvO68w50MJr8r
|
||||
|
||||
const stripeTestPromise = loadStripe(PUBLIC_KEY);
|
||||
|
||||
const StripeContainer = ({cost}) => {
|
||||
const StripeContainer = ({cost, invoice}) => {
|
||||
return (
|
||||
<Elements stripe={stripeTestPromise}>
|
||||
<PaymentForm cost={cost}/>
|
||||
<PaymentForm cost={cost} invoice={invoice} />
|
||||
</Elements>
|
||||
)
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ const Invoices = () => {
|
||||
<InvoiceList
|
||||
invoices={invoices}
|
||||
onCancel={handleCancelInvoice}
|
||||
paymentInfos={false}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -69,12 +69,12 @@ const MyInvoices = () => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<InvoiceList
|
||||
invoices={invoices}
|
||||
onCancel={handleCancelInvoice}
|
||||
paymentInfos={true}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -4,8 +4,6 @@ import ReviewProdList from "../components/ReviewProdList";
|
||||
import TotalProductsPrice from "../components/TotalProductsPrice";
|
||||
import { Row, Col, Button } from "react-bootstrap";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Swal from "sweetalert2";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
import { CartContext } from "../components/Cart";
|
||||
import StripeContainer from "../components/StripeContainer"
|
||||
|
||||
@ -13,7 +11,7 @@ const ReviewInvoice = () => {
|
||||
|
||||
|
||||
const navigate = useNavigate();
|
||||
const mySwal = withReactContent(Swal);
|
||||
|
||||
|
||||
const cart = useContext(CartContext);
|
||||
|
||||
@ -90,47 +88,48 @@ const ReviewInvoice = () => {
|
||||
navigate("/formulaire")
|
||||
}
|
||||
|
||||
const handleConfirmer = async () => {
|
||||
const json = JSON.stringify(thisInvoice);
|
||||
|
||||
const response = await fetch(`https://localhost:7292/api/Invoice`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: json
|
||||
})
|
||||
if (response.ok) {
|
||||
mySwal.fire({
|
||||
title: 'Commande envoyée avec succès!',
|
||||
timer: 2000,
|
||||
icon: "success"
|
||||
}).then(
|
||||
() => {
|
||||
cart.emptyCart();
|
||||
navigate('/morceaux');
|
||||
}
|
||||
)
|
||||
}
|
||||
else {
|
||||
console.log("Erreur de creation la commande #" + thisInvoice.id);
|
||||
mySwal.fire({
|
||||
title: 'Erreur!',
|
||||
timer: 2000,
|
||||
icon: "error"
|
||||
})
|
||||
}
|
||||
// const handleConfirmer = async () => {
|
||||
// const json = JSON.stringify(thisInvoice);
|
||||
|
||||
}
|
||||
// const response = await fetch(`https://localhost:7292/api/Invoice`, {
|
||||
// method: 'POST',
|
||||
// credentials: 'include',
|
||||
// mode: 'cors',
|
||||
// headers: {
|
||||
// 'Accept': 'application/json',
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// body: json
|
||||
// })
|
||||
// if (response.ok) {
|
||||
// mySwal.fire({
|
||||
// title: 'Commande envoyée avec succès!',
|
||||
// timer: 2000,
|
||||
// icon: "success"
|
||||
// }).then(
|
||||
// () => {
|
||||
// cart.emptyCart();
|
||||
// navigate('/morceaux');
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// else {
|
||||
// console.log("Erreur de creation la commande #" + thisInvoice.id);
|
||||
// mySwal.fire({
|
||||
// title: 'Erreur!',
|
||||
// timer: 2000,
|
||||
// icon: "error"
|
||||
// })
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row>
|
||||
<h2 className="confirmer-infos">Veuillez confirmer les informations ci-dessous!</h2>
|
||||
<Col xs={6} md={4}>
|
||||
<Col xs={6} xl={4}>
|
||||
|
||||
<div className="review-invoice-info">
|
||||
<div>
|
||||
@ -177,21 +176,21 @@ const ReviewInvoice = () => {
|
||||
<TotalProductsPrice
|
||||
/>
|
||||
</div>
|
||||
<Row className="invoice-buttons">
|
||||
{/* <Col xs={6}>
|
||||
<Row className="invoice-buttons">
|
||||
{/* <Col xs={6}>
|
||||
<Button className="invoice-button confirmer" onClick={handleConfirmer}>Confirmer</Button>
|
||||
</Col> */}
|
||||
<Col xs={12}>
|
||||
<Button className="invoice-button modifier" onClick={handleModify}>Modifier</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
<Col xs={12}>
|
||||
<Button className="invoice-button modifier" onClick={handleModify}>Modifier</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Col xs={6} md={8}>
|
||||
<Col xs={6} xl={4}>
|
||||
<ReviewProdList
|
||||
/>
|
||||
</Col>
|
||||
<StripeContainer cost={total} invoice={thisInvoice} />
|
||||
</Row>
|
||||
<StripeContainer cost={total} />
|
||||
</>
|
||||
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ a {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#cardholder-name {
|
||||
.cardholder-info {
|
||||
background-color: transparent;
|
||||
border:none;
|
||||
color:white;
|
||||
|
Loading…
Reference in New Issue
Block a user