billglover / starling

A Go client for the Starling Bank API
MIT License
6 stars 6 forks source link

Account balance: add support for v2 endpoint, adjust JSON response #43

Open shymega opened 2 years ago

shymega commented 2 years ago

I have changed the AccountBalance function to accept context, and a string parameter of the accountUid. This will be a breaking change to the library.

The Balance struct now contains new fields, including a nested struct for each field as per the JSON representation from the Starling Bank /balance v2 API endpoint.

Additionally, instead of using float64, we now use int, as Starling return the monetary amounts as an integer, and do not use floating-point numbers. I'm working to add further v2 API support to this library and the Savings Goals need updating as well to use int and the CurrencyAndAmount JSON object (this object may be represented into a common struct in the future for reusability!).

A future commit should be made to adjust the AccountBalance test and mock JSON response.

Signed-off-by: Dom Rodriguez shymega@shymega.org.uk

shymega commented 2 years ago

Ah.. yeah, CI tests won't pass until I fix tests. I'll work on it in the coming days.