Skip to content
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

GetUpcomingInvoice for BillingService (2) #12377

Merged
merged 1 commit into from
Aug 25, 2022
Merged

GetUpcomingInvoice for BillingService (2) #12377

merged 1 commit into from
Aug 25, 2022

Conversation

AlexTugarev
Copy link
Member

Description

This PR implements GetLatestInvoice GetUpcomingInvoice. The rename is done intentionally, to a) align with terminology used in stripe, and b) to distinguish between the next invoice and an already paid invoice. The upcoming invoice contains the the amount of credits currently used (🤞🏻 after discounts), which can be compared with the spending limit configured.

  • rename GetLatestInvoice to GetUpcomingInvoice

Related Issue(s)

Fixes #11692

How to test

Setup UBB in for a team and lower the spending limit to 1 or 2 credits for a simple test, then start a workspace or two to hit that limit. After a while, cannot tell it precisely, you'll need to reload the dashboard to refresh the spending limit checks. In the server component you'll find a log message on spending limit events, and the known dashboard notification should be visible:
Screen Shot 2022-08-23 at 16 21 48

Release Notes

NONE

Werft options:

  • /werft with-preview
  • /werft with-payment

@AlexTugarev AlexTugarev requested a review from a team August 25, 2022 10:18
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Aug 25, 2022
components/server/ee/src/billing/billing-service.ts Outdated Show resolved Hide resolved
components/usage/pkg/stripe/stripe.go Outdated Show resolved Hide resolved
components/usage/pkg/stripe/stripe.go Show resolved Hide resolved
@easyCZ
Copy link
Member

easyCZ commented Aug 25, 2022

What's the plan for dealing with the scenario when the GetUpcomingInvoice RPC is not implemented on the usage component when server rolls out?

@AlexTugarev
Copy link
Member Author

need to fix this

interface conversion: interface {} is nil, not *stripe.Customer

@roboquat roboquat merged commit 030c183 into main Aug 25, 2022
@roboquat roboquat deleted the at/upcoming branch August 25, 2022 14:07
@AlexTugarev AlexTugarev mentioned this pull request Aug 25, 2022
2 tasks
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Aug 29, 2022
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 deployed Change is completely running in production release-note-none size/XXL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement BillingService.GetLatestInvoice
3 participants