diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d5ed2787..f9967ad26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated the URL of the Ghostfolio Slack channel - Removed the _Ghostfolio in Numbers_ section from the about page +### Fixed + +- Fixed an issue with the price when creating a `Subscription` + ## 1.275.0 - 2023-05-30 ### Changed diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts index 37b49ee34..c3e01851d 100644 --- a/apps/api/src/app/subscription/subscription.service.ts +++ b/apps/api/src/app/subscription/subscription.service.ts @@ -1,10 +1,6 @@ import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; -import { - DEFAULT_LANGUAGE_CODE, - PROPERTY_STRIPE_CONFIG -} from '@ghostfolio/common/config'; -import { Subscription as SubscriptionInterface } from '@ghostfolio/common/interfaces'; +import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; import { UserWithSettings } from '@ghostfolio/common/types'; import { SubscriptionType } from '@ghostfolio/common/types/subscription-type.type'; import { Injectable, Logger } from '@nestjs/common'; @@ -101,19 +97,8 @@ export class SubscriptionService { aCheckoutSessionId ); - let subscriptions: SubscriptionInterface[] = []; - - const stripeConfig = (await this.prismaService.property.findUnique({ - where: { key: PROPERTY_STRIPE_CONFIG } - })) ?? { value: '{}' }; - - subscriptions = [JSON.parse(stripeConfig.value)]; - - const coupon = subscriptions[0]?.coupon ?? 0; - const price = subscriptions[0]?.price ?? 0; - await this.createSubscription({ - price: price - coupon, + price: session.amount_total / 100, userId: session.client_reference_id });