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

[usage] Add listing of credit balance #12710

Merged
merged 1 commit into from
Sep 7, 2022
Merged

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Sep 6, 2022

Description

Implements retrieval of credit balance for all attribution IDs in the Usage table. Will be used when updating invoices against Stripe.

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@easyCZ easyCZ requested a review from a team September 6, 2022 20:20
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 6, 2022

type Balance struct {
AttributionID AttributionID `gorm:"column:attributionId;type:varchar;size:255;" json:"attributionId"`
CreditCents CreditCents `gorm:"column:creditCents;type:bigint;" json:"creditCents"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have missed this discussion elsewhere but what is the purpose of the CreditsCents type? When we wrote the other reconciler we always stored credit values as floating point values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it stores credits * 100 rounded. This removes precision errors. Here, we use a custom type to represent that it's not credits, but credits * 100, or CreditCents

@roboquat roboquat merged commit 2882e7e into main Sep 7, 2022
@roboquat roboquat deleted the mp/usage-list-balance-db branch September 7, 2022 05:48
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 7, 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/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants