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: Update GraphQL schema to create or update charges #405

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

vincent-pochet
Copy link
Collaborator

Context

We want to introduce a new charge model to charge users based on a consumed volume.

The existing graduated pricing does not fit this need because it creates tier, and each tier has its own price.
The volume price works differently, it creates tiers, but the whole number of units is multiplied by the current tier. Then, the number of units consumed determine the total price for each unit.

Description

This PR updates the GraphQL schema to allow creation, update and query of the Volume charge model.

  • A new VolumeRange type is added to handle range definition. Attributes are fromValue, toValue, perUnitAmount and flatAmount
  • The Charge type is updated to add a new volumeRanges attribute as an array of VolumeRange
  • A new VolumeRangeInput type is added to handle range creation and update. Arguments are fromValue, toValue, perUnitAmount and flatAmount
  • The ChargeInput type used in createPlan and updatePlan is also updated to handle a new argument volumeRangeInput as an array of VolumeRangeInput

Related Task

This PR follows #394 and #404

@vincent-pochet vincent-pochet added the Billable Metric Related to the billable metrics label Aug 23, 2022
@vincent-pochet vincent-pochet self-assigned this Aug 23, 2022
@vincent-pochet vincent-pochet force-pushed the feat/volume-pricing-graphql branch from 222600a to 9d03882 Compare August 23, 2022 13:53
@vincent-pochet vincent-pochet merged commit 5e4acee into main Aug 26, 2022
@vincent-pochet vincent-pochet deleted the feat/volume-pricing-graphql branch August 26, 2022 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Billable Metric Related to the billable metrics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants