Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Can't create payee with transfer_acct #2

Closed
aon opened this issue May 20, 2020 · 2 comments
Closed

Can't create payee with transfer_acct #2

aon opened this issue May 20, 2020 · 2 comments

Comments

@aon
Copy link
Contributor

aon commented May 20, 2020

Hey @jlongster ! I'm trying to work on this. I can currently import accounts and categories (tho not sorted yet, for some reason) but the issue I'm having is with payees. I can't seem to set transfer_acct. I don't know if there's maybe something wrong with the API or something wrong with my code:

let api = require('@actual-app/api');
const fs = require('fs') 


async function run() {
  let id = await api.createPayee({
    name: "Test - Tarjeta",
    transfer_acct: "86cf22d5-3ca1-434f-be14-489032bf3fea"
  });
  console.log(await api.getPayees());
}

api.runWithBudget('My-Finances-a8f9d08', run);

And the console logs:

D:\Documentos\GitHub\import-ynab5>node test.js
[
  {
    id: 'cc8010f5-c9f4-47bc-aa9f-cbbc5dd2b50e',
    name: 'cablevision',
    category: null,
    transfer_acct: null
  },
  {
    id: '1b4fb67f-51ea-4408-bf73-7a5243a4bc42',
    name: 'Test - Tarjeta',
    category: null,
    transfer_acct: null
  },
  {
    id: '5b5ef78e-d2ab-40e9-a8c0-2562c33b07b8',
    name: 'Efectivo',
    category: null,
    transfer_acct: '1f9959ad-2725-4dc1-b67f-b800d9a64883'
  },
  {
    id: '041e8dda-8a0e-4d75-975a-98e4080749d6',
    name: 'Tarjeta',
    category: null,
    transfer_acct: '86cf22d5-3ca1-434f-be14-489032bf3fea'
  }
]

Any help would be awesome. Thanks!

@jlongster
Copy link
Contributor

Hey @aon, sorry for the delay!

The docs don't explain this well, but you cannot directly create a transfer payee. Those are considered "internal" and need to be in sync with the list of accounts, otherwise weird things might happen.

When you create an account, a transfer payee is automatically created for that account. So you just need to create the account and that's it. It looks like you've already created that account and the transfer payee already exists:

  {
    id: '041e8dda-8a0e-4d75-975a-98e4080749d6',
    name: 'Tarjeta',
    category: null,
    transfer_acct: '86cf22d5-3ca1-434f-be14-489032bf3fea'
  }

@aon
Copy link
Contributor Author

aon commented May 29, 2020

Right, that makes sense. I'll have to pull the existing transfer payees and use them for the transactions, something similar to what you did on import-ynab4. Thanks!

@aon aon closed this as completed May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants