diff --git a/server/polar/checkout/service.py b/server/polar/checkout/service.py index d3f48d8f49..888ae11db9 100644 --- a/server/polar/checkout/service.py +++ b/server/polar/checkout/service.py @@ -941,9 +941,11 @@ async def handle_stripe_success( customer=stripe_customer_id, currency=checkout.currency or "usd", price=stripe_price_id, - coupon=checkout.discount.stripe_coupon_id - if checkout.discount - else None, + coupon=( + checkout.discount.stripe_coupon_id + if checkout.discount + else None + ), automatic_tax=checkout.product.is_tax_applicable, metadata=metadata, invoice_metadata={ @@ -963,9 +965,11 @@ async def handle_stripe_success( subscription_id=subscription.stripe_subscription_id, old_price=subscription.price.stripe_price_id, new_price=stripe_price_id, - coupon=checkout.discount.stripe_coupon_id - if checkout.discount - else None, + coupon=( + checkout.discount.stripe_coupon_id + if checkout.discount + else None + ), automatic_tax=checkout.product.is_tax_applicable, metadata=metadata, invoice_metadata={ @@ -984,9 +988,9 @@ async def handle_stripe_success( customer=stripe_customer_id, currency=checkout.currency or "usd", price=stripe_price_id, - coupon=checkout.discount.stripe_coupon_id - if checkout.discount - else None, + coupon=( + checkout.discount.stripe_coupon_id if checkout.discount else None + ), automatic_tax=checkout.product.is_tax_applicable, metadata={ **metadata, @@ -1072,9 +1076,9 @@ async def handle_free_success( customer=stripe_customer_id, currency=checkout.currency or "usd", price=stripe_price_id, - coupon=checkout.discount.stripe_coupon_id - if checkout.discount - else None, + coupon=( + checkout.discount.stripe_coupon_id if checkout.discount else None + ), automatic_tax=False, metadata=metadata, invoice_metadata={ @@ -1092,9 +1096,9 @@ async def handle_free_success( customer=stripe_customer_id, currency=checkout.currency or "usd", price=stripe_price_id, - coupon=checkout.discount.stripe_coupon_id - if checkout.discount - else None, + coupon=( + checkout.discount.stripe_coupon_id if checkout.discount else None + ), automatic_tax=False, metadata=metadata, idempotency_key=idempotency_key, @@ -1552,9 +1556,11 @@ async def _update_checkout_tax( checkout.subtotal_amount, checkout.product.stripe_product_id, checkout.customer_billing_address, - [checkout.customer_tax_id] - if checkout.customer_tax_id is not None - else [], + ( + [checkout.customer_tax_id] + if checkout.customer_tax_id is not None + else [] + ), ) checkout.tax_amount = tax_amount except TaxCalculationError: @@ -1642,9 +1648,11 @@ async def _create_or_update_customer( update_params["address"] = checkout.customer_billing_address.to_dict() # type: ignore await stripe_service.update_customer( stripe_customer_id, - tax_id=to_stripe_tax_id(checkout.customer_tax_id) - if checkout.customer_tax_id is not None - else None, + tax_id=( + to_stripe_tax_id(checkout.customer_tax_id) + if checkout.customer_tax_id is not None + else None + ), **update_params, ) customer.stripe_customer_id = stripe_customer_id