Closed arifainchtein closed 1 year ago
PETOSS-283
Thanks for raising an issue, a ticket has been created to track your request
sorry, it looks like part of the code (the top) in my bug description was not stylized properly
Hi @arifainchtein , thanks for bringing this to our attention. The addAttachmentsItem method should be made private in our SDK since it is only used for unmarshalling attachment details in the GetInvoices call. I'll look into updating this in the future since it can be misleading.
You can only upload an attachment once an invoice is created. You will want to use accountingApi.createInvoiceAttachmentByFileName to add attachments for each invoice created after calling accountingApi.createInvoices.
SDK you're using (please complete the following information):
Describe the bug I am creating and invoice and want to upload the pdf of the sale invoice
To Reproduce Here is the code i am using. It runs clean without any exceptions, but when i go see the invoice, there is no attachment I have verified that the file exist at the location and is a valid pdf file
`Invoice invoice = new Invoice(); invoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC); invoice.setContact(contact); SimpleDateFormat invoiceDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateValue = invoiceDateFormat.format(new Date()); // System.out.println("line 400, dateValue=" + dateValue); // invoice.setDate(dateValue); YearMonth ym = YearMonth.now( ZoneId.of( "Australia/Melbourne" ) ) ; YearMonth ymNext = ym.plusMonths( 1 ) ; java.time.LocalDate ld = ymNext.atEndOfMonth() ; String dueDateValue = ld.toString() ; // invoice.setDueDate(dueDateValue); // System.out.println("line 407, dueDateValue=" + dueDateValue); invoice.setLineItems(lineItems); invoice.setReference("Customer Order " + customerorder.getInt("id")); invoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.DRAFT);
Expected behavior The PDF file should be part of the invoice when i go see it in xero
Screenshots
Additional context I am using the demo company