add enrollments to order
This commit is contained in:
@@ -11,7 +11,7 @@ from pydantic import FutureDatetime
|
||||
from api_gateway import JSONResponse
|
||||
from boto3clients import dynamodb_client
|
||||
from config import ENROLLMENT_TABLE
|
||||
from middlewares.authentication_middleware import User as Authenticated
|
||||
from routes.orgs import billing
|
||||
|
||||
from ...enrollments.enroll import Context, Enrollment, Org, Subscription, enroll_now
|
||||
|
||||
@@ -74,24 +74,20 @@ def proceed(
|
||||
exc_cls=ScheduledNotFoundError,
|
||||
)
|
||||
billing_day = scheduled.get('subscription_billing_day')
|
||||
ctx = cast(
|
||||
Context,
|
||||
{
|
||||
'created_by': router.context['user'],
|
||||
'org': Org(id=org_id, name=scheduled['org_name']),
|
||||
**(
|
||||
{'subscription': Subscription(billing_day=billing_day)}
|
||||
if billing_day
|
||||
else {}
|
||||
),
|
||||
},
|
||||
)
|
||||
ctx: Context = {
|
||||
'created_by': router.context['user'],
|
||||
'org': Org(id=org_id, name=scheduled['org_name']),
|
||||
}
|
||||
|
||||
if billing_day:
|
||||
ctx['subscription'] = Subscription(billing_day=billing_day)
|
||||
|
||||
try:
|
||||
enrollment = enroll_now(
|
||||
Enrollment(
|
||||
user=scheduled['user'],
|
||||
course=scheduled['course'],
|
||||
seat=scheduled.get('seat'),
|
||||
),
|
||||
ctx,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user