-
Notifications
You must be signed in to change notification settings - Fork 650
Prevent billing address changes on VAT invoices #8702
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
Conversation
…ated VAT is calculated based on the billing address at order creation time. Changing the country/state after an order has been paid would result in an inconsistent invoice where the address doesn't match the VAT charged. Changes: - Backend: Add InvoiceBillingAddressUpdateError that is raised when attempting to change country or state on a paid order - Frontend: Disable country and state picker fields in the Edit Invoice modal when the order has been paid - Add disabled prop support to CountryPicker and CountryStatePicker components
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📦 Next.js Bundle Analysis for webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
frankie567
left a comment
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.
Good catch, just a few changes needed on the im plementation itself
server/polar/order/service.py
Outdated
| existing_state = existing_address.get("state") if existing_address else None | ||
|
|
||
| if new_country != existing_country or new_state != existing_state: | ||
| raise InvoiceBillingAddressUpdateError(order) |
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.
Rather than raising a custom error, we should directly raise a PolarRequestValidationError, like here for example:
polar/server/polar/product/service.py
Lines 430 to 439 in 93404fa
| raise PolarRequestValidationError( | |
| [ | |
| { | |
| "type": "value_error", | |
| "loc": ("body", "benefits", order), | |
| "msg": "Benefit does not exist.", | |
| "input": benefit_id, | |
| } | |
| ] | |
| ) |
📦 Next.js Bundle Analysis for webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
06b9748 to
68ac948
Compare
📦 Next.js Bundle Analysis for webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
68ac948 to
5d6f49f
Compare
📦 Next.js Bundle Analysis for webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Replace custom InvoiceBillingAddressUpdateError with standard PolarRequestValidationError for better consistency with the codebase.
5d6f49f to
355c6ad
Compare
📦 Next.js Bundle Analysis for webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
Superseded by #8892 |
|
Wow sorry, @pieterbeulque, completely forgot about this one 🙈 |
|
hehe no all good 🫶 this had merge conflicts anyway so better to do it from scratch |
VAT is calculated based on the billing address at order creation time. Changing the country/state after an order has been paid would result in an inconsistent invoice where the address doesn't match the VAT charged.