-
Notifications
You must be signed in to change notification settings - Fork 104
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
Feat(invoice_custom_sections): api controllers #3007
base: main
Are you sure you want to change the base?
Conversation
8dba59d
to
b99d81b
Compare
232645c
to
8e753ee
Compare
7870b8d
to
15a84d4
Compare
8d3de8e
to
8927cbe
Compare
organization: { | ||
lago_id: model.organization_id | ||
} |
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.
Do we plan to add more organization details in this serializer? If no I would suggest to flatten it (not a blocker ;) )
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, makes perfect sense, updating, thank you!
attr_reader :customer, :section_ids, :skip_invoice_custom_sections | ||
attr_reader :customer, :section_ids, :skip_invoice_custom_sections, :section_codes | ||
|
||
def raise_double_selection |
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 sure of the naming here as result.validation_failure!
is not raising an error but only marking the result object as failed and adding the error detail to it.
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.
🙌
@skip_invoice_custom_sections = skip_invoice_custom_sections | ||
|
||
super | ||
end | ||
|
||
def call | ||
return result.not_found_failure!(resource: "customer") unless customer | ||
raise_invalid_params if skip_invoice_custom_sections && section_ids.present? | ||
raise_double_selection if !section_ids.nil? && !section_codes.nil? |
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.
You might need to return the result here (or am I missing something?)
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.
oops, yes, thanks
Context
API controllers to support invoice_custom_sections functionality
Description
Added InvoiceCustomSectionsController and updated customers controller with two new actions