You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Create a repeating invoice
@Test
void testAddXeroRepeatingInvoice() throws Exception {
String accessToken = xeroService.getToken();
ApiClient defaultClient = new ApiClient();
AccountingApi apiInstance = AccountingApi.getInstance(defaultClient);
String xeroTenantId = xeroService.getTenantId();
Boolean summarizeErrors = true;
RepeatingInvoices repeatingInvoices = new RepeatingInvoices();
RepeatingInvoice repeatingInvoice = new RepeatingInvoice();
UUID invoiceId = UUID.randomUUID();
System.out.println(invoiceId);
repeatingInvoice.setRepeatingInvoiceID(invoiceId);
Contact contact = new Contact();
contact.setContactID(UUID.fromString("fe6f61ee-e6f1-4f32-b6fe-3486c6bac13c"));
Schedule schedule = new Schedule();
schedule.setUnit(Schedule.UnitEnum.WEEKLY);
schedule.setStartDate(org.threeten.bp.LocalDate.now());
schedule.setEndDate(org.threeten.bp.LocalDate.now().plusDays(3L));
schedule.setPeriod(5);
schedule.setDueDate(3);
LineItem lineItem = new LineItem();
lineItem.setQuantity(1.0);
lineItem.setDescription("test");
lineItem.setAccountCode("123456");
lineItem.setUnitAmount(108.8);
repeatingInvoice.setContact(contact);
repeatingInvoice.setLineItems(List.of(lineItem));
repeatingInvoice.setSchedule(schedule);
repeatingInvoice.setType(RepeatingInvoice.TypeEnum.ACCREC);
repeatingInvoice.setStatus(RepeatingInvoice.StatusEnum.AUTHORISED);
repeatingInvoices.setRepeatingInvoices(List.of(repeatingInvoice));
try {
RepeatingInvoices result = apiInstance.createRepeatingInvoices(accessToken, xeroTenantId, repeatingInvoices, summarizeErrors);
System.out.println(result);
} catch (XeroException e) {
System.err.println("Exception when calling AccountingApi#createRepeatingInvoices");
e.printStackTrace();
}
}
// Update the repeating invoice based on the returned repeating invoice Id
@Test
void testUpdateXeroRepeatingInvoice() throws IOException {
String accessToken = xeroService.getToken();
ApiClient defaultClient = new ApiClient();
UUID repeatingInvoiceID = RETURNED REPEATING INVOICE ID
AccountingApi apiInstance = AccountingApi.getInstance(defaultClient);
String xeroTenantId = xeroService.getTenantId();
RepeatingInvoices repeatingInvoices = new RepeatingInvoices();
RepeatingInvoice repeatingInvoice = new RepeatingInvoice();
Contact contact = new Contact();
contact.setContactID(UUID.fromString("fe6f61ee-e6f1-4f32-b6fe-3486c6bac13c"));
Schedule schedule = new Schedule();
schedule.setUnit(Schedule.UnitEnum.MONTHLY);
schedule.setStartDate(org.threeten.bp.LocalDate.now());
schedule.setEndDate(org.threeten.bp.LocalDate.now().plusDays(10L));
schedule.setPeriod(5);
schedule.setDueDate(3);
LineItem lineItem = new LineItem();
lineItem.setQuantity(1.0);
lineItem.setDescription("test");
lineItem.setAccountCode("123456");
lineItem.setUnitAmount(109.9);
repeatingInvoice.setContact(contact);
repeatingInvoice.setLineItems(List.of(lineItem));
repeatingInvoice.setSchedule(schedule);
repeatingInvoice.setType(RepeatingInvoice.TypeEnum.ACCREC);
repeatingInvoice.setStatus(RepeatingInvoice.StatusEnum.AUTHORISED);
repeatingInvoices.setRepeatingInvoices(List.of(repeatingInvoice));
try {
RepeatingInvoices result = apiInstance.updateRepeatingInvoices(accessToken, xeroTenantId, repeatingInvoiceID, repeatingInvoices);
System.out.println(result);
} catch (XeroException e) {
System.err.println("Exception when calling AccountingApi#updateRepeatingInvoice");
e.printStackTrace();
}
}
What I got in my Demo company is, every time I do updating, a new invoice will be created instead of replacing the previous one. But I can literally do updating repeating invoices mannually in Xero Demo company.
The text was updated successfully, but these errors were encountered:
What I got in my Demo company is, every time I do updating, a new invoice will be created instead of replacing the previous one. But I can literally do updating repeating invoices mannually in Xero Demo company.
The text was updated successfully, but these errors were encountered: