From 1aa9fbb2b3b04e00f5fc2859b411ad40bbc92bca Mon Sep 17 00:00:00 2001 From: emmdim Date: Tue, 26 Nov 2024 14:09:18 +0100 Subject: [PATCH] Adds stripe customer email in organization subscription --- api/docs.md | 1 + api/stripe.go | 1 + db/types.go | 1 + 3 files changed, 3 insertions(+) diff --git a/api/docs.md b/api/docs.md index 1659935..4e96787 100644 --- a/api/docs.md +++ b/api/docs.md @@ -684,6 +684,7 @@ Only the following parameters can be changed. Every parameter is optional. "endDate":"0001-01-01T00:00:00Z", "renewalDate":"0001-01-01T00:00:00Z", "active":true, + "email": "test@test.com", "maxCensusSize":10 }, "usage":{ diff --git a/api/stripe.go b/api/stripe.go index c7bfaa8..36b4997 100644 --- a/api/stripe.go +++ b/api/stripe.go @@ -74,6 +74,7 @@ func (a *API) handleWebhook(w http.ResponseWriter, r *http.Request) { RenewalDate: renewalDate, Active: subscription.Status == "active", MaxCensusSize: int(subscription.Items.Data[0].Quantity), + Email: customer.Email, } // TODO will only worked for new subscriptions diff --git a/db/types.go b/db/types.go index 02a48eb..ebdeae5 100644 --- a/db/types.go +++ b/db/types.go @@ -103,6 +103,7 @@ type OrganizationSubscription struct { RenewalDate time.Time `json:"renewalDate" bson:"renewalDate"` Active bool `json:"active" bson:"active"` MaxCensusSize int `json:"maxCensusSize" bson:"maxCensusSize"` + Email string `json:"email" bson:"email"` } type OrganizationCounters struct {