-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/745/create invoice job #845
Conversation
0c515b2
to
a5c28ce
Compare
As soon as #744 is merged, this PR needs small adjustments and rebase, then it is ready to review 🚀 |
57673ca
to
921de2e
Compare
60d8c22
to
ed69b88
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.
Bitte noch fehlende specs ergänzen und prüfen ob die verschieben von ExternalInvoice
nach InvoiceForm
sinn machen würde. Beim Job müssen noch die callbacks entsprechend spez verwendet werden
class CreateMembershipInvoiceJob < BaseJob | ||
self.parameters = [:external_invoice_id, :date, :discount, :new_entry] | ||
|
||
def initialize(external_invoice_id, date, discount, new_entry) |
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.
params anpassen gemäss spec (new_entry und discount als kw args mit default values), super aufruf ergänze
@@ -12,6 +12,7 @@ def create | |||
invoice_form.attributes = invoice_form_params | |||
|
|||
if invoice_form.valid? && create_invoice | |||
enqueue_membership_invoice_job |
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.
Hier fehlt noch der check membership_invoice.invoice?
und das als fehlerhaft markiern (status: error
, log entry erzeugen), das auch mit spec abdecken
end | ||
|
||
def perform | ||
if membership_invoice.is_a?(Invoices::Abacus::MembershipInvoice) |
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.
membership_invoice.invoice?
behandeln analog controller
def external_invoice = @external_invoice ||= ExternalInvoice::SacMembership.new(person: person) | ||
|
||
def enqueue_membership_invoice_job | ||
membership_invoice = @external_invoice.build_membership_invoice(invoice_form.discount, invoice_form.new_entry, invoice_form.reference_date) |
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.
Das if
statement mit dem type check find ich nicht gut, besser wäre die fehler dann direkt von der form zu holen, e.g.
member_invoice = invoice_form.build_membership_invoice
if member_invoice
enqueue_job
else
handle_error(invoice_form.membership_invoice_error)
end
end | ||
|
||
def active_memberships | ||
[member.membership_from_role(sac_member.stammsektion_role)] + |
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.
werde hier wirklich die richtigen methoden verwendet, kenne das api nicht aber deckt sich nicht 1:1 mit spec, bitte nochmals prüfen und fehlende tests ergänzen
@@ -39,6 +39,19 @@ def title | |||
I18n.t("invoices.sac_memberships.title", year: year) | |||
end | |||
|
|||
def build_membership_invoice(discount, new_entry, reference_date) | |||
@date = reference_date |
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.
Ist das ausreichend, damit via context
und sac_member
das stichdatum richtig berücksichtigt wird?
ed69b88
to
6dfc7b7
Compare
No description provided.