plaid/plaid-python

Incorrect AccountsBalanceGetRequestOptions datetime format

mse63 opened this issue · 2 comments

mse63 commented

min_last_updated_datetime is required for balance on ins_128026 (Capital One)

Attempting to supply this parameter with code like this:

request = AccountsBalanceGetRequest(access_token=access_token, options=AccountsBalanceGetRequestOptions(min_last_updated_datetime = datetime.now() - timedelta(hours = 24)))
response = client.accounts_balance_get(request)

fails due to receiving this response back:

HTTP response body: {
  "display_message": null,
  "documentation_url": "https://plaid.com/docs/?ref=error#invalid-request-errors",
  "error_code": "INVALID_FIELD",
  "error_message": "options.min_last_updated_datetime must be a valid RFC 3339 datetime string",
  "error_type": "INVALID_REQUEST",
  "request_id": "eUHp90BEiFybvse",
  "suggested_action": null
}

It is currently impossible to use the Balance API with Capital One with this library, because it does not convert datetimes into the right format, and it does not allow the user to give a string for the datetime when creating the AccountsBalanceGetRequestOptions object.

@mse63 This is likely caused due to a lack of timezone information in the input date-time object. The API requires that all input date-times contain timezone data: see the section here in the README for more info how to properly create dates and date-times for use with the python library. https://github.com/plaid/plaid-python#dates

Closing this issue as "works as intended" -- feel free to revive the thread or create a new issue if the suggestion above did not solve your problem.