microsoft / Partner-Center-Java

Partner Center SDK for Java
https://docs.microsoft.com/java/partnercenter/
31 stars 12 forks source link

Ontime UsageLineItems returning Blank Array in SDK 1.15.3 #119

Closed gagan2730 closed 3 years ago

gagan2730 commented 4 years ago

SDK is not able to fetch USAGELINEITEMS for provider ONE_TIME. It returns a blank array as response. we tried fetching the usage details for multiple Invoices using the Partner Center API and we were able to get the details in the API Response, but the same was not working when using Partner Center Java SDK.

msize commented 4 years ago

@gagan2730 Could you provide an example of URI which you perform?

gagan2730 commented 4 years ago

``if (invoiceDetail.getBillingProvider() == BillingProvider.ONE_TIME && invoiceDetail.getInvoiceLineItemType() == InvoiceLineItemType.USAGELINEITEMS) {

                this.getContext().getConsoleHelper().startProgress(MessageFormat.format("Getting invoice line item for product {0} and line item type {1}",
                    invoiceDetail.getBillingProvider(),
                    invoiceDetail.getInvoiceLineItemType()));

                ResourceCollection<InvoiceLineItem> invoiceLineItemsCollection = invoicePageSize == 0
                        ? invoiceOperations.by(invoiceDetail.getBillingProvider(),
                                invoiceDetail.getInvoiceLineItemType()).get()
                        : invoiceOperations.by(invoiceDetail.getBillingProvider(),
                                invoiceDetail.getInvoiceLineItemType()).get(invoicePageSize, offset);
                IResourceCollectionEnumerator<ResourceCollection<InvoiceLineItem>> invoiceLineItemEnumerator
                        = partnerOperations.getEnumerators().getInvoiceLineItems().create(invoiceLineItemsCollection);

                System.out.println("totalcount-->" + invoiceLineItemsCollection.getTotalCount());
                try {
                    while (invoiceLineItemEnumerator.hasValue()) {
                        result_json.put(invoiceLineItemEnumerator.getCurrent());
                        invoiceLineItemEnumerator.next();
                        this.getContext().getConsoleHelper().stopProgress();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    e.printStackTrace();
                }
ghost commented 4 years ago

@gagan2730 I believe the root cause for this has been resolved with a recent code update. The incorrect value for the billing provider was being used when requesting one time line items. It should be onetime and not one_time. This update will be included in version 1.15.4 when it is released. Currently there is still some regression testing that needs to be completed prior to release that version. Our hope is to have it published by early next week at the latest.

AndresButelman commented 4 years ago

Hi, do you have an ETA for the 1.15.4 release? We need to be able to fetch line items, tried downgrading to version 1.15.1 momentarily, but that didn´t work due to a parsing error. I saw that fixes to this have already been merged. Are you planning on releasing it soon? Thanks!