add billing period
This commit is contained in:
@@ -23,13 +23,13 @@ enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
new_image = event.detail['new_image']
|
||||
now_ = now()
|
||||
data = user_layer.get_item(
|
||||
terms = user_layer.get_item(
|
||||
# Post-migration: uncomment the following line
|
||||
# KeyPair(new_image['org_id'], 'METADATA#BILLING_TERMS'),
|
||||
KeyPair(new_image['tenant_id'], 'metadata#billing_policy'),
|
||||
)
|
||||
|
||||
if not data:
|
||||
if not terms:
|
||||
return False
|
||||
|
||||
try:
|
||||
@@ -49,8 +49,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
'id': new_image['id'],
|
||||
'sk': 'METADATA#SUBSCRIPTION_COVERED',
|
||||
'org_id': new_image['tenant_id'],
|
||||
'billing_day': data['billing_day'],
|
||||
'created_at': now(),
|
||||
'billing_day': terms['billing_day'],
|
||||
'created_at': now_,
|
||||
},
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user