@@ -50,8 +50,8 @@ def _display_credit_line(plan_credits: dict) -> None:
5050 console .print (f" { plan_label :10} { bar } { remaining :2} of { total } remaining expires { formatted_date } " )
5151
5252
53- def _display_purchased_credit_line (bucket : dict ) -> None :
54- """Display a purchased credit line with progress bar."""
53+ def _display_bucket_credit_line (bucket : dict , label : str ) -> None :
54+ """Display a credit bucket line (purchased or promo) with progress bar."""
5555 remaining = bucket ["remaining" ]
5656 total = bucket ["total" ]
5757 expiry_date = bucket ["expiry_date" ]
@@ -71,12 +71,12 @@ def _display_purchased_credit_line(bucket: dict) -> None:
7171 bar = _create_progress_bar (remaining , total , width = 30 )
7272
7373 if is_expired :
74- console .print (f" Purchased { bar } expired { formatted_date } " )
74+ console .print (f" { label :10 } { bar } expired { formatted_date } " )
7575 else :
76- console .print (f" Purchased { bar } { remaining :2} of { total } remaining expires { formatted_date } " )
76+ console .print (f" { label :10 } { bar } { remaining :2} of { total } remaining expires { formatted_date } " )
7777
7878
79- def _display_status_message (plan_credits : Optional [dict ], purchased_credits : list ) -> None :
79+ def _display_status_message (plan_credits : Optional [dict ], purchased_credits : list , promo_credits : list ) -> None :
8080 """Display appropriate status message based on credit state."""
8181 has_remaining = False
8282
@@ -93,8 +93,8 @@ def _display_status_message(plan_credits: Optional[dict], purchased_credits: lis
9393 if remaining > 0 and period_end > now :
9494 has_remaining = True
9595
96- # Check if any purchased credits have remaining balance and not expired
97- for bucket in purchased_credits :
96+ # Check if any purchased or promo credits have remaining balance and not expired
97+ for bucket in [ * purchased_credits , * promo_credits ] :
9898 dt_str = bucket ["expiry_date" ].replace ("Z" , "+00:00" )
9999 expiry_date = datetime .fromisoformat (dt_str )
100100 # If naive datetime, assume UTC
@@ -127,6 +127,7 @@ def print_status(api_key: str, api_url: str, client_version: str) -> None:
127127 org_owner = response .get ("organization_owner_email" )
128128 plan_credits = response .get ("plan_credits" )
129129 purchased_credits = response .get ("purchased_credits" , [])
130+ promo_credits = response .get ("promo_credits" , [])
130131
131132 # Display header information
132133 if client_version_valid :
@@ -153,8 +154,12 @@ def print_status(api_key: str, api_url: str, client_version: str) -> None:
153154
154155 # Display purchased credits
155156 for bucket in purchased_credits :
156- _display_purchased_credit_line (bucket )
157+ _display_bucket_credit_line (bucket , "Purchased" )
158+
159+ # Display promo credits
160+ for bucket in promo_credits :
161+ _display_bucket_credit_line (bucket , "Promo" )
157162
158163 # Display status messages and management link
159- _display_status_message (plan_credits , purchased_credits )
164+ _display_status_message (plan_credits , purchased_credits , promo_credits )
160165 console .print ("\n To manage your plan navigate to https://platform.codeplain.ai/plans" )
0 commit comments