Prevent billing address changes on VAT invoices#8702
Prevent billing address changes on VAT invoices#8702pieterbeulque wants to merge 2 commits intomainfrom
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.
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.
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
📦 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.