Giter Club home page Giter Club logo

Comments (5)

philals avatar philals commented on July 21, 2024

Hi @tallday. Have you checked the source code of this module to make sure the function is there?

from xero-node.

tallday avatar tallday commented on July 21, 2024

It doesnt look like the function is there to me. Thats why im confused as the documentation provides the example. @philals

from xero-node.

jordanwalsh23 avatar jordanwalsh23 commented on July 21, 2024

Hi @tallday, if you check the tests files it's often more helpful (and potentially more correct) than the documentation:

  it('create multiple banktransactions', done => {
    const banktransactions = [];

    for (let i = 0; i < 2; i += 1) {
      banktransactions.push(
        currentApp.core.bankTransactions.newBankTransaction({
          Type: 'SPEND',
          Contact: {
            Name: 'Johnny McGibbons',
          },
          LineItems: [
            {
              Description: 'Annual Bank Account Fee',
              UnitAmount: 0.01,
              AccountCode: expenseAccountCode,
            },
          ],
          BankAccount: {
            AccountID: bankAccountId,
          },
        })
      );
    }

    currentApp.core.bankTransactions
      .saveBankTransactions(banktransactions)
      .then(response => {
        expect(response.entities).to.have.length.greaterThan(0);
        response.entities.forEach(bankTransaction => {
          expect(bankTransaction.BankTransactionID).to.not.equal('');
          expect(bankTransaction.BankTransactionID).to.not.equal(undefined);
        });
        done();
      })
      .catch(err => {
        console.error(util.inspect(err, null, null));
        done(wrapError(err));
      });
  });

In this case the function is actually saveBankTransactions() and it takes an array of banktransaction objects that were created from the newBankTransaction() constructor.

Hope that helps.

from xero-node.

tallday avatar tallday commented on July 21, 2024

Thanks very much. This has help me a lot @jordanwalsh23.
I have since determined that I was actually wanting to create bank statements not transactions. Which then I discovered this https://xero.uservoice.com/forums/5528-xero-api/suggestions/340274-import-bank-statement-lines-via-the-api

from xero-node.

philals avatar philals commented on July 21, 2024

Thanks for the help @jordanwalsh23

from xero-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.