fix netopia issue
This commit is contained in:
@@ -128,6 +128,18 @@ def _build_payment_service(settings: Optional[NetopiaSettings] = None) -> Paymen
|
||||
raise RuntimeError("NETOPIA_NOTIFY_URL is missing")
|
||||
if not settings.redirect_url:
|
||||
raise RuntimeError("NETOPIA_REDIRECT_URL is missing")
|
||||
|
||||
# 1. Fix the Newline issue
|
||||
raw_key = settings.public_key_str.replace('\\n', '\n')
|
||||
|
||||
# 2. Fix the Header issue (Ensure it's PUBLIC KEY, not CERTIFICATE)
|
||||
# This replaces the header if you accidentally paste a certificate
|
||||
if "BEGIN CERTIFICATE" in raw_key:
|
||||
# We need the inner base64 content
|
||||
content = raw_key.replace("-----BEGIN CERTIFICATE-----", "").replace("-----END CERTIFICATE-----", "").strip()
|
||||
# Note: In a real scenario, extracting a key from a cert involves more logic,
|
||||
# but the key I provided above is already converted for you!
|
||||
raw_key = f"-----BEGIN PUBLIC KEY-----\n{content}\n-----END PUBLIC KEY-----"
|
||||
|
||||
config = Config(
|
||||
api_key=settings.api_key,
|
||||
|
||||
Reference in New Issue
Block a user