ai-lls-lib 1.4.0rc2__tar.gz → 1.4.0rc3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/PKG-INFO +1 -1
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/pyproject.toml +1 -1
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/__init__.py +1 -1
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/payment/credit_manager.py +8 -15
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/README.md +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/auth/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/auth/context_parser.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/__main__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/aws_client.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/admin.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/cache.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/stripe.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/test_stack.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/commands/verify.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/cli/env_loader.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/core/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/core/cache.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/core/models.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/core/processor.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/core/verifier.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/payment/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/payment/models.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/payment/stripe_manager.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/payment/webhook_processor.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/providers/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/providers/base.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/providers/external.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/providers/stub.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/testing/__init__.py +0 -0
- {ai_lls_lib-1.4.0rc2 → ai_lls_lib-1.4.0rc3}/src/ai_lls_lib/testing/fixtures.py +0 -0
@@ -13,7 +13,7 @@ from ai_lls_lib.core.verifier import PhoneVerifier
|
|
13
13
|
from ai_lls_lib.core.processor import BulkProcessor
|
14
14
|
from ai_lls_lib.core.cache import DynamoDBCache
|
15
15
|
|
16
|
-
__version__ = "1.4.0-rc.
|
16
|
+
__version__ = "1.4.0-rc.3"
|
17
17
|
__all__ = [
|
18
18
|
"PhoneVerification",
|
19
19
|
"BulkJob",
|
@@ -23,12 +23,10 @@ class CreditManager:
|
|
23
23
|
def __init__(self, table_name: Optional[str] = None):
|
24
24
|
"""Initialize with DynamoDB table."""
|
25
25
|
if not boto3:
|
26
|
-
|
27
|
-
self.table = None
|
28
|
-
return
|
26
|
+
raise RuntimeError("boto3 is required for CreditManager")
|
29
27
|
|
30
28
|
self.dynamodb = boto3.resource("dynamodb")
|
31
|
-
self.table_name = table_name
|
29
|
+
self.table_name = table_name if table_name else os.environ['CREDITS_TABLE']
|
32
30
|
|
33
31
|
try:
|
34
32
|
self.table = self.dynamodb.Table(self.table_name)
|
@@ -39,7 +37,7 @@ class CreditManager:
|
|
39
37
|
def get_balance(self, user_id: str) -> int:
|
40
38
|
"""Get current credit balance for a user."""
|
41
39
|
if not self.table:
|
42
|
-
|
40
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
43
41
|
|
44
42
|
try:
|
45
43
|
response = self.table.get_item(Key={"user_id": user_id})
|
@@ -53,7 +51,7 @@ class CreditManager:
|
|
53
51
|
def add_credits(self, user_id: str, amount: int) -> int:
|
54
52
|
"""Add credits to user balance and return new balance."""
|
55
53
|
if not self.table:
|
56
|
-
|
54
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
57
55
|
|
58
56
|
try:
|
59
57
|
response = self.table.update_item(
|
@@ -76,7 +74,7 @@ class CreditManager:
|
|
76
74
|
Returns True if successful, False if insufficient balance.
|
77
75
|
"""
|
78
76
|
if not self.table:
|
79
|
-
|
77
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
80
78
|
|
81
79
|
try:
|
82
80
|
# Conditional update - only deduct if balance >= amount
|
@@ -107,7 +105,7 @@ class CreditManager:
|
|
107
105
|
) -> None:
|
108
106
|
"""Update subscription state in CreditsTable."""
|
109
107
|
if not self.table:
|
110
|
-
|
108
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
111
109
|
|
112
110
|
try:
|
113
111
|
update_expr = "SET subscription_status = :status, updated_at = :now"
|
@@ -136,12 +134,7 @@ class CreditManager:
|
|
136
134
|
def get_user_payment_info(self, user_id: str) -> Dict[str, Any]:
|
137
135
|
"""Get user's payment-related information."""
|
138
136
|
if not self.table:
|
139
|
-
|
140
|
-
"credits": 1000,
|
141
|
-
"stripe_customer_id": None,
|
142
|
-
"stripe_subscription_id": None,
|
143
|
-
"subscription_status": None
|
144
|
-
}
|
137
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
145
138
|
|
146
139
|
try:
|
147
140
|
response = self.table.get_item(Key={"user_id": user_id})
|
@@ -176,7 +169,7 @@ class CreditManager:
|
|
176
169
|
def set_stripe_customer_id(self, user_id: str, stripe_customer_id: str) -> None:
|
177
170
|
"""Store Stripe customer ID for a user."""
|
178
171
|
if not self.table:
|
179
|
-
|
172
|
+
raise RuntimeError(f"DynamoDB table {self.table_name} not accessible")
|
180
173
|
|
181
174
|
try:
|
182
175
|
self.table.update_item(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|