-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PM-13999] Show estimated tax for taxable countries #12145
[PM-13999] Show estimated tax for taxable countries #12145
Conversation
…r-Clients' into PM-14892-Sales-Tax-Estimation-For-Clients
…9-Show-estimated-tax-for-taxable-countries
…M-13999-Show-estimated-tax-for-taxable-countries
apps/web/src/app/billing/individual/premium/premium-v2.component.html
Outdated
Show resolved
Hide resolved
.then((invoice) => { | ||
this.estimatedTax = invoice.taxAmount; | ||
}) | ||
.catch((error) => { |
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.
Consider extracting the error handling logic into a separate method. This keeps your main logic clear and makes it easier to manage errors
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.
I usually keep them inline unless I need to reference the code elsewhere.
if (!this.taxInfoComponent.country || !this.taxInfoComponent.postalCode) { | ||
return; | ||
} | ||
const request: PreviewIndividualInvoiceRequest = { |
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.
If previewIndividualInvoice returns a promise, using async/await can improve readability and eliminate the need for .then() and .catch() chaining
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.
I had looked into that, but then I get a linting error: Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the
void operator
where I am subscribing to value changes calling refreshSalesTax()
.
message: this.i18nService.t("taxInfoUpdated"), | ||
}); | ||
}) | ||
.catch((error) => { |
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.
Instead of mixing async/await with .then() and .catch(), use async/await consistently to improve readability and also consider extracting the error
this.total = invoice.totalAmount; | ||
}) | ||
.catch((error) => { | ||
this.toastService.showToast({ |
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.
Consider centralizing the error handling logic for better maintainability
This reverts commit f0413bd.
New Issues
Fixed Issues
|
This reverts commit 1dce7f5.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-13999
📔 Objective
AC-2476-deprecate-stripe-sources-api
feature flag in both enabled/disabled state.📸 Screenshots
Bot postal code & country fields are required. Note that the checkbox to include a tax id is removed.
It also listens for additional fields, such as plan, billing interval, additional storage, additional seats, machine accounts, etc.
Tax id codes are validated by our backend using regular expressions to resolve the tax id type based on the selected country:
Error messages by Stripe are also handled now, example is not available.
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes