Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations/stripe: Use global time.

Niloth P5c8d9edaaec2
diff --git a/zerver/webhooks/stripe/tests.py b/zerver/webhooks/stripe/tests.py
index 49cd4b9cc7f..c9f38e0c868 100644
--- a/zerver/webhooks/stripe/tests.py
+++ b/zerver/webhooks/stripe/tests.py
@@ -141,13 +141,13 @@ Billing method: send invoice"""
expected_topic_name = "cus_00000000000000"
expected_message = """\
[Subscription](https://dashboard.stripe.com/subscriptions/sub_E6STM5w5EX3K28) updated
-* Billing cycle anchor is now Nov 01, 2019, 12:00:00 UTC
-* Current period end is now Nov 01, 2019, 12:00:00 UTC
-* Current period start is now Dec 06, 2018, 05:53:55 UTC
-* Start is now Dec 06, 2018, 05:53:55 UTC
+* Billing cycle anchor is now <time:Nov 01, 2019, 12:00:00 UTC>
+* Current period end is now <time:Nov 01, 2019, 12:00:00 UTC>
+* Current period start is now <time:Dec 06, 2018, 05:53:55 UTC>
+* Start is now <time:Dec 06, 2018, 05:53:55 UTC>
* Status is now trialing
-* Trial end is now Nov 01, 2019, 12:00:00 UTC
-* Trial start is now Dec 06, 2018, 05:53:55 UTC"""
+* Trial end is now <time:Nov 01, 2019, 12:00:00 UTC>
+* Trial start is now <time:Dec 06, 2018, 05:53:55 UTC>"""
self.check_webhook(
"customer_subscription_updated",
expected_topic_name,
diff --git a/zerver/webhooks/stripe/view.py b/zerver/webhooks/stripe/view.py
index fa810e32741..34ecdc5596b 100644
--- a/zerver/webhooks/stripe/view.py
+++ b/zerver/webhooks/stripe/view.py
@@ -363,5 +363,6 @@ def linkified_id(object_id: str, lower: bool = False) -> str:
def stringify(value: object) -> str:
if isinstance(value, int) and value > 1500000000 and value < 2000000000:
- return timestamp_to_datetime(value).strftime("%b %d, %Y, %H:%M:%S %Z")
+ datetime_value = timestamp_to_datetime(value).strftime("%b %d, %Y, %H:%M:%S %Z")
+ return f"<time:{datetime_value}>"
return str(value)