Skip to content

Commit

Permalink
Merge PR #660 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by dhongu
  • Loading branch information
OCA-git-bot committed Oct 19, 2023
2 parents d49abb2 + acf667a commit d17f224
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions l10n_ro_account_anaf_sync/controllers/anaf_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Token Revocation Endpoint https://logincert.anaf.ro/anaf-oauth2/v1/revoke


def redirect(self, location, code=303, local=True):
def redirect(location, code=303, local=True):
# compatibility, Werkzeug support URL as location
if isinstance(location, urls.URL):
location = location.to_url()
Expand Down Expand Up @@ -72,11 +72,10 @@ def redirect_anaf(self, anaf_config_id, **kw):
"last_request_datetime": now,
}
)
anaf_oauth_url = anaf_config.anaf_oauth_url
client_id = anaf_config.client_id
odoo_oauth_url = user.get_base_url() + "/l10n_ro_account_anaf_sync/anaf_oauth"
redirect_url = "%s?response_type=code&client_id=%s&redirect_uri=%s" % (
anaf_oauth_url,
anaf_config.anaf_oauth_url + "/authorize",
client_id,
odoo_oauth_url,
)
Expand Down Expand Up @@ -136,18 +135,12 @@ def get_anaf_oauth_code(self, **kw):
redirect_uri = user.get_base_url() + "/l10n_ro_account_anaf_sync/anaf_oauth"
data = {
"grant_type": "authorization_code",
"client_id": "%s",
"client_secret": "%s",
"code": "%s",
"access_key": "%s",
"redirect_uri": "%s",
} % (
anaf_config.client_id,
anaf_config.client_secret,
code,
code,
redirect_uri,
)
"client_id": "{}".format(anaf_config.client_id),
"client_secret": "{}".format(anaf_config.client_secret),
"code": "{}".format(code),
"access_key": "{}".format(code),
"redirect_uri": "{}".format(redirect_uri),
}
response = requests.post(
anaf_config.anaf_oauth_url + "/token",
data=data,
Expand Down

0 comments on commit d17f224

Please sign in to comment.