Skip to content

Conversation

floganz
Copy link
Contributor

@floganz floganz commented Jun 4, 2025

Context

For Charge we have special charge model (graduated_percentage) which only allowed for premium license.
Currently it's validated in services duplicating the logic but also it created very bad user experience.

User on free organization can submit { charge_model: "graduated_percentage" }, we'll internally reset it to nil and return in API response that charge model is required field and should have a value (value_is_mandatory). That error message could be related to the dozens of field and still do not communicate real error reason.

Also this PR contains some of changes extracted from future PR related to the PricingUnit feature.

Description

Extracted charge model validation from services to the model
Fix rubocop warning
Refactor charge related tests to make it easier to expand them with new cases

@floganz floganz self-assigned this Jun 4, 2025
@floganz floganz force-pushed the feat-refactor-charge-services-tests branch from 204f1f6 to a25e819 Compare June 4, 2025 14:36
@floganz floganz changed the title mish(charge): Extract validation from services to the model misс(charge): Extract validation from services to the model Jun 4, 2025
@floganz floganz force-pushed the feat-refactor-charge-services-tests branch from a25e819 to 5d7de95 Compare June 6, 2025 09:25
@floganz floganz removed the request for review from lovrocolic June 6, 2025 09:36
@floganz floganz merged commit b59fbe0 into main Jun 6, 2025
14 checks passed
@floganz floganz deleted the feat-refactor-charge-services-tests branch June 6, 2025 09:38
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