diff --git a/src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrder.cs b/src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrder.cs index 0ff30ad7..dabf8790 100644 --- a/src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrder.cs +++ b/src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrder.cs @@ -229,6 +229,8 @@ public class CustomerOrder : OrderOperation, IHasTaxDetalization, ISupportSecuri /// public virtual decimal HandlingTotalWithTax { get; set; } + public bool IsAnonymous { get; set; } + #region ITaxable Members /// diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.Designer.cs new file mode 100644 index 00000000..009ffc09 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.Designer.cs @@ -0,0 +1,2057 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +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("20231018130044_IsAnonymous")] + partial class IsAnonymous + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AddressType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("varchar(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + 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(64) + .HasColumnType("varchar(64)"); + + 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(18,4)"); + + 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("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("DiscountTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("DiscountTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("HandlingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("HandlingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("PaymentTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp(6)"); + + b.Property("ShippingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ShippingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("SubTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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("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(18,4)"); + + 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(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + 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(18,4)"); + + 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(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + 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(18,4)"); + + 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(18,4)"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + 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(18,4)"); + + 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/20231018130044_IsAnonymous.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.cs new file mode 100644 index 00000000..06c8df3e --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + public partial class IsAnonymous : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsAnonymous", + table: "CustomerOrder", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsAnonymous", + table: "CustomerOrder"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs index 691b4948..2949c060 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs @@ -349,6 +349,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasPrecision(18, 4) .HasColumnType("decimal(18,4)"); + b.Property("IsAnonymous") + .HasColumnType("tinyint(1)"); + b.Property("IsApproved") .HasColumnType("tinyint(1)"); diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.Designer.cs new file mode 100644 index 00000000..4b0b9eb2 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.Designer.cs @@ -0,0 +1,2009 @@ +// +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("20231018130007_IsAnonymous")] + partial class IsAnonymous + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .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(32) + .HasColumnType("character varying(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("character varying(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + 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(64) + .HasColumnType("character varying(64)"); + + 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("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("numeric(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("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("numeric(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("numeric(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("numeric(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("numeric(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/20231018130007_IsAnonymous.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.cs new file mode 100644 index 00000000..d9bfd7e8 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + public partial class IsAnonymous : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsAnonymous", + table: "CustomerOrder", + type: "boolean", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsAnonymous", + table: "CustomerOrder"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs index e384bb92..5f2fedff 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs @@ -341,6 +341,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("HandlingTotalWithTax") .HasColumnType("Money"); + b.Property("IsAnonymous") + .HasColumnType("boolean"); + b.Property("IsApproved") .HasColumnType("boolean"); diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.Designer.cs new file mode 100644 index 00000000..750083ca --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.Designer.cs @@ -0,0 +1,2010 @@ +// +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("20231018125853_IsAnonymous")] + partial class IsAnonymous + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AddressType") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Email") + .HasMaxLength(254) + .HasColumnType("nvarchar(254)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + 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(64) + .HasColumnType("nvarchar(64)"); + + 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("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("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/20231018125853_IsAnonymous.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.cs new file mode 100644 index 00000000..4e48c5af --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + public partial class IsAnonymous : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsAnonymous", + table: "CustomerOrder", + type: "bit", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsAnonymous", + table: "CustomerOrder"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs index 0e2a9c80..67142b96 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs @@ -342,6 +342,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("HandlingTotalWithTax") .HasColumnType("Money"); + b.Property("IsAnonymous") + .HasColumnType("bit"); + b.Property("IsApproved") .HasColumnType("bit"); diff --git a/src/VirtoCommerce.OrdersModule.Data/Model/CustomerOrderEntity.cs b/src/VirtoCommerce.OrdersModule.Data/Model/CustomerOrderEntity.cs index c7d725e5..fc88cde1 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Model/CustomerOrderEntity.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Model/CustomerOrderEntity.cs @@ -91,6 +91,8 @@ public class CustomerOrderEntity : OperationEntity, ISupportPartialPriceUpdate, [StringLength(128)] public string PurchaseOrderNumber { get; set; } + public bool IsAnonymous { get; set; } + #region Navigation Properties public virtual ObservableCollection TaxDetails { get; set; } = new NullCollection(); @@ -162,6 +164,7 @@ public override OrderOperation ToModel(OrderOperation operation) order.PurchaseOrderNumber = PurchaseOrderNumber; order.LanguageCode = LanguageCode; order.TaxPercentRate = TaxPercentRate; + order.IsAnonymous = IsAnonymous; order.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); order.Items = Items.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); @@ -242,6 +245,7 @@ public override OperationEntity FromModel(OrderOperation operation, PrimaryKeyRe PurchaseOrderNumber = order.PurchaseOrderNumber; LanguageCode = order.LanguageCode; TaxPercentRate = order.TaxPercentRate; + IsAnonymous = order.IsAnonymous; if (order.Addresses != null) { @@ -335,6 +339,7 @@ public override void Patch(OperationEntity target) operation.SubscriptionId = SubscriptionId; operation.PurchaseOrderNumber = PurchaseOrderNumber; operation.LanguageCode = LanguageCode; + operation.IsAnonymous = IsAnonymous; // Checks whether calculation of sum is needed to pass the result to the property of base class before calling of base.Patch var needPatchPrices = !(GetNonCalculatablePrices().All(x => x == 0m) && diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index f4e8cab9..7d81d7e6 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -129,6 +129,7 @@ protected virtual CustomerOrder ToOrderModel(ShoppingCart cart) order.FeeTotalWithTax = cart.FeeTotalWithTax; order.HandlingTotal = cart.HandlingTotal; order.HandlingTotalWithTax = cart.HandlingTotalWithTax; + order.IsAnonymous = cart.IsAnonymous; order.Status = GetInitialOrderStatusAsync(cart).GetAwaiter().GetResult();