Skip to content
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(events): Refactor PayInAdvance Billable Metric validation #2143

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

julienbourdeau
Copy link
Contributor

@julienbourdeau julienbourdeau commented Jun 6, 2024

Description

Whenever a event associated with PayInAdvance charge is recieved, we create a Fee for this event.

The validation was performed only after we create the Fee for invoiceable: false charges creating some disparities if the charge is invoiceable or not.

I realized that there is already a validation on the aggregation in the Charge model, which I refactored.

I have removed all the validation in the PostProcess events because, you're not supposed to be able to create invalid charge (see Charge model validation) and if you send events without the properties[bm.field_name], I'm not sure it should fail silently. It creates a fee even without valid properties so I'm keeping the condition as-is, but earlier in the function.

@julienbourdeau julienbourdeau self-assigned this Jun 6, 2024
@julienbourdeau julienbourdeau force-pushed the fix/check-event-invoiceable-false branch from 0214542 to fd979fc Compare June 7, 2024 09:26
@julienbourdeau julienbourdeau changed the title fix(events): Confirm event is processable for invoiceable: false charge too feat(events): Refactor PayInAdvance Billable Metric validation Jun 7, 2024
@julienbourdeau julienbourdeau marked this pull request as draft June 7, 2024 12:01
@julienbourdeau julienbourdeau force-pushed the fix/check-event-invoiceable-false branch 2 times, most recently from 5ec699e to ebeb611 Compare June 7, 2024 13:02
@julienbourdeau julienbourdeau marked this pull request as ready for review June 7, 2024 13:02
@julienbourdeau julienbourdeau force-pushed the fix/check-event-invoiceable-false branch from ebeb611 to 24cca30 Compare June 7, 2024 15:08
@julienbourdeau julienbourdeau force-pushed the fix/check-event-invoiceable-false branch from 24cca30 to 9845c8b Compare June 7, 2024 15:11
Copy link
Collaborator

@vincent-pochet vincent-pochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@julienbourdeau julienbourdeau merged commit 4144983 into main Jun 10, 2024
6 checks passed
@julienbourdeau julienbourdeau deleted the fix/check-event-invoiceable-false branch June 10, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants