-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UBP] Connect Stripe webhook to FinalizeInvoice
RPC
#11987
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
team: delivery
Issue belongs to the self-hosted team
team: webapp
Issue belongs to the WebApp team
labels
Aug 9, 2022
/hold because it's based on #11985 |
adrienthebo
approved these changes
Aug 9, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
16 tasks
AlexTugarev
approved these changes
Aug 10, 2022
The public-api-server depends on the usage component as it will invoke RPCs on the usage component billing 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).
Construct and pass a billingservice client to the Stripe webhook so that it can invoke the `FinalizeInvoice` RPC when the webhook is triggered.
Allow ingress from the public api server so that the Stripe webhook can invoke RPCs on the usage component.
`mockgen --source client.go`
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.
andrew-farries
force-pushed
the
af/invoke-finalize-invoice-rpc-from-webhook
branch
from
August 10, 2022 13:29
8132ebf
to
b0b331b
Compare
Contributor
Author
/werft run 👍 started the job as gitpod-build-af-invoke-finalize-invoice-rpc-from-webhook.23 |
/unhold |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
deployed: webapp
Meta team change is running in production
release-note-none
size/L
team: delivery
Issue belongs to the self-hosted team
team: webapp
Issue belongs to the WebApp team
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Do the necessary plumbing to connect the Stripe webhook (#11806) to the
FinalizeInvoice
RPC (#11903).With this PR, the webhook calls the
FinalizeInvoice
RPC on theusage
component when it receives ainvoice.finalized
event.This PR also updated the
usage
component network policy to allow ingress from thepublic-api-server
and adds config for thepublic-api-server
so that it knows where theusage
gRPC server is located (ieusage:9002
in-cluster).The
FinalizeInvoice
RPC is still unimplemented and the webhook is not yet registered with Stripe.Related Issue(s)
Part of #10937
How to test
The PR adds a test for the webhook to check it calls
FinalizeInvoice
with the expected invoice id when it receives aninvoice.finalized
event.For an end-to-end test:
public-api-server
HTTP port pod in the preview environment:This should start a series of Stripe events (setting up a customer and payment methods), the last of which (the
invoice.finalized
event) should receive a200 OK
response.usage
pod logs:This shows that the webhook called the
FinalizeInvoice
RPC.Release Notes
Documentation
Werft options: