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

オープン
#767 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
nodejs, typescript
領域
api

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
264
フォーク
177
平均マージ
10時間 5分
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

XeroAPI/xero-node のほかの issue

XeroAPI/xero-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。