LineAmountType option gone
Opened this issue · 5 comments
In version 0.10 the LineAmountType used to be set-able: INCLUSIVE etc
http://developer.xero.com/documentation/api/types/#LineAmountTypes
In version 0.13 this option appears to be missing. Any reason for that? The commented code below compiled and worked on 0.10
//LineAmountType lat = new LineAmountType();
//lat.setEnumeration(Enumeration.INCLUSIVE);
Invoice invoice = new Invoice();
invoice.setCurrencyCode(CurrencyCode.USD);
invoice.setLineItems(lineItemList);
invoice.setStatus(InvoiceStatus.DRAFT);
invoice.setType(InvoiceType.ACCREC);
//invoice.setLineAmountTypes(lat);
cheers
James
The client library is generated from https://github.com/XeroAPI/XeroAPI-Schemas. Maybe they removed it?
Looks like it's still being generated, but slightly differently now. I see it in the latest version as getLineAmountTypes()
It's probably because we switched from Jibx, which was unsupported and broken on Java 8, to JAXB which is much more widely used. Feel free to submit a pull request to this project or more likely the XeroAPI-Schemas project if you can figure out why that's happening and determine it shouldn't be. Unfortunately, I'm unlikely to have time to look at this myself.
I think I may have an idea why this does not work.
I can do either of the below and it has absolutely no effect on the created invoice.
invoice.getLineAmountTypes.add("Inclusive");
invoice.getLineAmountTypes().set(0,"Inclusive");
If your invoice default is "Exclusive" in Xero they will still be created that way (and this setting appears to be the API default also, regardless of what you set in Xero settings unfortunately).
It's not clear to me why lineAmountType is designated as a list in the schema (and as a result your code, which is generating based on the schema). It only set once per invoice for all line items. It's not a list in any schema example I have seen. I think this is a bug in the published schema:
https://github.com/XeroAPI/XeroAPI-Schemas/blob/20fd7ff2f81142269a18fc77ba908aeb975e9ebe/v2.00/BaseTypes.xsd#L150
If you agree I will go ahead and chase it up with the other project.
cheers
James