Git Product home page Git Product logo

commercetools / commercetools-dotnet-core-sdk-v2 Goto Github PK

View Code? Open in Web Editor NEW
13.0 42.0 10.0 700.09 MB

Home Page: https://commercetools.github.io/commercetools-dotnet-core-sdk-v2/docs/html/index.html

License: Apache License 2.0

C# 99.81% PowerShell 0.01% Ruby 0.01% Makefile 0.01% HTML 0.11% CSS 0.02% JavaScript 0.01% RAML 0.01% Shell 0.01% Dockerfile 0.01%
commercetools sdk commercetools-sdk commercetools-dotnet-core-sdk commercetools-dotnet-sdk audit-sdk commercetools-scp

commercetools-dotnet-core-sdk-v2's People

Contributors

ajimae avatar anjalivashisth avatar ashishhk avatar barbara79 avatar csi-lund avatar ct-sdks[bot] avatar evansinho avatar github-actions[bot] avatar industrian avatar jenschude avatar jherey avatar kodiakhq[bot] avatar michelerezk avatar renovate[bot] avatar tarostar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commercetools-dotnet-core-sdk-v2's Issues

Price ValidFrom and ValidTo don't allow nullable values, and hence default to {01/01/0001 00:00:00}

In the IPriceImport interface, the ValidFrom and ValidTo datetimes force a value, which defaults to 01/01/0001 00:00:00 if you don't set one in your code. This gets imported as
image
rather than the values being empty

In the curl examples, if you don't set the ValidFrom or ValidTo they get set as empty / blank

How to provide client with an existing bearer token?

Is your feature request related to a problem? Please describe.

I see I can create a client using a ClientCredentialsTokenProvider and a PasswordTokenProvider. What if I already have a bearer token and can skip creating one?

Describe the solution you'd like

I want to be able to input an existing bearer token that the client can use for the Authorization header.

Describe alternatives you've considered

Not sure...

Additional context

Mismatch in type

Hi IBaseResources and their respective updates are using Int64 version numbers.
However the OrderEditApply is still using Int32 which results in a need to convert when applying an order edit. Whilst this is unlikely to ever be an issue, would be nice if they were aligned and I couldn't find reference to a limit on versions 😝!

[DeserializeAs(typeof(commercetools.Sdk.Api.Models.OrderEdits.OrderEditApply))]
public partial interface IOrderEditApply
{
int EditVersion { get; set; }
int ResourceVersion { get; set; }
}

Payment entity : from 4.0.0 to 4.1.0 : missing field

Hi,

We've just updated my dependencies, and we noticed that for the entity Payment (generated), a field (AmountAuthorized) previously available (in 4.0.0) is now missing, 'breaking changing' one of our developer code.

v 4.0.0

v4.1.0
https://github.com/commercetools/commercetools-dotnet-core-sdk-v2/blob/4.1.0/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Payments/IPayment.cs

If I rely to the current API documentation this is what is expected, but when I make a raw call to the API the field is still returned
image

I guess it's for compatibility reason, but I wonder how the deprecated field was filled in before v4.1.0, is it the same value for the AmountPlanned field and for the removed AmountAuthorized field ?
Is it something possible to decorate future discarded fields as [Deprecated] to know if we could rely on it for a long period or not ?

Thank you for your help

A bug happens when a cart set shippingAddress

Describe the bug
The field "POBox" don't be saved when a cart set shippingAddress. The other fields of address are ok.

To Reproduce
a cart set shippingAddress.

Expected behavior
The value of "POBox" should be stored.

Screenshots/Code snippet
image
image
image

Stack information (please complete the following information):

  • dotnet: Core 3.1
  • SDK: v2.0、v2.3

Additional context

The wrong type of TaxCategory SubRate Amount

Describe the bug
I suppose there is a typo in data type.

V1 SDK is decimal
https://github.com/commercetools/commercetools-dotnet-core-sdk/blob/95538255acd49e16a37f5d809dce03b865b80b2b/commercetools.Sdk/commercetools.Sdk.Domain/TaxCategories/SubRate.cs#L6

V2 SDK is double

To Reproduce

Expected behavior
V2 SDK TaxCategory SubRate Amount should be decimal.

Screenshots/Code snippet

Stack information (please complete the following information):

  • dotnet: Core 3.0
  • SDK: v2.2

Additional context
When calculating TaxRate using external provider the followng error occurs:

{
	"statusCode": 400,
	"message": "A total amount of 0.09999999999999999 was given, but the total of all subrates is 0.1.",
	"errors": [
		{
			"code": "InvalidOperation",
			"message": "A total amount of 0.09999999999999999 was given, but the total of all subrates is 0.1.",
			"action": {
				"action": "setLineItemTaxRate",
				"lineItemId": "2099ecec-628f-42b9-bcea-8d5d82f3bd5e",
				"externalTaxRate": {
					"name": "Avalara calculated tax",
					"amount": 0.09999999999999999,
					"country": "US",
					"subRates": [
						{
							"name": "IL STATE TAX",
							"amount": 0.0625
						},
						{
							"name": "IL COUNTY TAX",
							"amount": 0.0175
						},
						{
							"name": "IL CITY TAX",
							"amount": 0.01
						},
						{
							"name": "IL SPECIAL TAX",
							"amount": 0.01
						}
					]
				}
			},
			"actionIndex": 1
		}
	]
}

CartUpdate : setCustomType fail, need guidance to use it

Hi,

I need to update a custom field on cart entity.
I created the field this way, it works as expected

curl --location --request POST 'https://api.europe-west1.gcp.commercetools.com/************/types' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer EyVFlBHo5XjRD6QdjEA***********' \
--data-raw '{
  "key" : "cart_abandoned_tag",
  "name" : {
    "en" : "cart_abandoned_tag"
  },
  "description" : {
    "en" : "Define the iteration tag of a cart defined abandoned"
  },
  "resourceTypeIds" : [ "order" ],
  "fieldDefinitions" : [ {
    "name" : "cart_abandoned_tag",
    "label" : {
      "en" : "cart_abandoned_tag"
    },
    "required" : false,
    "type" : {
      "name" : "Number"
    }
  } ]
}'

Then I set my custom field to a cart this way, it also works as expected

curl --location --request POST 'https://api.europe-west1.gcp.commercetools.com/************/carts/9cba350a-9a89-4bee-9b22-487e57bc999b' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer EyVFlBHo5XjRD6QdjEAp8r************' \
--data-raw '{
    "version": 13,
    "actions": [
        {
            "action" : "setCustomType",
            "type" : {
              "id" : "3259d348-441a-4067-b4dc-e5e8bedd6bfa",
              "typeId" : "type"
            },
            "fields" : {
              "cart_abandoned_tag" : 1
            }
          }
    ]
}'

But when I need to do it in C# (I use the 4.0.0 version of the CT client), it's not clear about what I'm supposed to use as an update action, indeed the Action field is a string, I supposed I need to push a serialized object :

