diff --git a/.github/workflows/release-alpha.yml b/.github/workflows/release-alpha.yml index f71ddac0..c8a09757 100644 --- a/.github/workflows/release-alpha.yml +++ b/.github/workflows/release-alpha.yml @@ -3,9 +3,7 @@ name: Release alpha on: workflow_dispatch: - pull_request_review: - types: - - submitted + jobs: ci: runs-on: ubuntu-latest @@ -34,7 +32,7 @@ jobs: id: image - name: Add version suffix - uses: VirtoCommerce/vc-github-actions/add-version-suffix@VP-5059 + uses: VirtoCommerce/vc-github-actions/add-version-suffix@master - name: SonarCloud Begin uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master @@ -54,7 +52,7 @@ jobs: - name: Build Docker Image # if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }} id: dockerBuild - uses: VirtoCommerce/vc-github-actions/build-docker-image@VP-5059 + uses: VirtoCommerce/vc-github-actions/build-docker-image@master with: imageName: "demo-storefront" tag: ${{ steps.image.outputs.taggedVersion }} @@ -71,7 +69,7 @@ jobs: - name: Publish Docker Image # if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }} - uses: VirtoCommerce/vc-github-actions/publish-docker-image@VP-5059 + uses: VirtoCommerce/vc-github-actions/publish-docker-image@master with: image: ${{ steps.dockerBuild.outputs.imageName }} tag: ${{ steps.image.outputs.taggedVersion }} @@ -86,7 +84,7 @@ jobs: # - name: Publish to Blob # if: ${{ github.ref == 'refs/heads/dev' }} # id: blobRelease -# uses: VirtoCommerce/vc-github-actions/publish-blob-release@VP-5059 +# uses: VirtoCommerce/vc-github-actions/publish-blob-release@master # with: # blobSAS: ${{ secrets.BLOB_TOKEN }} @@ -94,16 +92,16 @@ jobs: # if: ${{ github.ref == 'refs/heads/master' }} # with: # changelog: ${{ steps.changelog.outputs.changelog }} -# uses: VirtoCommerce/vc-github-actions/publish-github-release@VP-5059 +# uses: VirtoCommerce/vc-github-actions/publish-github-release@master # - name: Setup Git Credentials # if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'}} -# uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@VP-5059 +# uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master # with: # githubToken: ${{ secrets.REPO_TOKEN }} # - name: Publish Manifest # if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'}} -# uses: VirtoCommerce/vc-github-actions/publish-manifest@VP-5059 +# uses: VirtoCommerce/vc-github-actions/publish-manifest@master # with: -# packageUrl: ${{ steps.blobRelease.outputs.packageUrl }} \ No newline at end of file +# packageUrl: ${{ steps.blobRelease.outputs.packageUrl }} diff --git a/.gitignore b/.gitignore index 7bc9642a..fd0c5552 100644 --- a/.gitignore +++ b/.gitignore @@ -270,3 +270,5 @@ __pycache__/ .vscode VirtoCommerce.Storefront/wwwroot/js/designer.bundle.js* + +core-model-v1 diff --git a/Directory.Build.props b/Directory.Build.props index 5e351ff8..29d71e57 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ VirtoCommerce - 1.2.0 + 1.3.0 $(VersionSuffix)-$(BuildNumber) diff --git a/VirtoCommerce.Storefront.Model/Cart/Demo/AddCartItem.cs b/VirtoCommerce.Storefront.Model/Cart/Demo/AddCartItem.cs index 87836ac8..6efe5032 100644 --- a/VirtoCommerce.Storefront.Model/Cart/Demo/AddCartItem.cs +++ b/VirtoCommerce.Storefront.Model/Cart/Demo/AddCartItem.cs @@ -1,7 +1,12 @@ +using Newtonsoft.Json; + namespace VirtoCommerce.Storefront.Model.Cart { partial class AddCartItem { public string ConfiguredProductId { get; set; } + + [JsonIgnore] + public string ConfiguredGroupId { get; set; } } } diff --git a/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredGroup.cs b/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredGroup.cs new file mode 100644 index 00000000..20c80744 --- /dev/null +++ b/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredGroup.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using VirtoCommerce.Storefront.Model.Catalog; +using VirtoCommerce.Storefront.Model.Common; + +namespace VirtoCommerce.Storefront.Model.Cart.Demo +{ + public class ConfiguredGroup : Entity + { + public ConfiguredGroup(int quantity, Currency currency, string productId) + { + Id = Guid.NewGuid().ToString("N"); + ProductId = productId; + Quantity = quantity; + Currency = currency; + + ExtendedPrice = new Money(currency); + ExtendedPriceWithTax = new Money(currency); + TaxTotal = new Money(currency); + + ListPrice = new Money(currency); + ListPriceWithTax = new Money(currency); + SalePrice = new Money(currency); + SalePriceWithTax = new Money(currency); + PlacedPrice = new Money(currency); + PlacedPriceWithTax = new Money(currency); + + Items = new List(); + } + + public string ProductId { get; set; } + + public Product Product { get; set; } + + public DateTime CreatedDate { get; set; } + + public DateTime? ModifiedDate { get; set; } + + public string CreatedBy { get; set; } + + public string ModifiedBy { get; set; } + + [JsonRequired] + public virtual IList Items { get; set; } + + [JsonRequired] + public int Quantity { get; set; } + + #region Pricing + + [JsonRequired] + public Currency Currency { get; set; } + + public Money ListPrice { get; set; } + + public Money ListPriceWithTax { get; set; } + + public Money SalePrice { get; set; } + + public Money SalePriceWithTax { get; set; } + + public Money PlacedPrice { get; set; } + + public Money PlacedPriceWithTax { get; set; } + + [JsonRequired] + public Money ExtendedPrice { get; set; } + + [JsonRequired] + public Money ExtendedPriceWithTax { get; set; } + + #endregion Pricing + + #region Taxation + + [JsonRequired] + public Money TaxTotal { get; set; } + + #endregion Taxation + + public ICollection Parts { get; set; } = new List(); + } +} diff --git a/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredItem.cs b/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredItem.cs deleted file mode 100644 index 764904ca..00000000 --- a/VirtoCommerce.Storefront.Model/Cart/Demo/ConfiguredItem.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using VirtoCommerce.Storefront.Model.Catalog; - -namespace VirtoCommerce.Storefront.Model.Cart.Demo -{ - public class ConfiguredItem - { - public ConfiguredItem() - { - Parts = new List(); - } - - public LineItem ConfiguredLineItem { get; set; } - - public ICollection Parts { get; set; } - } -} diff --git a/VirtoCommerce.Storefront.Model/Cart/Demo/LineItem.cs b/VirtoCommerce.Storefront.Model/Cart/Demo/LineItem.cs index 60b2ef6b..6f449c62 100644 --- a/VirtoCommerce.Storefront.Model/Cart/Demo/LineItem.cs +++ b/VirtoCommerce.Storefront.Model/Cart/Demo/LineItem.cs @@ -2,6 +2,6 @@ namespace VirtoCommerce.Storefront.Model.Cart { public partial class LineItem { - public string ConfiguredProductId { get; set; } + public string ConfiguredGroupId { get; set; } } } diff --git a/VirtoCommerce.Storefront.Model/Cart/Demo/ShoppingCart.cs b/VirtoCommerce.Storefront.Model/Cart/Demo/ShoppingCart.cs index e23c9dc2..ccba982e 100644 --- a/VirtoCommerce.Storefront.Model/Cart/Demo/ShoppingCart.cs +++ b/VirtoCommerce.Storefront.Model/Cart/Demo/ShoppingCart.cs @@ -1,11 +1,23 @@ using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; using VirtoCommerce.Storefront.Model.Cart.Demo; namespace VirtoCommerce.Storefront.Model.Cart { public partial class ShoppingCart { + [JsonRequired] + public LineItem[] UsualItems + { + get + { + var result = Items.Where(x => !ConfiguredGroups.Any(y => y.Items.Contains(x))).ToArray(); - public ICollection ConfiguredItems { get; set; } = new List(); + return result; + } + } + + public ICollection ConfiguredGroups { get; set; } = new List(); } } diff --git a/VirtoCommerce.Storefront.Model/Order/Demo/ConfiguredGroup.cs b/VirtoCommerce.Storefront.Model/Order/Demo/ConfiguredGroup.cs new file mode 100644 index 00000000..2c0eb1a4 --- /dev/null +++ b/VirtoCommerce.Storefront.Model/Order/Demo/ConfiguredGroup.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using VirtoCommerce.Storefront.Model.Catalog; +using VirtoCommerce.Storefront.Model.Common; + +namespace VirtoCommerce.Storefront.Model.Order.Demo +{ + public class ConfiguredGroup : Entity + { + public ConfiguredGroup(int quantity, Currency currency, string productId) + { + Id = Guid.NewGuid().ToString("N"); + Items = new List(); + ProductId = productId; + Quantity = quantity; + Currency = currency; + + ExtendedPrice = new Money(currency); + ExtendedPriceWithTax = new Money(currency); + TaxTotal = new Money(currency); + + Price = new Money(currency); + PriceWithTax = new Money(currency); + PlacedPrice = new Money(currency); + PlacedPriceWithTax = new Money(currency); + } + + public string ProductId { get; set; } + + public Product Product { get; set; } + + public DateTime CreatedDate { get; set; } + + public DateTime? ModifiedDate { get; set; } + + public string CreatedBy { get; set; } + + public string ModifiedBy { get; set; } + + [JsonRequired] + public virtual IList Items { get; set; } + + [JsonRequired] + public int Quantity { get; set; } + + #region Pricing + + [JsonRequired] + public Currency Currency { get; set; } + + public Money Price { get; set; } + + public Money PriceWithTax { get; set; } + + public Money PlacedPrice { get; set; } + + public Money PlacedPriceWithTax { get; set; } + + [JsonRequired] + public Money ExtendedPrice { get; set; } + + [JsonRequired] + public Money ExtendedPriceWithTax { get; set; } + + #endregion Pricing + + #region Taxation + + [JsonRequired] + public Money TaxTotal { get; set; } + + #endregion Taxation + + public ICollection Parts { get; set; } = new List(); + } +} diff --git a/VirtoCommerce.Storefront.Model/Order/Demo/CustomerOrder.cs b/VirtoCommerce.Storefront.Model/Order/Demo/CustomerOrder.cs new file mode 100644 index 00000000..53a5d487 --- /dev/null +++ b/VirtoCommerce.Storefront.Model/Order/Demo/CustomerOrder.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using VirtoCommerce.Storefront.Model.Order.Demo; + +namespace VirtoCommerce.Storefront.Model.Order +{ + public partial class CustomerOrder + { + [JsonRequired] + public LineItem[] UsualItems => Items.Where(x => !ConfiguredGroups.Any(y => y.Items.Contains(x))).ToArray(); + + public ICollection ConfiguredGroups { get; set; } = new List(); + } +} diff --git a/VirtoCommerce.Storefront.Model/Order/Demo/LineItem.cs b/VirtoCommerce.Storefront.Model/Order/Demo/LineItem.cs new file mode 100644 index 00000000..ebff55ba --- /dev/null +++ b/VirtoCommerce.Storefront.Model/Order/Demo/LineItem.cs @@ -0,0 +1,11 @@ +using VirtoCommerce.Storefront.Model.Catalog; + +namespace VirtoCommerce.Storefront.Model.Order +{ + public partial class LineItem + { + public string ConfiguredGropupId { get; set; } + + public Product Product { get; set; } + } +} diff --git a/VirtoCommerce.Storefront.Model/Order/Demo/Services/IDemoCustomerOrderService.cs b/VirtoCommerce.Storefront.Model/Order/Demo/Services/IDemoCustomerOrderService.cs new file mode 100644 index 00000000..1234f6ea --- /dev/null +++ b/VirtoCommerce.Storefront.Model/Order/Demo/Services/IDemoCustomerOrderService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; + +namespace VirtoCommerce.Storefront.Model.Order.Services +{ + public interface IDemoCustomerOrderService + { + Task LoadProductsAsync(params CustomerOrder[] orders); + + void SelectConfiguredProductParts(params CustomerOrder[] orders); + } +} diff --git a/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs b/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs index a54b6914..9a8e71b8 100644 --- a/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs +++ b/VirtoCommerce.Storefront/AutoRestClients/CartModuleApi.cs @@ -4669,6 +4669,158 @@ public PaymentMethod() // regenerated. // +namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class DemoCartConfiguredGroup + { + /// + /// Initializes a new instance of the DemoCartConfiguredGroup class. + /// + public DemoCartConfiguredGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DemoCartConfiguredGroup class. + /// + public DemoCartConfiguredGroup(string productId = default(string), IList itemIds = default(IList), int? quantity = default(int?), string currency = default(string), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? listPrice = default(double?), double? listPriceWithTax = default(double?), double? salePrice = default(double?), double? salePriceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? taxTotal = default(double?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + { + ProductId = productId; + ItemIds = itemIds; + Quantity = quantity; + Currency = currency; + ExtendedPrice = extendedPrice; + ExtendedPriceWithTax = extendedPriceWithTax; + ListPrice = listPrice; + ListPriceWithTax = listPriceWithTax; + SalePrice = salePrice; + SalePriceWithTax = salePriceWithTax; + PlacedPrice = placedPrice; + PlacedPriceWithTax = placedPriceWithTax; + TaxTotal = taxTotal; + CreatedDate = createdDate; + ModifiedDate = modifiedDate; + CreatedBy = createdBy; + ModifiedBy = modifiedBy; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "productId")] + public string ProductId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "itemIds")] + public IList ItemIds { get; set; } + + /// + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedPrice")] + public double? ExtendedPrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedPriceWithTax")] + public double? ExtendedPriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "listPrice")] + public double? ListPrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "listPriceWithTax")] + public double? ListPriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "salePrice")] + public double? SalePrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "salePriceWithTax")] + public double? SalePriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "placedPrice")] + public double? PlacedPrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "placedPriceWithTax")] + public double? PlacedPriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "taxTotal")] + public double? TaxTotal { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedDate")] + public System.DateTime? ModifiedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedBy")] + public string ModifiedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + namespace VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models { using Microsoft.Rest; @@ -5796,9 +5948,9 @@ public CartLineItem() /// /// Initializes a new instance of the CartLineItem class. /// - public CartLineItem(string configuredProductId = default(string), string productId = default(string), string catalogId = default(string), string categoryId = default(string), string sku = default(string), string productType = default(string), string name = default(string), int? quantity = default(int?), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string fulfillmentLocationCode = default(string), string shipmentMethodCode = default(string), bool? requiredShipping = default(bool?), string thumbnailImageUrl = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string currency = default(string), string languageCode = default(string), string note = default(string), bool? isReccuring = default(bool?), bool? taxIncluded = default(bool?), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), string validationType = default(string), bool? isReadOnly = default(bool?), string priceId = default(string), Price price = default(Price), double? listPrice = default(double?), double? listPriceWithTax = default(double?), double? salePrice = default(double?), double? salePriceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public CartLineItem(string configuredGroupId = default(string), string productId = default(string), string catalogId = default(string), string categoryId = default(string), string sku = default(string), string productType = default(string), string name = default(string), int? quantity = default(int?), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string fulfillmentLocationCode = default(string), string shipmentMethodCode = default(string), bool? requiredShipping = default(bool?), string thumbnailImageUrl = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string currency = default(string), string languageCode = default(string), string note = default(string), bool? isReccuring = default(bool?), bool? taxIncluded = default(bool?), double? volumetricWeight = default(double?), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), string validationType = default(string), bool? isReadOnly = default(bool?), string priceId = default(string), Price price = default(Price), double? listPrice = default(double?), double? listPriceWithTax = default(double?), double? salePrice = default(double?), double? salePriceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { - ConfiguredProductId = configuredProductId; + ConfiguredGroupId = configuredGroupId; ProductId = productId; CatalogId = catalogId; CategoryId = categoryId; @@ -5866,8 +6018,8 @@ public CartLineItem() /// /// - [JsonProperty(PropertyName = "configuredProductId")] - public string ConfiguredProductId { get; set; } + [JsonProperty(PropertyName = "configuredGroupId")] + public string ConfiguredGroupId { get; set; } /// /// @@ -6722,8 +6874,9 @@ public ShoppingCart() /// /// Initializes a new instance of the ShoppingCart class. /// - public ShoppingCart(string name = default(string), string storeId = default(string), string channelId = default(string), bool? isAnonymous = default(bool?), string customerId = default(string), string customerName = default(string), string organizationId = default(string), string currency = default(string), string languageCode = default(string), bool? taxIncluded = default(bool?), bool? isRecuring = default(bool?), string comment = default(string), string status = default(string), string purchaseOrderNumber = default(string), string weightUnit = default(string), double? weight = default(double?), string validationType = default(string), string type = default(string), double? volumetricWeight = default(double?), double? total = default(double?), double? subTotal = default(double?), double? subTotalWithTax = default(double?), double? subTotalDiscount = default(double?), double? subTotalDiscountWithTax = default(double?), double? shippingTotal = default(double?), double? shippingTotalWithTax = default(double?), double? shippingSubTotal = default(double?), double? shippingSubTotalWithTax = default(double?), double? shippingDiscountTotal = default(double?), double? shippingDiscountTotalWithTax = default(double?), double? paymentTotal = default(double?), double? paymentTotalWithTax = default(double?), double? paymentSubTotal = default(double?), double? paymentSubTotalWithTax = default(double?), double? paymentDiscountTotal = default(double?), double? paymentDiscountTotalWithTax = default(double?), double? handlingTotal = default(double?), double? handlingTotalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), double? feeTotal = default(double?), double? feeTotalWithTax = default(double?), IList addresses = default(IList), IList items = default(IList), IList payments = default(IList), IList shipments = default(IList), IList coupons = default(IList), string coupon = default(string), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public ShoppingCart(IList configuredGroups = default(IList), string name = default(string), string storeId = default(string), string channelId = default(string), bool? isAnonymous = default(bool?), string customerId = default(string), string customerName = default(string), string organizationId = default(string), string currency = default(string), string languageCode = default(string), bool? taxIncluded = default(bool?), bool? isRecuring = default(bool?), string comment = default(string), string status = default(string), string purchaseOrderNumber = default(string), string weightUnit = default(string), double? weight = default(double?), string validationType = default(string), string type = default(string), double? volumetricWeight = default(double?), double? total = default(double?), double? subTotal = default(double?), double? subTotalWithTax = default(double?), double? subTotalDiscount = default(double?), double? subTotalDiscountWithTax = default(double?), double? shippingTotal = default(double?), double? shippingTotalWithTax = default(double?), double? shippingSubTotal = default(double?), double? shippingSubTotalWithTax = default(double?), double? shippingDiscountTotal = default(double?), double? shippingDiscountTotalWithTax = default(double?), double? paymentTotal = default(double?), double? paymentTotalWithTax = default(double?), double? paymentSubTotal = default(double?), double? paymentSubTotalWithTax = default(double?), double? paymentDiscountTotal = default(double?), double? paymentDiscountTotalWithTax = default(double?), double? handlingTotal = default(double?), double? handlingTotalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), double? feeTotal = default(double?), double? feeTotalWithTax = default(double?), IList addresses = default(IList), IList items = default(IList), IList payments = default(IList), IList shipments = default(IList), IList coupons = default(IList), string coupon = default(string), IList discounts = default(IList), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string objectType = default(string), IList dynamicProperties = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { + ConfiguredGroups = configuredGroups; Name = name; StoreId = storeId; ChannelId = channelId; @@ -6796,6 +6949,11 @@ public ShoppingCart() /// partial void CustomInit(); + /// + /// + [JsonProperty(PropertyName = "configuredGroups")] + public IList ConfiguredGroups { get; set; } + /// /// [JsonProperty(PropertyName = "name")] diff --git a/VirtoCommerce.Storefront/AutoRestClients/OrdersModuleApi.cs b/VirtoCommerce.Storefront/AutoRestClients/OrdersModuleApi.cs index 567ef57a..512f6ceb 100644 --- a/VirtoCommerce.Storefront/AutoRestClients/OrdersModuleApi.cs +++ b/VirtoCommerce.Storefront/AutoRestClients/OrdersModuleApi.cs @@ -6,11 +6,16 @@ namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { - using System.Collections.Generic; - using System.Net.Http; using Microsoft.Rest; using Microsoft.Rest.Serialization; + using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OrdersModuleClient : ServiceClient, IOrdersModuleClient { @@ -296,7 +301,7 @@ private void Initialize() NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + Converters = new List { new Iso8601TimeSpanConverter() } @@ -326,7 +331,15 @@ private void Initialize() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// @@ -374,16 +387,18 @@ public partial interface IOrdersModuleClient : System.IDisposable namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; using System.Collections.Generic; using System.IO; + using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; /// /// OrderModule operations. @@ -460,7 +475,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -472,11 +487,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -501,12 +516,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -621,7 +634,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -656,12 +669,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -776,7 +787,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -811,12 +822,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -911,7 +920,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -923,11 +932,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -952,12 +961,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1076,7 +1083,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1088,11 +1095,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -1117,12 +1124,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1225,7 +1230,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1260,12 +1265,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1357,7 +1360,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1369,11 +1372,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -1398,12 +1401,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1492,7 +1493,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1504,11 +1505,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -1533,12 +1534,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1618,7 +1617,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1653,12 +1652,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 204 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1746,7 +1743,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1781,12 +1778,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -1892,7 +1887,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -1927,12 +1922,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2041,7 +2034,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -2076,12 +2069,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2174,7 +2165,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -2186,11 +2177,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -2215,12 +2206,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2319,7 +2308,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -2354,12 +2343,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2391,7 +2378,6 @@ public OrderModule(OrdersModuleClient client) return _result; } - /// /// /// @@ -2446,7 +2432,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -2481,12 +2467,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2574,7 +2558,7 @@ public OrderModule(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -2586,11 +2570,11 @@ public OrderModule(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -2615,12 +2599,10 @@ public OrderModule(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -2675,12 +2657,17 @@ public OrderModule(OrdersModuleClient client) namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; using System.Collections.Generic; using System.IO; + using System.Net; + using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using Microsoft.Rest; - using Models; /// /// OrderModule operations. @@ -3044,694 +3031,702 @@ public partial interface IOrderModule namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; using System.Collections.Generic; using System.IO; + using System.Net; + using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using Models; /// /// Extension methods for OrderModule. /// public static partial class OrderModuleExtensions { - /// - /// Search customer orders by given criteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// criteria - /// - public static CustomerOrderSearchResult SearchCustomerOrder(this IOrderModule operations, CustomerOrderSearchCriteria body = default(CustomerOrderSearchCriteria)) - { - return operations.SearchCustomerOrderAsync(body).GetAwaiter().GetResult(); - } + /// + /// Search customer orders by given criteria + /// + /// + /// The operations group for this extension method. + /// + /// + /// criteria + /// + public static CustomerOrderSearchResult SearchCustomerOrder(this IOrderModule operations, CustomerOrderSearchCriteria body = default(CustomerOrderSearchCriteria)) + { + return operations.SearchCustomerOrderAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Search customer orders by given criteria + /// + /// + /// The operations group for this extension method. + /// + /// + /// criteria + /// + /// + /// The cancellation token. + /// + public static async Task SearchCustomerOrderAsync(this IOrderModule operations, CustomerOrderSearchCriteria body = default(CustomerOrderSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchCustomerOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Find customer order by number + /// + /// + /// Return a single customer order with all nested documents or null if order + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order number + /// + /// + /// + public static CustomerOrder GetByNumber(this IOrderModule operations, string number, string respGroup) + { + return operations.GetByNumberAsync(number, respGroup).GetAwaiter().GetResult(); + } + + /// + /// Find customer order by number + /// + /// + /// Return a single customer order with all nested documents or null if order + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order number + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetByNumberAsync(this IOrderModule operations, string number, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByNumberWithHttpMessagesAsync(number, respGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Find customer order by id + /// + /// + /// Return a single customer order with all nested documents or null if order + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// + public static CustomerOrder GetById(this IOrderModule operations, string id, string respGroup) + { + return operations.GetByIdAsync(id, respGroup).GetAwaiter().GetResult(); + } + + /// + /// Find customer order by id + /// + /// + /// Return a single customer order with all nested documents or null if order + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IOrderModule operations, string id, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, respGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Calculate order totals after changes + /// + /// + /// Return order with recalculated totals + /// + /// + /// The operations group for this extension method. + /// + /// + /// Customer order + /// + public static CustomerOrder CalculateTotals(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) + { + return operations.CalculateTotalsAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Calculate order totals after changes + /// + /// + /// Return order with recalculated totals + /// + /// + /// The operations group for this extension method. + /// + /// + /// Customer order + /// + /// + /// The cancellation token. + /// + public static async Task CalculateTotalsAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CalculateTotalsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Register customer order payment in external payment system + /// + /// + /// Used in storefront checkout or manual order payment registration + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// payment id + /// + /// + /// banking card information + /// + public static ProcessPaymentRequestResult ProcessOrderPayments(this IOrderModule operations, string orderId, string paymentId, BankCardInfo body = default(BankCardInfo)) + { + return operations.ProcessOrderPaymentsAsync(orderId, paymentId, body).GetAwaiter().GetResult(); + } + + /// + /// Register customer order payment in external payment system + /// + /// + /// Used in storefront checkout or manual order payment registration + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// payment id + /// + /// + /// banking card information + /// + /// + /// The cancellation token. + /// + public static async Task ProcessOrderPaymentsAsync(this IOrderModule operations, string orderId, string paymentId, BankCardInfo body = default(BankCardInfo), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ProcessOrderPaymentsWithHttpMessagesAsync(orderId, paymentId, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create new customer order based on shopping cart. + /// + /// + /// The operations group for this extension method. + /// + /// + /// shopping cart id + /// + public static CustomerOrder CreateOrderFromCart(this IOrderModule operations, string cartId) + { + return operations.CreateOrderFromCartAsync(cartId).GetAwaiter().GetResult(); + } + + /// + /// Create new customer order based on shopping cart. + /// + /// + /// The operations group for this extension method. + /// + /// + /// shopping cart id + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrderFromCartAsync(this IOrderModule operations, string cartId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrderFromCartWithHttpMessagesAsync(cartId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add new customer order to system + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order + /// + public static CustomerOrder CreateOrder(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) + { + return operations.CreateOrderAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Add new customer order to system + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrderAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a existing customer order + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order + /// + public static void UpdateOrder(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) + { + operations.UpdateOrderAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Update a existing customer order + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order + /// + /// + /// The cancellation token. + /// + public static async Task UpdateOrderAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete a whole customer orders + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order ids for delete + /// + public static void DeleteOrdersByIds(this IOrderModule operations, IList ids = default(IList)) + { + operations.DeleteOrdersByIdsAsync(ids).GetAwaiter().GetResult(); + } + + /// + /// Delete a whole customer orders + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order ids for delete + /// + /// + /// The cancellation token. + /// + public static async Task DeleteOrdersByIdsAsync(this IOrderModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteOrdersByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get new shipment for specified customer order + /// + /// + /// Return new shipment document with populates all required properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + public static OrderShipment GetNewShipment(this IOrderModule operations, string id) + { + return operations.GetNewShipmentAsync(id).GetAwaiter().GetResult(); + } + + /// + /// Get new shipment for specified customer order + /// + /// + /// Return new shipment document with populates all required properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// The cancellation token. + /// + public static async Task GetNewShipmentAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNewShipmentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get new payment for specified customer order + /// + /// + /// Return new payment document with populates all required properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + public static PaymentIn GetNewPayment(this IOrderModule operations, string id) + { + return operations.GetNewPaymentAsync(id).GetAwaiter().GetResult(); + } + + /// + /// Get new payment for specified customer order + /// + /// + /// Return new payment document with populates all required properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// customer order id + /// + /// + /// The cancellation token. + /// + public static async Task GetNewPaymentAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNewPaymentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a some order statistic information for Commerce manager dashboard + /// + /// + /// The operations group for this extension method. + /// + /// + /// start interval date + /// + /// + /// end interval date + /// + public static DashboardStatisticsResult GetDashboardStatisticsAsync(this IOrderModule operations, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) + { + return operations.GetDashboardStatisticsAsyncAsync(start, end).GetAwaiter().GetResult(); + } + + /// + /// Get a some order statistic information for Commerce manager dashboard + /// + /// + /// The operations group for this extension method. + /// + /// + /// start interval date + /// + /// + /// end interval date + /// + /// + /// The cancellation token. + /// + public static async Task GetDashboardStatisticsAsyncAsync(this IOrderModule operations, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDashboardStatisticsAsyncWithHttpMessagesAsync(start, end, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Payment callback operation used by external payment services to inform post + /// process payment in our system + /// + /// + /// The operations group for this extension method. + /// + /// + /// payment callback parameters + /// + public static PostProcessPaymentRequestResult PostProcessPayment(this IOrderModule operations, PaymentCallbackParameters body = default(PaymentCallbackParameters)) + { + return operations.PostProcessPaymentAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Payment callback operation used by external payment services to inform post + /// process payment in our system + /// + /// + /// The operations group for this extension method. + /// + /// + /// payment callback parameters + /// + /// + /// The cancellation token. + /// + public static async Task PostProcessPaymentAsync(this IOrderModule operations, PaymentCallbackParameters body = default(PaymentCallbackParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostProcessPaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static Stream GetInvoicePdf(this IOrderModule operations, string orderNumber) + { + return operations.GetInvoicePdfAsync(orderNumber).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetInvoicePdfAsync(this IOrderModule operations, string orderNumber, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.GetInvoicePdfWithHttpMessagesAsync(orderNumber, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } - /// - /// Search customer orders by given criteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// criteria - /// - /// - /// The cancellation token. - /// - public static async Task SearchCustomerOrderAsync(this IOrderModule operations, CustomerOrderSearchCriteria body = default(CustomerOrderSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.SearchCustomerOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + /// + /// The operations group for this extension method. + /// + /// + /// + public static IList GetOrderChanges(this IOrderModule operations, string id) { - return _result.Body; + return operations.GetOrderChangesAsync(id).GetAwaiter().GetResult(); } - } - /// - /// Find customer order by number - /// - /// - /// Return a single customer order with all nested documents or null if order - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order number - /// - /// - /// - public static CustomerOrder GetByNumber(this IOrderModule operations, string number, string respGroup) - { - return operations.GetByNumberAsync(number, respGroup).GetAwaiter().GetResult(); - } + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> GetOrderChangesAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOrderChangesWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } - /// - /// Find customer order by number - /// - /// - /// Return a single customer order with all nested documents or null if order - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order number - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetByNumberAsync(this IOrderModule operations, string number, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByNumberWithHttpMessagesAsync(number, respGroup, null, cancellationToken).ConfigureAwait(false)) + /// + /// The operations group for this extension method. + /// + /// + /// + public static ChangeLogSearchResult SearchOrderChanges(this IOrderModule operations, CustomerOrderHistorySearchCriteria body = default(CustomerOrderHistorySearchCriteria)) { - return _result.Body; + return operations.SearchOrderChangesAsync(body).GetAwaiter().GetResult(); } - } - /// - /// Find customer order by id - /// - /// - /// Return a single customer order with all nested documents or null if order - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// - public static CustomerOrder GetById(this IOrderModule operations, string id, string respGroup) - { - return operations.GetByIdAsync(id, respGroup).GetAwaiter().GetResult(); - } + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SearchOrderChangesAsync(this IOrderModule operations, CustomerOrderHistorySearchCriteria body = default(CustomerOrderHistorySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchOrderChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + /// + /// OrderModulePayments operations. + /// + public partial class OrderModulePayments : IServiceOperations, IOrderModulePayments + { /// - /// Find customer order by id + /// Initializes a new instance of the OrderModulePayments class. /// - /// - /// Return a single customer order with all nested documents or null if order - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// - /// - /// The cancellation token. + /// + /// Reference to the service client. /// - public static async Task GetByIdAsync(this IOrderModule operations, string id, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Thrown when a required parameter is null + /// + public OrderModulePayments(OrdersModuleClient client) { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, respGroup, null, cancellationToken).ConfigureAwait(false)) + if (client == null) { - return _result.Body; + throw new System.ArgumentNullException("client"); } + Client = client; } /// - /// Calculate order totals after changes + /// Gets a reference to the OrdersModuleClient /// - /// - /// Return order with recalculated totals - /// - /// - /// The operations group for this extension method. - /// - /// - /// Customer order - /// - public static CustomerOrder CalculateTotals(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) - { - return operations.CalculateTotalsAsync(body).GetAwaiter().GetResult(); - } + public OrdersModuleClient Client { get; private set; } /// - /// Calculate order totals after changes + /// Search order payments by given criteria /// - /// - /// Return order with recalculated totals - /// - /// - /// The operations group for this extension method. - /// /// - /// Customer order + /// criteria + /// + /// + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public static async Task CalculateTotalsAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SearchOrderPaymentsWithHttpMessagesAsync(PaymentSearchCriteria body = default(PaymentSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CalculateTotalsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) { - return _result.Body; + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SearchOrderPayments", tracingParameters); } - } - - /// - /// Register customer order payment in external payment system - /// - /// - /// Used in storefront checkout or manual order payment registration - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// payment id - /// - /// - /// banking card information - /// - public static ProcessPaymentRequestResult ProcessOrderPayments(this IOrderModule operations, string orderId, string paymentId, BankCardInfo body = default(BankCardInfo)) - { - return operations.ProcessOrderPaymentsAsync(orderId, paymentId, body).GetAwaiter().GetResult(); - } - - /// - /// Register customer order payment in external payment system - /// - /// - /// Used in storefront checkout or manual order payment registration - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// payment id - /// - /// - /// banking card information - /// - /// - /// The cancellation token. - /// - public static async Task ProcessOrderPaymentsAsync(this IOrderModule operations, string orderId, string paymentId, BankCardInfo body = default(BankCardInfo), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ProcessOrderPaymentsWithHttpMessagesAsync(orderId, paymentId, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create new customer order based on shopping cart. - /// - /// - /// The operations group for this extension method. - /// - /// - /// shopping cart id - /// - public static CustomerOrder CreateOrderFromCart(this IOrderModule operations, string cartId) - { - return operations.CreateOrderFromCartAsync(cartId).GetAwaiter().GetResult(); - } - - /// - /// Create new customer order based on shopping cart. - /// - /// - /// The operations group for this extension method. - /// - /// - /// shopping cart id - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrderFromCartAsync(this IOrderModule operations, string cartId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrderFromCartWithHttpMessagesAsync(cartId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Add new customer order to system - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order - /// - public static CustomerOrder CreateOrder(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) - { - return operations.CreateOrderAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Add new customer order to system - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrderAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update a existing customer order - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order - /// - public static void UpdateOrder(this IOrderModule operations, CustomerOrder body = default(CustomerOrder)) - { - operations.UpdateOrderAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Update a existing customer order - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order - /// - /// - /// The cancellation token. - /// - public static async Task UpdateOrderAsync(this IOrderModule operations, CustomerOrder body = default(CustomerOrder), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateOrderWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Delete a whole customer orders - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order ids for delete - /// - public static void DeleteOrdersByIds(this IOrderModule operations, IList ids = default(IList)) - { - operations.DeleteOrdersByIdsAsync(ids).GetAwaiter().GetResult(); - } - - /// - /// Delete a whole customer orders - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order ids for delete - /// - /// - /// The cancellation token. - /// - public static async Task DeleteOrdersByIdsAsync(this IOrderModule operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteOrdersByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get new shipment for specified customer order - /// - /// - /// Return new shipment document with populates all required properties. - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - public static OrderShipment GetNewShipment(this IOrderModule operations, string id) - { - return operations.GetNewShipmentAsync(id).GetAwaiter().GetResult(); - } - - /// - /// Get new shipment for specified customer order - /// - /// - /// Return new shipment document with populates all required properties. - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// The cancellation token. - /// - public static async Task GetNewShipmentAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetNewShipmentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get new payment for specified customer order - /// - /// - /// Return new payment document with populates all required properties. - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - public static PaymentIn GetNewPayment(this IOrderModule operations, string id) - { - return operations.GetNewPaymentAsync(id).GetAwaiter().GetResult(); - } - - /// - /// Get new payment for specified customer order - /// - /// - /// Return new payment document with populates all required properties. - /// - /// - /// The operations group for this extension method. - /// - /// - /// customer order id - /// - /// - /// The cancellation token. - /// - public static async Task GetNewPaymentAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetNewPaymentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a some order statistic information for Commerce manager dashboard - /// - /// - /// The operations group for this extension method. - /// - /// - /// start interval date - /// - /// - /// end interval date - /// - public static DashboardStatisticsResult GetDashboardStatisticsAsync(this IOrderModule operations, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) - { - return operations.GetDashboardStatisticsAsyncAsync(start, end).GetAwaiter().GetResult(); - } - - /// - /// Get a some order statistic information for Commerce manager dashboard - /// - /// - /// The operations group for this extension method. - /// - /// - /// start interval date - /// - /// - /// end interval date - /// - /// - /// The cancellation token. - /// - public static async Task GetDashboardStatisticsAsyncAsync(this IOrderModule operations, System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDashboardStatisticsAsyncWithHttpMessagesAsync(start, end, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Payment callback operation used by external payment services to inform post - /// process payment in our system - /// - /// - /// The operations group for this extension method. - /// - /// - /// payment callback parameters - /// - public static PostProcessPaymentRequestResult PostProcessPayment(this IOrderModule operations, PaymentCallbackParameters body = default(PaymentCallbackParameters)) - { - return operations.PostProcessPaymentAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Payment callback operation used by external payment services to inform post - /// process payment in our system - /// - /// - /// The operations group for this extension method. - /// - /// - /// payment callback parameters - /// - /// - /// The cancellation token. - /// - public static async Task PostProcessPaymentAsync(this IOrderModule operations, PaymentCallbackParameters body = default(PaymentCallbackParameters), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PostProcessPaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The operations group for this extension method. - /// - /// - /// - public static Stream GetInvoicePdf(this IOrderModule operations, string orderNumber) - { - return operations.GetInvoicePdfAsync(orderNumber).GetAwaiter().GetResult(); - } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetInvoicePdfAsync(this IOrderModule operations, string orderNumber, CancellationToken cancellationToken = default(CancellationToken)) - { - var _result = await operations.GetInvoicePdfWithHttpMessagesAsync(orderNumber, null, cancellationToken).ConfigureAwait(false); - _result.Request.Dispose(); - return _result.Body; - } - - /// - /// The operations group for this extension method. - /// - /// - /// - public static IList GetOrderChanges(this IOrderModule operations, string id) - { - return operations.GetOrderChangesAsync(id).GetAwaiter().GetResult(); - } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task> GetOrderChangesAsync(this IOrderModule operations, string id, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetOrderChangesWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The operations group for this extension method. - /// - /// - /// - public static ChangeLogSearchResult SearchOrderChanges(this IOrderModule operations, CustomerOrderHistorySearchCriteria body = default(CustomerOrderHistorySearchCriteria)) - { - return operations.SearchOrderChangesAsync(body).GetAwaiter().GetResult(); - } - - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SearchOrderChangesAsync(this IOrderModule operations, CustomerOrderHistorySearchCriteria body = default(CustomerOrderHistorySearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.SearchOrderChangesWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi -{ - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - - /// - /// OrderModulePayments operations. - /// - public partial class OrderModulePayments : IServiceOperations, IOrderModulePayments - { - /// - /// Initializes a new instance of the OrderModulePayments class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public OrderModulePayments(OrdersModuleClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the OrdersModuleClient - /// - public OrdersModuleClient Client { get; private set; } - - /// - /// Search order payments by given criteria - /// - /// - /// criteria - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> SearchOrderPaymentsWithHttpMessagesAsync(PaymentSearchCriteria body = default(PaymentSearchCriteria), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SearchOrderPayments", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/order/payments/search").ToString(); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "api/order/payments/search").ToString(); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -3743,11 +3738,11 @@ public OrderModulePayments(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -3772,12 +3767,10 @@ public OrderModulePayments(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -3892,7 +3885,7 @@ public OrderModulePayments(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -3927,12 +3920,10 @@ public OrderModulePayments(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -4024,7 +4015,7 @@ public OrderModulePayments(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -4036,11 +4027,11 @@ public OrderModulePayments(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -4065,12 +4056,10 @@ public OrderModulePayments(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -4158,7 +4147,7 @@ public OrderModulePayments(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -4170,11 +4159,11 @@ public OrderModulePayments(OrdersModuleClient client) // Serialize Request string _requestContent = null; - if (body != null) + if(body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json-patch+json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) @@ -4199,12 +4188,10 @@ public OrderModulePayments(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -4302,7 +4289,7 @@ public OrderModulePayments(OrdersModuleClient client) if (customHeaders != null) { - foreach (var _header in customHeaders) + foreach(var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { @@ -4337,12 +4324,10 @@ public OrderModulePayments(OrdersModuleClient client) if ((int)_statusCode != 200 && (int)_statusCode != 401 && (int)_statusCode != 403) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) - { + if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } - else - { + else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); @@ -4379,11 +4364,16 @@ public OrderModulePayments(OrdersModuleClient client) namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; using System.Collections.Generic; + using System.Net; + using System.Net.Http; using System.Threading; using System.Threading.Tasks; - using Microsoft.Rest; - using Models; /// /// OrderModulePayments operations. @@ -4424,259 +4414,265 @@ public partial interface IOrderModulePayments /// /// The headers that will be added to request. /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByIdWithHttpMessagesAsync(string id, string respGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or update order payment - /// - /// - /// payment - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> CreatePaymentWithHttpMessagesAsync(PaymentIn body = default(PaymentIn), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - Task> UpdatePaymentWithHttpMessagesAsync(PaymentIn body = default(PaymentIn), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete an order payment - /// - /// - /// order payment ids - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task DeleteOrderPaymentsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi -{ - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - using Models; - - /// - /// Extension methods for OrderModulePayments. - /// - public static partial class OrderModulePaymentsExtensions - { - /// - /// Search order payments by given criteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// criteria - /// - public static PaymentSearchResult SearchOrderPayments(this IOrderModulePayments operations, PaymentSearchCriteria body = default(PaymentSearchCriteria)) - { - return operations.SearchOrderPaymentsAsync(body).GetAwaiter().GetResult(); - } - - /// - /// Search order payments by given criteria - /// - /// - /// The operations group for this extension method. - /// - /// - /// criteria - /// - /// - /// The cancellation token. - /// - public static async Task SearchOrderPaymentsAsync(this IOrderModulePayments operations, PaymentSearchCriteria body = default(PaymentSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.SearchOrderPaymentsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Find order payment by id - /// - /// - /// Return a single order payment with all nested documents or null if payment - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// order payment id - /// - /// - /// - public static PaymentIn GetById(this IOrderModulePayments operations, string id, string respGroup) - { - return operations.GetByIdAsync(id, respGroup).GetAwaiter().GetResult(); - } - - /// - /// Find order payment by id - /// - /// - /// Return a single order payment with all nested documents or null if payment - /// was not found - /// - /// - /// The operations group for this extension method. - /// - /// - /// order payment id - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetByIdAsync(this IOrderModulePayments operations, string id, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, respGroup, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update order payment - /// - /// - /// The operations group for this extension method. - /// - /// - /// payment + /// + /// The cancellation token. /// - public static CustomerOrder CreatePayment(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn)) - { - return operations.CreatePaymentAsync(body).GetAwaiter().GetResult(); - } - + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByIdWithHttpMessagesAsync(string id, string respGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update order payment /// - /// - /// The operations group for this extension method. - /// /// /// payment /// + /// + /// The headers that will be added to request. + /// /// /// The cancellation token. /// - public static async Task CreatePaymentAsync(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreatePaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The operations group for this extension method. - /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> CreatePaymentWithHttpMessagesAsync(PaymentIn body = default(PaymentIn), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// - public static CustomerOrder UpdatePayment(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn)) - { - return operations.UpdatePaymentAsync(body).GetAwaiter().GetResult(); - } - - /// - /// The operations group for this extension method. - /// - /// + /// + /// The headers that will be added to request. /// /// /// The cancellation token. /// - public static async Task UpdatePaymentAsync(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdatePaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + Task> UpdatePaymentWithHttpMessagesAsync(PaymentIn body = default(PaymentIn), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an order payment /// - /// - /// The operations group for this extension method. - /// /// /// order payment ids /// - public static void DeleteOrderPaymentsByIds(this IOrderModulePayments operations, IList ids = default(IList)) - { - operations.DeleteOrderPaymentsByIdsAsync(ids).GetAwaiter().GetResult(); - } - - /// - /// Delete an order payment - /// - /// - /// The operations group for this extension method. - /// - /// - /// order payment ids + /// + /// The headers that will be added to request. /// /// /// The cancellation token. /// - public static async Task DeleteOrderPaymentsByIdsAsync(this IOrderModulePayments operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteOrderPaymentsByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } + /// + /// Thrown when the operation returned an invalid status code + /// + Task DeleteOrderPaymentsByIdsWithHttpMessagesAsync(IList ids = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OrderModulePayments. + /// + public static partial class OrderModulePaymentsExtensions + { + /// + /// Search order payments by given criteria + /// + /// + /// The operations group for this extension method. + /// + /// + /// criteria + /// + public static PaymentSearchResult SearchOrderPayments(this IOrderModulePayments operations, PaymentSearchCriteria body = default(PaymentSearchCriteria)) + { + return operations.SearchOrderPaymentsAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Search order payments by given criteria + /// + /// + /// The operations group for this extension method. + /// + /// + /// criteria + /// + /// + /// The cancellation token. + /// + public static async Task SearchOrderPaymentsAsync(this IOrderModulePayments operations, PaymentSearchCriteria body = default(PaymentSearchCriteria), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SearchOrderPaymentsWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Find order payment by id + /// + /// + /// Return a single order payment with all nested documents or null if payment + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// order payment id + /// + /// + /// + public static PaymentIn GetById(this IOrderModulePayments operations, string id, string respGroup) + { + return operations.GetByIdAsync(id, respGroup).GetAwaiter().GetResult(); + } + + /// + /// Find order payment by id + /// + /// + /// Return a single order payment with all nested documents or null if payment + /// was not found + /// + /// + /// The operations group for this extension method. + /// + /// + /// order payment id + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IOrderModulePayments operations, string id, string respGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, respGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update order payment + /// + /// + /// The operations group for this extension method. + /// + /// + /// payment + /// + public static CustomerOrder CreatePayment(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn)) + { + return operations.CreatePaymentAsync(body).GetAwaiter().GetResult(); + } + + /// + /// Create or update order payment + /// + /// + /// The operations group for this extension method. + /// + /// + /// payment + /// + /// + /// The cancellation token. + /// + public static async Task CreatePaymentAsync(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreatePaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// + public static CustomerOrder UpdatePayment(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn)) + { + return operations.UpdatePaymentAsync(body).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePaymentAsync(this IOrderModulePayments operations, PaymentIn body = default(PaymentIn), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePaymentWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an order payment + /// + /// + /// The operations group for this extension method. + /// + /// + /// order payment ids + /// + public static void DeleteOrderPaymentsByIds(this IOrderModulePayments operations, IList ids = default(IList)) + { + operations.DeleteOrderPaymentsByIdsAsync(ids).GetAwaiter().GetResult(); + } + + /// + /// Delete an order payment + /// + /// + /// The operations group for this extension method. + /// + /// + /// order payment ids + /// + /// + /// The cancellation token. + /// + public static async Task DeleteOrderPaymentsByIdsAsync(this IOrderModulePayments operations, IList ids = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteOrderPaymentsByIdsWithHttpMessagesAsync(ids, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } } } @@ -4688,7 +4684,16 @@ public static PaymentIn GetById(this IOrderModulePayments operations, string id, namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OperationLog { @@ -4781,7 +4786,16 @@ public OperationLog() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class SortInfo { @@ -4831,8 +4845,16 @@ public SortInfo() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class CustomerOrderSearchCriteria { @@ -5048,7 +5070,156 @@ public CustomerOrderSearchCriteria() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class DemoOrderConfiguredGroup + { + /// + /// Initializes a new instance of the DemoOrderConfiguredGroup class. + /// + public DemoOrderConfiguredGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DemoOrderConfiguredGroup class. + /// + public DemoOrderConfiguredGroup(string productId = default(string), IList itemIds = default(IList), int? quantity = default(int?), string currency = default(string), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? price = default(double?), double? priceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? taxTotal = default(double?), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + { + ProductId = productId; + ItemIds = itemIds; + Quantity = quantity; + Currency = currency; + ExtendedPrice = extendedPrice; + ExtendedPriceWithTax = extendedPriceWithTax; + Price = price; + PriceWithTax = priceWithTax; + PlacedPrice = placedPrice; + PlacedPriceWithTax = placedPriceWithTax; + TaxTotal = taxTotal; + CreatedDate = createdDate; + ModifiedDate = modifiedDate; + CreatedBy = createdBy; + ModifiedBy = modifiedBy; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "productId")] + public string ProductId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "itemIds")] + public IList ItemIds { get; set; } + + /// + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedPrice")] + public double? ExtendedPrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedPriceWithTax")] + public double? ExtendedPriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "price")] + public double? Price { get; set; } + + /// + /// + [JsonProperty(PropertyName = "priceWithTax")] + public double? PriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "placedPrice")] + public double? PlacedPrice { get; set; } + + /// + /// + [JsonProperty(PropertyName = "placedPriceWithTax")] + public double? PlacedPriceWithTax { get; set; } + + /// + /// + [JsonProperty(PropertyName = "taxTotal")] + public double? TaxTotal { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdDate")] + public System.DateTime? CreatedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedDate")] + public System.DateTime? ModifiedDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "modifiedBy")] + public string ModifiedBy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OrderAddress { @@ -5195,8 +5366,16 @@ public OrderAddress() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class ObjectSettingEntry { @@ -5214,7 +5393,7 @@ public ObjectSettingEntry() /// Possible values include: 'ShortText', /// 'LongText', 'Integer', 'Decimal', 'DateTime', 'Boolean', /// 'SecureString', 'Json' - public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), object value = default(object), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) + public ObjectSettingEntry(bool? itHasValues = default(bool?), string objectId = default(string), string objectType = default(string), object value = default(object), bool? restartRequired = default(bool?), string moduleId = default(string), string groupName = default(string), string name = default(string), bool? isHidden = default(bool?), string valueType = default(string), IList allowedValues = default(IList), object defaultValue = default(object), bool? isDictionary = default(bool?)) { ItHasValues = itHasValues; ObjectId = objectId; @@ -5224,6 +5403,7 @@ public ObjectSettingEntry() ModuleId = moduleId; GroupName = groupName; Name = name; + IsHidden = isHidden; ValueType = valueType; AllowedValues = allowedValues; DefaultValue = defaultValue; @@ -5276,6 +5456,11 @@ public ObjectSettingEntry() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// + [JsonProperty(PropertyName = "isHidden")] + public bool? IsHidden { get; set; } + /// /// Gets or sets possible values include: 'ShortText', 'LongText', /// 'Integer', 'Decimal', 'DateTime', 'Boolean', 'SecureString', 'Json' @@ -5308,7 +5493,16 @@ public ObjectSettingEntry() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class TaxDetail { @@ -5361,8 +5555,16 @@ public TaxDetail() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentMethod { @@ -5543,7 +5745,16 @@ public PaymentMethod() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class ProcessPaymentRequestResult { @@ -5628,7 +5839,16 @@ public ProcessPaymentRequestResult() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class Discount { @@ -5705,7 +5925,16 @@ public Discount() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentGatewayTransaction { @@ -5874,8 +6103,16 @@ public PaymentGatewayTransaction() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class IOperation { @@ -5964,7 +6201,16 @@ public IOperation() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class DynamicPropertyObjectValue { @@ -6053,7 +6299,16 @@ public DynamicPropertyObjectValue() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class DynamicPropertyName { @@ -6100,8 +6355,16 @@ public DynamicPropertyName() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class DynamicObjectProperty { @@ -6244,8 +6507,16 @@ public DynamicObjectProperty() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentIn { @@ -6265,7 +6536,7 @@ public PaymentIn() /// 'Pending', 'Authorized', 'Paid', 'PartiallyRefunded', 'Refunded', /// 'Voided', 'Custom', 'Cancelled', 'Declined', 'Error' /// Tax category or type - public PaymentIn(string orderId = default(string), string purpose = default(string), string gatewayCode = default(string), PaymentMethod paymentMethod = default(PaymentMethod), string organizationId = default(string), string organizationName = default(string), string customerId = default(string), string customerName = default(string), System.DateTime? incomingDate = default(System.DateTime?), OrderAddress billingAddress = default(OrderAddress), string paymentStatus = default(string), System.DateTime? authorizedDate = default(System.DateTime?), System.DateTime? capturedDate = default(System.DateTime?), System.DateTime? voidedDate = default(System.DateTime?), ProcessPaymentRequestResult processPaymentResult = default(ProcessPaymentRequestResult), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), string objectType = default(string), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), IList discounts = default(IList), IList transactions = default(IList), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), string purchaseOrderNumber = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public PaymentIn(string orderId = default(string), string purpose = default(string), string gatewayCode = default(string), PaymentMethod paymentMethod = default(PaymentMethod), string organizationId = default(string), string organizationName = default(string), string customerId = default(string), string customerName = default(string), System.DateTime? incomingDate = default(System.DateTime?), OrderAddress billingAddress = default(OrderAddress), string paymentStatus = default(string), System.DateTime? authorizedDate = default(System.DateTime?), System.DateTime? capturedDate = default(System.DateTime?), System.DateTime? voidedDate = default(System.DateTime?), ProcessPaymentRequestResult processPaymentResult = default(ProcessPaymentRequestResult), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), string objectType = default(string), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), IList discounts = default(IList), IList transactions = default(IList), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { OrderId = orderId; Purpose = purpose; @@ -6304,7 +6575,6 @@ public PaymentIn() Currency = currency; Sum = sum; OuterId = outerId; - PurchaseOrderNumber = purchaseOrderNumber; IsCancelled = isCancelled; CancelledDate = cancelledDate; CancelReason = cancelReason; @@ -6513,11 +6783,6 @@ public PaymentIn() [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } - /// - /// - [JsonProperty(PropertyName = "purchaseOrderNumber")] - public string PurchaseOrderNumber { get; set; } - /// /// [JsonProperty(PropertyName = "isCancelled")] @@ -6578,8 +6843,16 @@ public PaymentIn() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OrderLineItem { @@ -6602,8 +6875,9 @@ public OrderLineItem() /// item discount amount /// Tax category or type /// Reserve quantity - public OrderLineItem(string priceId = default(string), string currency = default(string), double? price = default(double?), double? priceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), int? reserveQuantity = default(int?), int? quantity = default(int?), string productId = default(string), string sku = default(string), string productType = default(string), string catalogId = default(string), string categoryId = default(string), string name = default(string), string comment = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string shippingMethodCode = default(string), string fulfillmentLocationCode = default(string), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string outerId = default(string), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), string objectType = default(string), IList dynamicProperties = default(IList), IList discounts = default(IList), IList taxDetails = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public OrderLineItem(string configuredGroupId = default(string), string priceId = default(string), string currency = default(string), double? price = default(double?), double? priceWithTax = default(double?), double? placedPrice = default(double?), double? placedPriceWithTax = default(double?), double? extendedPrice = default(double?), double? extendedPriceWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), int? reserveQuantity = default(int?), int? quantity = default(int?), string productId = default(string), string sku = default(string), string productType = default(string), string catalogId = default(string), string categoryId = default(string), string name = default(string), string comment = default(string), string imageUrl = default(string), bool? isGift = default(bool?), string shippingMethodCode = default(string), string fulfillmentLocationCode = default(string), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string outerId = default(string), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), string objectType = default(string), IList dynamicProperties = default(IList), IList discounts = default(IList), IList taxDetails = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { + ConfiguredGroupId = configuredGroupId; PriceId = priceId; Currency = currency; Price = price; @@ -6663,6 +6937,11 @@ public OrderLineItem() /// partial void CustomInit(); + /// + /// + [JsonProperty(PropertyName = "configuredGroupId")] + public string ConfiguredGroupId { get; set; } + /// /// Gets or sets price id /// @@ -6934,8 +7213,16 @@ public OrderLineItem() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class ShippingMethod { @@ -7030,7 +7317,16 @@ public ShippingMethod() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OrderShipmentItem { @@ -7125,8 +7421,16 @@ public OrderShipmentItem() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class ShipmentPackage { @@ -7245,8 +7549,16 @@ public ShipmentPackage() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class CustomerOrder { @@ -7265,6 +7577,8 @@ public CustomerOrder() /// the order was created /// Flag determines that the order is the /// prototype + /// Internal number of order provided + /// by customer /// Number for subscription /// associated with this order /// Identifier for subscription @@ -7279,8 +7593,9 @@ public CustomerOrder() /// $100). /// Grand order total /// Tax category or type - public CustomerOrder(string customerId = default(string), string customerName = default(string), string channelId = default(string), string storeId = default(string), string storeName = default(string), string organizationId = default(string), string organizationName = default(string), string employeeId = default(string), string employeeName = default(string), string shoppingCartId = default(string), bool? isPrototype = default(bool?), string subscriptionNumber = default(string), string subscriptionId = default(string), string objectType = default(string), IList addresses = default(IList), IList inPayments = default(IList), IList items = default(IList), IList shipments = default(IList), IList discounts = default(IList), double? discountAmount = default(double?), IList taxDetails = default(IList), IList scopes = default(IList), double? total = default(double?), double? subTotal = default(double?), double? subTotalWithTax = default(double?), double? subTotalDiscount = default(double?), double? subTotalDiscountWithTax = default(double?), double? subTotalTaxTotal = default(double?), double? shippingTotal = default(double?), double? shippingTotalWithTax = default(double?), double? shippingSubTotal = default(double?), double? shippingSubTotalWithTax = default(double?), double? shippingDiscountTotal = default(double?), double? shippingDiscountTotalWithTax = default(double?), double? shippingTaxTotal = default(double?), double? paymentTotal = default(double?), double? paymentTotalWithTax = default(double?), double? paymentSubTotal = default(double?), double? paymentSubTotalWithTax = default(double?), double? paymentDiscountTotal = default(double?), double? paymentDiscountTotalWithTax = default(double?), double? paymentTaxTotal = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), double? feeTotal = default(double?), double? feeTotalWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), string languageCode = default(string), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), string purchaseOrderNumber = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public CustomerOrder(IList configuredGroups = default(IList), string customerId = default(string), string customerName = default(string), string channelId = default(string), string storeId = default(string), string storeName = default(string), string organizationId = default(string), string organizationName = default(string), string employeeId = default(string), string employeeName = default(string), string shoppingCartId = default(string), bool? isPrototype = default(bool?), string purchaseOrderNumber = default(string), string subscriptionNumber = default(string), string subscriptionId = default(string), string objectType = default(string), IList addresses = default(IList), IList inPayments = default(IList), IList items = default(IList), IList shipments = default(IList), IList discounts = default(IList), double? discountAmount = default(double?), IList taxDetails = default(IList), IList scopes = default(IList), double? total = default(double?), double? subTotal = default(double?), double? subTotalWithTax = default(double?), double? subTotalDiscount = default(double?), double? subTotalDiscountWithTax = default(double?), double? subTotalTaxTotal = default(double?), double? shippingTotal = default(double?), double? shippingTotalWithTax = default(double?), double? shippingSubTotal = default(double?), double? shippingSubTotalWithTax = default(double?), double? shippingDiscountTotal = default(double?), double? shippingDiscountTotalWithTax = default(double?), double? shippingTaxTotal = default(double?), double? paymentTotal = default(double?), double? paymentTotalWithTax = default(double?), double? paymentSubTotal = default(double?), double? paymentSubTotalWithTax = default(double?), double? paymentDiscountTotal = default(double?), double? paymentDiscountTotalWithTax = default(double?), double? paymentTaxTotal = default(double?), double? discountTotal = default(double?), double? discountTotalWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), double? feeTotal = default(double?), double? feeTotalWithTax = default(double?), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), string languageCode = default(string), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { + ConfiguredGroups = configuredGroups; CustomerId = customerId; CustomerName = customerName; ChannelId = channelId; @@ -7292,6 +7607,7 @@ public CustomerOrder() EmployeeName = employeeName; ShoppingCartId = shoppingCartId; IsPrototype = isPrototype; + PurchaseOrderNumber = purchaseOrderNumber; SubscriptionNumber = subscriptionNumber; SubscriptionId = subscriptionId; ObjectType = objectType; @@ -7342,7 +7658,6 @@ public CustomerOrder() Currency = currency; Sum = sum; OuterId = outerId; - PurchaseOrderNumber = purchaseOrderNumber; IsCancelled = isCancelled; CancelledDate = cancelledDate; CancelReason = cancelReason; @@ -7361,6 +7676,11 @@ public CustomerOrder() /// partial void CustomInit(); + /// + /// + [JsonProperty(PropertyName = "configuredGroups")] + public IList ConfiguredGroups { get; set; } + /// /// [JsonProperty(PropertyName = "customerId")] @@ -7419,6 +7739,12 @@ public CustomerOrder() [JsonProperty(PropertyName = "isPrototype")] public bool? IsPrototype { get; set; } + /// + /// Gets or sets internal number of order provided by customer + /// + [JsonProperty(PropertyName = "purchaseOrderNumber")] + public string PurchaseOrderNumber { get; set; } + /// /// Gets or sets number for subscription associated with this order /// @@ -7680,11 +8006,6 @@ public CustomerOrder() [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } - /// - /// - [JsonProperty(PropertyName = "purchaseOrderNumber")] - public string PurchaseOrderNumber { get; set; } - /// /// [JsonProperty(PropertyName = "isCancelled")] @@ -7745,8 +8066,16 @@ public CustomerOrder() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class OrderShipment { @@ -7766,7 +8095,7 @@ public OrderShipment() /// Current shipment option /// code /// Tax category or type - public OrderShipment(string organizationId = default(string), string organizationName = default(string), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string employeeId = default(string), string employeeName = default(string), string shipmentMethodCode = default(string), string shipmentMethodOption = default(string), ShippingMethod shippingMethod = default(ShippingMethod), string customerOrderId = default(string), CustomerOrder customerOrder = default(CustomerOrder), IList items = default(IList), IList packages = default(IList), IList inPayments = default(IList), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), IList discounts = default(IList), OrderAddress deliveryAddress = default(OrderAddress), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string objectType = default(string), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), string purchaseOrderNumber = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) + public OrderShipment(string organizationId = default(string), string organizationName = default(string), string fulfillmentCenterId = default(string), string fulfillmentCenterName = default(string), string employeeId = default(string), string employeeName = default(string), string shipmentMethodCode = default(string), string shipmentMethodOption = default(string), ShippingMethod shippingMethod = default(ShippingMethod), string customerOrderId = default(string), CustomerOrder customerOrder = default(CustomerOrder), IList items = default(IList), IList packages = default(IList), IList inPayments = default(IList), string weightUnit = default(string), double? weight = default(double?), string measureUnit = default(string), double? height = default(double?), double? length = default(double?), double? width = default(double?), IList discounts = default(IList), OrderAddress deliveryAddress = default(OrderAddress), double? price = default(double?), double? priceWithTax = default(double?), double? total = default(double?), double? totalWithTax = default(double?), double? discountAmount = default(double?), double? discountAmountWithTax = default(double?), double? fee = default(double?), double? feeWithTax = default(double?), string objectType = default(string), string taxType = default(string), double? taxTotal = default(double?), double? taxPercentRate = default(double?), IList taxDetails = default(IList), string operationType = default(string), string parentOperationId = default(string), string number = default(string), bool? isApproved = default(bool?), string status = default(string), string comment = default(string), string currency = default(string), double? sum = default(double?), string outerId = default(string), bool? isCancelled = default(bool?), System.DateTime? cancelledDate = default(System.DateTime?), string cancelReason = default(string), IList dynamicProperties = default(IList), IList operationsLog = default(IList), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? modifiedDate = default(System.DateTime?), string createdBy = default(string), string modifiedBy = default(string), string id = default(string)) { OrganizationId = organizationId; OrganizationName = organizationName; @@ -7812,7 +8141,6 @@ public OrderShipment() Currency = currency; Sum = sum; OuterId = outerId; - PurchaseOrderNumber = purchaseOrderNumber; IsCancelled = isCancelled; CancelledDate = cancelledDate; CancelReason = cancelReason; @@ -8054,11 +8382,6 @@ public OrderShipment() [JsonProperty(PropertyName = "outerId")] public string OuterId { get; set; } - /// - /// - [JsonProperty(PropertyName = "purchaseOrderNumber")] - public string PurchaseOrderNumber { get; set; } - /// /// [JsonProperty(PropertyName = "isCancelled")] @@ -8119,8 +8442,16 @@ public OrderShipment() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class CustomerOrderSearchResult { @@ -8173,7 +8504,16 @@ public CustomerOrderSearchResult() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class BankCardInfo { @@ -8244,7 +8584,16 @@ public BankCardInfo() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class Money { @@ -8291,7 +8640,16 @@ public Money() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class QuarterPeriodMoney { @@ -8350,8 +8708,16 @@ public QuarterPeriodMoney() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class DashboardStatisticsResult { @@ -8452,7 +8818,16 @@ public DashboardStatisticsResult() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class KeyValuePair { @@ -8499,8 +8874,16 @@ public KeyValuePair() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentCallbackParameters { @@ -8541,7 +8924,16 @@ public PaymentCallbackParameters() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PostProcessPaymentRequestResult { @@ -8626,8 +9018,16 @@ public PostProcessPaymentRequestResult() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class CustomerOrderHistorySearchCriteria { @@ -8736,8 +9136,16 @@ public CustomerOrderHistorySearchCriteria() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class ChangeLogSearchResult { @@ -8784,8 +9192,16 @@ public ChangeLogSearchResult() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentSearchCriteria { @@ -8986,8 +9402,16 @@ public PaymentSearchCriteria() namespace VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models { - using System.Collections.Generic; + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; public partial class PaymentSearchResult { diff --git a/VirtoCommerce.Storefront/Controllers/Api/ApiCartDemoController.cs b/VirtoCommerce.Storefront/Controllers/Api/ApiCartDemoController.cs index 4cbf05a0..d4cc06a8 100644 --- a/VirtoCommerce.Storefront/Controllers/Api/ApiCartDemoController.cs +++ b/VirtoCommerce.Storefront/Controllers/Api/ApiCartDemoController.cs @@ -1,7 +1,8 @@ +using System; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; using FluentValidation; +using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Cart; @@ -11,7 +12,6 @@ using VirtoCommerce.Storefront.Model.Common.Exceptions; using VirtoCommerce.Storefront.Model.Services; - namespace VirtoCommerce.Storefront.Controllers.Api { [StorefrontApiRoute("cartdemo")] @@ -19,7 +19,8 @@ namespace VirtoCommerce.Storefront.Controllers.Api public class ApiCartDemoController : StorefrontControllerBase { private readonly ICartBuilder _cartBuilder; - private readonly ICatalogService _catalogService; + private readonly ICatalogService _catalogService; + public ApiCartDemoController(IWorkContextAccessor workContextAccessor, ICatalogService catalogService, ICartBuilder cartBuilder, IStorefrontUrlBuilder urlBuilder) : base(workContextAccessor, urlBuilder) @@ -28,24 +29,48 @@ public ApiCartDemoController(IWorkContextAccessor workContextAccessor, ICatalogS _catalogService = catalogService; } - // POST: storefrontapi/cart/items/bulk [HttpPost("items/bulk")] [ValidateAntiForgeryToken] public async Task> AddItemsToCart([FromBody] AddCartItem[] items) { + if (items.IsNullOrEmpty()) + { + throw new ArgumentNullException(nameof(items)); + } + EnsureCartExists(); //Need lock to prevent concurrent access to same cart using (await AsyncLock.GetLockByKey(WorkContext.CurrentCart.Value.GetCacheKey()).LockAsync()) { var productIds = items.Select(x => x.Id).ToArray(); - var products = await _catalogService.GetProductsAsync(productIds, Model.Catalog.ItemResponseGroup.ItemSmall | Model.Catalog.ItemResponseGroup.ItemWithPrices | Model.Catalog.ItemResponseGroup.Inventory); + var products = await _catalogService.GetProductsAsync(productIds, Model.Catalog.ItemResponseGroup.ItemSmall | Model.Catalog.ItemResponseGroup.ItemWithPrices | Model.Catalog.ItemResponseGroup.Inventory); var cartBuilder = await LoadOrCreateCartAsync(); var cart = _cartBuilder.Cart; + var currency = WorkContext.CurrentCurrency; + + var firstItem = items.First(); + + var configuredProductId = firstItem.ConfiguredProductId; + + var configuredGroup = cart.ConfiguredGroups?.FirstOrDefault(x => (x.ProductId == configuredProductId) + && x.Items.OrderBy(x => x.ProductId).Select(x => x.ProductId).SequenceEqual(items.OrderBy(i => i.ProductId).Select(i => i.ProductId).ToArray()) + ); + + if (configuredGroup == null) + { + configuredGroup = new Model.Cart.Demo.ConfiguredGroup(firstItem.Quantity, currency, configuredProductId); + cart.ConfiguredGroups.Add(configuredGroup); + } + else + { + configuredGroup.Quantity += Math.Max(1, firstItem.Quantity); + } foreach (var item in items) { + item.ConfiguredGroupId = configuredGroup?.Id; item.Product = products.First(x => x.Id == item.ProductId); await cartBuilder.AddItemAsync(item); } diff --git a/VirtoCommerce.Storefront/Controllers/Api/ApiOrderController.cs b/VirtoCommerce.Storefront/Controllers/Api/ApiOrderController.cs index 629cc35a..62947287 100644 --- a/VirtoCommerce.Storefront/Controllers/Api/ApiOrderController.cs +++ b/VirtoCommerce.Storefront/Controllers/Api/ApiOrderController.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; @@ -23,14 +24,18 @@ namespace VirtoCommerce.Storefront.Controllers.Api public class ApiOrderController : StorefrontControllerBase { private readonly IOrderModule _orderApi; + private readonly IDemoCustomerOrderService _orderService; private readonly IStoreService _storeService; private readonly IAuthorizationService _authorizationService; private readonly IPaymentSearchService _paymentSearchService; - public ApiOrderController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, IOrderModule orderApi, IStoreService storeService, IAuthorizationService authorizationService, IPaymentSearchService paymentSearchService) + public ApiOrderController(IWorkContextAccessor workContextAccessor, IStorefrontUrlBuilder urlBuilder, + IOrderModule orderApi, IDemoCustomerOrderService orderService, IStoreService storeService, + IAuthorizationService authorizationService, IPaymentSearchService paymentSearchService) : base(workContextAccessor, urlBuilder) { _orderApi = orderApi; + _orderService = orderService; _storeService = storeService; _authorizationService = authorizationService; _paymentSearchService = paymentSearchService; @@ -77,10 +82,13 @@ public async Task> SearchCustomerOrders( criteria.CustomerId = WorkContext.CurrentUser.Id; } var result = await _orderApi.SearchCustomerOrderAsync(criteria.ToSearchCriteriaDto()); + var orders = result.Results.Select(x => x.ToCustomerOrder(WorkContext.AllCurrencies, WorkContext.CurrentLanguage)).ToArray(); + await _orderService.LoadProductsAsync(orders); + _orderService.SelectConfiguredProductParts(orders); return new CustomerOrderSearchResult { - Results = result.Results.Select(x => x.ToCustomerOrder(WorkContext.AllCurrencies, WorkContext.CurrentLanguage)).ToArray(), + Results = orders, TotalCount = result.TotalCount ?? default(int), }; } @@ -95,7 +103,10 @@ public async Task> GetCustomerOrder(string orderNumb { return Unauthorized(); } - return orderDto.ToCustomerOrder(WorkContext.AllCurrencies, WorkContext.CurrentLanguage); + var order = orderDto.ToCustomerOrder(WorkContext.AllCurrencies, WorkContext.CurrentLanguage); + await _orderService.LoadProductsAsync(order); + _orderService.SelectConfiguredProductParts(order); + return order; } // GET: storefrontapi/orders/{orderNumber}/newpaymentdata @@ -252,7 +263,7 @@ public async Task GetInvoicePdf(string orderNumber) return Unauthorized(); } - var stream = await _orderApi.GetInvoicePdfAsync(order.Number); + Stream stream = await _orderApi.GetInvoicePdfAsync(order.Number); return File(stream, "application/pdf"); } diff --git a/VirtoCommerce.Storefront/Controllers/CartController.cs b/VirtoCommerce.Storefront/Controllers/CartController.cs index 20bd39a5..6b1cd698 100644 --- a/VirtoCommerce.Storefront/Controllers/CartController.cs +++ b/VirtoCommerce.Storefront/Controllers/CartController.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; using VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi; using VirtoCommerce.Storefront.Infrastructure; using VirtoCommerce.Storefront.Model; diff --git a/VirtoCommerce.Storefront/Domain/Cart/CartConverter.cs b/VirtoCommerce.Storefront/Domain/Cart/CartConverter.cs index 4d85ff9e..ab54671f 100644 --- a/VirtoCommerce.Storefront/Domain/Cart/CartConverter.cs +++ b/VirtoCommerce.Storefront/Domain/Cart/CartConverter.cs @@ -496,6 +496,11 @@ public static ShoppingCart ToShoppingCart(this cartDto.ShoppingCart cartDto, Cur result.VolumetricWeight = (decimal)(cartDto.VolumetricWeight ?? 0); result.Weight = (decimal)(cartDto.Weight ?? 0); + if (!cartDto.ConfiguredGroups.IsNullOrEmpty()) + { + result.ConfiguredGroups = cartDto.ConfiguredGroups.Select(x => x.ToConfiguredGroup(result)).ToList(); + } + return result; } @@ -536,6 +541,8 @@ public static cartDto.ShoppingCart ToShoppingCartDto(this ShoppingCart cart) result.VolumetricWeight = (double)cart.VolumetricWeight; result.Weight = (double)cart.Weight; + result.ConfiguredGroups = cart.ConfiguredGroups.Select(x => x.ToConfiguredGroup()).ToList(); + return result; } @@ -682,11 +689,9 @@ public static LineItem ToLineItem(this cartDto.CartLineItem lineItemDto, Currenc Width = (decimal?)lineItemDto.Width, Length = (decimal?)lineItemDto.Length, Height = (decimal?)lineItemDto.Height, - ConfiguredProductId = lineItemDto.ConfiguredProductId, + ConfiguredGroupId = lineItemDto.ConfiguredGroupId, }; - - result.ImageUrl = lineItemDto.ImageUrl.RemoveLeadingUriScheme(); if (lineItemDto.TaxDetails != null) @@ -768,7 +773,7 @@ public static cartDto.CartLineItem ToLineItemDto(this LineItem lineItem) DynamicProperties = lineItem.DynamicProperties.Select(ToCartDynamicPropertyDto).ToList(), VolumetricWeight = (double)(lineItem.VolumetricWeight ?? 0), - ConfiguredProductId = lineItem.ConfiguredProductId, + ConfiguredGroupId = lineItem.ConfiguredGroupId, }; retVal.Weight = (double?)lineItem.Weight; retVal.Width = (double?)lineItem.Width; diff --git a/VirtoCommerce.Storefront/Domain/Cart/Demo/CartConverter.cs b/VirtoCommerce.Storefront/Domain/Cart/Demo/CartConverter.cs new file mode 100644 index 00000000..cdca1cfc --- /dev/null +++ b/VirtoCommerce.Storefront/Domain/Cart/Demo/CartConverter.cs @@ -0,0 +1,73 @@ +using System; +using System.Linq; +using VirtoCommerce.Storefront.Model.Cart; +using VirtoCommerce.Storefront.Model.Cart.Demo; +using VirtoCommerce.Storefront.Model.Common; +using cartApiDto = VirtoCommerce.Storefront.AutoRestClients.CartModuleApi.Models; + +namespace VirtoCommerce.Storefront.Domain +{ + public static partial class CartConverter + { + public static cartApiDto.DemoCartConfiguredGroup ToConfiguredGroup(this ConfiguredGroup group) + { + foreach (var lineItem in group.Items) + { + lineItem.Id = lineItem.Id ?? Guid.NewGuid().ToString("N"); + } + + return new cartApiDto.DemoCartConfiguredGroup + { + Id = group.Id ?? Guid.NewGuid().ToString("N"), + ProductId = group.ProductId, + ItemIds = group.Items.Select(x => x.Id).ToList(), + CreatedBy = group.CreatedBy, + CreatedDate = group.CreatedDate, + ModifiedBy = group.ModifiedBy, + ModifiedDate = group.ModifiedDate, + Currency = group.Currency.Code, + ExtendedPrice = (double)group.ExtendedPrice.InternalAmount, + ExtendedPriceWithTax = (double)group.ExtendedPriceWithTax.InternalAmount, + ListPrice = (double)group.ListPrice.InternalAmount, + ListPriceWithTax = (double)group.ListPriceWithTax.InternalAmount, + PlacedPrice = (double)group.PlacedPrice.InternalAmount, + PlacedPriceWithTax = (double)group.PlacedPriceWithTax.InternalAmount, + SalePrice = (double)group.SalePrice.InternalAmount, + SalePriceWithTax = (double)group.SalePriceWithTax.InternalAmount, + TaxTotal = (double)group.TaxTotal.InternalAmount, + Quantity = group.Quantity + }; + } + + public static ConfiguredGroup ToConfiguredGroup(this cartApiDto.DemoCartConfiguredGroup group, ShoppingCart cart) + { + var result = new ConfiguredGroup(group.Quantity ?? 0, cart.Currency, group.ProductId) + { + Id = group.Id, + CreatedBy = group.CreatedBy, + CreatedDate = group.CreatedDate ?? DateTime.UtcNow, + ModifiedBy = group.ModifiedBy, + ModifiedDate = group.ModifiedDate, + + ExtendedPrice = new Money(group.ExtendedPrice ?? 0, cart.Currency), + ExtendedPriceWithTax = new Money(group.ExtendedPriceWithTax ?? 0, cart.Currency), + TaxTotal = new Money(group.TaxTotal ?? 0, cart.Currency), + + ListPrice = new Money(group.ListPrice ?? 0, cart.Currency), + ListPriceWithTax = new Money(group.ListPriceWithTax ?? 0, cart.Currency), + SalePrice = new Money(group.SalePrice ?? 0, cart.Currency), + SalePriceWithTax = new Money(group.SalePriceWithTax ?? 0, cart.Currency), + PlacedPrice = new Money(group.PlacedPrice ?? 0, cart.Currency), + PlacedPriceWithTax = new Money(group.PlacedPriceWithTax ?? 0, cart.Currency), + Currency = cart.Currency, + }; + + foreach (var item in group.ItemIds.Select(id => cart.Items.First(x => x.Id == id))) + { + result.Items.Add(item); + } + + return result; + } + } +} diff --git a/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartBuilder.cs b/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartBuilder.cs index ef5c49b5..54d73ceb 100644 --- a/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartBuilder.cs +++ b/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartBuilder.cs @@ -34,18 +34,19 @@ public override Task RemoveItemAsync(string lineItemId) { EnsureCartExists(); - var configureLineItem = Cart.ConfiguredItems.FirstOrDefault(x => x.ConfiguredLineItem?.ProductId.Equals(lineItemId, StringComparison.InvariantCulture) ?? false); + var configuredGroup = Cart.ConfiguredGroups?.FirstOrDefault(x => x.Id.Equals(lineItemId, StringComparison.InvariantCulture)); - if (configureLineItem != null) + if (configuredGroup != null) { - var configurablePieces = Cart.Items.Where(x => x.ConfiguredProductId?.Equals(lineItemId, StringComparison.InvariantCulture) ?? false).ToArray(); + var groupItems = Cart.Items.Where(x => !string.IsNullOrEmpty(x.ConfiguredGroupId) && + x.ConfiguredGroupId.Equals(configuredGroup.Id, StringComparison.InvariantCulture)).ToArray(); - foreach (var configuirablePieceLineItem in configurablePieces) + foreach (var lineItem in groupItems) { - Cart.Items.Remove(configuirablePieceLineItem); + Cart.Items.Remove(lineItem); } - Cart.ConfiguredItems.Remove(configureLineItem); + Cart.ConfiguredGroups.Remove(configuredGroup); } return base.RemoveItemAsync(lineItemId); @@ -55,18 +56,16 @@ public override Task ChangeItemQuantityAsync(ChangeCartItemQty changeItemQty) { EnsureCartExists(); - var configuredProduct = Cart.ConfiguredItems?.FirstOrDefault(x => - x.ConfiguredLineItem?.ProductId.Equals(changeItemQty.LineItemId, StringComparison.InvariantCulture) ?? false); + var configuredGroup = Cart.ConfiguredGroups?.FirstOrDefault(x => x.Id.Equals(changeItemQty.LineItemId, StringComparison.InvariantCulture)); - if (configuredProduct != null) + if (configuredGroup != null) { - foreach (var lineItem in Cart - .Items - .Where(x => - !string.IsNullOrEmpty(x.ConfiguredProductId) && - x.ConfiguredProductId.Equals(configuredProduct.ConfiguredLineItem.ProductId) - ) - ) + configuredGroup.Quantity = changeItemQty.Quantity; + + var groupItems = Cart.Items.Where(x => !string.IsNullOrEmpty(x.ConfiguredGroupId) && + x.ConfiguredGroupId.Equals(configuredGroup.Id, StringComparison.InvariantCulture)).ToArray(); + + foreach (var lineItem in groupItems) { lineItem.Quantity = changeItemQty.Quantity; } @@ -83,9 +82,9 @@ public override async Task AddItemAsync(AddCartItem addCartItem) if (result.IsValid) { - var lineItem = addCartItem.Product.ToLineItem(Cart.Language, addCartItem.Quantity); + var lineItem = addCartItem.Product.ToLineItem(Cart.Language, addCartItem.Quantity); lineItem.Product = addCartItem.Product; - lineItem.ConfiguredProductId = addCartItem.ConfiguredProductId; + lineItem.ConfiguredGroupId = addCartItem.ConfiguredGroupId; if (addCartItem.Price != null) { @@ -114,16 +113,28 @@ public override async Task AddItemAsync(AddCartItem addCartItem) return result.IsValid; } + public override async Task ClearAsync() + { + await base.ClearAsync(); + Cart.ConfiguredGroups.Clear(); + } + protected override async Task AddLineItemAsync(LineItem lineItem) { - if (!string.IsNullOrEmpty(lineItem.ConfiguredProductId)) + var existingLineItem = Cart.Items.FirstOrDefault(li => li.ProductId.EqualsInvariant(lineItem.ProductId) + && (li.ConfiguredGroupId?.EqualsInvariant(lineItem.ConfiguredGroupId) ?? true)); + + if (existingLineItem != null) { - lineItem.Id = null; - Cart.Items.Add(lineItem); + await ChangeItemQuantityAsync(existingLineItem, existingLineItem.Quantity + Math.Max(1, lineItem.Quantity)); + await ChangeItemPriceAsync(existingLineItem, new ChangeCartItemPrice { LineItemId = existingLineItem.Id, NewPrice = lineItem.ListPrice.Amount }); + existingLineItem.Comment = lineItem.Comment; + existingLineItem.DynamicProperties = lineItem.DynamicProperties; } else { - await base.AddLineItemAsync(lineItem); + lineItem.Id = null; + Cart.Items.Add(lineItem); } } } diff --git a/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartService.cs b/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartService.cs index afdfb58d..3ee83fa1 100644 --- a/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartService.cs +++ b/VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartService.cs @@ -9,7 +9,6 @@ using VirtoCommerce.Storefront.Model; using VirtoCommerce.Storefront.Model.Caching; using VirtoCommerce.Storefront.Model.Cart; -using VirtoCommerce.Storefront.Model.Cart.Demo; using VirtoCommerce.Storefront.Model.Catalog; using VirtoCommerce.Storefront.Model.Catalog.Services; using VirtoCommerce.Storefront.Model.Common; @@ -51,6 +50,7 @@ public override async Task> SearchCartsAsync(CartSearch { throw new ArgumentNullException(nameof(criteria)); } + var cacheKey = CacheKey.With(GetType(), "SearchCartsAsync", criteria.GetCacheKey()); return await _memoryCache.GetOrCreateExclusiveAsync(cacheKey, async cacheEntry => { @@ -66,7 +66,7 @@ public override async Task> SearchCartsAsync(CartSearch var cart = cartDto.ToShoppingCart(currency, language, user); - await AddConfiguredItemsToCartAsync(cart, language, currency); + await FillProductPartsOfGroupsAsync(cart); result.Add(cart); } @@ -74,30 +74,22 @@ public override async Task> SearchCartsAsync(CartSearch }); } - - protected virtual async Task AddConfiguredItemsToCartAsync(ShoppingCart cart, Language language, Currency currency) + protected virtual async Task FillProductPartsOfGroupsAsync(ShoppingCart cart) { - foreach (var grouping in cart.Items.Where(x => !x.ConfiguredProductId.IsNullOrEmpty()).GroupBy(x => x.ConfiguredProductId)) + if (cart.ConfiguredGroups.IsNullOrEmpty()) { - var configuredProductId = grouping.Key; - var configuredProductItems = grouping.AsEnumerable().ToArray(); - var configuredProductQuantity = configuredProductItems.FirstOrDefault()?.Quantity ?? 1; - - var configuredItem = new ConfiguredItem(); - var product = (await _catalogService.GetProductsAsync(new[] {configuredProductId}, ItemResponseGroup.None)).FirstOrDefault(); + return; + } - configuredItem.ConfiguredLineItem = product?.ToLineItem(language, configuredProductQuantity); + var groupProductsIds = cart.ConfiguredGroups.Select(x => x.ProductId).ToArray(); + var groupProducts = await _catalogService.GetProductsAsync(groupProductsIds, ItemResponseGroup.None); - if (configuredItem.ConfiguredLineItem != null) - { - configuredItem.ConfiguredLineItem.PlacedPrice = new Money(configuredProductItems.Sum(x => x.PlacedPrice.Amount), currency); - configuredItem.ConfiguredLineItem.ExtendedPrice = new Money(configuredProductItems.Sum(x => x.ExtendedPrice.Amount), currency); - } + foreach (var group in cart.ConfiguredGroups) + { + var product = groupProducts.FirstOrDefault(x => x.Id.Equals(group.ProductId, StringComparison.InvariantCulture)); + group.Product = product; - configuredItem - .Parts - .AddRange( - configuredProductItems + var productParts = group.Items .Select(x => { var result = _demoCatalogService.TryGetProductPartByCategoryId(x.CategoryId); @@ -106,10 +98,9 @@ protected virtual async Task AddConfiguredItemsToCartAsync(ShoppingCart cart, La return result; }) - .OrderBy(x => x.Name) - ); + .OrderBy(x => x.Name).ToArray(); - cart.ConfiguredItems.Add(configuredItem); + group.Parts.AddRange(productParts); } } } diff --git a/VirtoCommerce.Storefront/Domain/Order/CustomerOrderService.cs b/VirtoCommerce.Storefront/Domain/Order/CustomerOrderService.cs index a7dae44b..8da1d9f9 100644 --- a/VirtoCommerce.Storefront/Domain/Order/CustomerOrderService.cs +++ b/VirtoCommerce.Storefront/Domain/Order/CustomerOrderService.cs @@ -32,14 +32,14 @@ public async Task> SearchOrdersAsync(OrderSearchCriter return await InnerSearchOrdersAsync(criteria, workContext); } - public async Task GetOrderByNumberAsync(string number) + public virtual async Task GetOrderByNumberAsync(string number) { var workContext = _workContextAccessor.WorkContext; return (await _orderApi.GetByNumberAsync(number, string.Empty))?.ToCustomerOrder(workContext.AllCurrencies, workContext.CurrentLanguage); } - public async Task GetOrderByIdAsync(string id) + public virtual async Task GetOrderByIdAsync(string id) { var workContext = _workContextAccessor.WorkContext; return (await _orderApi.GetByIdAsync(id, string.Empty))?.ToCustomerOrder(workContext.AllCurrencies, workContext.CurrentLanguage); diff --git a/VirtoCommerce.Storefront/Domain/Order/Demo/DemoCustomerOrderService.cs b/VirtoCommerce.Storefront/Domain/Order/Demo/DemoCustomerOrderService.cs new file mode 100644 index 00000000..2f561320 --- /dev/null +++ b/VirtoCommerce.Storefront/Domain/Order/Demo/DemoCustomerOrderService.cs @@ -0,0 +1,88 @@ +using System.Linq; +using System.Threading.Tasks; +using PagedList.Core; +using VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi; +using VirtoCommerce.Storefront.Model; +using VirtoCommerce.Storefront.Model.Catalog; +using VirtoCommerce.Storefront.Model.Catalog.Services; +using VirtoCommerce.Storefront.Model.Common; +using VirtoCommerce.Storefront.Model.Order; +using VirtoCommerce.Storefront.Model.Order.Services; +using VirtoCommerce.Storefront.Model.Services; + +namespace VirtoCommerce.Storefront.Domain +{ + public class DemoCustomerOrderService : CustomerOrderService, IDemoCustomerOrderService + { + private readonly ICatalogService _catalogService; + private readonly IDemoCatalogService _demoCatalogService; + + public DemoCustomerOrderService(IOrderModule orderApi, ICatalogService catalogService, IDemoCatalogService demoCatalogService, + IWorkContextAccessor workContextAccessor) : base(orderApi, workContextAccessor) + { + _catalogService = catalogService; + _demoCatalogService = demoCatalogService; + } + + public override async Task GetOrderByNumberAsync(string number) + { + var order = await base.GetOrderByNumberAsync(number); + await LoadProductsAsync(order); + SelectConfiguredProductParts(order); + return order; + } + + + public override async Task GetOrderByIdAsync(string id) + { + var order = await base.GetOrderByIdAsync(id); + await LoadProductsAsync(order); + SelectConfiguredProductParts(order); + return order; + } + + protected override async Task> InnerSearchOrdersAsync(OrderSearchCriteria criteria, WorkContext workContext) + { + var ordersPagedList = await base.InnerSearchOrdersAsync(criteria, workContext); + var orders = ordersPagedList.ToArray(); + await LoadProductsAsync(orders.ToArray()); + SelectConfiguredProductParts(orders); + return new StaticPagedList(ordersPagedList, ordersPagedList.PageNumber, ordersPagedList.PageSize, ordersPagedList.TotalItemCount); + } + + public async Task LoadProductsAsync(params CustomerOrder[] orders) + { + var productIds = orders.SelectMany(o => o.Items.Select(i => i.ProductId).Concat(o.ConfiguredGroups.Select(c => c.ProductId))).ToArray(); + var products = (await _catalogService.GetProductsAsync(productIds, ItemResponseGroup.None)).ToDictionary(x => x.Id, x => x); + + foreach (var lineItem in orders.SelectMany(o => o.Items)) + { + lineItem.Product = products[lineItem.ProductId]; + } + + foreach (var group in orders.SelectMany(x => x.ConfiguredGroups)) + { + group.Product = products[group.ProductId]; + } + } + + public void SelectConfiguredProductParts(params CustomerOrder[] orders) + { + foreach (var group in orders.SelectMany(x => x.ConfiguredGroups)) + { + var productParts = group.Items + .Select(x => + { + var result = _demoCatalogService.TryGetProductPartByCategoryId(x.CategoryId); + + result.SelectedItemId = x.Id; + + return result; + }) + .OrderBy(x => x.Name).ToArray(); + + group.Parts.AddRange(productParts); + } + } + } +} diff --git a/VirtoCommerce.Storefront/Domain/Order/Demo/OrderConverter.cs b/VirtoCommerce.Storefront/Domain/Order/Demo/OrderConverter.cs new file mode 100644 index 00000000..e2f20b11 --- /dev/null +++ b/VirtoCommerce.Storefront/Domain/Order/Demo/OrderConverter.cs @@ -0,0 +1,69 @@ +using System; +using System.Linq; +using VirtoCommerce.Storefront.Model.Order; +using VirtoCommerce.Storefront.Model.Order.Demo; +using VirtoCommerce.Storefront.Model.Common; +using orderDto = VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models; + +namespace VirtoCommerce.Storefront.Domain +{ + public static partial class OrderConverter + { + public static orderDto.DemoOrderConfiguredGroup ToConfiguredGroup(this ConfiguredGroup group) + { + foreach (var lineItem in group.Items) + { + lineItem.Id = lineItem.Id ?? Guid.NewGuid().ToString("N"); + } + + return new orderDto.DemoOrderConfiguredGroup + { + Id = group.Id ?? Guid.NewGuid().ToString("N"), + ProductId = group.ProductId, + ItemIds = group.Items.Select(x => x.Id).ToList(), + CreatedBy = group.CreatedBy, + CreatedDate = group.CreatedDate, + ModifiedBy = group.ModifiedBy, + ModifiedDate = group.ModifiedDate, + Currency = group.Currency.Code, + ExtendedPrice = (double)group.ExtendedPrice.InternalAmount, + ExtendedPriceWithTax = (double)group.ExtendedPriceWithTax.InternalAmount, + Price = (double)group.Price.InternalAmount, + PriceWithTax = (double)group.PriceWithTax.InternalAmount, + PlacedPrice = (double)group.PlacedPrice.InternalAmount, + PlacedPriceWithTax = (double)group.PlacedPriceWithTax.InternalAmount, + TaxTotal = (double)group.TaxTotal.InternalAmount, + Quantity = group.Quantity + }; + } + + public static ConfiguredGroup ToConfiguredGroup(this orderDto.DemoOrderConfiguredGroup group, CustomerOrder order) + { + var result = new ConfiguredGroup(group.Quantity ?? 0, order.Currency, group.ProductId) + { + Id = group.Id, + CreatedBy = group.CreatedBy, + CreatedDate = group.CreatedDate ?? DateTime.UtcNow, + ModifiedBy = group.ModifiedBy, + ModifiedDate = group.ModifiedDate, + + ExtendedPrice = new Money(group.ExtendedPrice ?? 0, order.Currency), + ExtendedPriceWithTax = new Money(group.ExtendedPriceWithTax ?? 0, order.Currency), + TaxTotal = new Money(group.TaxTotal ?? 0, order.Currency), + + Price = new Money(group.Price ?? 0, order.Currency), + PriceWithTax = new Money(group.PriceWithTax ?? 0, order.Currency), + PlacedPrice = new Money(group.PlacedPrice ?? 0, order.Currency), + PlacedPriceWithTax = new Money(group.PlacedPriceWithTax ?? 0, order.Currency), + Currency = order.Currency, + }; + + foreach (var item in group.ItemIds.Select(id => order.Items.First(x => x.Id == id))) + { + result.Items.Add(item); + } + + return result; + } + } +} diff --git a/VirtoCommerce.Storefront/Domain/Order/OrderConverter.cs b/VirtoCommerce.Storefront/Domain/Order/OrderConverter.cs index 5d0d0d81..1e01ec5a 100644 --- a/VirtoCommerce.Storefront/Domain/Order/OrderConverter.cs +++ b/VirtoCommerce.Storefront/Domain/Order/OrderConverter.cs @@ -8,7 +8,6 @@ using coreDto = VirtoCommerce.Storefront.AutoRestClients.CoreModuleApi.Models; using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models; using orderDto = VirtoCommerce.Storefront.AutoRestClients.OrdersModuleApi.Models; -using storeDto = VirtoCommerce.Storefront.AutoRestClients.StoreModuleApi.Models; using paymentDto = VirtoCommerce.Storefront.AutoRestClients.PaymentModuleApi.Models; namespace VirtoCommerce.Storefront.Domain @@ -230,7 +229,8 @@ public static LineItem ToOrderLineItem(this orderDto.OrderLineItem lineItemDto, CreatedBy = lineItemDto.CreatedBy, CreatedDate = lineItemDto.CreatedDate, ModifiedDate = lineItemDto.ModifiedDate, - ModifiedBy = lineItemDto.ModifiedBy + ModifiedBy = lineItemDto.ModifiedBy, + ConfiguredGropupId = lineItemDto.ConfiguredGroupId }; @@ -438,13 +438,11 @@ public static CustomerOrder ToCustomerOrder(this orderDto.CustomerOrder order, I PurchaseOrderNumber = order.PurchaseOrderNumber }; - if (order.Addresses != null) { result.Addresses = order.Addresses.Select(ToAddress).ToList(); } - if (order.DynamicProperties != null) { result.DynamicProperties = order.DynamicProperties.Select(ToDynamicProperty).ToList(); @@ -460,6 +458,11 @@ public static CustomerOrder ToCustomerOrder(this orderDto.CustomerOrder order, I result.Items = order.Items.Select(i => ToOrderLineItem(i, availCurrencies, language)).ToList(); } + if (!order.ConfiguredGroups.IsNullOrEmpty()) + { + result.ConfiguredGroups = order.ConfiguredGroups.Select(x => x.ToConfiguredGroup(result)).ToList(); + } + if (order.Shipments != null) { result.Shipments = order.Shipments.Select(s => ToOrderShipment(s, availCurrencies, language)).ToList(); @@ -469,10 +472,12 @@ public static CustomerOrder ToCustomerOrder(this orderDto.CustomerOrder order, I { result.Discounts.AddRange(order.Discounts.Select(x => ToDiscount(x, new[] { currency }, language))); } + if (order.TaxDetails != null) { result.TaxDetails = order.TaxDetails.Select(td => ToTaxDetail(td, currency)).ToList(); } + result.DiscountAmount = new Money(order.DiscountAmount ?? 0, currency); result.DiscountTotal = new Money(order.DiscountTotal ?? 0, currency); result.DiscountTotalWithTax = new Money(order.DiscountTotalWithTax ?? 0, currency); diff --git a/VirtoCommerce.Storefront/Startup.cs b/VirtoCommerce.Storefront/Startup.cs index 0a13f54b..c4f080fb 100644 --- a/VirtoCommerce.Storefront/Startup.cs +++ b/VirtoCommerce.Storefront/Startup.cs @@ -100,7 +100,9 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(x => x.GetRequiredService()); + services.AddSingleton(x => x.GetRequiredService()); services.AddSingleton(); services.AddSingleton(); services.AddSingleton();