chore: small stuff

This commit is contained in:
Livio Bieri 2023-11-17 13:29:16 +01:00 committed by Christian Cueni
parent b1439122e1
commit dc1eaad412
2 changed files with 8 additions and 8 deletions

View File

@ -650,11 +650,11 @@ SENDGRID_API_KEY = env("IT_SENDGRID_API_KEY", default="")
# Datatrans (payment)
# See https://admin.sandbox.datatrans.com/MerchSecurAdmin.jsp)
DATATRANS_HMAC_KEY = env("DATATRANS_HMAC_KEY")
DATATRANS_HMAC_KEY = env("DATATRANS_HMAC_KEY", default="")
# See https://admin.sandbox.datatrans.com/MenuDispatch.jsp?main=1&sub=4)
# => echo -n "Username:Password" | base64
DATATRANS_BASIC_AUTH_KEY = env("DATATRANS_BASIC_AUTH_KEY")
DATATRANS_BASIC_AUTH_KEY = env("DATATRANS_BASIC_AUTH_KEY", default="")
if APP_ENVIRONMENT.startswith("prod"):
DATATRANS_API_ENDPOINT = "https://api.datatrans.com"

View File

@ -114,9 +114,11 @@ def checkout_vv(request):
# already initialized -> redirect to payment page again
if checkout := checkouts.filter(state=CheckoutState.INITIALIZED).first():
return JsonResponse(
{"next_step_url": get_payment_url(transaction_id=checkout.transaction_id)}
)
# FIXME: Ask datatrans how they advice to handle this case:
# - 1. Why is the payment url not reusable? Calling the payment url again
# with the same transaction id results in a blank page.
# - 2. After 30 minutes, the transaction is fails but our webhook is not called?
return JsonResponse({"next_step_url": get_payment_url(checkout.transaction_id)})
# not yet initialized at all, or canceled/failed
base_redirect_url = request.data["redirect_url"]
@ -143,9 +145,7 @@ def checkout_vv(request):
**request.data["address"],
)
return JsonResponse(
{"next_step_url": get_payment_url(transaction_id=transaction_id)}
)
return JsonResponse({"next_step_url": get_payment_url(transaction_id)})
def webhook_url(base_url: str) -> str: