@@ -3893,7 +3893,6 @@ async def test_different_customers_different_invoice_numbers(
38933893 }
38943894 await save_fixture (organization )
38953895
3896- # Create two different customers
38973896 customer_1 = await create_customer (
38983897 save_fixture ,
38993898 organization = organization ,
@@ -3909,7 +3908,6 @@ async def test_different_customers_different_invoice_numbers(
39093908 stripe_customer_id = "STRIPE_CUSTOMER_2" ,
39103909 )
39113910
3912- # Create checkout and order for customer 1
39133911 checkout_1 = await create_checkout (
39143912 save_fixture ,
39153913 products = [product_one_time ],
@@ -3918,7 +3916,6 @@ async def test_different_customers_different_invoice_numbers(
39183916 )
39193917 order_1 = await order_service .create_from_checkout_one_time (session , checkout_1 )
39203918
3921- # Create checkout and order for customer 2
39223919 checkout_2 = await create_checkout (
39233920 save_fixture ,
39243921 products = [product_one_time ],
@@ -3927,36 +3924,29 @@ async def test_different_customers_different_invoice_numbers(
39273924 )
39283925 order_2 = await order_service .create_from_checkout_one_time (session , checkout_2 )
39293926
3930- # Refresh to get the invoice numbers
39313927 await session .refresh (order_1 )
39323928 await session .refresh (order_2 )
39333929
3934- # Both customers should have different invoice number sequences
3935- # They should both start with the organization prefix but have customer-specific numbering
39363930 assert order_1 .invoice_number is not None
39373931 assert order_2 .invoice_number is not None
39383932 assert order_1 .invoice_number != order_2 .invoice_number
39393933
3940- # Verify they both start with organization prefix
39413934 assert order_1 .invoice_number .startswith (organization .customer_invoice_prefix )
39423935 assert order_2 .invoice_number .startswith (organization .customer_invoice_prefix )
39433936
3944- # Each customer should start at 0001
39453937 assert order_1 .invoice_number .endswith ("-0001" )
39463938 assert order_2 .invoice_number .endswith ("-0001" )
39473939
3948- # Verify invoice numbers contain customer-specific suffix
3949- customer_1_suffix = str (customer_1 .id ).split ("-" )[0 ].upper ()
3950- customer_2_suffix = str (customer_2 .id ).split ("-" )[0 ].upper ()
3951- assert customer_1_suffix in order_1 .invoice_number
3952- assert customer_2_suffix in order_2 .invoice_number
3940+ await session .refresh (customer_1 )
3941+ await session .refresh (customer_2 )
3942+ assert customer_1 .short_id_str in order_1 .invoice_number
3943+ assert customer_2 .short_id_str in order_2 .invoice_number
39533944
3954- # Verify format: PREFIX-CUSTOMER_SUFFIX-0001
39553945 assert (
39563946 order_1 .invoice_number
3957- == f"{ organization .customer_invoice_prefix } -{ customer_1_suffix } -0001"
3947+ == f"{ organization .customer_invoice_prefix } -{ customer_1 . short_id_str } -0001"
39583948 )
39593949 assert (
39603950 order_2 .invoice_number
3961- == f"{ organization .customer_invoice_prefix } -{ customer_2_suffix } -0001"
3951+ == f"{ organization .customer_invoice_prefix } -{ customer_2 . short_id_str } -0001"
39623952 )
0 commit comments