[solidus_admin] Add payment methods editor - #6619
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6619 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 1050 1053 +3
Lines 21369 21382 +13
=======================================
+ Hits 19731 19744 +13
Misses 1638 1638 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e5670df to
6428ecb
Compare
6428ecb to
5db7d5c
Compare
jarednorman
left a comment
There was a problem hiding this comment.
Based on a quick review locally:
- I don't think validation errors are showing up.
- This doesn't render controls for additional preferences on the payment methods, making it kind of useless for many payment methods.
- Auto-capture is (sadly) not boolean. Null means something (use store default) and we should let people select that.
- When a preference source is chosen, the server/test-mode still looks editable even though changes to those are ignored. That's not a great user experience.
- Probably should sort gateway types in alphabetically or something.
- Changing a payment method's type on update doesn't convert the record to the new class the way the old admin did.
- New records no longer preselect the default store.
☹️ - We should use the shared discard and save button helpers and drop the unused translation keys, and name the HTML hint translations with the _html suffix instead of calling html_safe.
- I think the description a text area.
- Can we pull the store and type queries out of the template?
- We should use the payment method's name as the edit page title.
5db7d5c to
42e04e4
Compare
|
@jarednorman I intend to add commits for a few of the trivial items here, but I would like to use the What do you think about that approach? |
42e04e4 to
fc4b1e1
Compare
|
Does it display object-level validation issues? |
Fine by me! Just make sure we keep track of all of the above. It's very important that the new admin be the same or better than the old one when it comes to all functionality. |
fc4b1e1 to
eeebcbf
Compare
|
I pasted the following into some core models, like validate :fake_object_level_validation
def fake_object_level_validation
errors.add(:base, "fake object-level validation error")
endAnd it seems like the answer is no. It's unclear to me whether there's been a regression recently, but I tried this against this branch, against If you all know this to have been working as expected (flash messages, I'd assume?) and there's been a regression, I can look into it. But I defer to you all who have a deeper knowledge of the current status of the admin. Edit: I created #6629 to address missing presentation of object-level validation errors. |
|
I'm clearly just mistaken about the validation visibility. 😬 |
2cea917 to
de1f071
Compare
|
I just rebased against the latest |
|
Regarding keeping track of the work to be finished:
|
|
@tvdeyen @jarednorman If y'all could prioritize re-reviewing this one and merging it if it's good to go: I intend to keep working on the payment methods UI and basing my next work off of these commits. |
Inherit from resources controller, define necessary overriding methods. We also do not need #index and #destroy actions other than the ones defined on the ResourcesController.
Render links in the table.
Removes row_url and replaces it with edit_path and usages of new routing paths.
For validation errors to be shown correctly we need a proper identifier for turbo stream to replace, default one used by resources controller is :resource_modal but this name does not fit for our page so we use a custom name.
The HTML IDs were incorrect. While I was making this change I saw opportunities to reduce the complexity of the component templates and reduce the need generic translation strings at the component level.
Based on Jared Norman's review, the work done so far on the payment methods editor is missing a lot of functionality: > 1. I don't think validation errors are showing up. > 2. This doesn't render controls for additional preferences on the > payment methods, making it kind of useless for many payment > methods. > 3. Auto-capture is (sadly) not boolean. Null means something (use > store default) and we should let people select that. > 4. When a preference source is chosen, the server/test-mode still > looks editable even though changes to those are ignored. That's > not a great user experience. > 5. Probably should sort gateway types in alphabetically or something. > 6. Changing a payment method's type on update doesn't convert the > record to the new class the way the old admin did. > 7. New records no longer preselect the default store.☹️ > 8. We should use the shared discard and save button helpers and drop > the unused translation keys, and name the HTML hint translations > with the _html suffix instead of calling html_safe. > 9. I think the description a text area. > 10. Can we pull the store and type queries out of the template? > 11. We should use the payment method's name as the edit page title. I don't want to tackle all of this in a single pull request, though I think it's all necessary changes to the functionality. Using the alpha features flag lets us work more iteratively over this.
This was bad form, no pun intended.
de1f071 to
bb27342
Compare

Summary
Replaces #6302.
This pull request adds functionality to allow admins to add, edit, and remove payment methods from the
solidus_admin.Note that I have co-opted most of this work from the original author. I have resolved merge conflicts, ensured linting and tests pass, and so on. I will take responsibility for any issues that come up during code review.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: