-
Notifications
You must be signed in to change notification settings - Fork 2
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 service to order copy cards #570
Conversation
From: https://eaflood.atlassian.net/browse/RUBY-767 Add a reusable service that given a registration, a user, a number of copy cards and a user, generates a copy cards only 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.
I started going through what WCR Frontend does and found
- https://github.com/DEFRA/waste-carriers-frontend/blob/master/app/controllers/order_controller.rb
- https://github.com/DEFRA/waste-carriers-frontend/blob/568296e712e16cb00422cdb09e0a49469ff1daa9/app/models/registration.rb#L1620
- https://github.com/DEFRA/waste-carriers-frontend/blob/568296e712e16cb00422cdb09e0a49469ff1daa9/lib/registration_order.rb
- https://github.com/DEFRA/waste-carriers-frontend/blob/568296e712e16cb00422cdb09e0a49469ff1daa9/lib/order_builder.rb
So gave up!
From what I'm reading it looks correct. I'm just commenting on what order to do things
- add the new functionality and then refactor the current order method
- or refactor the existing process first, then have the new functionality follow the same pattern
I'm voting for the later but could be shouted down.
@@ -25,19 +25,12 @@ class Order | |||
field :manualOrder, as: :manual_order, type: String | |||
field :order_item_reference, type: String | |||
|
|||
# TODO: Move to a service |
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.
If the intention is to move this to an OrderRenewalService
(or something like that) would it be better to do that refactoring first and then add your new service?
As is I'm just not sure I like the idea that if we never get round to this TODO
we'll have Order
create the order with new_order
, set the order items as if its a renewal, but then OrderAdditionalCardsService
take that order and simply overwrites the array. Plus we're creating orders in 2 different ways.
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.
This service do not use the code in new_order
so I have left the TODO for the next person touching it. We should get there naturally when we work out the front end flow.
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.
🤦♂ Yep, was pointed out to me I was misreading the changes!
@@ -25,19 +25,12 @@ class Order | |||
field :manualOrder, as: :manual_order, type: String | |||
field :order_item_reference, type: String | |||
|
|||
# TODO: Move to a service |
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.
🤦♂ Yep, was pointed out to me I was misreading the changes!
I am pretty sure I actually need this as it is now, so I am merging this in |
From: https://eaflood.atlassian.net/browse/RUBY-767
Add a reusable service that given a registration, a user, a number of copy cards and a user, generates a copy cards only order