42 Commits

Author SHA1 Message Date
Sven Efftinge
03a5fb6ac7 [billing] provide human readable price info 2023-01-23 11:55:30 +01:00
Sven Efftinge
6868ce095c [dashboard] access invoices after cancellation 2023-01-06 08:27:45 +01:00
Sven Efftinge
a6170cad92 [dashboard] display credit usage 2022-12-12 11:09:22 -03:00
Christian Weichel
478a75e744 Switch license to AGPL 2022-12-08 13:05:19 -03:00
Jan Keromnes
337beaf7d1 [usage] Ensure Gitpod can detect customers' automatic tax status when creating new subsriptions 2022-12-08 07:49:18 -03:00
Laurie T. Malau
ee08e7863c [db] Move db models to gitpod-db/go module 2022-11-21 08:37:50 -03:00
Jan Keromnes
b1161a5094 [stripe] When creating a Subscription, don't specify a custom billing cycle anchor date - let it go from date to date instead 2022-11-16 13:29:45 +02:00
Laurie T. Malau
ee8354aa79 [usage] Implement CreateStripeSubscription 2022-11-01 16:15:06 +01:00
Milan Pavlik
224c961883 [billing] Implement CreateStripeCustomer 2022-10-19 10:38:34 +02:00
Milan Pavlik
c8a7667c0d [usage] Report Stripe metrics without full request path 2022-10-11 13:50:26 +02:00
Milan Pavlik
c428154475 [stripe] Implement BillingService.GetStripeCustomer 2022-10-07 16:55:23 +02:00
Milan Pavlik
93fa97a5be [stripe] Add test for filtering out balances for Stripe Cost Centers 2022-10-05 17:59:21 +02:00
Milan Pavlik
269af7cd96 [stripe] Report metrics from client calls in Go 2022-10-05 14:06:20 +02:00
Milan Pavlik
ec9523701d [stripe] Fix inverted comparison 2022-10-05 13:13:20 +02:00
Andrew Farries
83cb1c7a74 Make function output stable
Ensure that the `queriesForCustomersWithAttributionIDs` is stable by
sorting the the attributionIDs before mapping them to queries.

Iteration of map keys is not stable in Go.
2022-10-04 09:31:20 +02:00
Milan Pavlik
c031a86064 [usage] Handle Stripe customers with zero subscriptions 2022-10-04 09:30:20 +02:00
Milan Pavlik
865cc2c5a7 [usage] Simplify UpdateInvoices handling 2022-09-29 15:11:29 +02:00
Sven Efftinge
4d35f4db8f [usage] remove unused GetUpcomingInvoice 2022-09-19 11:22:20 +02:00
Sven Efftinge
65812bf67f [usage] implement CancelSubscription 2022-09-16 16:24:17 +02:00
Milan Pavlik
686963ba63 [usage] Fix stripe invoice finalization 2022-09-16 14:37:17 +02:00
Milan Pavlik
a26a070e45 [usage] Remove verbose log 'searching for customer with query' 2022-09-16 13:50:17 +02:00
Milan Pavlik
e85ad2a595 [usage] Remove unused config and functions 2022-09-12 08:35:13 +02:00
Milan Pavlik
43e526b1d6 [stripe] Finalized invoce debits, do not set credits to negative when updating 2022-09-09 09:27:24 +02:00
Milan Pavlik
9329939388 [stripe] Use attributionId in stripe queries 2022-09-09 07:18:23 +02:00
Milan Pavlik
52279b12ab [billing] Implement ReconcileInvoices 2022-09-07 14:34:22 +02:00
Milan Pavlik
28f6980a26 [stripe] Handle invoice finalization 2022-08-31 16:06:16 +02:00
Milan Pavlik
33c613c5da [stripe] Set reportId on invoices after updating credits 2022-08-30 11:36:15 +02:00
Milan Pavlik
8d009263e1 [billing] Set report ID on Invoices when updating usage credits 2022-08-26 13:40:11 +02:00
Alex Tugarev
aaf9c3af97 fixup 2022-08-25 17:47:10 +02:00
Alex Tugarev
030c183993 Use upcoming invoice 2022-08-25 16:07:10 +02:00
Milan Pavlik
6390f20643 [billing] Report metrics on updated subscriptions 2022-08-04 12:52:48 -03:00
Milan Pavlik
51375056a4 [usage] stripe.UpdateUsage uses context 2022-07-27 02:58:21 -03:00
Milan Pavlik
e6602f7ffa [usage] Refactor server start into a function, specify config 2022-06-30 17:58:39 +05:30
Milan Pavlik
7c567bfa19 [usage] Refactor credit calculation into a WorkspacePricer 2022-06-30 17:30:38 +05:30
Andrew Farries
db870a5b44 Make client init take a config struct not a path
* Rename the function to `New`.
* Lift config file unmarshaling out of the package and into the
  consumer.
2022-06-27 13:45:36 +05:30
Andrew Farries
64060888a5 Make stripe package return clients
`Authenticate` now returns a Client object rather than acting as a
singleton. Change the `UpdateUsage` function to be a method on the
client type.

See:
https://github.com/stripe/stripe-go#with-a-client
2022-06-27 13:45:36 +05:30
Jan Keromnes
df32c3bd05 [usage] Update formula: 1 credit = 6 minutes, rounded up 2022-06-23 12:42:32 +05:30
Andrew Farries
9554966982 Update subscription item with usage
* Convert the usage report so that it contains one entry for each team
  that registered usage during the billing period.
* For each team, query Stripe to find the corresponding Customer.
* Update each Customer's subscription with their used credits.
2022-06-17 15:06:26 +05:30
Andrew Farries
0001dc60d6 Add godoc comment to Authenticate method 2022-06-17 15:06:26 +05:30
Andrew Farries
060c4f5c63 Query Stripe API to find customers for each teamId
For each teamId in the usage report, query the Stripe API to find Stripe
Customer records that correspond to those teamIds.
2022-06-16 18:05:26 +05:30
Andrew Farries
2d9f9d03d7 Add stripe customer query builder to stripe pkg
Build and test the query that will be used to retrieve a list of stripe
customers matching a given set of teamIds.
2022-06-16 18:05:26 +05:30
Andrew Farries
d87da28d46 Authenticate to the Stripe API
When the `run` subcommand is invoked, authenticate to the Stripe API
using API keys.
2022-06-16 18:05:26 +05:30