-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add reverse charge fields to address #6168
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
Add reverse charge fields to address #6168
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6168 +/- ##
=======================================
Coverage 88.80% 88.80%
=======================================
Files 842 842
Lines 18234 18235 +1
=======================================
+ Hits 16192 16193 +1
Misses 2042 2042 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We need to find a solution for storing user-specific data on addresses. As it stands, this PR is incompatible with the existing address handling behaviour and could expose the stored data to other users who possessed only another user's name and address. I believe that:
Ultimately, I think our "immutable" addresses were a mistake, but I don't think the solution is trivial either. Curious to hear the thoughts of the rest of @solidusio/core-team. |
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.
Not opposed to this functionality, but there are security implications due to how our "immutable" addresses work.
There are some good news about that: I see where you come from: Removal of the persistent address is a pain. We have a plan for that iterating:
But I don't expect that before September / October. Question is which of the two approaches we want to take here:
Right now we are struggling with the middle way as the PRs are stuck here much longer than the three days (which I can understand), but if we want to move together we need to find a different rhythm here. @jarednorman Is there anything you find more worrysome than before regarding the addresses with this change? For you in the US the way addresses currently work is technically difficult to handle, but I didn't see any security issues or compliance issues. |
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.
Thanks @JustShah well done PR!
Fabian is right, VAT IDs are not PII, but public - even mandatory - information for companies in the EU. I would like to put this feature behind a flag, because the vast majority of our stores will never use this feature. I like that we support this now, though.
admin/app/components/solidus_admin/ui/forms/address/component.html.erb
Outdated
Show resolved
Hide resolved
1efe6c8 to
30b9a6d
Compare
|
Dependency Notes:
|
30b9a6d to
c81aace
Compare
@jarednorman I just double checked and the
I think so as well. Simple idea™️: Only allow addresses being altered/deleted if not associated with completed/shipped orders. Most correct idea™️: Introduce a The crazy idea™️: Remove the immutability all together and let the accounting system (all businesses have anyway) deal with the legal regulations and let Solidus just be a order management system which only job is to collect orders and does not care about keeping historical data indefinitely. Maybe too crazy? Worth a thought at least. |
I would opt for that, it also allows compatibility with progressive invoicing as in most jurisdictions mandatory.
+1 need to change a shipped order, reimburse and work on a copy as almost all ERPs
I'd focus on having solidus more pro on eCommerce and literally focus on that, I think if we find an agreement on how to handle taxes compatible to real life scenarios we have a solution that's relatively easy to integrate and allows people to attach their own system to import orders and handle updates. |
|
Stupid solution with added benefit: In that way we get added benefits such as an out of the box address management for users. |
With that you mean Address Book management UI features for User account and Admin sections? I am asking, because we have an address book. All user addresses are stored in their address book. Can you elaborate on what you mean exactly? |
|
AFAIK immutable addresses become complex to remove where we touch orders. We can simply separate the user addresses from the Order addresses and we are good for another 10 years as any completed Order must be conserved anyway for tax purposes. What I would do is this:
Am I missing anything or is the current address book saving only one billing and one shipping address? Instantly compliant and relatively painless to do (though some additional maintenance effort as the fields need to exist twice) and we could try to solve this more permanently at any point between the year 2025 and 2034 (probably 31/12/2034 knowing us;). |
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.
Great work @JustShah
I just have on least request, before this can be merged.
core/db/migrate/20250225051308_add_vat_id_email_and_reverse_charge_status_to_addresses.rb
Outdated
Show resolved
Hide resolved
|
@tvdeyen holy seal of approval? |
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.
Thanks
|
@JustShah I fixed (hopefully most of) the flaky specs in latest @jarednorman last chance for raising concerns before merging |
fdd1a75 to
1bccaea
Compare
|
@tvdeyen rebased |
1bccaea to
1be1631
Compare
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.
We need a final rebase (with conflict resolving). I also have a minor non-mandatory nit about the vat_id field.
core/db/migrate/20250225051308_add_vat_id_email_and_reverse_charge_status_to_addresses.rb
Show resolved
Hide resolved
Enhances the Address model by introducing new attributes: email, vat_id, and reverse_charge_status. - **Enhanced Data Completeness**: Storing email and vat_id in the address model ensures that all relevant information is captured within the address record. - **Improved Tax Handling**: The reverse_charge_status enum provides better handling and flexibility for tax-related settings, aligning with various tax requirements and user needs.
Update the API components to include email, vat_id, and reverse_charge_status in the address attributes. Modified `Spree::ApiConfiguration` and `Spree::PermittedAttributes` to handle the new fields. These changes improve data completeness and tax handling by storing additional information in the address.
Update the admin address handling logic to include email, vat_id, and reverse_charge_status fields. Changes include updating form partials and views to handle these new fields, and modifying the JavaScript to process them.
1be1631 to
0963b8e
Compare
Warnings
Important
Blocks #6169
Summary
Description:
This pull request introduces enhancements to the address handling logic in both the admin and API components by incorporating additional fields: email, VAT ID, and reverse charge status. These changes aim to improve the completeness of address data and enhance tax handling capabilities.
Key Changes:
Admin Interface Updates:
API Enhancements:
Spree::ApiConfigurationto include email, VAT ID, and reverse charge status in the address attributes.Spree::PermittedAttributesto handle the new fields.address_books_spec.rbandcheckouts_spec.rb) to verify the handling of the new attributes.Address Model Improvements:
These changes enhance the functionality and completeness of the address handling logic by capturing additional relevant information and improving tax handling capabilities. The modifications ensure a more robust and flexible approach to managing address data within both the admin interface and the API.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: