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

Abierto
#767 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
nodejs, typescript
Área
api

Línea de trabajo

The failure is in the Schedule model's DueDateTypeEnum, which the SDK generates from the Xero OpenAPI spec, so the source is likely the spec or generator, not hand-written code. Start by comparing the enum values in the generated Schedule model with the DAYSAFTERINVOICEDATE value from the issue, and reproduce the error the issue describes with a minimal createRepeatingInvoices call. Done means the enum accepts the value the API expects and the error no longer occurs for the 14-days-after-invoice-date case.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
264
Forks
177
Merge medio
10 h 5 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de XeroAPI/xero-node

Todos los issues de XeroAPI/xero-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.