await _commerceToolsClient
                .WithApi().WithProjectKey(_projectKey)
                .Carts()
                .WithId(cartId)
                .Post(new CartUpdate
                {
                    Version = currentCart.Version,
                    Actions = new List<ICartUpdateAction> 
                    {
           new CartUpdateAction
            {
                Action = new
                {
                    action = "setCustomType",
                    type = new
                    {
                        id = abandonedFieldId,
                        typeId = "type"
                    },
                    fields = new
                    {
                        cart_abandoned_tag = abandonedTag
                    }
                }.Serialize()
                    }
                })
                .ExecuteAsync();

but it fails wit the error

[13:17:10 ERR] An unhandled exception has occurred while executing the request.
commercetools.Base.Client.Error.BadRequestException: Client error response https://api.europe-west1.gcp.commercetools.com/*****************/carts/9cba350a-9a89-4bee-9b22-487e57bc999b 400 Bad Request
   at commercetools.Base.Client.ErrorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at commercetools.Base.Client.Middlewares.HttpMiddleware.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at commercetools.Base.Client.Middlewares.AuthorizationMiddleware.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at commercetools.Base.Client.Middlewares.CorrelationIdMiddleware.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at commercetools.Base.Client.CtpClient.ExecuteAsJsonAsync(HttpRequestMessage requestMessage)
   at commercetools.Base.Client.CtpClient.ExecuteAsync[T](HttpRequestMessage requestMessage)
   at commercetools.Sdk.Api.Client.RequestBuilders.Carts.ByProjectKeyCartsByIDPost.ExecuteAsync()

Models for attribute definitions?

I can get a product attribute like so

ProductVariant variant;
string attributeName;
var attribute = variant.Attributes.SingleOrDefault(a => a.Name.Equals(attributeName, StringComparison.CurrentCultureIgnoreCase));

attribute.Value is an object. There doesn't seem to be any types I can use for casting the attribute to a AttributeDefinition with a AttributeType

Common interface for update actions and RequestBuilders.

Is your feature request related to a problem? Please describe.

Hi commercetools devs! Firstly thanks for great new SDK, like it 👍

I'm in the progress of migrating from v1 to v2 and come across a few situations with the generated models and builders where in v1 I was able to write extensions and execute generic operations using UpdateAction etc. Now things like the model updates XUpdateAction and XUpdate are separate. As are the Get, Post, and Delete builders with their ById and ByKey variations.

You seem to have already done some of this in #126
I see that you introduced the IPagedQueryResourceRequest and IRequestCommand for the paged get commands.
I can see also the IRequestCommand interface is applied to the ByProjectKeyCartsByIDGet.
I can also see the presence of IResourceUpdate IResourceUpdateAction interfaces but its only applied to IChannelUpdate/IChannelUpdateAction

Describe the solution you'd like

Expand IRequestCommand usage to all get, update and delete and their ByKey and ById request builders. where not already applied
Expand IResourceUpdate IResourceUpdateActions to all Update/UpdateAction models where not already applied.

Describe alternatives you've considered
At the moment it would mean writing builder specific extensions but Execute is not exposed so changing the extensions to work differently to accept a function where T : IBaseResource

Additional context
None.

Thanks!

Anonym token and retrieving existing cart

Hi - How do I let TokenProvider know not to generate a new token, instead use the one which is provided to the method parameter. I use the following code, but that still generates a new token.

   var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
   var serializerService = serviceProvider.GetService<SerializerService>();

  var token = "NO9d8_LHQjGe3XG_8NUra0bCLYWPVo7i"
   var token = new InMemoryAnonymousCredentialsStoreManager(null)
   {

     Token = new Token
     {
       AccessToken = token
     }
   };


   //Create passwordFlow TokenProvider
   var passwordTokenProvider = TokenProviderFactory
       .CreateAnonymousSessionTokenProvider(meClientConfig,
           httpClientFactory, token);

   Console.WriteLine(passwordTokenProvider.Token.AccessToken);

Looking forward to your answer, thanks

TypedMoneyExtensions AmountToDecimal Fraction Digit handling

Describe the bug

When we migrated out codebase form SDK 1 to 2 we saw several failed tests when using the extension AmountToDecimal.

In SDK 1 the AmountToDecimal factors in FractionDigits when converting to decimal. here

In SDK 2 if its not high precision then the conversion assumed that its 2 fraction digits and divides by 100. here

This caused errors where we using the same calculation logic code on multiple currencies and precisions - particularly but not exclusive to korean which has 0 fraction digits.

       //SDK 1
        public override decimal AmountToDecimal()
        {
            return CentAmount / (decimal) Math.Pow(10, FractionDigits ?? 2);
        }


        // SDK 2 
        public static decimal AmountToDecimal(this ITypedMoney typedMoney)
        {
            IHighPrecisionMoney highPrecisionMoney = typedMoney as IHighPrecisionMoney;
            if (highPrecisionMoney != null)
            {
                return (decimal)highPrecisionMoney.PreciseAmount / (decimal)Math.Pow(10.0, highPrecisionMoney.FractionDigits);
            }

            return (decimal)typedMoney.CentAmount / 100m;
        }

To Reproduce

   [Test]
        public void CT_TypedMoney_ZeroFractionCulture_Success()
        {
            var money = new TypedMoney() { CentAmount = 1000, CurrencyCode = "ko-KR", FractionDigits = 0 };

            var result1 = commercetools.Sdk.Api.Models.Common.TypedMoneyExtensions.AmountToDecimal(money);
            var result2 = AmountToDecimalSDK1(money.CentAmount, money.FractionDigits);
            var result3 = AmountToDecimalModified(money);

            Assert.AreNotEqual(1000, result1, "DecimalAmount");
            Assert.AreEqual(1000, result2, "DecimalAmount");
            Assert.AreEqual(1000, result3, "DecimalAmount");
        }


        //SDK 1 adapted 

        public decimal AmountToDecimalSDK1(long centAmount, int? fractionDigits)
        {
            return centAmount / (decimal)Math.Pow(10, fractionDigits ?? 2);
        }

        //Modified
        public decimal AmountToDecimalModified(this ITypedMoney typedMoney)
        {
            IHighPrecisionMoney highPrecisionMoney = typedMoney as IHighPrecisionMoney;
            if (highPrecisionMoney != null)
            {
                return (decimal)highPrecisionMoney.PreciseAmount / (decimal)Math.Pow(10.0, highPrecisionMoney.FractionDigits);
            }

            return typedMoney.CentAmount / (decimal)Math.Pow(10, typedMoney.FractionDigits);
        }

Expected behavior
AmountToDecimal handles fraction digits

  • dotnet: NET6 & Standard 2.1
  • SDK: commercetools.Sdk.Api" Version="4.1.0"

Dotnet Core SDK Release with Import API And ML

  • Include ML and Import API SDKs into the beta release
  • update ReadMe file to show how to use Import Api and ML SDKs
  • update ReadMe file to show how to use multiple clients with different token providers

Missing generated types for OrderCustomLineItem message and payloads

Describe the bug

The api documents outline the following message types, and respective payloads.

https://docs.commercetools.com/api/message-types#ordercustomlineitemadded
https://docs.commercetools.com/api/message-types#ordercustomlineitemremoved
https://docs.commercetools.com/api/message-types#ordercustomlineitemquantitychanged

But they are not present in the SDK today. Other message types do exist.

Expected behavior
These types should exist

Screenshots/Code snippet

Stack information (please complete the following information):

  • dotnet: [e.g. Core 6.0]
  • SDK: latest, 3.2.0

Additional context

WithExpand not working as expected for ICart

Describe the bug
When using withExpand the properties selected are NOT expanded as expected, could be doing this wrong.

To Reproduce
Running the following....

var cart = await _commerceToolsClient.WithApi(_commerceToolsProjectKey, basketUser.StoreId.ToUpper())
                    .Carts().WithId(basketId)
                    .Get().WithExpand("PaymentInfo.Payments").WithExpand("DiscountCodes")
                    .ExecuteAsync();

Expected behavior
DiscountCodes and PaymentInfo.Payments are properties on ICart so should be expanded

Screenshots/Code snippet
If applicable, add screenshots or code samples to help explain your problem.

Stack information (please complete the following information):

  • dotnet: [e.g. 5.0]
  • SDK: [e.g. v2.1.1]

Additional context
Add any other context about the problem here.

.NET Create Integration Tests

Create Integration Tests for

  • productProjection search
  • Product Image Upload
  • Fix Search Query params like filterQuery to be filter.query

Inconsistent ApiBaseAddress and AuthorizationBaseAddress format

Describe the bug
Inconsistent application of BaseAddress format, between ApiBaseAddress and AuthorizationBaseAddress. For example, AuthorizationBaseAddress requires a trailing "/" otherwise an exception is thrown:

System.Net.Http.HttpRequestException: 'No such host is known.'

To Reproduce
See code snippet below.

Expected behavior
Both the ApiBaseAddress and AuthorizationBaseAddress should either have the trailing "/" character or neither should.

Screenshots/Code snippet

image

Stack information (please complete the following information):

  • dotnet: [e.g. Core 3.1]
  • commercetools SDK: [e.g. v1.1.4]

Additional context
Consider commenting each property of the ClientConfiguration so that during development time the IDE can show hints and examples.

Postman Collection returns data that SDK does not

When you call the Get Cart By Id endpoint using the Postman Collection, one of the data elements that's returned on LineItems is a "productKey" field.

However, in the SDK, when you call the equivalent API call, this field is not returned, nor is it defined in the ILineItem.cs file (commercetools.Sdk.Api/Generated/Models/Carts/ILineItem.cs).

Right now, I'm storing a custom field on the line item to house that key. If it's being returned, it should be showing up in the SDK (in my opinion), it would definitely make my life easier and reduce storing the same data twice.

Here you can see the productKey is returned:
image

Definition for ILineItem:
image

Generated .NET SDK Unit tests - Test Coverage

As part of Test Coverage improvement and to feel confident with 100% automation in code generation we aim to improve our test coverage for generated SDKs

AC

  • Unit Tests for API Request Builders

Configuring a Proxy for the HttpClient

The SDK has taken the responsibility of creating the HttpClient used for the API communication.

It would be nice with an option to set a proxy server for this client, and I cannot see how that would be possible with the current implementation.

public static IHttpClientBuilder SetupClient(this IServiceCollection services, string clientName, Func<HttpResponseMessage, Type> errorResponseTypeMapper, Func<IServiceProvider, ISerializerService> serializerFactory)

The use case would for example be a corporate proxy, or it could be for debugging purposes, to see the actual http calls going through Fiddler.

DotNET SDK V2 - Documentation Content

Improve the documentation around Dotnet SDK V2 to improve UX and reduce support question

Accptance Criteria

Scope of Work

  • Standardised documentation

Reference:

Product attribute set as number returns different attributes based on the value

In our project we have NumberType attribute for the product which could have floating values or integer value. During import we set it as a NumberAttribute float numeric value. However inside commercetools it keeps integer values without floating point, even if it was setup like a floating value (example 13.0 would be represented like a 13). When I try to get attributes for the product SDK returns different attribute types - when it is integer value it deserializes it to LongAttribute and when a a float value it returns DecimalAttribute.

To Reproduce

  • Set Attribute of a NumberType with value 13.0
  • Get Attribute it will be LongAttribute
  • Update same Attribute to value 13.9
  • Get Attribute it will be DecimalAttribute

Expected behavior
I would expect it will always be the same attribute type.

Stack information (please complete the following information):

  • dotnet: [e.g. Core 3.1]
  • SDK: 3.0.2

Deserialize ImportOperation: Failed to find the required 'Type' discriminator property error

Describe the Bug
While ImportOperation Deserialization which has error of type "DuplicateAttributeValue", it's failing to deserialize the attribute because it doesn't have type property in the json.

To Reproduce
Try to Deserialize the below json to IImportOperation:
{
"version": 1,
"importContainerKey": "productsImport",
"resourceKey": "MG-Iphone11",
"id": "d2c20ea3-657b-4314-b312-cd527asss",
"state": "validationFailed",
"errors": [
{
"code": "DuplicateAttributeValue",
"message": "Attribute can't have the same value in a different variant.",
"attribute": {
"name": "phonecolor",
"value": "Black"
}
}
],
"createdAt": "2021-11-05T09:38:28.878Z",
"lastModifiedAt": "2021-11-05T09:38:29.204Z",
"expiresAt": "2021-11-07T09:38:28.878Z"
}

missing Discription in PaymentDraft

The field Description on the PaymentDraft or PaymentMethodInfo is not part of the sdk but there is a field in the merchant center to display it.

Expected behavior
It should be possible to add a description for the payment method when creating the payment.

Screenshots/Code snippet
image

OrderSearchRequest's Query is "string" typed and causes 400 Bad Request

Describe the bug
As the type of Query of OrderSearchRequest is string, the query get serialized into string content like the below.

{   
  "query": "{ \"exact\": {\"field\": \"itemShippingAddresses.postalCode\", \"value\": \"EC1R 5EN\"  } }",
  "limit": 20,
  "offset": 0
}

To Reproduce

ApiRoot
  .WithProjectKey("test_projectKey")
  .Orders()
  .Search()
  .Post(new OrderSearchRequest {
    Query = JsonSerializer.Serialize(new {
        exact = new {
          field = "itemShippingAddresses.postalCode",
          value = "EC1R 5EN"
        }
      }
  })

This call returns with 400 Bad Request

Expected behavior
It should send a valid json as POST request body

{   
  "query": {
     "exact": {
       "field": "itemShippingAddresses.postalCode", 
       "value":  "EC1R 5EN"  
      }
   },
  "limit": 20,
  "offset": 0
}

Screenshots/Code snippet
If applicable, add screenshots or code samples to help explain your problem.

Stack information (please complete the following information):

  • dotnet: Core 3.1
  • SDK: [e.g. v2.2]

Additional context
Add any other context about the problem here.

Custom APIM for commercetools config

URi segement gets overwritten for ApiBaseAddress
The URi segement is replaced by the SDK keeping only the domain name.

To Reproduce
Define an API gateway and use "ApiBaseAddress" as https://{{domain}}/api/internal-api/commercetools/, at the time of calling the API let's say product projection, then the final URL composed is https://{{domain}}/{{project-key}}/product-projections/search?staged=True.

Expected behavior
The URi should take the segements defined in the ApiBaseAddres, so the final URL should be like https://{{domain}}/api/internal-api/commercetools/{{project-key}}/product-projections/search?staged=True.

Configuration

 "CommercetoolsClient": {
    "AuthorizationBaseAddress": "http://localhost:8090/api/commercetools-auth/",
    "ApiBaseAddress": "http://localhost:8090/internal-api/commercetools/"
  }

Stack information :

  • dotnet: [e.g. Core 5.0]
  • SDK: [e.g. v2]

Additional context
AuthorizationBaseAddress however works fine, the URi segment is not overwritten.

[Question] Deserializing events from a Message Bus

Hi,

Sorry to create an Issue but currenlty I don't know where to ask my question. Please don't hesitate if we could use another communication channel.

I can't find a documentation nor an example of this, but basically we need to consume commercetools events (from an Azure Message bus topic), deserialize the event/payload to a strongly typed object then process it (we basically plan to forward it to our Kafka cluster as it is our integration bus).
As I understood, the lib allows to publish typed events, not to consume them, am I right ?
So we plan to use the raw lib https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/servicebus/Azure.Messaging.ServiceBus to do so.

Well here is my question : can I safely deserialize the consumed events to a typed object of your library (https://github.com/commercetools/commercetools-dotnet-core-sdk-v2/tree/master/commercetools.Sdk/commercetools.Sdk.Api/Generated/Models/Messages) based on any transported metadata within the message ?
If you have any best practices/samples to share on event consumption using your lib, it could be great.

Our stack : .net6 / Docker+K8S

@MicheleRezk @jenschude

Thank you!

Common interface for ApiMethods

Is your feature request related to a problem? Please describe.

Hello,
I'm in the progress of migrating from v1 to v2.
When using v1 I was able to perform generic operations on different Objects using CommandBuilder<>. As for now - different API methods have their own (the same) implementation for Query, Limit, Offset, etc., and there is no common interface for that.

Example:
Carts.Limit
Order.Limit

Describe the solution you'd like
Introduce an interface for Expand, Sort, Limit, Offset, etc., and if possible for ExecuteAsync too.

Describe alternatives you've considered
None.

Additional context
None.

Project Key and WithApi

Hi

We are migrating from SDK v1 to SDK 2 and was a bit confused by the the switch to UseAPI().WithProjectKey("...").
In SDK v1 and SDK v2 the project key is specified within the appsettings. Which is mentioned within getting started.

In SDK v2 the project key needs to be set every time either via withApi wor WithProjectKey meaning that instead of writing
var a = await _commercetoolsClient.Builder().Stores().Query().SetLimit(100).ExecuteAsync();
i now have to write

var b = await commercetoolsV2Client.WithApi("KEY").Stores().Get().WithLimit(100).ExecuteAsync(); or
var c = await commercetoolsV2Client.WithApi().WithProjectKey("KEY").Stores().Get().WithLimit(100).ExecuteAsync();

So I can get round this by using the options pattern and then decorating the Client with a class that contains the injected options and settings and extract the project key.

 services.AddOptions();
 services.Configure<ClientConfiguration>(configuration.GetSection("CommercetoolsV2Client"));
 
 ....
         public ClientDecorator(
            IClient client,
            IOptions<ClientConfiguration> clientConfiguration
        )
        {
            _client = client;
            ProjectKey = clientConfiguration.Value.ProjectKey;
        }

Should WithApi() not default to use the appsettings project key and accept an override if specified?
or perhaps there is better strategy that I have missed/misunderstood?
Thanks in advance

When trying to get a list of Baskets for a Store return a useful type (not object)

Is your feature request related to a problem? Please describe.
I am trying to get a list of baskets for a store, using ByProjectKeyInStoreKeyByStoreKeyCartsGet but the ExecuteAsync() returns a Task<Object>

Describe the solution you'd like
I would like this to return a ICartPagedQueryResponse like for ByProjectKeyCartsGet

Describe alternatives you've considered
I have tried casting the object returned to a ICartPagedQueryResponse as that is what it is (or looks very similar) but no good. This is effecting my ability to upgrade

Additional context
none

Exception with nested serializiation

Describe the bug

When doing:

var resultdata = cl.WithApi().WithProjectKey("myproject").Products().Post(pdf).ExecuteAsync().Result;

where pdf.MasterVariant.Attributes has a:
                 var value = new SetAttribute<NestedAttribute>();
                    value.Name = "options";
                    var values = new List<NestedAttribute>();
                    value.Value = values;
                    pdf.MasterVariant.Attributes.Add(value);

                        var id = "abc";
                        var nested = new NestedAttribute();

                        nested.Value = new List<IAttribute>()
                        {
                            new StringAttribute
                            {
                                Name = "id",
                                Value = id,
                            },
                            new LongAttribute
                            {
                                Name = "minamount",
                                Value = (long)0,
                            },
                            new LongAttribute
                            {
                                Name = "maxamount",
                                Value = (long)q.ProductOptions.Count,
                            },
                            new SetAttribute<NestedAttribute>()
                            {
                                Name = "products",
                                Value = new List<NestedAttribute>()
                            },
                            new LocalizedStringAttribute
                            {
                                Name = "title",
                                Value = new LocalizedString
                                {
                                    { "nl-NL", q.OptionCategory.ToString() }
                                }
                            }
                        };
                        values.Add(nested);

gives me a :
System.InvalidCastException: 'Unable to cast object of type 'commercetools.Sdk.Api.Serialization.JsonConverters.AttributeConverter' to type 'System.Text.Json.Serialization.JsonConverter`1[commercetools.Sdk.Api.Models.Products.NestedAttribute]'.'

To Reproduce
Above code, with a post

Expected behavior
No error

Stack information (please complete the following information):

  • net core 6
    • sdk 4.1

Additional context

 	System.Text.Json.dll!System.Text.Json.Serialization.JsonCollectionConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute>, commercetools.Sdk.Api.Models.Products.NestedAttribute>.GetElementConverter(ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Converters.ListOfTConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute>, commercetools.Sdk.Api.Models.Products.NestedAttribute>.OnWriteResume(System.Text.Json.Utf8JsonWriter writer, System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute> value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonCollectionConverter<System.__Canon, System.__Canon>.OnTryWrite(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute>>.TryWrite(System.Text.Json.Utf8JsonWriter writer, System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute> value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.__Canon>.WriteCore(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.NestedAttribute>>.WriteCoreAsObject(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.WriteUsingSerializer<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.Serialize<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	commercetools.Sdk.Api.dll!commercetools.Sdk.Api.Serialization.JsonConverters.AttributeConverter.Write(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IAttribute value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.IAttribute>.TryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IAttribute value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Converters.ListOfTConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.IAttribute>, commercetools.Sdk.Api.Models.Products.IAttribute>.OnWriteResume(System.Text.Json.Utf8JsonWriter writer, System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.IAttribute> value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonCollectionConverter<System.__Canon, System.__Canon>.OnTryWrite(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.IAttribute>>.TryWrite(System.Text.Json.Utf8JsonWriter writer, System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.IAttribute> value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Metadata.JsonPropertyInfo<System.Collections.Generic.List<commercetools.Sdk.Api.Models.Products.IAttribute>>.GetMemberAndWriteJson(object obj, ref System.Text.Json.WriteStack state, System.Text.Json.Utf8JsonWriter writer)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Converters.ObjectDefaultConverter<commercetools.Sdk.Api.Models.Products.ProductVariantDraft>.OnTryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.ProductVariantDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.ProductVariantDraft>.TryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.ProductVariantDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.__Canon>.WriteCore(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.ProductVariantDraft>.WriteCoreAsObject(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.WriteUsingSerializer<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.Serialize<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	commercetools.Base.Serialization.dll!commercetools.Base.Serialization.JsonConverters.DeserializeAsConverter<commercetools.Sdk.Api.Models.Products.IProductVariantDraft>.Write(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IProductVariantDraft value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.IProductVariantDraft>.TryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IProductVariantDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Metadata.JsonPropertyInfo<commercetools.Sdk.Api.Models.Products.IProductVariantDraft>.GetMemberAndWriteJson(object obj, ref System.Text.Json.WriteStack state, System.Text.Json.Utf8JsonWriter writer)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.Converters.ObjectDefaultConverter<commercetools.Sdk.Api.Models.Products.ProductDraft>.OnTryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.ProductDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.ProductDraft>.TryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.ProductDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.__Canon>.WriteCore(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.ProductDraft>.WriteCoreAsObject(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.WriteUsingSerializer<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.Serialize<object>(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	commercetools.Base.Serialization.dll!commercetools.Base.Serialization.JsonConverters.DeserializeAsConverter<commercetools.Sdk.Api.Models.Products.IProductDraft>.Write(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IProductDraft value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<commercetools.Sdk.Api.Models.Products.IProductDraft>.TryWrite(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IProductDraft value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.Serialization.JsonConverter<System.__Canon>.WriteCore(System.Text.Json.Utf8JsonWriter writer, System.__Canon value, System.Text.Json.JsonSerializerOptions options, ref System.Text.Json.WriteStack state)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.WriteUsingSerializer<commercetools.Sdk.Api.Models.Products.IProductDraft>(System.Text.Json.Utf8JsonWriter writer, commercetools.Sdk.Api.Models.Products.IProductDraft value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.WriteStringUsingSerializer<commercetools.Sdk.Api.Models.Products.IProductDraft>(commercetools.Sdk.Api.Models.Products.IProductDraft value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo)	Unknown
 	System.Text.Json.dll!System.Text.Json.JsonSerializer.Serialize<commercetools.Sdk.Api.Models.Products.IProductDraft>(commercetools.Sdk.Api.Models.Products.IProductDraft value, System.Text.Json.JsonSerializerOptions options)	Unknown
 	commercetools.Sdk.Api.dll!commercetools.Sdk.Api.Serialization.SerializerService.Serialize<commercetools.Sdk.Api.Models.Products.IProductDraft>(commercetools.Sdk.Api.Models.Products.IProductDraft input)	Unknown
 	commercetools.Sdk.Api.dll!commercetools.Sdk.Api.Client.RequestBuilders.Products.ByProjectKeyProductsPost.Build()	Unknown
 	commercetools.Sdk.Api.dll!commercetools.Sdk.Api.Client.RequestBuilders.Products.ByProjectKeyProductsPost.ExecuteAsync()	Unknown
>	

Exception logged but not thrown from the ExecuteAsync

In the implementation of one of my services, I am creating a client that takes an existing token and invokes call for different resources. In-case the token is not valid then an exception is logged, but ExecuteAsync does not throws exception. Whereas, the behaviour is different if the service instead of creating a new client injects an existing client then exceptions are logged and thrown also from ExecuteAsync. Here is an example implementation. What can I do to get catch the exception in my service and map that to custom excpetion?

      {
        Client = ClientFactory.Create(
          "MeClient",
          this.clientConf,
          this.httpClientFactory,
          this.serializerService,
         new AnonymToken(aToken))
      };


ClientContainer.Client.WithApi("my-project-key").Me().Carts().Get().ExecuteAsync()

Missing types for order set shipping method action

Is your feature request related to a problem? Please describe.

Missing types for OrderSetShippingMethodAction and OrderSetCustomShippingMethodAction.

See Set ShippingMethod and Set Custom ShippingMethod.

Describe the solution you'd like

Add classes:

public class OrderSetShippingMethodAction : IOrderSetShippingMethodAction, IOrderUpdateAction
{
    public OrderSetShippingMethodAction();

    public string Action { get; set; }
    public IShippingMethodResourceIdentifier ShippingMethod { get; set; }
    public IExternalTaxRateDraft ExternalTaxRate { get; set; }
}

public class OrderSetCustomShippingMethodAction : IOrderSetCustomShippingMethodAction, IOrderUpdateAction
{
    public OrderSetCustomShippingMethodAction();

    public string Action { get; set; }
    public string ShippingMethodName { get; set; }
    public ShippingRateDraft ShippingRate { get; set; }
    public ITaxCategoryResourceIdentifier TaxCategory { get; set; }
    public IExternalTaxRateDraft ExternalTaxRate { get; set; }
}

Describe alternatives you've considered

Adding the types in my own source code.

Additional context

Missing description in lineItem

Describe the bug
LineItem has product name, product key but missing product description

Expected behavior
LineItem has LocalizedString description

Stack information:

  • dotnet: [e.g. Core 3.0]
  • SDK: [e.g. v2.2]

Notification event serialization problem on attributes ?

Describe the bug
Hi, I just noticed that when getting "stringified" event from Azure Service Bus after it has been pushed by CT, I got an invalid JSON payload
See example of a ProductPublished type with just the part of the attributes having a missing curly brace

{
  "attributes": [
    {
      "name": "bundled_products",
      "value": [
        {
          "typeId": "product",
          "id": "e3b0f02e-0484-4989-a9b6-dcbc32a****"
        },
        {
          "typeId": "product",
          "id": "c3671846-8d3a-4d5d-b2d9-55653530****"
        }
      ]
    },
    {
      "name": "summary",
      "value": {
        "it": "My super product"
      }
    },
    {
      "name": "size",
      "value": {
        "key": "one_size",
        "label": "One size"
      }
    },
    {
      "name": "weight",
      "value": 2
    },
    {
      "name": "product_classification",
      "value": {
        "key": "NONE",
        "label": {
          "fr": "",
          "it": "",
          "fr-FR": "",
          "es": "",
          "en-US": "Regular product",
          "pt": "",
          "da": ""
        }
        <========  ******************** closing curly brace is missing here ******************
    },
    {
      "name": "related_accessories",
      "value": [
        {
          "typeId": "product",
          "id": "49e96f8b-8c74-4ef9-a3b4-ecdd3f1e****"
        },
        {
          "typeId": "product",
          "id": "2b94910d-cc11-4755-92ca-4eafbcb5****"
        },
        {
          "typeId": "product",
          "id": "751d9739-be25-4b0b-b4bc-ec39a6c7****"
        },
        {
          "typeId": "product",
          "id": "2151faf3-6ff8-4093-9034-345a84f7****"
        },
        {
          "typeId": "product",
          "id": "552c2604-a1f8-4b0f-bf43-757a2af2****"
        },
        {
          "typeId": "product",
          "id": "e0f2ea30-bece-44cb-a2db-4e2a7c2c****"
        }
      ]
    }
  ]
}

Curiously it seems not to impact the Deserialization (hydrating a typed object) from this string which is strange to me.

To Reproduce
Typically in the Azure Service Bus message handler

      private async Task MessageHandler(ProcessMessageEventArgs args)
        {
            string body = args.Message.Body.ToString();
            _logger.LogInformation(body);
         }

Please PM me if you need to access our specific account / data.
Thank you

Expected behavior
A valid JSON format

Screenshots/Code snippet
If applicable, add screenshots or code samples to help explain your problem.

Stack information (please complete the following information):

  • dotnet: [e.g. 6.0]
  • SDK: [e.g. v3.1.0]

High precision cart

Describe the bug
totalPrice of cart is always with type centPrecision

To Reproduce
Add one lineitem in the cart with type highPrecision

Expected behavior
totalPrice of the cart should be sum of highPrecision?

Screenshots/Code snippet

{
    "limit": 20,
    "offset": 0,
    "count": 1,
    "total": 1,
    "results": [
        {
            "type": "Cart",
            "id": "e38bb26a-9ecc-4505-bcb4-1687bbb2c1ca",
            "version": 3,
            "lastMessageSequenceNumber": 1,
            "createdAt": "2021-06-27T18:55:15.575Z",
            "lastModifiedAt": "2021-06-27T18:55:27.899Z",
            "lastModifiedBy": {
                "clientId": "eCrByg06j1uSUbxM4S4DvwnH",
                "isPlatformClient": false
            },
            "createdBy": {
                "clientId": "eCrByg06j1uSUbxM4S4DvwnH",
                "isPlatformClient": false
            },
            "lineItems": [
                {
                    "id": "98733f33-c7b7-46a9-a21c-0d58d5fb16f3",
                    "productId": "8d913c65-b7df-423c-9aad-65be9be80219",
                    "name": {
                        "en-US": "Test"
                    },
                    "productType": {
                        "typeId": "product-type",
                        "id": "0dcc53c1-f4dd-4297-ba28-60349319cc77",
                        "version": 1
                    },
                    "productSlug": {
                        "en-US": "test"
                    },
                    "variant": {
                        "id": 1,
                        "sku": "test",
                        "key": "test",
                        "prices": [
                            {
                                "value": {
                                    "type": "highPrecision",
                                    "currencyCode": "EUR",
                                    "centAmount": 2,
                                    "preciseAmount": 24,
                                    "fractionDigits": 3
                                },
                                "id": "05a5fb18-6547-4d36-bb88-3c68bc653f32"
                            }
                        ],
                        "images": [],
                        "attributes": [],
                        "assets": []
                    },
                    "price": {
                        "value": {
                            "type": "highPrecision",
                            "currencyCode": "EUR",
                            "centAmount": 2,
                            "preciseAmount": 24,
                            "fractionDigits": 3
                        },
                        "id": "05a5fb18-6547-4d36-bb88-3c68bc653f32"
                    },
                    "quantity": 1,
                    "discountedPricePerQuantity": [],
                    "addedAt": "2021-06-27T18:55:27.861Z",
                    "lastModifiedAt": "2021-06-27T18:55:27.861Z",
                    "state": [
                        {
                            "quantity": 1,
                            "state": {
                                "typeId": "state",
                                "id": "9ee398d4-9b48-4b09-b199-d6178512ed4c"
                            }
                        }
                    ],
                    "priceMode": "Platform",
                    "totalPrice": {
                        "type": "centPrecision",
                        "currencyCode": "EUR",
                        "centAmount": 2,
                        "fractionDigits": 2
                    },
                    "lineItemMode": "Standard"
                }
            ],
            "cartState": "Active",
            "totalPrice": {
                "type": "centPrecision",
                "currencyCode": "EUR",
                "centAmount": 2,
                "fractionDigits": 2
            },
            "customLineItems": [],
            "discountCodes": [],
            "inventoryMode": "None",
            "taxMode": "Platform",
            "taxRoundingMode": "HalfEven",
            "taxCalculationMode": "LineItemLevel",
            "refusedGifts": [],
            "origin": "Customer",
            "itemShippingAddresses": []
        }
    ]
}

Stack information:

  • dotnet: [e.g. Core 5.0]
  • SDK: [e.g. v2]

ProductProjection Search POST request

Describe the bug
Post(JsonElement? jsonNode) method of the ByProjectKeyProductProjectionsSearchRequestBuilder class has jsonNode parameter which later on the Build() method of ByProjectKeyProductProjectionsSearchPost serialized and added as a content with application/json type. However based on documentation body of the post request should be encoded in application/x-www-form-urlencoded.Because of this this method works not properly.

To Reproduce
Call POST method and pass serialized to JsonElement object with property limit set as 1
API still returns 20 items, like by default.

Expected behavior
API should return single item
Screenshots/Code snippet
If applicable, add screenshots or code samples to help explain your problem.

Stack information (please complete the following information):

  • dotnet: Core 3.1
  • SDK: v1.5.0

Additional context
As it should be of content type of application/x-www-form-urlencoded it make sense to use QueryString of the request and add it as Content with a content type application/x-www-form-urlencoded and clean up QueryString of the request. As well it seems that JsonElement? jsonNode of the Post() method is not required in such case. And finally instead of returning JsonElement from the ExecuteAsync() of ByProjectKeyProductProjectionsSearchPost It make sense to return IProductProjectionPagedSearchResponse like Get method returns.
Here a part of ByProjectKeyProductProjectionsSearchPost which should be used instead existing one

public async Task<IProductProjectionPagedSearchResponse> ExecuteAsync()
{
    var requestMessage = Build();
    return await ApiHttpClient.ExecuteAsync<IProductProjectionPagedSearchResponse>(requestMessage);
}

public override HttpRequestMessage Build()
{
    var request = base.Build();
    request.Content = new FormUrlEncodedContent(QueryParams);
    return request;
}

It does not work about sorting by scopedPrice in ProductProjectionSearch

Describe the bug
It does work about sorting by scopedPrice in ProductProjectionSearch

To Reproduce

  1. set PriceCustomerGroup、PriceCurrency、PriceCountry、PriceChannel for ProductProjectionSearch
  2. set sort to variants.scopedPrice.value asc
  3. call the ProductProjectionSearch

Expected behavior
the result of ProductProjectionSearch can be sorted by scopedPrice

Screenshots/Code snippet
image
image
image
image
the result responses some products including scopedPrice but the sort of products is invalid.

Stack information (please complete the following information):

  • dotnet: Core 3.1
  • SDK: v2.4.0

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.