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(customers): Add or update customer currency via GraphQL #463

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

vincent-pochet
Copy link
Collaborator

Context

Currently, we cannot apply a coupon, an add-on or even prepaid-credits if a customer has no active subscription. This problem happen because customer object does not hold the currency directly, but via the currency of the plan of it’s first active subscription.

It’s a problem when a plan is invoiced in-advance because it can then take up to 1 year to apply the mentioned objects on the first generated invoice.

Description

This PR allows front end to assign customer currency:

  • At customer creation time via the createCustomer mutation
  • At customer edition via the updateCustomer mutation

It also exposes this currency in the Customer type

In the update scenario, if the customer is attached to an active subscription, an add_on, a coupon or a wallet, the action will raise an unprocessable_entity error, with the error code currencies_does_not_match attached to the currency field

@vincent-pochet vincent-pochet added GraphQL Related to the GraphQL API Customer Customer management labels Sep 15, 2022
@vincent-pochet vincent-pochet self-assigned this Sep 15, 2022
@vincent-pochet vincent-pochet merged commit d9de6c1 into main Sep 16, 2022
@vincent-pochet vincent-pochet deleted the feature/graphql-customer-currency branch September 16, 2022 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Customer management GraphQL Related to the GraphQL API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants