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

RSDK-9177: add billing wrappers #4570

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

purplenicole730
Copy link
Member

No description provided.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Nov 20, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 20, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@purplenicole730 purplenicole730 marked this pull request as ready for review November 21, 2024 23:56
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 21, 2024
@purplenicole730 purplenicole730 requested review from a team, njooma and jckras and removed request for a team November 21, 2024 23:56
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

Pretty much LGTM! Just some nits.

UsageCostTypePerMachine
)

func usageCostTypeFromProto(costType pb.UsageCostType) UsageCostType {
Copy link
Member

Choose a reason for hiding this comment

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

[opt] Could hypothetically put these "from proto" methods in app/billing_proto_conversions.go to match your pattern in the app wrappers PR; up to you though.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's only in app that we're doing that. In fact, I think we might be removing that file for app as well.

)

// UsageCostType specifies the type of usage cost.
type UsageCostType int32
Copy link
Member

Choose a reason for hiding this comment

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

[nit] This and the enum below can just be ints, I think (int32 or int64 depending on your system.) Using int32 implies some need for a smaller int that probably is not necessary.

return resp.OutstandingBalance, invoices, nil
}

// GetInvoicePDF gets the invoice PDF data.
Copy link
Member

Choose a reason for hiding this comment

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

A small elaboration here about the returned byte slice representing the raw bytes of the obtained PDF file would be great.

discount float64 = 9
totalWithDiscount = cost - discount
totalWithoutDiscount float64 = cost
email = "email"
Copy link
Member

Choose a reason for hiding this comment

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

This is always where I use funny strings like [email protected] but I appreciate the professionalism 🙏🏻 😆 .

Copy link
Member Author

Choose a reason for hiding this comment

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

You made me burst out laughing omg. I love it

@@ -63,6 +64,16 @@ func CreateViamClientWithAPIKey(
return CreateViamClientWithOptions(ctx, options, logger)
}

// Billingclient initializes and returns a Billingclient instance used to make app method calls.
// To use Billingclient, you must first instantiate a ViamClient.
func (c *ViamClient) Billingclient() *BillingClient {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (c *ViamClient) Billingclient() *BillingClient {
func (c *ViamClient) BillingClient() *BillingClient {

I think you can capitalize the c here without a namespacing issue (see DataClient method below.)

return data, nil
}

// SendPaymentRequiredEmail sends an email about payment requirement.
Copy link
Member

Choose a reason for hiding this comment

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

can you include how customerOrgID and billingOwnerOrgID are used in the function in the comment? I think it will make it a little more clear

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... I tried to look for the definition in the proto definition, and I can't seem to find it. It also doesn't exist in the other SDKs.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 22, 2024
Copy link
Member

@jckras jckras left a comment

Choose a reason for hiding this comment

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

everything lgtm - the only thing we should decide on is where we should place structs in the file so we are consistent.

app/billing_client.go Show resolved Hide resolved
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 22, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants