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

App 6822: Adding CLI command to update the billing service #4612

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

RoxyFarhad
Copy link
Member

@RoxyFarhad RoxyFarhad commented Dec 6, 2024

The caveat here is that we need to pass in an address as a CLI command, IMO there are 2 possible ways to do this :

  1. Have each part of the address: line1, line2, city, state, zipcode as its own flag e.g. billing-service update --line1=<line-1> ---line-2=<line2> --city=<city> --state=<state> --zipcode=<zipcode>
  2. Pass in the address like a string like so and then we parse it under the hood e.g. billing-service update --address="line1, line2, city, state, zipcode"

I implemented 2 because I thought it was a better UX to the user but open to opinions here

Manual Testing:
Screenshot 2024-12-09 at 1 22 23 PM
Screenshot 2024-12-09 at 1 24 08 PM

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Dec 6, 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 Dec 9, 2024
cli/client.go Outdated
printf(cCtx.App.Writer, "City: %s", address.GetCity())
printf(cCtx.App.Writer, "State: %s", address.GetState())
printf(cCtx.App.Writer, "Postal Code: %s", address.GetZipcode())
printf(cCtx.App.Writer, "Country: %s", "USA")
Copy link
Member

Choose a reason for hiding this comment

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

lol

Copy link
Member

Choose a reason for hiding this comment

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

can we assume this actually? do we care if its USA?

Copy link
Member Author

Choose a reason for hiding this comment

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

I made the same assumption as our Stripe payment assumptions:

  1. we can't charge people outside of the US because we haven't integrated Stripe's internal tax product yet.

I think we also can't pay people directly on stripe because of this?

I actually didn't mention this as a non-goal on the scope, but I can get confirmation.

Copy link
Member

Choose a reason for hiding this comment

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

cool sounds good!

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a ticket to change it at the end of the epic as steve said its non-prio but it will actually require an API change

cli/app.go Outdated
&cli.StringFlag{
Name: organizationBillingAddress,
Required: true,
Usage: "the stringified address that follows the pattern: line1, line2, city, state, zipcode",
Copy link
Member

Choose a reason for hiding this comment

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

or "line1, city, state, zipcode" right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, Ill add a line2 (optional) to the helper text

cli/utils.go Outdated
Comment on lines 77 to 95
currIndex := 0

addr.AddressLine_1 = splitAddress[currIndex]
currIndex++

if len(splitAddress) == 4 {
// if its only 4 lines long that means that there is no line2
currIndex++
} else {
addr.AddressLine_2 = &splitAddress[currIndex]
currIndex++
}

addr.City = splitAddress[currIndex]
currIndex++
addr.State = splitAddress[currIndex]
currIndex++
addr.Zipcode = splitAddress[currIndex]
return addr, nil
Copy link
Member

Choose a reason for hiding this comment

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

[style, optional] ik repeated code in this but might be more readable to do something like this:

Suggested change
currIndex := 0
addr.AddressLine_1 = splitAddress[currIndex]
currIndex++
if len(splitAddress) == 4 {
// if its only 4 lines long that means that there is no line2
currIndex++
} else {
addr.AddressLine_2 = &splitAddress[currIndex]
currIndex++
}
addr.City = splitAddress[currIndex]
currIndex++
addr.State = splitAddress[currIndex]
currIndex++
addr.Zipcode = splitAddress[currIndex]
return addr, nil
if len(splitAddress) == 4 {
return &apppb.BillingAddress{
Address_Line_1: splitAddress[0],
City: splitAddress[1],
State: splitAddress[2],
Zipcode: splitAddress[3],
}, nil
}
return &apppb.BillingAddress{
Address_Line_1: splitAddress[0],
Address_Line_2: splitAddress[1],
City: splitAddress[2],
State: splitAddress[3],
Zipcode: splitAddress[4],
}, nil

Copy link
Member Author

Choose a reason for hiding this comment

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

yea thats what i had before, ill revert back to that 👍🏼

Copy link
Member

@jr22 jr22 left a comment

Choose a reason for hiding this comment

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

few nits and looks like tests and stuff are failing but otherwise looks good. will approve with screenshot of manual test ?

@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 Dec 9, 2024
@RoxyFarhad RoxyFarhad requested a review from jr22 December 9, 2024 18:25
@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 Dec 9, 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 Dec 9, 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 Dec 9, 2024
@RoxyFarhad RoxyFarhad merged commit ba259a2 into viamrobotics:main Dec 9, 2024
17 checks passed
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.

3 participants