-
Notifications
You must be signed in to change notification settings - Fork 110
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
base: main
Are you sure you want to change the base?
RSDK-9177: add billing wrappers #4570
Conversation
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.
Pretty much LGTM! Just some nits.
UsageCostTypePerMachine | ||
) | ||
|
||
func usageCostTypeFromProto(costType pb.UsageCostType) UsageCostType { |
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.
[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.
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.
It's only in app that we're doing that. In fact, I think we might be removing that file for app as well.
app/billing_client.go
Outdated
) | ||
|
||
// UsageCostType specifies the type of usage cost. | ||
type UsageCostType int32 |
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.
[nit] This and the enum below can just be int
s, I think (int32
or int64
depending on your system.) Using int32
implies some need for a smaller int that probably is not necessary.
app/billing_client.go
Outdated
return resp.OutstandingBalance, invoices, nil | ||
} | ||
|
||
// GetInvoicePDF gets the invoice PDF data. |
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.
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" |
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.
This is always where I use funny strings like [email protected]
but I appreciate the professionalism 🙏🏻 😆 .
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.
You made me burst out laughing omg. I love it
app/viam_client.go
Outdated
@@ -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 { |
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.
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. |
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.
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
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.
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.
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.
everything lgtm - the only thing we should decide on is where we should place structs in the file so we are consistent.
No description provided.