Search code examples
intuit-partner-platform

How to read the unit price of an Item with IPP DevKit


I've seen elsewhere how to set the UnitPrice on an Item, using the wiley and elusive Item1 field as Intuit.Ipp.Data.Qbd.Money. But how do I READ the unit price from the Item1 field? I can't cast it. The new operator doesn't work ("new ...Money(myItem.Item1)"). So how do I get the price?

I realize the DevKit will probably never be changed so this makes sense. But can we at least get some doc explaining all those strange "xxxItemxxx" fields?


Solution

  • ServiceContext context = new ServiceContext(oauthValidator, realmId, intuitServiceType);
    DataServices commonService = new DataServices(context);

                            Intuit.Ipp.Data.Qbd.Item qbdItem = new Intuit.Ipp.Data.Qbd.Item();
                            Intuit.Ipp.Data.Qbd.Money unitPrice = new Intuit.Ipp.Data.Qbd.Money();
                            unitPrice.Amount = 22;
                            unitPrice.AmountSpecified = true;
                            qbdItem.Item1 = unitPrice;
                            IEnumerable<Intuit.Ipp.Data.Qbd.Item> qbdItemsResult = commonService.FindAll(qbdItem, 1, 10) as IEnumerable<Intuit.Ipp.Data.Qbd.Item>;
                            foreach (var itemResult in qbdItemsResult)
                            {
                                Intuit.Ipp.Data.Qbd.Money test1UnitPrice = itemResult.Item1 as Intuit.Ipp.Data.Qbd.Money;
                            }
    

    You can use the above code for .Net.