Skip to content

Custom taxAmount for Bank Transaction causing validation error #768

@alexbrazier

Description

@alexbrazier

/**
* The tax amount is auto calculated as a percentage of the line amount (see below) based on the tax rate. This value can be overriden if the calculated <TaxAmount> is not correct.
*/
'taxAmount'?: number;

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

  • Version 13.0.0

Describe the bug
The accounting model LineItem says that you can set a custom taxAmount if the auto calculated amount is wrong. It seems this is possible when creating Invoices but not when creating Bank Transactions.

This is possible via the UI for both bank transactions and invoices, so it just seems to be a validation error that is blocking it.

Creating a 'Spend' BankTransaction using the API with an adjusted TaxAmount results in a Validation Error:

[Message] => Tax amount 52.23 is incorrect for INPUT2 tax type, should be 52.28

To Reproduce
Steps to reproduce the behavior:

  const result = await xero.accountingApi
    .createBankTransactions(tenantId, {
      bankTransactions: [
        {
          type: BankTransaction.TypeEnum.SPEND,
          bankAccount: {
            code: account,
          },
          isReconciled: true,
          contact: { name: 'Contact' },
          date,
          reference
          lineItems: [
            {
              description: 'Description',
              quantity: 1,
              unitAmount: 261.4,
              accountCode,
              taxAmount: 52.23,
            },
          ],
        },
      ],
    })

Expected behavior

If I pass in a custom taxAmount then I expect the bank transaction to be created with the custom tax amount as it is on the UI, not to validate it and throw an error.

Screenshots
Image

Additional context
The docs linked at the top suggest this is possible and the only limitation seems to be a validation making sure the tax matches

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