From f83871c182c3646ba2e82b96e68c5a10e957453e Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 18 Nov 2019 17:02:57 -0800 Subject: [PATCH] corporate: Consistently use delivery_email for billing. This is yet another corner case where EMAIL_ADDRESS_VISIBILITY_ADMINS broke existing code. --- corporate/lib/stripe.py | 4 ++-- corporate/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py index d6c2ed1647..690edb8175 100644 --- a/corporate/lib/stripe.py +++ b/corporate/lib/stripe.py @@ -178,7 +178,7 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str]=Non # customer that we can delete or ignore. stripe_customer = stripe.Customer.create( description="%s (%s)" % (realm.string_id, realm.name), - email=user.email, + email=user.delivery_email, metadata={'realm_id': realm.id, 'realm_str': realm.string_id}, source=stripe_token) event_time = timestamp_to_datetime(stripe_customer.created) @@ -298,7 +298,7 @@ def process_initial_upgrade(user: UserProfile, licenses: int, automanage_license currency='usd', customer=customer.stripe_customer_id, description="Upgrade to Zulip Standard, ${} x {}".format(price_per_license/100, licenses), - receipt_email=user.email, + receipt_email=user.delivery_email, statement_descriptor='Zulip Standard') # Not setting a period start and end, but maybe we should? Unclear what will make things # most similar to the renewal case from an accounting perspective. diff --git a/corporate/views.py b/corporate/views.py index 3fd8a2eff0..23c296bf43 100644 --- a/corporate/views.py +++ b/corporate/views.py @@ -129,7 +129,7 @@ def initial_upgrade(request: HttpRequest) -> HttpResponse: signed_seat_count, salt = sign_string(str(seat_count)) context = { 'publishable_key': STRIPE_PUBLISHABLE_KEY, - 'email': user.email, + 'email': user.delivery_email, 'seat_count': seat_count, 'signed_seat_count': signed_seat_count, 'salt': salt,