Order update attributes refactor#357
Conversation
|
Looking great to me! The extraction of code into standalone classes seems like what we've been needing and the spec cleanups along the way are great to have also. |
There was a problem hiding this comment.
What do you think of apply instead of update for the name of this method? Or something else like that. If I have a "FooAttributes" object, I kind expect foo_attributes.update to refresh the attributes themselves or something like that.
|
Disappointing discovery: if I comment out set_shipments_cost, all specs still pass 😞. Will have to try and add a feature test exposing that. |
aaef027 to
c1e5d26
Compare
There was a problem hiding this comment.
I don't like setting variables in conditional statements. I propose 2 different wat how to handle it:
return {} if masseged_params[:order].blank?
massaged_params[:order].permit(permitted_checkout_attributes)
update_params = massaged_params.fetch(:order, {})
update_params.permit(permitted_checkout_attributes)
There was a problem hiding this comment.
Seems a bit bike-shedding-ish...
Also, in this case I like how the current form calls out the fact that we may want to discontinue supporting requests without parameters (which I find weird).
There was a problem hiding this comment.
Yeah I'm with @jordan-brough and @jhawthorn on this. I think the assignment in the conditional makes a lot of sense here.
8a24713 to
5938878
Compare
|
This is looking pretty great! @jhawthorn do you have much more on your todo list here or do you think this is pretty close to ready? |
|
@jordan-brough I have just two things I want to check up on. The first you might be able to help clarify Here https://github.com/solidusio/solidus/pull/357/files#diff-0a2f4b241f8427ca90d58eec529e0e8aR53 we assign Second issue is to find out why we have |
5938878 to
146d73c
Compare
|
I've added a test for |
|
@jhawthorn taking a look now |
|
@jhawthorn I can't see a definite use for the verification_value with existing cards. We definitely haven't used it ourselves. You probably already saw this, but this is the commit that added this via the I'd guess that someone was requiring their customers to re-supply the CVV before being able to re-use an existing card, and that the in-memory credit card was making its way to the payment processor code (e.g. in code like this) and that code expected the verification value to be there. Summary: I don't know. When I moved that code around I was just trying to be extra cautious. I would be willing to bet that there are very few stores that use that param, if any. |
146d73c to
3a5e16a
Compare
|
@jordan-brough thanks. I was mistaken and assumed that was added by us. Might as well leave it in for now, changing that would be ouside this PR's scope. As of 3a5e16ab49687c7960d90bfbf8e05b09eff0ecd2 (which was horrible to track down) this is good to go by me. 🚢 |
There was a problem hiding this comment.
I'm still not a fan of the fact that we define this twice even though we already have a module in place which we can use to DRY this up.
There was a problem hiding this comment.
I'm still not a fan of changing this. :)
|
@jhawthorn super! I'm going to take another look today and verify that it'll give us what we were looking for originally. |
There was a problem hiding this comment.
Can we just leave this in apply? I don't see the point of extracting one line of code that we only call once.
|
This looks great overall. Keen to still chat a bit more about |
There was a problem hiding this comment.
@jhawthorn should this be a configurable class? e.g. Spree::Config.order_update_attributes_class.new(...)
There was a problem hiding this comment.
and same question for PaymentCreate
There was a problem hiding this comment.
I think that might be a good idea but is outside the scope of this PR
There was a problem hiding this comment.
I think before we merge this PR it ought to be in a state that satisfies the original extension goal that we had in mind. Maybe we should chat sometime about how we could best do that with the current state of this PR?
There was a problem hiding this comment.
I'll submit this also as a follow-up after this PR.
This inverse_of is now there implicitly, so it makes no sense to test that it isn't defined.
Originally I prefered accepting request, but now think that accepting request_env is cleaner as it doesn't depend on the structure of an ActionDispatch request.
a49cedc to
1ab4d74
Compare
Order update attributes refactor
No description provided.