diff --git a/automations/approve.ts b/automations/approve.ts index 1ea9b19..c1253d3 100644 --- a/automations/approve.ts +++ b/automations/approve.ts @@ -1,5 +1,5 @@ import { Automation } from "../automation" -import { Account, API, BudgetDetail, TransactionDetail, TransactionDetailClearedEnum } from "ynab" +import { Account, API, BudgetDetail, TransactionClearedStatus, TransactionDetail, TransactionFlagColor } from "ynab" export class ApproverAutomation extends Automation { @@ -25,7 +25,7 @@ export class ApproverAutomation extends Automation { private shouldApproveTransaction(transaction: TransactionDetail, options: { [key: string]: string }): boolean { return !transaction.approved && - (options.cleared === "yes" ? transaction.cleared !== TransactionDetailClearedEnum.Uncleared : true) && + (options.cleared === "yes" ? transaction.cleared !== TransactionClearedStatus.Uncleared : true) && (options.imported === "yes" ? transaction.import_id !== null : true) } } \ No newline at end of file diff --git a/automations/replicate.ts b/automations/replicate.ts index a59cf37..e32aec1 100644 --- a/automations/replicate.ts +++ b/automations/replicate.ts @@ -1,5 +1,5 @@ import {Automation} from "../automation" -import {Account, API, BudgetDetail, TransactionDetail, TransactionDetailClearedEnum, TransactionDetailFlagColorEnum} from "ynab" +import {Account, API, BudgetDetail, TransactionClearedStatus, TransactionDetail, TransactionFlagColor } from "ynab" export class ReplicateAutomation extends Automation { public get kind() { @@ -38,7 +38,7 @@ export class ReplicateAutomation extends Automation { approved: true, date: t.date, import_id: t.import_id, - flag_color: (options["to_flag"] ? options["to_flag"] : t.flag_color) as TransactionDetailFlagColorEnum, + flag_color: (options["to_flag"] ? options["to_flag"] : t.flag_color) as TransactionFlagColor, payee_name: t.payee_name, memo: t.memo, cleared: t.cleared, @@ -87,7 +87,7 @@ export class ReplicateAutomation extends Automation { return false } - if (options["cleared"] === "yes" && transaction.cleared === TransactionDetailClearedEnum.Uncleared) { + if (options["cleared"] === "yes" && transaction.cleared === TransactionClearedStatus.Uncleared) { return false } diff --git a/automations/stocks.ts b/automations/stocks.ts index 16e5710..c3ffcb5 100644 --- a/automations/stocks.ts +++ b/automations/stocks.ts @@ -1,7 +1,7 @@ import { Automation } from "../automation" import { getCurrencyData, getStockData } from "../utils/tiingo" -import { Account, API, BudgetDetail, SaveTransaction, SaveTransactionClearedEnum } from "ynab" +import { Account, API, BudgetDetail, SaveTransaction, TransactionClearedStatus } from "ynab" export class StockAutomation extends Automation { private stockChecker = new StockChecker() @@ -27,7 +27,7 @@ export class StockAutomation extends Automation { date: new Date().toISOString().split('T')[0], amount: shift, payee_name: options.payee_name || "Stock Market", - cleared: SaveTransactionClearedEnum.Cleared, + cleared: TransactionClearedStatus.Cleared, approved: true, memo: values.map(v => `${v.symbol}: ${v.nativeCurrency} ${v.nativeValue.toFixed(2)} @ ${v.nativeCurrency} ${v.nativePrice}`).join(', ') }