add billing

This commit is contained in:
2025-12-12 09:48:08 -03:00
parent 979ef22126
commit 3954b148fe
4 changed files with 18 additions and 3 deletions

View File

@@ -49,6 +49,7 @@ app.include_router(users.password, prefix='/users')
app.include_router(orders.router, prefix='/orders')
app.include_router(orgs.add, prefix='/orgs')
app.include_router(orgs.admins, prefix='/orgs')
app.include_router(orgs.billing, prefix='/orgs')
app.include_router(orgs.custom_pricing, prefix='/orgs')
app.include_router(orgs.scheduled, prefix='/orgs')
app.include_router(orgs.submission, prefix='/orgs')

View File

@@ -1,5 +1,6 @@
from .add import router as add
from .admins import router as admins
from .billing import router as billing
from .custom_pricing import router as custom_pricing
from .enrollments.scheduled import router as scheduled
from .enrollments.submission import router as submission
@@ -9,6 +10,7 @@ from .users.batch_jobs import router as batch_jobs
__all__ = [
'add',
'admins',
'billing',
'custom_pricing',
'scheduled',
'submission',

View File

@@ -163,18 +163,28 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
({ output, input_record, status }, index) =>
status === 'success' ? (
<li className="space-x-1" key={index}>
<span className=" text-green-500">
Agendado para{' '}
{new Intl.DateTimeFormat(
'pt-BR'
).format(
new Date(output.scheduled_for)
)}
</span>
<span>&mdash;</span>
<Abbr>{output.user.name}</Abbr>
<span>&mdash;</span>
<Abbr>{output.course.name}</Abbr>
</li>
) : (
<li className="space-x-1" key={index}>
<span className=" text-red-500">
Agendado anteriormente
</span>
<span>&mdash;</span>
<Abbr>{input_record.user.name}</Abbr>
<span>&mdash;</span>
<Abbr>{input_record.course.name}</Abbr>
<span className=" text-red-500 lowercase">
(Agendado anteriormente)
</span>
</li>
)
)}

View File

@@ -24,6 +24,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
*_, org_id = old_image['id'].split('#')
offset_days = old_image.get('dedup_window_offset_days')
billing_day = old_image.get('subscription_billing_day')
created_by = old_image.get('created_by')
enrollment = Enrollment(
course=old_image['course'],
user=old_image['user'],
@@ -43,6 +44,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
if billing_day
else None
),
created_by=created_by,
scheduled_at=datetime.fromisoformat(old_image['created_at']),
# Transfer the deduplication window if it exists
deduplication_window={'offset_days': offset_days} if offset_days else None,