Xero-Java icon indicating copy to clipboard operation
Xero-Java copied to clipboard

Uploading a pdf and making it the sales invoice to be included in the email to customer

Open arifainchtein opened this issue 3 years ago • 0 comments

SDK you're using (please complete the following information): 4.14

Describe the bug I have created an invoice and uploaded a pdf as an attachment. This pdf represent the sales invoice that i want to mail to the client. However, when i click on the send email button and i send the email with the sales invoce, the one that is sent in the email is not the one i uploaded. but one created by xero using a different template. How can a an attachment to an invoice and mark it to be the pdf is to be included in the email sent to the customer?

To Reproduce Here is the code i use to upload the attachemtn:

Invoice newinvoice = result.getInvoices().get(0); logger.debug("line 462, returning invoice=" + newinvoice.toString()); UUID invoiceid = newinvoice.getInvoiceID(); Invoices retinvoices = accountingApi.getInvoice(access_token, xero_tenant_id, invoiceid, null); //logger.debug("line 448, returning invoice=" + retinvoices.getInvoices().get(0).getAmountDue()); String basename= FilenameUtils.getName(filename); logger.debug("line 447, invoice created for customerorder " + customerorderid + " invoiceid=" + invoiceid + " basename=" + basename);
		accountingApi.createInvoiceAttachmentByFileName(access_token, xero_tenant_id, invoiceid,basename, invoicePDFFile, includeonline);

Expected behavior The uploaded pdf becomes the sale invoice pdf emailed to a client

arifainchtein avatar Apr 17 '23 09:04 arifainchtein