chore: small stuff
This commit is contained in:
parent
b1439122e1
commit
dc1eaad412
|
|
@ -650,11 +650,11 @@ SENDGRID_API_KEY = env("IT_SENDGRID_API_KEY", default="")
|
||||||
|
|
||||||
# Datatrans (payment)
|
# Datatrans (payment)
|
||||||
# See https://admin.sandbox.datatrans.com/MerchSecurAdmin.jsp)
|
# 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)
|
# See https://admin.sandbox.datatrans.com/MenuDispatch.jsp?main=1&sub=4)
|
||||||
# => echo -n "Username:Password" | base64
|
# => 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"):
|
if APP_ENVIRONMENT.startswith("prod"):
|
||||||
DATATRANS_API_ENDPOINT = "https://api.datatrans.com"
|
DATATRANS_API_ENDPOINT = "https://api.datatrans.com"
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,11 @@ def checkout_vv(request):
|
||||||
|
|
||||||
# already initialized -> redirect to payment page again
|
# already initialized -> redirect to payment page again
|
||||||
if checkout := checkouts.filter(state=CheckoutState.INITIALIZED).first():
|
if checkout := checkouts.filter(state=CheckoutState.INITIALIZED).first():
|
||||||
return JsonResponse(
|
# FIXME: Ask datatrans how they advice to handle this case:
|
||||||
{"next_step_url": get_payment_url(transaction_id=checkout.transaction_id)}
|
# - 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
|
# not yet initialized at all, or canceled/failed
|
||||||
base_redirect_url = request.data["redirect_url"]
|
base_redirect_url = request.data["redirect_url"]
|
||||||
|
|
@ -143,9 +145,7 @@ def checkout_vv(request):
|
||||||
**request.data["address"],
|
**request.data["address"],
|
||||||
)
|
)
|
||||||
|
|
||||||
return JsonResponse(
|
return JsonResponse({"next_step_url": get_payment_url(transaction_id)})
|
||||||
{"next_step_url": get_payment_url(transaction_id=transaction_id)}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def webhook_url(base_url: str) -> str:
|
def webhook_url(base_url: str) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue