71 Commits

Author SHA1 Message Date
Sven Efftinge
1b76bca17d [public-api] handle customer.subscription.deleted event
This event is fired by Stripe when a customer cancels their subscription
2022-09-16 16:24:17 +02:00
Milan Pavlik
42224aeee9 [baseserver] Add metric with version of the server, use in public api and usage 2022-09-16 14:20:17 +02:00
Milan Pavlik
c2b7421628 Fix stripe secret parsing 2022-08-30 10:58:14 +02:00
Milan Pavlik
40ab42e18a [public-api] Validate incoming stripe webhooks 2022-08-29 13:58:14 +02:00
Manuel Alejandro de Brito Fontes
438ffab694 Update k8s dependencies to v0.24.4 2022-08-23 08:18:39 +02:00
Manuel Alejandro de Brito Fontes
7b4a885ee3 Update k8s dependencies to v0.24.3 2022-08-23 08:18:39 +02:00
Andrew Farries
aba684fda1 Test webhook invokes FinalizeInvoice
TestWebhookInvokesFinalizeInvoiceRPC ensures that when the webhook is
hit with a `invoice.finalized` event, the `FinalizeInvoice` method on
the billing service is invoked with the invoice id from the event
payload.
2022-08-10 15:55:56 +02:00
Andrew Farries
d7416fd71d Add mock billing service
`mockgen --source client.go`
2022-08-10 15:55:56 +02:00
Andrew Farries
2d2f3e8b24 Make webhook use billingservice client
Construct and pass a billingservice client to the Stripe webhook so that
it can invoke the `FinalizeInvoice` RPC when the webhook is triggered.
2022-08-10 15:55:56 +02:00
Andrew Farries
c5ac85195b Add billingservice package to public-api-server
Takes the address of the billing service gRPC server and constructs a
client.

Also add a noop version of the client for when no billingservice is
configured (such as will be the case for self-hosted installations).
2022-08-10 15:55:56 +02:00
Andrew Farries
8586bc7fc3 Run 'leeway link' 2022-08-10 15:55:56 +02:00
Andrew Farries
c17cf53c8b Add leeway dependency to public-api-server
The public-api-server depends on the usage component as it will invoke
RPCs on the usage component billing server.
2022-08-10 15:55:56 +02:00
Andrew Farries
5ae8777513 Extract and log invoiceId in webhook 2022-08-10 15:25:54 +02:00
Andrew Farries
03d6f19013 Send valid payloads for stripe events
Add a minimal Stripe event payload for an `invoice.finalized` event.

Ensure all tests send event payloads. The only event type of interest
for the webhook is `invoice.finalized` so other event types can have
empty payloads.
2022-08-10 15:25:54 +02:00
Manuel Alejandro de Brito Fontes
7fd04928c7 Update go dependencies 2022-08-08 10:15:52 -03:00
Andrew Farries
c1a6f64e97 Add tests for the Stripe webhook
Test:
* The handler only accepts POST requests.
* The handler only responds to "invoice.finalized" events.

Add code to the handler to make those tests pass.
2022-08-05 10:12:49 -03:00
Andrew Farries
3218c48f67 Add http section to local usage config 2022-08-02 09:26:46 -03:00
Andrew Farries
a9958a0ffa Add Stripe webhook to public api server 2022-08-02 09:26:46 -03:00
Andrew Farries
9f31143458 go get github.com/gorilla/handlers 2022-08-02 09:26:46 -03:00
Andrew Farries
0d8584cf42 go get github.com/stripe/stripe-go/v72 2022-08-02 09:26:46 -03:00
Christian Weichel
705c4603ab [public-api] Support ListWorkspace 2022-07-13 10:17:00 +02:00
Andrew Farries
c83333fc3a Add usage-api component
Add Placeholder .proto files and script to generate Go client/server
SDKs.

Adapted from the `public-api` component.
2022-07-08 16:25:55 +05:30
JenTing Hsiao
856371178d Revert "Update k8s dependencies to v0.24.2"
This reverts commit 2911bc3283c2b79aacde0d16bce056de62eb696b.
2022-07-05 11:11:01 +02:00
mustard
154dc5fd7d [server,db,protocol] support ssh public key
Co-authored-by: George Tsiolis <tsiolis.g@gmail.com>
2022-07-05 11:04:52 +05:30
Manuel Alejandro de Brito Fontes
2911bc3283 Update k8s dependencies to v0.24.2 2022-07-05 03:37:52 +05:30
Manuel Alejandro de Brito Fontes
5ed1deb661 Update to new stable alpine version v3.16 2022-06-07 15:33:17 +05:30
Manuel Alejandro de Brito Fontes
6efe212447 Update sigs.k8s.io/e2e-framework to v0.0.7 2022-06-07 15:29:17 +05:30
Christian Weichel
b7bf69d01e [public-api-server] Harmonise configuration structure 2022-05-25 17:35:39 +05:30
Milan Pavlik
51450d5141 [public-api] Use standard cli setup 2022-05-19 14:27:33 +05:30
Milan Pavlik
49e3d1e82d [public-api] Do not use localhost as address, not reachable in k8s 2022-05-18 18:50:33 +05:30
Milan Pavlik
956f57caf7 [public-api] Default local server run to port 9001, same as installer config 2022-05-18 16:54:32 +05:30
Andrew Farries
155efaacfc Make proxy treat 403 error as rpc PermissionDenied 2022-05-17 22:11:32 +05:30
Andrew Farries
a645a8cf66 Implement test for GetOwnerToken 2022-05-17 22:11:32 +05:30
Andrew Farries
dc80c457f1 Add method to FakeGitpodAPI 2022-05-17 22:11:32 +05:30
Andrew Farries
27b685ce7b Implement GetOwnerToken rpc
Replace the stub implementation with a real one that invokes the server
JSON rpc API.
2022-05-17 22:11:32 +05:30
Christian Weichel
d2384ea29e [baseserver] Make consuing ServerConfiguration easier 2022-05-16 13:23:31 +05:30
Christian Weichel
5dd9465378 [public-api] Adapt to new baseserver structure 2022-05-16 13:23:31 +05:30
Christian Weichel
4960dce425 [baseserver] Enforce common standards services
specifically debug, health and readiness
2022-05-16 13:23:31 +05:30
Christian Weichel
b397fed927 [baseserver] Support common config struct 2022-05-16 13:23:31 +05:30
Milan Pavlik
fc5f2bf1c3 [baseserver] Dedicated debug server 2022-05-13 14:32:28 +05:30
Milan Pavlik
5361bab694 [public-api] Convert server errors to appropriate RPC errors 2022-05-13 13:08:28 +05:30
Andrew Farries
2a4dd8a2c0 Add test for GetOwnerToken method 2022-05-12 21:39:27 +05:30
Andrew Farries
e0fa9d2392 Add GetOwnerToken method to WorkspaceService 2022-05-12 21:39:27 +05:30
Laurie T. Malau
2250729ffd Add request duration metric 2022-05-10 15:17:25 +05:30
Laurie T. Malau
202d703fe0 Transform getWorkspace response 2022-05-06 17:25:22 +05:30
Milan Pavlik
d2d84646c4 [public-api] Convert to a cobra command and add config 2022-05-04 19:30:20 +05:30
Milan Pavlik
ca762836c6 Fix 2022-05-04 14:57:19 +05:30
Milan Pavlik
a451b0e6e7 [public-api] Convert to a cobra command and add config 2022-05-04 14:57:19 +05:30
Manuel Alejandro de Brito Fontes
2e7526ff72 Update go modules 2022-05-04 13:58:20 +05:30
Milan Pavlik
655281b3de [public-api] Restructure packages to better align with other components 2022-05-03 19:55:19 +05:30