From 6167c0ab742effe947505cabf16ed1cb160003fa Mon Sep 17 00:00:00 2001 From: Evgenii Kolosov <108291208+Ljutyj@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:33:32 +0300 Subject: [PATCH] * VCST-1659: Added "PromotionName" column to DiscountEntity (#439) --- .../VirtoCommerce.OrdersModule.Core.csproj | 6 +- ...41108155732_OrderPromotionName.Designer.cs | 2070 +++++++++++++++++ .../20241108155732_OrderPromotionName.cs | 30 + .../Migrations/OrderDbContextModelSnapshot.cs | 4 + ...41108155806_OrderPromotionName.Designer.cs | 2019 ++++++++++++++++ .../20241108155806_OrderPromotionName.cs | 29 + .../Migrations/OrderDbContextModelSnapshot.cs | 4 + ...41108155834_OrderPromotionName.Designer.cs | 2020 ++++++++++++++++ .../20241108155834_OrderPromotionName.cs | 29 + .../Migrations/OrderDbContextModelSnapshot.cs | 4 + .../Model/DiscountEntity.cs | 5 + .../Services/CustomerOrderBuilder.cs | 3 +- .../module.manifest | 6 +- ...ustomerOrderServiceImplIntegrationTests.cs | 58 +- 14 files changed, 6255 insertions(+), 32 deletions(-) create mode 100644 src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.Designer.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.Designer.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.Designer.cs create mode 100644 src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.cs diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index a21e7b13..47286f54 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -15,10 +15,10 @@ - - + + - + diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.Designer.cs new file mode 100644 index 00000000..c74602a0 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.Designer.cs @@ -0,0 +1,2070 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241108155732_OrderPromotionName")] + partial class OrderPromotionName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CloseTransaction") + .HasColumnType("tinyint(1)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("HandlingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("HandlingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("IsAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsPrototype") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PaymentTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp(6)"); + + b.Property("ShippingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShippingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("SubTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("SubTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsGift") + .HasColumnType("tinyint(1)"); + + b.Property("IsReccuring") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("tinyint(1)"); + + b.Property("CaptureId") + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime(6)"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("longtext"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("RefundId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestData") + .HasColumnType("longtext"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ResponseData") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("longtext"); + + b.Property("ReasonMessage") + .HasColumnType("longtext"); + + b.Property("RejectReasonMessage") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime(6)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("longtext"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.cs new file mode 100644 index 00000000..e650b3a3 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + /// + public partial class OrderPromotionName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PromotionName", + table: "OrderDiscount", + type: "varchar(128)", + maxLength: 128, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PromotionName", + table: "OrderDiscount"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs index 60239296..d5a39ef2 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs @@ -524,6 +524,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(64) .HasColumnType("varchar(64)"); + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("ShipmentId") .HasColumnType("varchar(128)"); diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.Designer.cs new file mode 100644 index 00000000..22870a33 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.Designer.cs @@ -0,0 +1,2019 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241108155806_OrderPromotionName")] + partial class OrderPromotionName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("CloseTransaction") + .HasColumnType("boolean"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsAnonymous") + .HasColumnType("boolean"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsPrototype") + .HasColumnType("boolean"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsGift") + .HasColumnType("boolean"); + + b.Property("IsReccuring") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BooleanValue") + .HasColumnType("boolean"); + + b.Property("CaptureId") + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DateTimeValue") + .HasColumnType("timestamp with time zone"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IntegerValue") + .HasColumnType("integer"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LongTextValue") + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("RefundId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IsProcessed") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("integer"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RequestData") + .HasColumnType("text"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ResponseData") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("CapturedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("IncomingDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VoidedDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("ReasonCode") + .HasColumnType("text"); + + b.Property("ReasonMessage") + .HasColumnType("text"); + + b.Property("RejectReasonMessage") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("DeliveryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TrackingUrl") + .HasColumnType("text"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.cs new file mode 100644 index 00000000..beebdcc1 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + /// + public partial class OrderPromotionName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PromotionName", + table: "OrderDiscount", + type: "character varying(128)", + maxLength: 128, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PromotionName", + table: "OrderDiscount"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs index adaf22b4..073cfb33 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs @@ -503,6 +503,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(64) .HasColumnType("character varying(64)"); + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + b.Property("ShipmentId") .HasColumnType("character varying(128)"); diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.Designer.cs new file mode 100644 index 00000000..d1e83c11 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.Designer.cs @@ -0,0 +1,2020 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241108155834_OrderPromotionName")] + partial class OrderPromotionName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("CloseTransaction") + .HasColumnType("bit"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsAnonymous") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsPrototype") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsGift") + .HasColumnType("bit"); + + b.Property("IsReccuring") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("bit"); + + b.Property("CaptureId") + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime2"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("RefundId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime2"); + + b.Property("RequestData") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResponseData") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime2"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime2"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime2"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("RejectReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.cs new file mode 100644 index 00000000..5868675c --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + /// + public partial class OrderPromotionName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PromotionName", + table: "OrderDiscount", + type: "nvarchar(128)", + maxLength: 128, + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PromotionName", + table: "OrderDiscount"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs index cff000ba..db9bdc29 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs @@ -503,6 +503,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(64) .HasColumnType("nvarchar(64)"); + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("ShipmentId") .HasColumnType("nvarchar(128)"); diff --git a/src/VirtoCommerce.OrdersModule.Data/Model/DiscountEntity.cs b/src/VirtoCommerce.OrdersModule.Data/Model/DiscountEntity.cs index 1ff9904b..fae24c96 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Model/DiscountEntity.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Model/DiscountEntity.cs @@ -12,6 +12,8 @@ public class DiscountEntity : Entity public string PromotionId { get; set; } [StringLength(1024)] public string PromotionDescription { get; set; } + [StringLength(128)] + public string PromotionName { get; set; } [Required] [StringLength(3)] public string Currency { get; set; } @@ -52,6 +54,7 @@ public virtual Discount ToModel(Discount discount) discount.Description = PromotionDescription; discount.PromotionId = PromotionId; discount.Coupon = CouponCode; + discount.Name = PromotionName; return discount; } @@ -68,6 +71,7 @@ public virtual DiscountEntity FromModel(Discount discount) PromotionDescription = discount.Description; PromotionId = discount.PromotionId; CouponCode = discount.Coupon; + PromotionName = discount.Name; return this; } @@ -80,6 +84,7 @@ public virtual void Patch(DiscountEntity target) target.DiscountAmountWithTax = DiscountAmountWithTax; target.PromotionDescription = PromotionDescription; target.PromotionId = PromotionId; + target.PromotionName = PromotionName; } } } diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index 7a4fb084..8a878337 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -39,7 +39,7 @@ public CustomerOrderBuilder(ICustomerOrderService customerOrderService, ISetting public virtual async Task PlaceCustomerOrderFromCartAsync(ShoppingCart cart) { var customerOrder = ConvertCartToOrder(cart); - await _customerOrderService.SaveChangesAsync(new[] { customerOrder }); + await _customerOrderService.SaveChangesAsync([customerOrder]); return customerOrder; } @@ -305,6 +305,7 @@ protected virtual Discount ToOrderModel(Discount discount) retVal.DiscountAmount = discount.DiscountAmount; retVal.DiscountAmountWithTax = discount.DiscountAmountWithTax; retVal.PromotionId = discount.PromotionId; + retVal.Name = discount.Name; return retVal; } diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index 70117273..d14356e5 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -6,12 +6,12 @@ 3.861.0 - + - + - + diff --git a/tests/VirtoCommerce.OrdersModule.Tests/CustomerOrderServiceImplIntegrationTests.cs b/tests/VirtoCommerce.OrdersModule.Tests/CustomerOrderServiceImplIntegrationTests.cs index 101b5b78..979cf7d8 100644 --- a/tests/VirtoCommerce.OrdersModule.Tests/CustomerOrderServiceImplIntegrationTests.cs +++ b/tests/VirtoCommerce.OrdersModule.Tests/CustomerOrderServiceImplIntegrationTests.cs @@ -156,29 +156,33 @@ private static CustomerOrder GetTestOrder(string id) StoreId = "test store", Addresses = new[] { - new Address { - AddressType = AddressType.Shipping, - City = "london", - Phone = "+68787687", - PostalCode = "22222", - CountryCode = "ENG", - CountryName = "England", - Email = "user@mail.com", - FirstName = "first name", - LastName = "last name", - Line1 = "line 1", - Organization = "org1" - } - }.ToList(), - Discounts = new[] { + new Address + { + AddressType = AddressType.Shipping, + City = "london", + Phone = "+68787687", + PostalCode = "22222", + CountryCode = "ENG", + CountryName = "England", + Email = "user@mail.com", + FirstName = "first name", + LastName = "last name", + Line1 = "line 1", + Organization = "org1" + } + }.ToList(), + Discounts = + [ new Discount - { - PromotionId = "testPromotion", - Currency = "USD", - DiscountAmount = 12, - Coupon = "ssss" + { + PromotionId = "testPromotion", + Name = "Test Promotion", + Description = "This is a test promotion", + Currency = "USD", + DiscountAmount = 12, + Coupon = "ssss" } - } + ] }; var item1 = new LineItem { @@ -193,13 +197,15 @@ private static CustomerOrder GetTestOrder(string id) Quantity = 2, FulfillmentLocationCode = "warehouse1", ShippingMethodCode = "EMS", - Discounts = new[] { new Discount + Discounts = [ new Discount { PromotionId = "itemPromotion", + Name = "Test Promotion", + Description = "This is a test promotion", Currency = "USD", DiscountAmount = 12, Coupon = "ssss" - }} + }] }; var item2 = new LineItem { @@ -236,13 +242,15 @@ private static CustomerOrder GetTestOrder(string id) Line1 = "line 1", Organization = "org1" }, - Discounts = new[] { new Discount + Discounts = [ new Discount { PromotionId = "testPromotion", + Name = "Test Promotion", + Description = "This is a test promotion", Currency = "USD", DiscountAmount = 12, Coupon = "" - }}, + }], };