diff --git a/README.md b/README.md index d926f08..c8461c9 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,17 @@ Toda compra é relacionada a empresa responsável, que é definida como o `tenan O gestor responsável pela ação também é relacionado à compra, com base no email presente na compra. ```json -{"id": "10", "sk": "0", "user": {"id": "123", "name": "Sérgio"}, "tenant": "100"} -{"id": "10", "sk": "linked_entities#org", "org_id": "111"} -{"id": "10", "sk": "linked_entities#user", "user_id": "123"} -{"id": "10", "sk": "slots", "status": "PENDING", "mode": "BATCH"} -{"id": "10", "sk": "slots#enrollment#11", "status": "SUCCESS"} -{"id": "10", "sk": "slots#enrollment#12", "status": "ROLLBACK"} +{"id": "101", "sk": "0", "name": "EDUSEG", "cnpj": "15608435000190", "tenant": "100"} +{"id": "101", "sk": "author", "name": "Sérgio", "email": "sergio@somosbeta.com.br", "user_id": "123"} +{"id": "101", "sk": "slots", "status": "PENDING", "mode": "BATCH"} +{"id": "101", "sk": "slots#enrollment#9omWNKymwU5U4aeun6mWzZ", "status": "SUCCESS"} +{"id": "101", "sk": "slots#enrollment#12", "status": "ROLLBACK"} ``` Quando o responsável é uma pessoa física (CPF). ```json -{"id": "20", "sk": "0", "user": {"id": "123", "name": "Sérgio"}, "tenant": "self"} +{"id": "20", "sk": "0", "name": "Sérgio", "email": "sergio@somosbeta.com.br", "cpf": "07879819908", "tenant": "123"} {"id": "20", "sk": "slots", "status": "PENDING", "mode": "STANDALONE"} {"id": "20", "sk": "slots#enrollment#1123", "status": "SUCCESS"} ``` @@ -38,7 +37,15 @@ Quando o responsável é uma pessoa física (CPF). {"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "failed", "failed_at": "2025-04-06T11:07:32.762178-03:00"} {"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "canceled", "canceled_at": "2025-04-06T11:07:32.762178-03:00"} {"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "archived", "archived_at": "2025-04-06T11:07:32.762178-03:00"} -{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "expired", "expired": "2025-04-06T11:07:32.762178-03:00"} +{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "expired", "expired_at": "2025-04-06T11:07:32.762178-03:00"} +{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "linked_entities#order", "order_id": "101"} +``` + +### Vagas + +```json +{"id": "slots#org#100", "sk": "order#101#faa8a547-bb9b-4103-bd8c-8fbe96b4056f", "course": {"name": "pytest"}} +{"id": "slots#org#100", "sk": "order#101#afffbdde-fe58-4df7-b4d5-7553a571d32a", "course": {"name": "pytest"}} ``` ### Emails/eventos agendados @@ -80,14 +87,14 @@ Se um certificado for emitido para a matrícula, o período de proteção será ### Política de cancelamento -Apenas matrículas com `metadata#cancel_policy` podem ser canceladas. +Apenas matrículas com `cancel_policy` podem ser canceladas. -Se houver `metadata#parent_slot`, +Se houver `metadata#parent_slot`, deve ser devolvido. ```json {"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "0"} {"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "cancel_policy"} -{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "metadata#parent_slot", "slot": {"id": "slots#123", "sk": "1221#f7120daf-96d2-4639-b8f4-d736fd99e4ee"}} +{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "metadata#parent_slot", "slot": {"id": "slots#org#123", "sk": "1221#f7120daf-96d2-4639-b8f4-d736fd99e4ee"}} ``` # Cursos diff --git a/enrollments-events/app/config.py b/enrollments-events/app/config.py index 9aff6e7..bdf9d6d 100644 --- a/enrollments-events/app/config.py +++ b/enrollments-events/app/config.py @@ -13,4 +13,3 @@ else: SQLITE_DATABASE = 'app/courses_export_2025-06-18_110214.db' SQLITE_TABLE = 'courses' -OLD_ENROLLMENT_TABLE: str = os.getenv('OLD_ENROLLMENT_TABLE') # type: ignore diff --git a/http-api/app/rules/enrollment.py b/http-api/app/rules/enrollment.py index 30515d6..c09b9b1 100644 --- a/http-api/app/rules/enrollment.py +++ b/http-api/app/rules/enrollment.py @@ -263,13 +263,13 @@ def set_status_as_canceled( with persistence_layer.transact_writer() as transact: transact.update( key=KeyPair(id, '0'), - update_expr='SET #status = :canceled, updated_at = :update', + update_expr='SET #status = :canceled, updated_at = :updated_at', expr_attr_names={ '#status': 'status', }, expr_attr_values={ ':canceled': 'CANCELED', - ':update': now_, + ':updated_at': now_, }, ) transact.put( @@ -321,13 +321,13 @@ def set_status_as_canceled( # Post-migration: uncomment the following line # key=KeyPair(order_id, f'slots#enrollment#{enrollment_id}'), key=KeyPair(order_id, f'generated_items#{enrollment_id}'), - update_expr='SET #status = :status, update_date = :update', + update_expr='SET #status = :status, updated_at = :updated_at', expr_attr_names={ '#status': 'status', }, expr_attr_values={ ':status': 'ROLLBACK', - ':update': now_, + ':updated_at': now_, }, cond_expr='attribute_exists(sk)', table_name=ORDER_TABLE, diff --git a/order-events/app/config.py b/order-events/app/config.py index ad958ca..7b13358 100644 --- a/order-events/app/config.py +++ b/order-events/app/config.py @@ -2,4 +2,13 @@ import os USER_TABLE: str = os.getenv('USER_TABLE') # type: ignore ORDER_TABLE: str = os.getenv('ORDER_TABLE') # type: ignore +COURSE_TABLE: str = os.getenv('COURSE_TABLE') # type: ignore ENROLLMENT_TABLE: str = os.getenv('ENROLLMENT_TABLE') # type: ignore + +# Post-migration: remove the lines below +if os.getenv('AWS_LAMBDA_FUNCTION_NAME'): + SQLITE_DATABASE = 'courses_export_2025-06-18_110214.db' +else: + SQLITE_DATABASE = 'app/courses_export_2025-06-18_110214.db' + +SQLITE_TABLE = 'courses' diff --git a/order-events/app/courses_export_2025-06-18_110214.db b/order-events/app/courses_export_2025-06-18_110214.db new file mode 100644 index 0000000..97681f0 Binary files /dev/null and b/order-events/app/courses_export_2025-06-18_110214.db differ diff --git a/order-events/app/events/assign_tenant_cnpj.py b/order-events/app/events/assign_tenant_cnpj.py index d3fbe44..385c327 100644 --- a/order-events/app/events/assign_tenant_cnpj.py +++ b/order-events/app/events/assign_tenant_cnpj.py @@ -46,15 +46,24 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: with order_layer.transact_writer() as transact: transact.update( key=KeyPair(new_image['id'], '0'), - update_expr='SET metadata__tenant_id = :tenant_id, \ - metadata__related_ids = :related_ids, \ - update_date = :update_date', + update_expr='SET tenant = :tenant_id, \ + updated_at = :updated_at', expr_attr_values={ ':tenant_id': ids['org_id'], - ':related_ids': set(ids.values()), - ':update_date': now_, + ':updated_at': now_, }, ) + + transact.update( + key=KeyPair(new_image['id'], 'author'), + update_expr='SET user_id = :user_id, updated_at = :updated_at', + expr_attr_values={ + ':user_id': ids['user_id'], + ':updated_at': now_, + }, + ) + + # Post-migration: remove the following line transact.put( item={ 'id': new_image['id'], @@ -64,15 +73,4 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: } ) - for k, v in ids.items(): - kind = k.removesuffix('_id') - transact.put( - item={ - 'id': new_image['id'], - 'sk': f'related_ids#{kind}', # e.g. related_ids#user - 'create_date': now_, - k: v, - } - ) - return True diff --git a/order-events/app/events/remove_slots_on_canceled.py b/order-events/app/events/remove_slots_if_canceled.py similarity index 91% rename from order-events/app/events/remove_slots_on_canceled.py rename to order-events/app/events/remove_slots_if_canceled.py index 51823a4..22726e4 100644 --- a/order-events/app/events/remove_slots_on_canceled.py +++ b/order-events/app/events/remove_slots_if_canceled.py @@ -29,13 +29,17 @@ class TenantDoesNotExistError(Exception): def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: new_image = event.detail['new_image'] order_id = new_image['id'] + # Post-migration: remove the following line tenant_id = order_layer.collection.get_item( KeyPair( order_id, SortKey('metadata#tenant', path_spec='tenant_id'), ), exc_cls=TenantDoesNotExistError, - ) + ).removeprefix('ORG#') + + # Post-migration: uncomment the following line + # tenant_id = new_image['tenant'] result = enrollment_layer.collection.query( KeyPair( @@ -45,11 +49,12 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: order_id, ) ) + with enrollment_layer.batch_writer() as batch: for pair in result['items']: batch.delete_item( Key={ - # Post-migration: rename `vacancies` to `slots` + # Post-migration: rename `vacancies` to `slots#org` 'id': {'S': ComposeKey(pair['id'], prefix='vacancies')}, 'sk': {'S': pair['sk']}, } diff --git a/order-events/app/events/stopgap/patch_items.py b/order-events/app/events/stopgap/patch_items.py new file mode 100644 index 0000000..0b4203c --- /dev/null +++ b/order-events/app/events/stopgap/patch_items.py @@ -0,0 +1,73 @@ +import json +import sqlite3 + +from aws_lambda_powertools import Logger +from aws_lambda_powertools.utilities.data_classes import ( + EventBridgeEvent, + event_source, +) +from aws_lambda_powertools.utilities.typing import LambdaContext +from layercake.dateutils import now +from layercake.dynamodb import ( + DynamoDBPersistenceLayer, + KeyPair, +) +from sqlite_utils import Database + +from boto3clients import dynamodb_client +from config import ORDER_TABLE, SQLITE_DATABASE, SQLITE_TABLE + +sqlite3.register_converter('json', json.loads) + +logger = Logger(__name__) +order_layer = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client) + + +@event_source(data_class=EventBridgeEvent) +@logger.inject_lambda_context +def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: + new_image = event.detail['new_image'] + now_ = now() + items = new_image['items'] + new_items: list[dict] = [] + + for item in items: + course = _get_course(item['id']) + + new_items.append( + item + | ( + { + 'id': course.get('metadata__betaeducacao_id'), + } + if course + else {} + ) + ) + + order_layer.update_item( + key=KeyPair(new_image['id'], 'items'), + update_expr='SET #items = :items, updated_at = :updated_at', + expr_attr_names={'#items': 'items'}, + expr_attr_values={':items': new_items, ':updated_at': now_}, + ) + + return True + + +class CourseNotFoundError(Exception): + def __init__(self, *args): + super().__init__('Course not found') + + +def _get_course(course_id: str) -> dict: + with sqlite3.connect( + database=SQLITE_DATABASE, detect_types=sqlite3.PARSE_DECLTYPES + ) as conn: + db = Database(conn) + rows = db[SQLITE_TABLE].rows_where('id = ?', [course_id]) + + for row in rows: + return row['json'] + + raise CourseNotFoundError diff --git a/order-events/app/events/stopgap/remove_slots.py b/order-events/app/events/stopgap/remove_slots.py index b1e2c70..ae5207d 100644 --- a/order-events/app/events/stopgap/remove_slots.py +++ b/order-events/app/events/stopgap/remove_slots.py @@ -24,8 +24,8 @@ enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client) @event_source(data_class=EventBridgeEvent) @logger.inject_lambda_context def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: - """Remove slots if the Tenant has a `metadata#billing_policy` and - the order is positive.""" + """Remove slots if the tenant has a `metadata#billing_policy` and + the total is greater than zero.""" new_image = event.detail['new_image'] order_id = new_image['id'] data = order_layer.collection.get_items( diff --git a/order-events/app/events/stopgap/set_as_paid.py b/order-events/app/events/stopgap/set_as_paid.py index 1edb1c2..605ec67 100644 --- a/order-events/app/events/stopgap/set_as_paid.py +++ b/order-events/app/events/stopgap/set_as_paid.py @@ -20,26 +20,27 @@ order_layer = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client) @event_source(data_class=EventBridgeEvent) @logger.inject_lambda_context def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool: + """Set to `PAID` if the status is `PENDING` and the total is zero.""" new_image = event.detail['new_image'] now_ = now() with order_layer.transact_writer() as transact: transact.update( key=KeyPair(new_image['id'], '0'), - update_expr='SET #status = :status, update_date = :update_date', + update_expr='SET #status = :status, updated_at = :updated_at', expr_attr_names={ '#status': 'status', }, expr_attr_values={ ':status': 'PAID', - ':update_date': now_, + ':updated_at': now_, }, ) transact.put( item={ 'id': new_image['id'], - 'sk': 'paid_date', - 'create_date': now_, + 'sk': 'paid_at', + 'paid_at': now_, } ) diff --git a/order-events/template.yaml b/order-events/template.yaml index dad47bb..8aa5f29 100644 --- a/order-events/template.yaml +++ b/order-events/template.yaml @@ -11,6 +11,9 @@ Parameters: OrderTable: Type: String Default: betaeducacao-prod-orders + CourseTable: + Type: String + Default: saladeaula_courses Globals: Function: @@ -31,6 +34,7 @@ Globals: USER_TABLE: !Ref UserTable ORDER_TABLE: !Ref OrderTable ENROLLMENT_TABLE: !Ref EnrollmentTable + COURSE_TABLE: !Ref CourseTable Resources: EventLog: @@ -64,10 +68,10 @@ Resources: metadata__tenant_id: - exists: false - EventRemoveSlotsOnCanceledFunction: + EventRemoveSlotsIfCanceledFunction: Type: AWS::Serverless::Function Properties: - Handler: events.delete_slots_on_canceled.lambda_handler + Handler: events.delete_slots_if_canceled.lambda_handler LoggingConfig: LogGroup: !Ref EventLog Policies: @@ -89,6 +93,28 @@ Resources: - exists: true status: [CANCELED, EXPIRED] + EventPatchItemsFunction: + Type: AWS::Serverless::Function + Properties: + Handler: events.stopgap.patch_items.lambda_handler + LoggingConfig: + LogGroup: !Ref EventLog + Policies: + - DynamoDBWritePolicy: + TableName: !Ref OrderTable + - DynamoDBReadPolicy: + TableName: !Ref CourseTable + Events: + Event: + Type: EventBridgeRule + Properties: + Pattern: + resources: [!Ref OrderTable] + detail-type: [INSERT] + detail: + new_image: + sk: ["items"] + EventSetAsPaidFunction: Type: AWS::Serverless::Function Properties: diff --git a/order-events/tests/conftest.py b/order-events/tests/conftest.py index 0a35607..fc62764 100644 --- a/order-events/tests/conftest.py +++ b/order-events/tests/conftest.py @@ -18,6 +18,7 @@ def pytest_configure(): os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME os.environ['ENROLLMENT_TABLE'] = PYTEST_TABLE_NAME os.environ['ORDER_TABLE'] = PYTEST_TABLE_NAME + os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME @dataclass diff --git a/order-events/tests/events/stopgap/test_patch_items.py b/order-events/tests/events/stopgap/test_patch_items.py new file mode 100644 index 0000000..f8bce53 --- /dev/null +++ b/order-events/tests/events/stopgap/test_patch_items.py @@ -0,0 +1,35 @@ +from decimal import Decimal + +import app.events.stopgap.patch_items as app +from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair + +from ...conftest import LambdaContext + + +def test_patch_items( + dynamodb_seeds, + dynamodb_persistence_layer: DynamoDBPersistenceLayer, + lambda_context: LambdaContext, +): + event = { + 'detail': { + 'new_image': { + 'id': '9omWNKymwU5U4aeun6mWzZ', + 'items': [ + { + 'id': 'a810dd22-56c0-4d9b-8cd2-7e2ee9c45839', + 'name': 'pytest', + 'quantity': 17, + 'unit_price': Decimal('87.2'), + }, + ], + } + }, + } + assert app.lambda_handler(event, lambda_context) # type: ignore + + result = dynamodb_persistence_layer.collection.get_item( + KeyPair('9omWNKymwU5U4aeun6mWzZ', 'items') + ) + + assert result['items'][0]['id'] == 'dc1a0428-47bf-4db1-a5da-24be49c9fda6' diff --git a/order-events/tests/events/test_assign_tenant.py b/order-events/tests/events/test_assign_tenant.py deleted file mode 100644 index ccb36cb..0000000 --- a/order-events/tests/events/test_assign_tenant.py +++ /dev/null @@ -1,28 +0,0 @@ -from aws_lambda_powertools.utilities.typing import LambdaContext -from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey - -import events.assign_tenant_cnpj as app - - -def test_assign_tenant_cnpj( - dynamodb_seeds, - dynamodb_persistence_layer: DynamoDBPersistenceLayer, - lambda_context: LambdaContext, -): - event = { - 'detail': { - 'new_image': { - 'id': '9omWNKymwU5U4aeun6mWzZ', - 'cnpj': '15608435000190', - 'email': 'sergio@somosbeta.com.br', - } - } - } - - assert app.lambda_handler(event, lambda_context) # type: ignore - - result = dynamodb_persistence_layer.collection.query( - PartitionKey('9omWNKymwU5U4aeun6mWzZ') - ) - - assert 4 == len(result['items']) diff --git a/order-events/tests/events/test_assign_tenant_cnpj.py b/order-events/tests/events/test_assign_tenant_cnpj.py index bdbb2c9..93094bd 100644 --- a/order-events/tests/events/test_assign_tenant_cnpj.py +++ b/order-events/tests/events/test_assign_tenant_cnpj.py @@ -25,5 +25,4 @@ def test_assign_tenant_cnpj( PartitionKey('9omWNKymwU5U4aeun6mWzZ') ) - assert 4 == len(result['items']) - print(result['items']) + assert 3 == len(result['items']) diff --git a/order-events/tests/events/test_remove_slots_on_canceled.py b/order-events/tests/events/test_remove_slots_if_canceled.py similarity index 89% rename from order-events/tests/events/test_remove_slots_on_canceled.py rename to order-events/tests/events/test_remove_slots_if_canceled.py index ff921fe..709d200 100644 --- a/order-events/tests/events/test_remove_slots_on_canceled.py +++ b/order-events/tests/events/test_remove_slots_if_canceled.py @@ -1,10 +1,10 @@ from aws_lambda_powertools.utilities.typing import LambdaContext from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey -import events.remove_slots_on_canceled as app +import events.remove_slots_if_canceled as app -def test_delete_slots_on_canceled( +def test_remove_slots_if_canceled( dynamodb_seeds, dynamodb_persistence_layer: DynamoDBPersistenceLayer, lambda_context: LambdaContext, diff --git a/order-events/tests/seeds.jsonl b/order-events/tests/seeds.jsonl index 2f87c24..bd070f3 100644 --- a/order-events/tests/seeds.jsonl +++ b/order-events/tests/seeds.jsonl @@ -1,10 +1,12 @@ {"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#payment_policy"}, "due_days": {"N": "90"}} {"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#billing_policy"}, "billing_day": {"N": "1"}, "payment_method": {"S": "PIX"}} {"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "0"}, "total": {"N": "398"}, "status": {"S": "PENDING"}} -{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "metadata#tenant"}, "tenant_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}} +{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "metadata#tenant"}, "tenant_id": {"S": "ORG#cJtK9SsnJhKPyxESe7g3DG"}} {"id": {"S": "cnpj"}, "sk": {"S": "15608435000190"}, "user_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}} {"id": {"S": "email"}, "sk": {"S": "sergio@somosbeta.com.br"}, "user_id": {"S": "5OxmMjL-ujoR5IMGegQz"}} {"id": {"S": "5OxmMjL-ujoR5IMGegQz"}, "sk": {"S": "0"}, "name": {"S": "Sérgio R Siqueira"}} {"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#1"}} {"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#2"}} -{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#3"}} \ No newline at end of file +{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#3"}} +{"id": {"S": "6a60d026-d383-4707-b093-b6eddea1a24e"}, "sk": {"S": "items"},"items": {"L": [{"M": {"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "name": {"S": "pytest"},"quantity": {"N": "1"},"unit_price": {"N": "109"}}}]}} +{"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "sk": {"S": "metadata#betaeducacao"},"course_id": {"S": "dc1a0428-47bf-4db1-a5da-24be49c9fda6"},"create_date": {"S": "2025-06-05T12:13:54.371416+00:00"}} \ No newline at end of file diff --git a/order-events/uv.lock b/order-events/uv.lock index e5424f7..7a12739 100644 --- a/order-events/uv.lock +++ b/order-events/uv.lock @@ -484,6 +484,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050, upload-time = "2025-03-19T20:10:01.071Z" }, ] +[[package]] +name = "jinja2" +version = "3.1.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markupsafe" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, +] + [[package]] name = "jmespath" version = "1.0.1" @@ -519,7 +531,7 @@ wheels = [ [[package]] name = "layercake" -version = "0.6.11" +version = "0.6.12" source = { directory = "../layercake" } dependencies = [ { name = "arnparse" }, @@ -528,12 +540,14 @@ dependencies = [ { name = "elasticsearch-dsl" }, { name = "ftfy" }, { name = "glom" }, + { name = "jinja2" }, { name = "meilisearch" }, { name = "orjson" }, { name = "pycpfcnpj" }, { name = "pydantic", extra = ["email"] }, { name = "pydantic-extra-types" }, { name = "pytz" }, + { name = "qrcode" }, { name = "requests" }, { name = "smart-open", extra = ["s3"] }, { name = "sqlite-utils" }, @@ -548,12 +562,14 @@ requires-dist = [ { name = "elasticsearch-dsl", specifier = ">=8.17.1" }, { name = "ftfy", specifier = ">=6.3.1" }, { name = "glom", specifier = ">=24.11.0" }, + { name = "jinja2", specifier = ">=3.1.6" }, { name = "meilisearch", specifier = ">=0.34.0" }, { name = "orjson", specifier = ">=3.10.15" }, { name = "pycpfcnpj", specifier = ">=1.8" }, { name = "pydantic", extras = ["email"], specifier = ">=2.10.6" }, { name = "pydantic-extra-types", specifier = ">=2.10.3" }, { name = "pytz", specifier = ">=2025.1" }, + { name = "qrcode", specifier = ">=8.2" }, { name = "requests", specifier = ">=2.32.3" }, { name = "smart-open", extras = ["s3"], specifier = ">=7.1.0" }, { name = "sqlite-utils", specifier = ">=3.38" }, @@ -570,6 +586,34 @@ dev = [ { name = "ruff", specifier = ">=0.11.1" }, ] +[[package]] +name = "markupsafe" +version = "3.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537, upload-time = "2024-10-18T15:21:54.129Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/83/0e/67eb10a7ecc77a0c2bbe2b0235765b98d164d81600746914bebada795e97/MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd", size = 14274, upload-time = "2024-10-18T15:21:24.577Z" }, + { url = "https://files.pythonhosted.org/packages/2b/6d/9409f3684d3335375d04e5f05744dfe7e9f120062c9857df4ab490a1031a/MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430", size = 12352, upload-time = "2024-10-18T15:21:25.382Z" }, + { url = "https://files.pythonhosted.org/packages/d2/f5/6eadfcd3885ea85fe2a7c128315cc1bb7241e1987443d78c8fe712d03091/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094", size = 24122, upload-time = "2024-10-18T15:21:26.199Z" }, + { url = "https://files.pythonhosted.org/packages/0c/91/96cf928db8236f1bfab6ce15ad070dfdd02ed88261c2afafd4b43575e9e9/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396", size = 23085, upload-time = "2024-10-18T15:21:27.029Z" }, + { url = "https://files.pythonhosted.org/packages/c2/cf/c9d56af24d56ea04daae7ac0940232d31d5a8354f2b457c6d856b2057d69/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79", size = 22978, upload-time = "2024-10-18T15:21:27.846Z" }, + { url = "https://files.pythonhosted.org/packages/2a/9f/8619835cd6a711d6272d62abb78c033bda638fdc54c4e7f4272cf1c0962b/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a", size = 24208, upload-time = "2024-10-18T15:21:28.744Z" }, + { url = "https://files.pythonhosted.org/packages/f9/bf/176950a1792b2cd2102b8ffeb5133e1ed984547b75db47c25a67d3359f77/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca", size = 23357, upload-time = "2024-10-18T15:21:29.545Z" }, + { url = "https://files.pythonhosted.org/packages/ce/4f/9a02c1d335caabe5c4efb90e1b6e8ee944aa245c1aaaab8e8a618987d816/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c", size = 23344, upload-time = "2024-10-18T15:21:30.366Z" }, + { url = "https://files.pythonhosted.org/packages/ee/55/c271b57db36f748f0e04a759ace9f8f759ccf22b4960c270c78a394f58be/MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1", size = 15101, upload-time = "2024-10-18T15:21:31.207Z" }, + { url = "https://files.pythonhosted.org/packages/29/88/07df22d2dd4df40aba9f3e402e6dc1b8ee86297dddbad4872bd5e7b0094f/MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f", size = 15603, upload-time = "2024-10-18T15:21:32.032Z" }, + { url = "https://files.pythonhosted.org/packages/62/6a/8b89d24db2d32d433dffcd6a8779159da109842434f1dd2f6e71f32f738c/MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c", size = 14510, upload-time = "2024-10-18T15:21:33.625Z" }, + { url = "https://files.pythonhosted.org/packages/7a/06/a10f955f70a2e5a9bf78d11a161029d278eeacbd35ef806c3fd17b13060d/MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb", size = 12486, upload-time = "2024-10-18T15:21:34.611Z" }, + { url = "https://files.pythonhosted.org/packages/34/cf/65d4a571869a1a9078198ca28f39fba5fbb910f952f9dbc5220afff9f5e6/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c", size = 25480, upload-time = "2024-10-18T15:21:35.398Z" }, + { url = "https://files.pythonhosted.org/packages/0c/e3/90e9651924c430b885468b56b3d597cabf6d72be4b24a0acd1fa0e12af67/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d", size = 23914, upload-time = "2024-10-18T15:21:36.231Z" }, + { url = "https://files.pythonhosted.org/packages/66/8c/6c7cf61f95d63bb866db39085150df1f2a5bd3335298f14a66b48e92659c/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe", size = 23796, upload-time = "2024-10-18T15:21:37.073Z" }, + { url = "https://files.pythonhosted.org/packages/bb/35/cbe9238ec3f47ac9a7c8b3df7a808e7cb50fe149dc7039f5f454b3fba218/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5", size = 25473, upload-time = "2024-10-18T15:21:37.932Z" }, + { url = "https://files.pythonhosted.org/packages/e6/32/7621a4382488aa283cc05e8984a9c219abad3bca087be9ec77e89939ded9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a", size = 24114, upload-time = "2024-10-18T15:21:39.799Z" }, + { url = "https://files.pythonhosted.org/packages/0d/80/0985960e4b89922cb5a0bac0ed39c5b96cbc1a536a99f30e8c220a996ed9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9", size = 24098, upload-time = "2024-10-18T15:21:40.813Z" }, + { url = "https://files.pythonhosted.org/packages/82/78/fedb03c7d5380df2427038ec8d973587e90561b2d90cd472ce9254cf348b/MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6", size = 15208, upload-time = "2024-10-18T15:21:41.814Z" }, + { url = "https://files.pythonhosted.org/packages/4f/65/6079a46068dfceaeabb5dcad6d674f5f5c61a6fa5673746f42a9f4c233b3/MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f", size = 15739, upload-time = "2024-10-18T15:21:42.784Z" }, +] + [[package]] name = "meilisearch" version = "0.34.1" @@ -584,7 +628,7 @@ wheels = [ ] [[package]] -name = "order-management" +name = "orders-events" version = "0.1.0" source = { virtual = "." } dependencies = [ @@ -859,6 +903,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/81/c4/34e93fe5f5429d7570ec1fa436f1986fb1f00c3e0f43a589fe2bbcd22c3f/pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00", size = 509225, upload-time = "2025-03-25T02:24:58.468Z" }, ] +[[package]] +name = "qrcode" +version = "8.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8f/b2/7fc2931bfae0af02d5f53b174e9cf701adbb35f39d69c2af63d4a39f81a9/qrcode-8.2.tar.gz", hash = "sha256:35c3f2a4172b33136ab9f6b3ef1c00260dd2f66f858f24d88418a015f446506c", size = 43317, upload-time = "2025-05-01T15:44:24.726Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dd/b8/d2d6d731733f51684bbf76bf34dab3b70a9148e8f2cef2bb544fccec681a/qrcode-8.2-py3-none-any.whl", hash = "sha256:16e64e0716c14960108e85d853062c9e8bba5ca8252c0b4d0231b9df4060ff4f", size = 45986, upload-time = "2025-05-01T15:44:22.781Z" }, +] + [[package]] name = "requests" version = "2.32.3"