abstract providers behind a common interface
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -56,7 +56,6 @@ func (c *Client) SetAccountBalance(accountID string, balance int) error {
|
||||
|
||||
balanceDelta := balance - ynabAccount.Data.Account.Balance
|
||||
balanceDelta += ynabTransactionAmount // Take into account the existing transaction
|
||||
|
||||
if balanceDelta == 0 {
|
||||
return nil // If balanceDelta is 0 do not create a transaction i.e. market is closed today
|
||||
}
|
||||
@ -71,6 +70,7 @@ func (c *Client) SetAccountBalance(accountID string, balance int) error {
|
||||
|
||||
} else {
|
||||
// there is an existing transaction - so update the existing one
|
||||
|
||||
err = c.updateTodayYNABCapitalGainsTransaction(accountID, ynabTransactionID, balanceDelta)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update YNAB capital gains transaction for account ID '%s': %v", accountID, err)
|
||||
|
@ -117,7 +117,6 @@ func (c *Client) processResponse(res *http.Response, out interface{}) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to unmarshal response body: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -138,6 +137,5 @@ func NewClient(budgetID, bearerToken string) (*Client, error) {
|
||||
httpClient: client,
|
||||
transport: transport,
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ func (c *Client) GetAccountTransactions(accountID string, sinceDate time.Time) (
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get account transactions: %v", err)
|
||||
}
|
||||
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
@ -82,7 +81,6 @@ func (c *Client) getTodayYnabCapitalGainsTransaction(accountID string) (string,
|
||||
}
|
||||
return transaction.ID, transaction.Amount, nil
|
||||
}
|
||||
|
||||
return "", 0, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user