diff --git a/src/VirtoCommerce.XOrder.Core/Models/ExpOrderAddress.cs b/src/VirtoCommerce.XOrder.Core/Models/ExpOrderAddress.cs index 14e08d1..8ef1f92 100644 --- a/src/VirtoCommerce.XOrder.Core/Models/ExpOrderAddress.cs +++ b/src/VirtoCommerce.XOrder.Core/Models/ExpOrderAddress.cs @@ -5,8 +5,9 @@ namespace VirtoCommerce.XOrder.Core.Models { - public sealed class ExpOrderAddress + public class ExpOrderAddress { + public Optional Id { get; set; } public Optional Key { get; set; } public Optional City { get; set; } public Optional CountryCode { get; set; } @@ -27,10 +28,11 @@ public sealed class ExpOrderAddress public Optional OuterId { get; set; } public Optional AddressType { get; set; } - public Address MapTo(Address address) + public virtual Address MapTo(Address address) { address ??= AbstractTypeFactory
.TryCreateInstance(); + Optional.SetValue(Id, x => address.Key = x); Optional.SetValue(Key, x => address.Key = x); Optional.SetValue(City, x => address.City = x); Optional.SetValue(CountryCode, x => address.CountryCode = x); diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/CustomerOrdersConnectionType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/CustomerOrdersConnectionType.cs index ee3691e..53099b5 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/CustomerOrdersConnectionType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/CustomerOrdersConnectionType.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; using System.Linq; using GraphQL.Types; -using GraphQL.Types.Relay; using VirtoCommerce.Xapi.Core.Infrastructure; using VirtoCommerce.Xapi.Core.Models.Facets; +using VirtoCommerce.Xapi.Core.Schemas; using CoreFacets = VirtoCommerce.Xapi.Core.Schemas.Facets; namespace VirtoCommerce.XOrder.Core.Schemas { - public class CustomerOrderConnectionType : ConnectionType> + public class CustomerOrderConnectionType : ExtendableConnectionType where TNodeType : IGraphType { public CustomerOrderConnectionType() diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InitializePaymentResultType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InitializePaymentResultType.cs index 0fc80ca..b41785b 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InitializePaymentResultType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InitializePaymentResultType.cs @@ -7,7 +7,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InitializePaymentResultType : ObjectGraphType + public class InitializePaymentResultType : ExtendableGraphType { public InitializePaymentResultType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputAddOrUpdateOrderPaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputAddOrUpdateOrderPaymentType.cs index 170d604..e8ba86f 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputAddOrUpdateOrderPaymentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputAddOrUpdateOrderPaymentType.cs @@ -1,8 +1,9 @@ using GraphQL.Types; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputAddOrUpdateOrderPaymentType : InputObjectGraphType + public class InputAddOrUpdateOrderPaymentType : ExtendableInputGraphType { public InputAddOrUpdateOrderPaymentType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputAuthorizePaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputAuthorizePaymentType.cs index ad0cea6..7361913 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputAuthorizePaymentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputAuthorizePaymentType.cs @@ -3,7 +3,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputAuthorizePaymentType : InputObjectGraphType + public class InputAuthorizePaymentType : ExtendableInputGraphType { public InputAuthorizePaymentType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputChangeOrderStatusType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputChangeOrderStatusType.cs index d633754..ec10c51 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputChangeOrderStatusType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputChangeOrderStatusType.cs @@ -1,8 +1,9 @@ using GraphQL.Types; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputChangeOrderStatusType : InputObjectGraphType + public class InputChangeOrderStatusType : ExtendableInputGraphType { public InputChangeOrderStatusType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputConfirmOrderPaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputConfirmOrderPaymentType.cs deleted file mode 100644 index ee8b0f4..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputConfirmOrderPaymentType.cs +++ /dev/null @@ -1,12 +0,0 @@ -using GraphQL.Types; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputConfirmOrderPaymentType : InputObjectGraphType - { - public InputConfirmOrderPaymentType() - { - Field>("payment"); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputCreateOrderFromCartType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputCreateOrderFromCartType.cs index 1a928c5..a345308 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputCreateOrderFromCartType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputCreateOrderFromCartType.cs @@ -1,8 +1,9 @@ using GraphQL.Types; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputCreateOrderFromCartType : InputObjectGraphType + public class InputCreateOrderFromCartType : ExtendableInputGraphType { public InputCreateOrderFromCartType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputInitializePaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputInitializePaymentType.cs index 004d874..c201e4c 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputInitializePaymentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputInitializePaymentType.cs @@ -1,8 +1,9 @@ using GraphQL.Types; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputInitializePaymentType : InputObjectGraphType + public class InputInitializePaymentType : ExtendableInputGraphType { public InputInitializePaymentType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderAddressType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderAddressType.cs index 7c61335..3223be8 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderAddressType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderAddressType.cs @@ -1,10 +1,11 @@ using GraphQL.Types; using VirtoCommerce.OrdersModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; using VirtoCommerce.XOrder.Core.Models; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputOrderAddressType : InputObjectGraphType + public class InputOrderAddressType : ExtendableInputGraphType { public InputOrderAddressType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderBankCardInfoType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderBankCardInfoType.cs index 78237d5..b59d231 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderBankCardInfoType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderBankCardInfoType.cs @@ -1,9 +1,9 @@ -using GraphQL.Types; using VirtoCommerce.PaymentModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputOrderBankCardInfoType : InputObjectGraphType + public class InputOrderBankCardInfoType : ExtendableInputGraphType { public InputOrderBankCardInfoType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderDiscountType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderDiscountType.cs deleted file mode 100644 index a76a102..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderDiscountType.cs +++ /dev/null @@ -1,19 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.CoreModule.Core.Common; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderDiscountType : InputObjectGraphType - { - public InputOrderDiscountType() - { - Field(x => x.DiscountAmount); - Field(x => x.Coupon, true); - Field(x => x.Description, true); - Field(x => x.PromotionId, true); - Field(x => x.Id, true); - Field(x => x.Currency); - Field(x => x.DiscountAmountWithTax); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderLineItemType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderLineItemType.cs deleted file mode 100644 index 731f512..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderLineItemType.cs +++ /dev/null @@ -1,60 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.OrdersModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderLineItemType : InputObjectGraphType - { - public InputOrderLineItemType() - { - Field(x => x.Id); - Field(x => x.ProductType, true); - Field(x => x.Name); - Field(x => x.Comment, true); - Field(x => x.ImageUrl, true); - Field(x => x.IsGift, true); - Field(x => x.ShippingMethodCode, true); - Field(x => x.FulfillmentLocationCode, true); - Field(x => x.FulfillmentCenterId, true); - Field(x => x.FulfillmentCenterName, true); - Field(x => x.OuterId, true); - Field(x => x.WeightUnit, true); - Field(x => x.Weight, true); - Field(x => x.MeasureUnit, true); - Field(x => x.Height, true); - Field(x => x.Length, true); - Field(x => x.Width, true); - Field(x => x.IsCancelled); - Field(x => x.CancelledDate, true); - Field(x => x.CancelReason, true); - - Field(x => x.CategoryId, true); - Field(x => x.CatalogId); - - Field(x => x.Sku); - Field(x => x.PriceId, true); - Field(x => x.Price); - Field(x => x.PriceWithTax); - Field(x => x.TaxType, true); - Field(x => x.TaxPercentRate); - Field(x => x.ReserveQuantity); - Field(x => x.Quantity); - Field(x => x.ProductId); - - Field(x => x.Currency); - Field(x => x.DiscountAmount); - Field(x => x.DiscountAmountWithTax); - Field(x => x.DiscountTotal); - Field(x => x.DiscountTotalWithTax); - Field(x => x.ExtendedPrice); - Field(x => x.ExtendedPriceWithTax); - Field(x => x.PlacedPrice); - Field(x => x.PlacedPriceWithTax); - Field(x => x.TaxTotal); - Field>>(nameof(LineItem.TaxDetails), - "Tax details"); - Field>>(nameof(LineItem.Discounts), - "Discounts"); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentMethodType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentMethodType.cs deleted file mode 100644 index 0cbb36f..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentMethodType.cs +++ /dev/null @@ -1,35 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.PaymentModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderPaymentMethodType : InputObjectGraphType - { - public InputOrderPaymentMethodType() - { - Field(x => x.Id); - Field>(nameof(PaymentMethod.TaxDetails), - "Tax details"); - Field(x => x.TaxTotal); - Field(x => x.TypeName, true); - Field(x => x.StoreId, true); - Field(x => x.DiscountAmountWithTax); - Field(x => x.DiscountAmount); - Field(x => x.TotalWithTax); - Field(x => x.Total); - Field(x => x.PriceWithTax); - Field(x => x.Price); - Field(x => x.Currency, true); - Field(x => x.IsAvailableForPartial); - Field(x => x.Priority); - Field(x => x.IsActive); - Field(x => x.LogoUrl, true); - Field(x => x.Name, true); - Field(x => x.Code); - Field(nameof(PaymentMethod.PaymentMethodType), - "Payment method type"); - Field(nameof(PaymentMethod.PaymentMethodGroupType), - "Payment method group type"); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentType.cs index c68731d..a305c38 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderPaymentType.cs @@ -4,7 +4,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputOrderPaymentType : InputObjectGraphType + public class InputOrderPaymentType : ExtendableInputGraphType { public InputOrderPaymentType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentItemType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentItemType.cs deleted file mode 100644 index 9077b96..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentItemType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.OrdersModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderShipmentItemType : InputObjectGraphType - { - public InputOrderShipmentItemType() - { - Field(x => x.Id); - Field(x => x.LineItemId); - Field(nameof(ShipmentItem.LineItem)); - Field(x => x.BarCode, true); - Field(x => x.Quantity); - Field(x => x.OuterId, true); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentPackageType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentPackageType.cs deleted file mode 100644 index 2d9bff1..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentPackageType.cs +++ /dev/null @@ -1,22 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.OrdersModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderShipmentPackageType : InputObjectGraphType - { - public InputOrderShipmentPackageType() - { - Field(x => x.Id); - Field(x => x.BarCode, true); - Field(x => x.PackageType, true); - Field(x => x.WeightUnit); - Field(x => x.Weight, true); - Field(x => x.MeasureUnit); - Field(x => x.Height, true); - Field(x => x.Length, true); - Field(x => x.Width, true); - Field>>(nameof(ShipmentPackage.Items)); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentType.cs deleted file mode 100644 index 93924a3..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShipmentType.cs +++ /dev/null @@ -1,69 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.OrdersModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderShipmentType : InputObjectGraphType - { - public InputOrderShipmentType() - { - Field(x => x.Id); - Field(x => x.ObjectType, true); - Field(x => x.CancelReason, true); - Field(x => x.CancelledDate, true); - Field(x => x.IsCancelled); - Field(x => x.OuterId, true); - Field(x => x.Currency); - Field(x => x.Comment, true); - Field(x => x.Status, true); - Field(x => x.IsApproved); - Field(x => x.Number); - Field(x => x.ParentOperationId, true); - Field(x => x.OperationType); - - Field(x => x.OrganizationId, true); - Field(x => x.OrganizationName, true); - Field(x => x.FulfillmentCenterId, true); - Field(x => x.FulfillmentCenterName, true); - Field(x => x.EmployeeId, true); - Field(x => x.EmployeeName, true); - Field(x => x.ShipmentMethodCode, true); - Field(x => x.ShipmentMethodOption, true); - Field(nameof(Shipment.ShippingMethod), - "Shipping method"); - Field(x => x.CustomerOrderId); - Field(x => x.WeightUnit, true); - Field(x => x.Weight, true); - Field(x => x.MeasureUnit, true); - Field(x => x.Height, true); - Field(x => x.Length, true); - Field(x => x.Width, true); - Field(nameof(Shipment.DeliveryAddress), - "Delivery address"); - - Field(x => x.TaxType, true); - Field(x => x.TaxPercentRate); - - Field(x => x.Price); - Field(x => x.PriceWithTax); - Field(x => x.Total); - Field(x => x.TotalWithTax); - Field(x => x.DiscountAmount); - Field(x => x.DiscountAmountWithTax); - Field(x => x.TaxTotal); - - Field(x => x.TrackingNumber, true); - Field(x => x.TrackingUrl, true); - Field(x => x.DeliveryDate, true); - - Field>>(nameof(Shipment.TaxDetails), - "Tax details"); - Field>>(nameof(Shipment.Items), - "Shipment items"); - Field>>(nameof(Shipment.Packages)); - Field>>(nameof(Shipment.InPayments)); - Field>>(nameof(Shipment.Discounts), - "Discounts"); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShippingMethodType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShippingMethodType.cs deleted file mode 100644 index 07ecf79..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderShippingMethodType.cs +++ /dev/null @@ -1,20 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.ShippingModule.Core.Model; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderShippingMethodType : InputObjectGraphType - { - public InputOrderShippingMethodType() - { - Field(x => x.Id); - Field(x => x.Code); - Field(x => x.LogoUrl, nullable: true); - Field(x => x.IsActive); - Field(x => x.Priority); - Field(x => x.TaxType, nullable: true); - Field(x => x.StoreId); - Field(x => x.TypeName); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderTaxDetailType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderTaxDetailType.cs deleted file mode 100644 index 4e4846e..0000000 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputOrderTaxDetailType.cs +++ /dev/null @@ -1,15 +0,0 @@ -using GraphQL.Types; -using VirtoCommerce.CoreModule.Core.Tax; - -namespace VirtoCommerce.XOrder.Core.Schemas -{ - public class InputOrderTaxDetailType : InputObjectGraphType - { - public InputOrderTaxDetailType() - { - Field(x => x.Rate); - Field(x => x.Amount); - Field(x => x.Name); - } - } -} diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputProcessOrderPaymentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputProcessOrderPaymentType.cs index edc9c32..0fea099 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputProcessOrderPaymentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputProcessOrderPaymentType.cs @@ -1,8 +1,9 @@ using GraphQL.Types; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputProcessOrderPaymentType : InputObjectGraphType + public class InputProcessOrderPaymentType : ExtendableInputGraphType { public InputProcessOrderPaymentType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderDynamicPropertiesType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderDynamicPropertiesType.cs index 9c26e6e..995062d 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderDynamicPropertiesType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderDynamicPropertiesType.cs @@ -3,7 +3,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputUpdateOrderDynamicPropertiesType : InputObjectGraphType + public class InputUpdateOrderDynamicPropertiesType : ExtendableInputGraphType { public InputUpdateOrderDynamicPropertiesType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderItemDynamicPropertiesType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderItemDynamicPropertiesType.cs index 9ca7dbe..be10e5d 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderItemDynamicPropertiesType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderItemDynamicPropertiesType.cs @@ -3,7 +3,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputUpdateOrderItemDynamicPropertiesType : InputObjectGraphType + public class InputUpdateOrderItemDynamicPropertiesType : ExtendableInputGraphType { public InputUpdateOrderItemDynamicPropertiesType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderPaymentDynamicPropertiesType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderPaymentDynamicPropertiesType.cs index 023a505..27c31d5 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderPaymentDynamicPropertiesType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderPaymentDynamicPropertiesType.cs @@ -3,7 +3,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputUpdateOrderPaymentDynamicPropertiesType : InputObjectGraphType + public class InputUpdateOrderPaymentDynamicPropertiesType : ExtendableInputGraphType { public InputUpdateOrderPaymentDynamicPropertiesType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderShipmentDynamicPropertiesType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderShipmentDynamicPropertiesType.cs index 8431b82..dba522f 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderShipmentDynamicPropertiesType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/InputUpdateOrderShipmentDynamicPropertiesType.cs @@ -3,7 +3,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class InputUpdateOrderShipmentDynamicPropertiesType : InputObjectGraphType + public class InputUpdateOrderShipmentDynamicPropertiesType : ExtendableInputGraphType { public InputUpdateOrderShipmentDynamicPropertiesType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderAddressType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderAddressType.cs index 9c5e607..f07beb5 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderAddressType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderAddressType.cs @@ -1,9 +1,10 @@ using GraphQL.Types; using VirtoCommerce.OrdersModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderAddressType : ObjectGraphType
+ public class OrderAddressType : ExtendableGraphType
{ public OrderAddressType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderBankCardInfoType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderBankCardInfoType.cs index 9506121..ff01d5a 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderBankCardInfoType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderBankCardInfoType.cs @@ -1,9 +1,9 @@ -using GraphQL.Types; using VirtoCommerce.PaymentModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderBankCardInfoType : ObjectGraphType + public class OrderBankCardInfoType : ExtendableGraphType { public OrderBankCardInfoType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderDiscountType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderDiscountType.cs index 8526520..5823113 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderDiscountType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderDiscountType.cs @@ -6,7 +6,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderDiscountType : ObjectGraphType + public class OrderDiscountType : ExtendableGraphType { public OrderDiscountType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderLineItemType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderLineItemType.cs index bc78e63..7eacd37 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderLineItemType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderLineItemType.cs @@ -106,7 +106,7 @@ public OrderLineItemType( var productField = new FieldType { Name = "product", - Type = GraphTypeExtenstionHelper.GetActualType(), + Type = GraphTypeExtensionHelper.GetActualType(), Resolver = new FuncFieldResolver>(context => { var includeFields = context.SubFields.Values.GetAllNodesPaths(context).ToArray(); @@ -141,7 +141,7 @@ public OrderLineItemType( var vendorField = new FieldType { Name = "vendor", - Type = GraphTypeExtenstionHelper.GetActualType(), + Type = GraphTypeExtensionHelper.GetActualType(), Resolver = new FuncFieldResolver>(context => { return dataLoader.LoadVendor(memberService, mapper, loaderKey: "order_vendor", vendorId: context.Source.VendorId); diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderPaymentMethodType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderPaymentMethodType.cs index 47792d9..da8a3f3 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderPaymentMethodType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderPaymentMethodType.cs @@ -7,7 +7,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderPaymentMethodType : ObjectGraphType + public class OrderPaymentMethodType : ExtendableGraphType { public OrderPaymentMethodType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentPackageType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentPackageType.cs index 79bdbca..e29dfc6 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentPackageType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentPackageType.cs @@ -1,9 +1,10 @@ using GraphQL.Types; using VirtoCommerce.OrdersModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderShipmentPackageType : ObjectGraphType + public class OrderShipmentPackageType : ExtendableGraphType { public OrderShipmentPackageType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentType.cs index 724b662..0186dce 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShipmentType.cs @@ -94,7 +94,7 @@ public OrderShipmentType( var vendorField = new FieldType { Name = "vendor", - Type = GraphTypeExtenstionHelper.GetActualType(), + Type = GraphTypeExtensionHelper.GetActualType(), Resolver = new FuncFieldResolver>(context => { return dataLoader.LoadVendor(memberService, mapper, loaderKey: "order_vendor", vendorId: context.Source.VendorId); diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShippingMethodType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShippingMethodType.cs index 868a479..c6aa001 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderShippingMethodType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderShippingMethodType.cs @@ -1,9 +1,9 @@ -using GraphQL.Types; using VirtoCommerce.ShippingModule.Core.Model; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderShippingMethodType : ObjectGraphType + public class OrderShippingMethodType : ExtendableGraphType { public OrderShippingMethodType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/OrderTaxDetailType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/OrderTaxDetailType.cs index 27c5abe..2cf10a3 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/OrderTaxDetailType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/OrderTaxDetailType.cs @@ -7,7 +7,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class OrderTaxDetailType : ObjectGraphType + public class OrderTaxDetailType : ExtendableGraphType { public OrderTaxDetailType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/PaymentInType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/PaymentInType.cs index 9a91e50..64a6364 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/PaymentInType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/PaymentInType.cs @@ -69,7 +69,7 @@ public PaymentInType( var vendorField = new FieldType { Name = "vendor", - Type = GraphTypeExtenstionHelper.GetActualType(), + Type = GraphTypeExtensionHelper.GetActualType(), Resolver = new FuncFieldResolver>(context => { return dataLoader.LoadVendor(memberService, mapper, loaderKey: "order_vendor", vendorId: context.Source.VendorId); diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/PaymentTransactionType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/PaymentTransactionType.cs index 8e8f447..5115bea 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/PaymentTransactionType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/PaymentTransactionType.cs @@ -7,7 +7,7 @@ namespace VirtoCommerce.XOrder.Core.Schemas { - public class PaymentTransactionType : ObjectGraphType + public class PaymentTransactionType : ExtendableGraphType { public PaymentTransactionType() { diff --git a/src/VirtoCommerce.XOrder.Core/Schemas/ProcessPaymentRequestResultType.cs b/src/VirtoCommerce.XOrder.Core/Schemas/ProcessPaymentRequestResultType.cs index 91c7081..c6a4a9e 100644 --- a/src/VirtoCommerce.XOrder.Core/Schemas/ProcessPaymentRequestResultType.cs +++ b/src/VirtoCommerce.XOrder.Core/Schemas/ProcessPaymentRequestResultType.cs @@ -1,9 +1,10 @@ using GraphQL.Types; using VirtoCommerce.PaymentModule.Model.Requests; +using VirtoCommerce.Xapi.Core.Schemas; namespace VirtoCommerce.XOrder.Core.Schemas { - public class ProcessPaymentRequestResultType : ObjectGraphType + public class ProcessPaymentRequestResultType : ExtendableGraphType { public ProcessPaymentRequestResultType() { diff --git a/src/VirtoCommerce.XOrder.Core/VirtoCommerce.XOrder.Core.csproj b/src/VirtoCommerce.XOrder.Core/VirtoCommerce.XOrder.Core.csproj index 23322e9..35224cb 100644 --- a/src/VirtoCommerce.XOrder.Core/VirtoCommerce.XOrder.Core.csproj +++ b/src/VirtoCommerce.XOrder.Core/VirtoCommerce.XOrder.Core.csproj @@ -10,8 +10,8 @@ - - - + + + \ No newline at end of file diff --git a/src/VirtoCommerce.XOrder.Data/Extensions/ServiceCollectionExtensions.cs b/src/VirtoCommerce.XOrder.Data/Extensions/ServiceCollectionExtensions.cs index 0a06f20..f9001b3 100644 --- a/src/VirtoCommerce.XOrder.Data/Extensions/ServiceCollectionExtensions.cs +++ b/src/VirtoCommerce.XOrder.Data/Extensions/ServiceCollectionExtensions.cs @@ -1,9 +1,7 @@ using System; -using GraphQL.Server; +using GraphQL.DI; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.DependencyInjection; -using VirtoCommerce.Xapi.Core.Extensions; -using VirtoCommerce.Xapi.Core.Infrastructure; using VirtoCommerce.Xapi.Core.Pipelines; using VirtoCommerce.XCart.Core.Models; using VirtoCommerce.XOrder.Core; @@ -18,9 +16,8 @@ public static class ServiceCollectionExtensions { public static IServiceCollection AddXOrder(this IServiceCollection services, IGraphQLBuilder graphQLBuilder) { - graphQLBuilder.AddSchema(typeof(CoreAssemblyMarker), typeof(DataAssemblyMarker)); - - services.AddSingleton>(); + // disable scoped schema for now + //services.AddSingleton>(); services.AddTransient(); services.AddSingleton(); diff --git a/src/VirtoCommerce.XOrder.Data/Queries/BaseQueries/BaseSearchOrderQueryBuilder.cs b/src/VirtoCommerce.XOrder.Data/Queries/BaseQueries/BaseSearchOrderQueryBuilder.cs index 4b93cd2..79d15e5 100644 --- a/src/VirtoCommerce.XOrder.Data/Queries/BaseQueries/BaseSearchOrderQueryBuilder.cs +++ b/src/VirtoCommerce.XOrder.Data/Queries/BaseQueries/BaseSearchOrderQueryBuilder.cs @@ -36,8 +36,8 @@ protected BaseSearchOrderQueryBuilder( protected override FieldType GetFieldType() { - var builder = GraphTypeExtenstionHelper.CreateConnection, CustomerOrderConnectionType, object>() - .Name(Name) + var builder = GraphTypeExtensionHelper + .CreateConnection, CustomerOrderConnectionType, object>(Name) .PageSize(Connections.DefaultPageSize); ConfigureArguments(builder.FieldType); diff --git a/src/VirtoCommerce.XOrder.Data/Schemas/OrderSchema.cs b/src/VirtoCommerce.XOrder.Data/Schemas/OrderSchema.cs index b206e26..17f3d74 100644 --- a/src/VirtoCommerce.XOrder.Data/Schemas/OrderSchema.cs +++ b/src/VirtoCommerce.XOrder.Data/Schemas/OrderSchema.cs @@ -63,8 +63,8 @@ public void Build(ISchema schema) { Name = "order", Arguments = AbstractTypeFactory.TryCreateInstance(), - Type = GraphTypeExtenstionHelper.GetActualType(), - Resolver = new AsyncFieldResolver(async context => + Type = GraphTypeExtensionHelper.GetActualType(), + Resolver = new FuncFieldResolver(async context => { var request = context.ExtractQuery(); @@ -89,18 +89,17 @@ public void Build(ISchema schema) }) }); - var paymentsConnectionBuilder = GraphTypeExtenstionHelper - .CreateConnection() - .Name("payments") + var paymentsConnectionBuilder = GraphTypeExtensionHelper + .CreateConnection("payments") .PageSize(Connections.DefaultPageSize) .OrderArguments(); paymentsConnectionBuilder.ResolveAsync(async context => await ResolvePaymentsConnectionAsync(_mediator, context)); schema.Query.AddField(paymentsConnectionBuilder.FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("createOrderFromCart") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("createOrderFromCart", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -117,9 +116,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(typeof(BooleanGraphType)) - .Name("changeOrderStatus") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("changeOrderStatus", typeof(BooleanGraphType)) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -130,9 +129,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(typeof(ProcessPaymentRequestResultType)) - .Name("processOrderPayment") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("processOrderPayment", typeof(ProcessPaymentRequestResultType)) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -144,9 +143,9 @@ public void Build(ISchema schema) .DeprecationReason("Obsolete. Use 'initializePayment' mutation") .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(typeof(InitializePaymentResultType)) - .Name("initializePayment") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("initializePayment", typeof(InitializePaymentResultType)) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -158,9 +157,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(typeof(AuthorizePaymentResultType)) - .Name("authorizePayment") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("authorizePayment", typeof(AuthorizePaymentResultType)) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -173,9 +172,9 @@ public void Build(ISchema schema) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("updateOrderDynamicProperties") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("updateOrderDynamicProperties", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -186,9 +185,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("updateOrderItemDynamicProperties") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("updateOrderItemDynamicProperties", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -199,9 +198,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("updateOrderPaymentDynamicProperties") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("updateOrderPaymentDynamicProperties", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -212,9 +211,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("updateOrderShipmentDynamicProperties") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("updateOrderShipmentDynamicProperties", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); @@ -225,9 +224,9 @@ public void Build(ISchema schema) }) .FieldType); - _ = schema.Mutation.AddField(FieldBuilder.Create(GraphTypeExtenstionHelper.GetActualType()) - .Name("addOrUpdateOrderPayment") - .Argument(GraphTypeExtenstionHelper.GetActualComplexType>(), _commandName) + _ = schema.Mutation.AddField(FieldBuilder + .Create("addOrUpdateOrderPayment", GraphTypeExtensionHelper.GetActualType()) + .Argument(GraphTypeExtensionHelper.GetActualComplexType>(), _commandName) .ResolveAsync(async context => { var type = GenericTypeHelper.GetActualType(); diff --git a/src/VirtoCommerce.XOrder.Web/Module.cs b/src/VirtoCommerce.XOrder.Web/Module.cs index 7f05149..30a1897 100644 --- a/src/VirtoCommerce.XOrder.Web/Module.cs +++ b/src/VirtoCommerce.XOrder.Web/Module.cs @@ -1,3 +1,5 @@ +using GraphQL; +using GraphQL.MicrosoftDI; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -5,7 +7,6 @@ using VirtoCommerce.Platform.Core.Settings; using VirtoCommerce.StoreModule.Core.Model; using VirtoCommerce.Xapi.Core.Extensions; -using VirtoCommerce.Xapi.Core.Infrastructure; using VirtoCommerce.XOrder.Core; using VirtoCommerce.XOrder.Data; using VirtoCommerce.XOrder.Data.Extensions; @@ -19,7 +20,11 @@ public class Module : IModule, IHasConfiguration public void Initialize(IServiceCollection serviceCollection) { - var graphQlBuilder = new CustomGraphQLBuilder(serviceCollection); + var graphQlBuilder = new GraphQLBuilder(serviceCollection, builder => + { + builder.AddSchema(serviceCollection, typeof(CoreAssemblyMarker), typeof(DataAssemblyMarker)); + }); + serviceCollection.AddXOrder(graphQlBuilder); } @@ -27,7 +32,8 @@ public void PostInitialize(IApplicationBuilder appBuilder) { var serviceProvider = appBuilder.ApplicationServices; - appBuilder.UseScopedSchema("order"); + // disable scoped schema for now + //appBuilder.UseScopedSchema("order"); // settings var settingsRegistrar = serviceProvider.GetRequiredService(); diff --git a/src/VirtoCommerce.XOrder.Web/module.manifest b/src/VirtoCommerce.XOrder.Web/module.manifest index 64963dc..764f46a 100644 --- a/src/VirtoCommerce.XOrder.Web/module.manifest +++ b/src/VirtoCommerce.XOrder.Web/module.manifest @@ -7,9 +7,9 @@ 3.867.0 - - - + + + Order Experience API