Skip to content

Error converting value \"DAYSAFTERBILLMONTH\" to type 'ScheduleDueType' #767

@sajagshresthaupstem

Description

@sajagshresthaupstem

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

  • Version [e.g. 13.0.1]

Describe the bug
I'm trying to create a repeating invoice with due date 14 days after the invoice date. But the enum DAYSAFTERINVOICEDATE has issues with the API.

Here's my code

  async createRepeatingInvoice(invoiceDetails: InvoiceDetails) {
    await this.setAccessToken();
    const { contactId, itemCode, reference, quantity, invoiceDate } =
      invoiceDetails;

    // const brandingTheme = await this.getBrandingThemeByName("sss");

    const invoiceData: RepeatingInvoice = {
      type: RepeatingInvoice.TypeEnum.ACCREC,
      status: RepeatingInvoice.StatusEnum.AUTHORISED,
      contact: {
        contactID: contactId,
      },
      lineItems: [
        {
          itemCode,
          quantity,
        },
      ],
      reference: reference,
      schedule: {
        period: 1,
        unit: Schedule.UnitEnum.MONTHLY,
        startDate: new Date(invoiceDate).toISOString(),
        dueDate: 14,
        dueDateType: Schedule.DueDateTypeEnum.DAYSAFTERINVOICEDATE,
      },
      markAsSent: true,
      // brandingThemeID: brandingTheme?.brandingThemeID,
    };

    const { body } = await this.xero.accountingApi.createRepeatingInvoices("", {
      repeatingInvoices: [invoiceData],
    });

    return body?.repeatingInvoices?.[0];
  }

Here's the error
Error converting value \"DAYSAFTERBILLMONTH\" to type 'ScheduleDueType'

To Reproduce
Steps to reproduce the behavior:
I can also reproduce this with the API explorer

Screenshots

Image

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions