feat(billing): refacto billing (#14243)
… prices for metered billing --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT } from '@/billing/graphql/fragments/billingSubscriptionSchedulePhaseItemFragment';
|
||||
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT } from '@/billing/graphql/fragments/billingSubscriptionSchedulePhaseFragment';
|
||||
|
||||
export const BILLING_SUBSCRIPTION_FRAGMENT = gql`
|
||||
fragment BillingSubscriptionFragment on BillingSubscription {
|
||||
id
|
||||
status
|
||||
metadata
|
||||
phases {
|
||||
...BillingSubscriptionSchedulePhaseFragment
|
||||
}
|
||||
}
|
||||
|
||||
${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT}
|
||||
${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT}
|
||||
`;
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT } from '@/billing/graphql/fragments/billingSubscriptionSchedulePhaseFragment';
|
||||
import { BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT } from '@/billing/graphql/fragments/billingSubscriptionSchedulePhaseItemFragment';
|
||||
|
||||
export const CURRENT_BILLING_SUBSCRIPTION_FRAGMENT = gql`
|
||||
fragment CurrentBillingSubscriptionFragment on BillingSubscription {
|
||||
id
|
||||
status
|
||||
interval
|
||||
metadata
|
||||
currentPeriodEnd
|
||||
phases {
|
||||
...BillingSubscriptionSchedulePhaseFragment
|
||||
}
|
||||
billingSubscriptionItems {
|
||||
id
|
||||
hasReachedCurrentPeriodCap
|
||||
quantity
|
||||
stripePriceId
|
||||
billingProduct {
|
||||
name
|
||||
description
|
||||
images
|
||||
metadata {
|
||||
productKey
|
||||
planKey
|
||||
priceUsageBased
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_ITEM_FRAGMENT}
|
||||
${BILLING_SUBSCRIPTION_SCHEDULE_PHASE_FRAGMENT}
|
||||
`;
|
||||
@@ -10,6 +10,8 @@ import { DELETED_WORKSPACE_MEMBER_QUERY_FRAGMENT } from '@/workspace-member/grap
|
||||
import { PARTIAL_WORKSPACE_MEMBER_QUERY_FRAGMENT } from '@/workspace-member/graphql/fragments/partialWorkspaceMemberQueryFragment';
|
||||
import { WORKSPACE_MEMBER_QUERY_FRAGMENT } from '@/workspace-member/graphql/fragments/workspaceMemberQueryFragment';
|
||||
import { gql } from '@apollo/client';
|
||||
import { CURRENT_BILLING_SUBSCRIPTION_FRAGMENT } from '@/users/graphql/fragments/currentBillingSubscriptionFragement';
|
||||
import { BILLING_SUBSCRIPTION_FRAGMENT } from '@/users/graphql/fragments/billingSubscriptionsFragment';
|
||||
|
||||
export const USER_QUERY_FRAGMENT = gql`
|
||||
fragment UserQueryFragment on User {
|
||||
@@ -65,31 +67,10 @@ export const USER_QUERY_FRAGMENT = gql`
|
||||
}
|
||||
metadataVersion
|
||||
currentBillingSubscription {
|
||||
id
|
||||
status
|
||||
interval
|
||||
metadata
|
||||
currentPeriodEnd
|
||||
billingSubscriptionItems {
|
||||
id
|
||||
hasReachedCurrentPeriodCap
|
||||
quantity
|
||||
stripePriceId
|
||||
billingProduct {
|
||||
name
|
||||
description
|
||||
metadata {
|
||||
planKey
|
||||
priceUsageBased
|
||||
productKey
|
||||
}
|
||||
}
|
||||
}
|
||||
...CurrentBillingSubscriptionFragment
|
||||
}
|
||||
billingSubscriptions {
|
||||
id
|
||||
status
|
||||
metadata
|
||||
...BillingSubscriptionFragment
|
||||
}
|
||||
workspaceMembersCount
|
||||
defaultRole {
|
||||
@@ -118,4 +99,6 @@ export const USER_QUERY_FRAGMENT = gql`
|
||||
${VIEW_FRAGMENT}
|
||||
${AVAILABLE_WORKSPACES_FOR_AUTH_FRAGMENT}
|
||||
${AVAILABLE_WORKSPACE_FOR_AUTH_FRAGMENT}
|
||||
${CURRENT_BILLING_SUBSCRIPTION_FRAGMENT}
|
||||
${BILLING_SUBSCRIPTION_FRAGMENT}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user