Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions static/gsApp/views/subscriptionPage/headerCards/headerCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ErrorBoundary from 'sentry/components/errorBoundary';
import type {Organization} from 'sentry/types/organization';

import type {Subscription} from 'getsentry/types';
import {hasNewBillingUI} from 'getsentry/utils/billing';
import {hasNewBillingUI, isDeveloperPlan} from 'getsentry/utils/billing';
import BillingInfoCard from 'getsentry/views/subscriptionPage/headerCards/billingInfoCard';
import LinksCard from 'getsentry/views/subscriptionPage/headerCards/linksCard';
import NextBillCard from 'getsentry/views/subscriptionPage/headerCards/nextBillCard';
Expand All @@ -22,7 +22,11 @@ function getCards(organization: Organization, subscription: Subscription) {
const hasBillingPerms = organization.access?.includes('org:billing');
const cards: React.ReactNode[] = [];

if (subscription.canSelfServe && hasBillingPerms) {
if (
subscription.canSelfServe &&
!isDeveloperPlan(subscription.planDetails) &&
hasBillingPerms
) {
cards.push(
<NextBillCard
key="next-bill"
Expand All @@ -32,7 +36,10 @@ function getCards(organization: Organization, subscription: Subscription) {
);
}

if (subscription.supportsOnDemand && hasBillingPerms) {
if (
(subscription.planDetails.allowOnDemand || subscription.onDemandInvoiced) &&
hasBillingPerms
) {
cards.push(
<PaygCard key="payg" subscription={subscription} organization={organization} />
);
Expand Down
47 changes: 45 additions & 2 deletions static/gsApp/views/subscriptionPage/subscriptionHeader.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('SubscriptionHeader', () => {
}
}

it('renders new header cards for self-serve customers', async () => {
it('renders new header cards for self-serve free customers', async () => {
const organization = OrganizationFixture({
features: ['subscriptions-v3'],
access: ['org:billing'],
Expand All @@ -121,6 +121,27 @@ describe('SubscriptionHeader', () => {
render(
<SubscriptionHeader organization={organization} subscription={subscription} />
);
await assertNewHeaderCards({
organization,
hasNextBillCard: false,
hasBillingInfoCard: true,
hasPaygCard: false,
});
});

it('renders new header cards for self-serve paid customers', async () => {
const organization = OrganizationFixture({
features: ['subscriptions-v3'],
access: ['org:billing'],
});
const subscription = SubscriptionFixture({
organization,
plan: 'am3_team',
});
SubscriptionStore.set(organization.slug, subscription);
render(
<SubscriptionHeader organization={organization} subscription={subscription} />
);
await assertNewHeaderCards({
organization,
hasNextBillCard: true,
Expand All @@ -129,7 +150,7 @@ describe('SubscriptionHeader', () => {
});
});

it('renders new header cards for self-serve partner customers', async () => {
it('renders new header cards for self-serve free partner customers', async () => {
const organization = OrganizationFixture({
features: ['subscriptions-v3'],
access: ['org:billing'],
Expand All @@ -143,6 +164,28 @@ describe('SubscriptionHeader', () => {
render(
<SubscriptionHeader organization={organization} subscription={subscription} />
);
await assertNewHeaderCards({
organization,
hasNextBillCard: false,
hasBillingInfoCard: false,
hasPaygCard: false,
});
});

it('renders new header cards for self-serve paid partner customers', async () => {
const organization = OrganizationFixture({
features: ['subscriptions-v3'],
access: ['org:billing'],
});
const subscription = SubscriptionFixture({
organization,
plan: 'am3_team',
isSelfServePartner: true,
});
SubscriptionStore.set(organization.slug, subscription);
render(
<SubscriptionHeader organization={organization} subscription={subscription} />
);
await assertNewHeaderCards({
organization,
hasNextBillCard: true,
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/views/subscriptionPage/usageOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function UsageOverviewTable({subscription, organization, usageData}: UsageOvervi
budget => (budget.apiName as string) === reservedBudgetCategory
)
: undefined;
const percentUsed = reservedBudget?.totalReservedSpend
const percentUsed = reservedBudget?.reservedBudget
? getPercentage(
reservedBudget?.totalReservedSpend,
reservedBudget?.reservedBudget
Expand Down
Loading