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

Offen
#767 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
nodejs, typescript
Bereich
api

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
TypeScript
Sterne
264
Forks
177
Ø Merge
10 Std. 5 Min.
Gemergte PRs (30 T.)
5

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus XeroAPI/xero-node

Alle Issues in XeroAPI/xero-node

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.