Add `ABACUS_` env var values for prod
This commit is contained in:
parent
b9b66a502e
commit
6de5660f31
Binary file not shown.
|
|
@ -685,9 +685,9 @@ else:
|
|||
|
||||
# default settings for python sftpserver test-server
|
||||
ABACUS_EXPORT_SFTP_HOST = env("ABACUS_EXPORT_SFTP_HOST", default="localhost")
|
||||
ABACUS_EXPORT_SFTP_PASSWORD = env("ABACUS_EXPORT_SFTP_PASSWORD", default="admin")
|
||||
ABACUS_EXPORT_SFTP_PORT = env("ABACUS_EXPORT_SFTP_PORT", default="3373")
|
||||
ABACUS_EXPORT_SFTP_USERNAME = env("ABACUS_EXPORT_SFTP_USERNAME", default="admin")
|
||||
ABACUS_EXPORT_SFTP_PASSWORD = env("ABACUS_EXPORT_SFTP_PASSWORD", default="admin")
|
||||
|
||||
|
||||
# S3 BUCKET CONFIGURATION
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime
|
||||
|
||||
import djclick as click
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from django.utils import timezone
|
||||
|
||||
from vbv_lernwelt.assignment.models import Assignment, AssignmentCompletion
|
||||
|
|
@ -14,6 +15,7 @@ from vbv_lernwelt.core.constants import (
|
|||
TEST_STUDENT2_VV_AND_VV_MENTOR_USER_ID,
|
||||
TEST_STUDENT3_USER_ID,
|
||||
TEST_TRAINER1_USER_ID,
|
||||
TEST_USER_EMPTY_ID,
|
||||
)
|
||||
from vbv_lernwelt.core.models import Organisation, User
|
||||
from vbv_lernwelt.course.consts import (
|
||||
|
|
@ -48,6 +50,7 @@ from vbv_lernwelt.self_evaluation_feedback.models import (
|
|||
CourseCompletionFeedback,
|
||||
SelfEvaluationFeedback,
|
||||
)
|
||||
from vbv_lernwelt.shop.models import CheckoutInformation
|
||||
|
||||
|
||||
@click.command()
|
||||
|
|
@ -142,6 +145,18 @@ def command(
|
|||
User.objects.all().update(language="de")
|
||||
User.objects.all().update(additional_json_data={})
|
||||
|
||||
CheckoutInformation.objects.filter(user_id=TEST_USER_EMPTY_ID).delete()
|
||||
User.objects.filter(id=TEST_USER_EMPTY_ID).delete()
|
||||
user, _ = User.objects.get_or_create(
|
||||
id=TEST_USER_EMPTY_ID,
|
||||
username="empty@example.com",
|
||||
email="empty@example.com",
|
||||
language="de",
|
||||
first_name="Flasche",
|
||||
last_name="Leer",
|
||||
password=make_password("test"),
|
||||
)
|
||||
|
||||
if create_assignment_completion or create_assignment_evaluation:
|
||||
print("create assignment completion data for test course")
|
||||
create_test_assignment_submitted_data(
|
||||
|
|
|
|||
|
|
@ -55,31 +55,87 @@ def fake_datatrans_pay_view(request, api_url=""):
|
|||
)
|
||||
print(response)
|
||||
|
||||
if api_url.startswith("/v1/start/") and request.method == "GET":
|
||||
if api_url.startswith("/v1/start/"):
|
||||
transaction_id = api_url.split("/")[-1]
|
||||
transaction_user = User.objects.filter(
|
||||
additional_json_data__datatrans_transaction_payload__refno=transaction_id
|
||||
).first()
|
||||
|
||||
redirect_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["redirect"]["successUrl"]
|
||||
if transaction_user is None:
|
||||
return HttpResponse(
|
||||
content=f"""
|
||||
<h1>Fake Datatrans Payment</h1>
|
||||
<p>No active transaction found for {transaction_id}</p>
|
||||
""",
|
||||
status=404,
|
||||
)
|
||||
|
||||
# start new thread which will call webhook after 2 seconds
|
||||
webhook_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["webhook"]["url"]
|
||||
thread = threading.Thread(
|
||||
target=call_transaction_complete_webhook,
|
||||
args=(
|
||||
webhook_url,
|
||||
transaction_id,
|
||||
),
|
||||
)
|
||||
thread.start()
|
||||
if request.method == "GET":
|
||||
return HttpResponse(
|
||||
content=f"""
|
||||
<h1>Fake Datatrans Payment</h1>
|
||||
<form action="{request.build_absolute_uri()}" method="post">
|
||||
<fieldset>
|
||||
<legend>Datatrans payment result status</legend>
|
||||
<div>
|
||||
<input type="radio" name="payment" value="settled" checked/>
|
||||
<label>settled</label>
|
||||
|
||||
# redirect to url
|
||||
return redirect(redirect_url + f"?datatransTrxId={transaction_id}")
|
||||
<input type="radio" name="payment" value="cancelled" />
|
||||
<label>cancelled</label>
|
||||
|
||||
<input type="radio" name="payment" value="failed" />
|
||||
<label>failed</label>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit">
|
||||
Pay with selected Status
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
"""
|
||||
)
|
||||
|
||||
elif request.method == "POST":
|
||||
payment_status = request.POST.get("payment", "settled")
|
||||
|
||||
if payment_status == "settled":
|
||||
success_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["redirect"]["successUrl"]
|
||||
|
||||
# start new thread which will call webhook after 2 seconds
|
||||
webhook_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["webhook"]["url"]
|
||||
thread = threading.Thread(
|
||||
target=call_transaction_complete_webhook,
|
||||
args=(
|
||||
webhook_url,
|
||||
transaction_id,
|
||||
),
|
||||
)
|
||||
thread.start()
|
||||
|
||||
# redirect to url
|
||||
return redirect(success_url + f"?datatransTrxId={transaction_id}")
|
||||
|
||||
if payment_status == "cancelled":
|
||||
cancel_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["redirect"]["cancelUrl"]
|
||||
|
||||
# redirect to url
|
||||
return redirect(cancel_url + f"?datatransTrxId={transaction_id}")
|
||||
|
||||
if payment_status == "failed":
|
||||
error_url = transaction_user.additional_json_data[
|
||||
"datatrans_transaction_payload"
|
||||
]["redirect"]["errorUrl"]
|
||||
|
||||
# redirect to url
|
||||
return redirect(error_url + f"?datatransTrxId={transaction_id}")
|
||||
|
||||
return HttpResponse(
|
||||
content="unknown api url", content_type="application/json", status=400
|
||||
|
|
|
|||
Loading…
Reference in New Issue