0
votes

I have been trying to create an order with following values but I am getting the Quantity null error even though the value for Quantity has been set clearly. Here is the code snippet.

var item = new CreateOrderRequestLineItem()
            {
                //Name = "Yaar Book",
                //Note = "New Book",
                CatalogObjectId = "STWMISUMLIIIXU6MVWNFX6FQ",
                Quantity = "1",
                BasePriceMoney = new Money() { Amount = 20, Currency = Money.CurrencyEnum.NPR }
            };

And got the following error:

System.IO.InvalidDataException: 'Quantity is a required property for CreateOrderRequestLineItem and cannot be null'

First I tried just by putting the name, but got the error, then I used the catalog id instead of just a name and still getting the same error.

I am using v2 of Connect API.

Thanks.

1

1 Answers

0
votes

This is how CreateOrderRequestLineItem should have been instantiated:

var item = new CreateOrderRequestLineItem(
            CatalogObjectId: "STWMISUMLIIIXU6MVWNFX6FQ",
            Quantity: "1",
            BasePriceMoney: new Money() { Amount = 20, Currency = Money.CurrencyEnum.NPR });