Add page_config support to SumUp create_checkout
Accept optional page_config parameter to use per-page SumUp merchant code and API key instead of global config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,8 +42,16 @@ async def create_checkout(
|
|||||||
redirect_url: str,
|
redirect_url: str,
|
||||||
webhook_url: str | None = None,
|
webhook_url: str | None = None,
|
||||||
description: str | None = None,
|
description: str | None = None,
|
||||||
|
page_config: Any | None = None,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
settings = _sumup_settings()
|
settings = _sumup_settings()
|
||||||
|
|
||||||
|
# Per-page SumUp credentials override globals
|
||||||
|
if page_config and getattr(page_config, "sumup_api_key", None):
|
||||||
|
settings["api_key"] = page_config.sumup_api_key
|
||||||
|
if page_config and getattr(page_config, "sumup_merchant_code", None):
|
||||||
|
settings["merchant_code"] = page_config.sumup_merchant_code
|
||||||
|
|
||||||
# Use stored reference if present, otherwise build it
|
# Use stored reference if present, otherwise build it
|
||||||
checkout_reference = order.sumup_reference or f"{settings['checkout_reference_prefix']}{order.id}"
|
checkout_reference = order.sumup_reference or f"{settings['checkout_reference_prefix']}{order.id}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user