-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
- Loading branch information
1 parent
42f4fcc
commit 2ffa7d4
Showing
6 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import base64 | ||
from pathlib import Path | ||
from typing import Literal | ||
|
||
PROFILE_TO_LOGO = { | ||
"BASIC": "public/img/fx-basic.png", | ||
"EN 16931": "public/img/fx-en16931.png", | ||
"EXTENDED": "public/img/fx-extended.png", | ||
} | ||
|
||
|
||
def get_einvoice_logo(profile: Literal["BASIC", "EN 16931", "EXTENDED"]) -> str | None: | ||
"""Return the logo for the given profile, as a base64 encoded data URL.""" | ||
if profile not in PROFILE_TO_LOGO: | ||
return None | ||
|
||
logo_path = Path(__file__).parent / PROFILE_TO_LOGO.get(profile) | ||
logo_bytes = logo_path.read_bytes() | ||
logo_base64 = base64.b64encode(logo_bytes).decode("utf-8") | ||
|
||
return f"data:image/png;base64,{logo_base64}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.