Skip to content

Commit

Permalink
[FIX] account_statement_import_online_gocardless: Bugs after the refa…
Browse files Browse the repository at this point in the history
…ctoring

After the refactoring in OCA#686, this doesn't work anymore:

- The API URL didn't end in "/", so the join_url doesn't do correctly
  the join.
- There's an infinite loop when getting the headers for getting the
  token.
  • Loading branch information
pedrobaeza committed Aug 9, 2024
1 parent 747c454 commit 770a65a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF

GOCARDLESS_API = "https://bankaccountdata.gocardless.com/api/v2"
GOCARDLESS_API = "https://bankaccountdata.gocardless.com/api/v2/"
REQUESTS_TIMEOUT = 60


Expand Down Expand Up @@ -57,7 +57,9 @@ def _gocardless_get_headers(self, basic=False):
headers["Authorization"] = f"Bearer {self._gocardless_get_token()}"
return headers

def _gocardless_request(self, endpoint, request_type="get", params=None, data=None):
def _gocardless_request(
self, endpoint, request_type="get", params=None, data=None, basic_auth=False
):
content = {}
url = url_join(GOCARDLESS_API, endpoint)
response = getattr(requests, request_type)(
Expand Down Expand Up @@ -93,6 +95,7 @@ def _gocardless_get_token(self):
data=json.dumps(
{"secret_id": self.username, "secret_key": self.password}
),
basic_auth=True,
)
expiration_date = now + relativedelta(seconds=data.get("access_expires", 0))
vals = {
Expand Down

0 comments on commit 770a65a

Please sign in to comment.