Skip to content

Commit

Permalink
Merge pull request #734 from readthedocs/davidfischer/fix-stripe-long…
Browse files Browse the repository at this point in the history
…-slugs

Stripe accepts at most 30 chars for metadata
  • Loading branch information
ericholscher committed Apr 11, 2023
2 parents 43300be + 9a721ba commit 70e158d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions adserver/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def action_create_draft_invoice(self, request, queryset):
auto_advance=False, # Draft invoice
collection_method="send_invoice",
custom_fields=[
{"name": "Advertiser", "value": advertiser.slug},
{"name": "Advertiser", "value": advertiser.slug[:30]},
{
"name": "Estimated Start",
"value": flight_start.strftime("%Y-%m-%d"),
Expand Down Expand Up @@ -655,8 +655,8 @@ def action_create_draft_invoice(self, request, queryset):
unit_amount_decimal=unit_amount, # in US cents
currency="USD",
metadata={
"Advertiser": advertiser.slug,
"Flight": flight.slug,
"Advertiser": advertiser.slug[:30],
"Flight": flight.slug[:30],
"Flight Start": flight.start_date.strftime("%Y-%m-%d"),
"Flight End": flight.end_date.strftime("%Y-%m-%d"),
},
Expand All @@ -672,7 +672,7 @@ def action_create_draft_invoice(self, request, queryset):
if total_cost >= 290_000
else "Thanks for your business!",
custom_fields=[
{"name": "Advertiser", "value": advertiser.slug},
{"name": "Advertiser", "value": advertiser.slug[:30]},
{
"name": "Estimated Start",
"value": earliest_start_date.strftime("%Y-%m-%d"),
Expand Down

0 comments on commit 70e158d

Please sign in to comment.