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

feat: [M3-6980] - Add DC Specific Pricing Invoice Support #9597

Conversation

bnussman-akamai
Copy link
Member

Description 📝

  • Adds Invoice support for DC specific pricing 💵

Major Changes 🔄

  • Adds region column to Invoice Details, PDF Invoice, and CSV invoice

Preview 📷

Invoice Detail 🧾

Screenshot 2023-08-28 at 4 39 42 PM

CSV 🧾

Screenshot 2023-08-28 at 4 40 10 PM

PDF 🧾

Screenshot 2023-08-28 at 4 40 41 PM

How to test 🧪

  • Turn the MSW on and the DC Specific Feature Flag on
  • Visit http://localhost:3000/account/billing/invoices/555
    • Observe that there is a region column in the invoice (check PDF and CSV too)
  • Verify you do not see the region column when the feature flag is off

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

Looks great! Just a couple things unrelated to the feature itself:

a min-width on the date fields would help readability on mobile
Screenshot 2023-08-29 at 09 25 01

you may not know, but worth asking the question, is the billing name.address still relevant?
Screenshot 2023-08-29 at 09 36 31

lastly, i noticed that none of the code additions user alphabetical ordering - is that intentional?

@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Aug 29, 2023
@bnussman-akamai
Copy link
Member Author

@abailly-akamai

  1. I will add some min-width!
  2. The Linode Billing address is correct here. The billing address is different depending on the date of the invoice.
  3. Can you explain further what you'd expect to be in alphabetical order?

@cpathipa
I'll look into reducing the duplication!

@abailly-akamai
Copy link
Contributor

@bnussman thx! nevermind, i read wrong, i was seeing ordered arguments as unalphabetised but that is irrelevant.

export const getInvoiceRegion = (invoiceItem: InvoiceItem) => {
// If the invoice item is not regarding transfer, just return the region.
if (!invoiceItem.label.toLowerCase().includes('transfer')) {
return invoiceItem.region;
Copy link
Contributor

Choose a reason for hiding this comment

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

In tables, I know we generally sub out the region id, which we get from invoiceItem.region, with the human readable label (e.g. Jakarta, ID). Do we want to do that here as well?

@@ -279,6 +294,21 @@ const truncateLabel = (label: string) => {
return label.length > 20 ? `${label.substr(0, 20)}...` : label;
};

export const getInvoiceRegion = (invoiceItem: InvoiceItem) => {
// If the invoice item is not regarding transfer, just return the region.
if (!invoiceItem.label.toLowerCase().includes('transfer')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can expect region to return a null image, but I think falling back to an empty string in that case is fine. API can't think of another situation in which a region would be null for a service's invoice item -- and we're still checking on whether it will be null for transfer overages in the global/general pool.

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Aug 31, 2023
@mjac0bs
Copy link
Contributor

mjac0bs commented Aug 31, 2023

Somehow I accidentally submitted my review before I meant to. I meant to add:

  • I'd also support Chandra's suggestion with the CSV headers.
  • Is there unit testing we can add for any of these components? I've asked Joe to prioritize this flow in e2es since we know there have been are invoice issues with larger invoices in the past.
  • I'm approving this PR in case a decision comes back on the open question we have while I'm OOO; don't want to block you and the rest of this looks good. If you merge before that transfer region question is answered, can we please add a ticket and TODO to follow up on that?

@jdamore-linode
Copy link
Contributor

@bnussman-akamai These most recent failures are caused by the changes in #9524, so merging in the latest changes from develop should get the tests running and passing again!

@bnussman-akamai bnussman-akamai merged commit 894bb1e into linode:develop Sep 6, 2023
12 of 13 checks passed
abailly-akamai pushed a commit that referenced this pull request Sep 7, 2023
* add basic region columns to pdf, csv, and table

* handle region transfer

* Added changeset: DC Specific Pricing Invoice Support

* fix error state

* add min width

* improve invoice label condition check

* fix loading state

* make comment more clear

---------

Co-authored-by: Banks Nussman <banks@nussman.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! DC-Specific Pricing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants