This commit is contained in:
parent
77e467071b
commit
4ff4c62daf
@ -70,7 +70,7 @@ func (c *Client) GetAccountTransactions(accountID string, sinceDate time.Time) (
|
|||||||
// Accepts a YNAB account ID and returns the transaction ID, amount and an error for the
|
// Accepts a YNAB account ID and returns the transaction ID, amount and an error for the
|
||||||
// the first transaction found with Payee Name "Capital Gains or Losses"
|
// the first transaction found with Payee Name "Capital Gains or Losses"
|
||||||
func (c *Client) getTodayYnabCapitalGainsTransaction(accountID string) (string, int, error) {
|
func (c *Client) getTodayYnabCapitalGainsTransaction(accountID string) (string, int, error) {
|
||||||
ynabTransactions, err := c.GetAccountTransactions(accountID, time.Now())
|
ynabTransactions, err := c.GetAccountTransactions(accountID, time.Now().In(c.loc))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, fmt.Errorf("failed to get ynab transactions: %v", err)
|
return "", 0, fmt.Errorf("failed to get ynab transactions: %v", err)
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ func (c *Client) createTodayYNABCapitalGainsTransaction(accountID string, amount
|
|||||||
transaction := TransactionRequest{}
|
transaction := TransactionRequest{}
|
||||||
transaction.Transaction.AccountID = accountID
|
transaction.Transaction.AccountID = accountID
|
||||||
transaction.Transaction.Amount = amount
|
transaction.Transaction.Amount = amount
|
||||||
transaction.Transaction.Date = time.Now().Format("2006-01-02")
|
transaction.Transaction.Date = time.Now().In(c.loc).Format("2006-01-02")
|
||||||
transaction.Transaction.Cleared = "cleared"
|
transaction.Transaction.Cleared = "cleared"
|
||||||
transaction.Transaction.Approved = true
|
transaction.Transaction.Approved = true
|
||||||
transaction.Transaction.PayeeName = "Capital Gains or Losses"
|
transaction.Transaction.PayeeName = "Capital Gains or Losses"
|
||||||
@ -110,7 +110,7 @@ func (c *Client) updateTodayYNABCapitalGainsTransaction(accountID string, transa
|
|||||||
transaction.Transaction.AccountID = accountID
|
transaction.Transaction.AccountID = accountID
|
||||||
transaction.Transaction.ID = transactionID
|
transaction.Transaction.ID = transactionID
|
||||||
transaction.Transaction.Amount = amount
|
transaction.Transaction.Amount = amount
|
||||||
transaction.Transaction.Date = time.Now().Format("2006-01-02")
|
transaction.Transaction.Date = time.Now().In(c.loc).Format("2006-01-02")
|
||||||
transaction.Transaction.Cleared = "cleared"
|
transaction.Transaction.Cleared = "cleared"
|
||||||
transaction.Transaction.Approved = true
|
transaction.Transaction.Approved = true
|
||||||
transaction.Transaction.PayeeName = "Capital Gains or Losses"
|
transaction.Transaction.PayeeName = "Capital Gains or Losses"
|
||||||
|
Loading…
Reference in New Issue
Block a user