Feature/upgrade stripe dependencies 20230226 (#1755)

* Upgrade Stripe dependencies

* Consider language of user in Stripe checkout

* Update changelog
pull/1759/head^2
Thomas Kaul 1 year ago committed by GitHub
parent cad8f0d0e2
commit f3333f24da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Considered the user's language in the _Stripe_ checkout
- Upgraded the _Stripe_ dependencies
- Upgraded `twitter-api-v2` from version `1.10.3` to `1.14.2`
## 1.240.0 - 2023-02-26
@ -1845,7 +1847,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Extended the historical data view in the admin control panel
- Upgraded _Stripe_ dependencies
- Upgraded the _Stripe_ dependencies
- Upgraded `prisma` from version `3.7.0` to `3.8.1`
### Fixed

@ -117,7 +117,7 @@ export class SubscriptionController {
return await this.subscriptionService.createCheckoutSession({
couponId,
priceId,
userId: this.request.user.id
user: this.request.user
});
} catch (error) {
Logger.error(error, 'SubscriptionController');

@ -4,6 +4,7 @@ import {
DEFAULT_LANGUAGE_CODE,
PROPERTY_STRIPE_CONFIG
} from '@ghostfolio/common/config';
import { UserWithSettings } from '@ghostfolio/common/interfaces';
import { Subscription as SubscriptionInterface } from '@ghostfolio/common/interfaces/subscription.interface';
import { SubscriptionType } from '@ghostfolio/common/types/subscription.type';
import { Injectable, Logger } from '@nestjs/common';
@ -23,7 +24,7 @@ export class SubscriptionService {
this.stripe = new Stripe(
this.configurationService.get('STRIPE_SECRET_KEY'),
{
apiVersion: '2020-08-27'
apiVersion: '2022-11-15'
}
);
}
@ -31,17 +32,17 @@ export class SubscriptionService {
public async createCheckoutSession({
couponId,
priceId,
userId
user
}: {
couponId?: string;
priceId: string;
userId: string;
user: UserWithSettings;
}) {
const checkoutSessionCreateParams: Stripe.Checkout.SessionCreateParams = {
cancel_url: `${this.configurationService.get(
'ROOT_URL'
)}/${DEFAULT_LANGUAGE_CODE}/account`,
client_reference_id: userId,
cancel_url: `${this.configurationService.get('ROOT_URL')}/${
user.Settings?.settings?.language ?? DEFAULT_LANGUAGE_CODE
}/account`,
client_reference_id: user.id,
line_items: [
{
price: priceId,
@ -116,10 +117,6 @@ export class SubscriptionService {
userId: session.client_reference_id
});
await this.stripe.customers.update(session.customer as string, {
description: session.client_reference_id
});
return session.client_reference_id;
} catch (error) {
Logger.error(error, 'SubscriptionService');

@ -83,7 +83,7 @@
"@prisma/client": "4.10.1",
"@simplewebauthn/browser": "5.2.1",
"@simplewebauthn/server": "5.2.1",
"@stripe/stripe-js": "1.22.0",
"@stripe/stripe-js": "1.47.0",
"alphavantage": "2.2.0",
"bent": "7.3.12",
"big.js": "6.2.1",
@ -114,7 +114,7 @@
"ngx-device-detector": "3.0.0",
"ngx-markdown": "15.1.0",
"ngx-skeleton-loader": "5.0.0",
"ngx-stripe": "13.0.0",
"ngx-stripe": "15.5.0",
"papaparse": "5.3.1",
"passport": "0.6.0",
"passport-google-oauth20": "2.0.0",
@ -122,7 +122,7 @@
"prisma": "4.10.1",
"reflect-metadata": "0.1.13",
"rxjs": "7.5.6",
"stripe": "8.199.0",
"stripe": "11.12.0",
"svgmap": "2.6.0",
"twitter-api-v2": "1.14.2",
"uuid": "9.0.0",

@ -5859,10 +5859,10 @@
regenerator-runtime "^0.13.7"
resolve-from "^5.0.0"
"@stripe/stripe-js@1.22.0":
version "1.22.0"
resolved "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-1.22.0.tgz"
integrity sha512-fm8TR8r4LwbXgBIYdPmeMjJJkxxFC66tvoliNnmXOpUgZSgQKoNPW3ON0ZphZIiif1oqWNhAaSrr7tOvGu+AFg==
"@stripe/stripe-js@1.47.0":
version "1.47.0"
resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.47.0.tgz#48626a2e43302330aa826ce498a2d9761db4053d"
integrity sha512-jKSClqEIKS2MbPCXlSsseDSZyJ3dVrfUrYMz5LBY1o9iS2tfKbpTZACt8r2g+xyQozI+uHr76pVTyFsmBKA4Mg==
"@tootallnate/once@2":
version "2.0.0"
@ -16492,10 +16492,10 @@ ngx-skeleton-loader@5.0.0:
perf-marks "^1.13.4"
tslib "^2.0.0"
ngx-stripe@13.0.0:
version "13.0.0"
resolved "https://registry.npmjs.org/ngx-stripe/-/ngx-stripe-13.0.0.tgz"
integrity sha512-SImKvoC/mZZrtzh2UUmxFdkqMLKX2y+BtcvMAPdHD4D7miXWEjCTZeXt8h85mcfy7y1NKKwIipH4CSr9eBzZ4w==
ngx-stripe@15.5.0:
version "15.5.0"
resolved "https://registry.yarnpkg.com/ngx-stripe/-/ngx-stripe-15.5.0.tgz#b05fc1cf9f55bb5e7f307ac5cfdf29807a2f48a9"
integrity sha512-Ut3JANfxSzl/4qy+pokHOXGVITgNSlSMv7XGN2Y4tPDk6BVUD9SSl/3VuXW9UdbKAmX0XS68nRACiKCOSet5zw==
dependencies:
tslib "^2.3.0"
@ -18268,14 +18268,14 @@ qs@6.10.3:
dependencies:
side-channel "^1.0.4"
qs@6.11.0:
qs@6.11.0, qs@^6.11.0:
version "6.11.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==
dependencies:
side-channel "^1.0.4"
qs@^6.10.0, qs@^6.4.0, qs@^6.6.0:
qs@^6.10.0, qs@^6.4.0:
version "6.10.5"
resolved "https://registry.npmjs.org/qs/-/qs-6.10.5.tgz"
integrity sha512-O5RlPh0VFtR78y79rgcgKK4wbAI0C5zGVLztOIdpWX6ep368q5Hv6XRxDvXuZ9q3C6v+e3n8UfZZJw7IIG27eQ==
@ -20016,13 +20016,13 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
stripe@8.199.0:
version "8.199.0"
resolved "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz"
integrity sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA==
stripe@11.12.0:
version "11.12.0"
resolved "https://registry.yarnpkg.com/stripe/-/stripe-11.12.0.tgz#2d7d4c37a6447a972128b1266e027693241704e3"
integrity sha512-7yzFyVV/eYpYalfjnw1f9sh/N3r5QVdx5MFtmpOg2QikKVAW4AptXC8P0wj1KNCd/LIo23nTDo0+m9788jHswg==
dependencies:
"@types/node" ">=8.1.0"
qs "^6.6.0"
qs "^6.11.0"
strong-log-transformer@^2.1.0:
version "2.1.0"

Loading…
Cancel
Save