@darraghor/nest-backend-libs 2.32.0 → 2.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authorization/authz.module.js +1 -1
- package/dist/authorization/authz.module.js.map +1 -1
- package/dist/authorization/models/RequestWithUser.d.ts +2 -1
- package/dist/authorization/services/UserValidation.service.d.ts +4 -3
- package/dist/authorization/services/UserValidation.service.js +44 -30
- package/dist/authorization/services/UserValidation.service.js.map +1 -1
- package/dist/authorization/strategies/apikeystrategy.d.ts +1 -1
- package/dist/authorization/strategies/apikeystrategy.js +3 -2
- package/dist/authorization/strategies/apikeystrategy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/invitations/invitation.module.js +1 -1
- package/dist/invitations/invitation.module.js.map +1 -1
- package/dist/invitations/invitation.service.d.ts +1 -1
- package/dist/invitations/invitation.service.js +1 -1
- package/dist/invitations/invitation.service.js.map +1 -1
- package/dist/organisation/dto/create-organisation.dto.d.ts +1 -1
- package/dist/organisation/dto/create-organisation.dto.js +1 -1
- package/dist/organisation/dto/create-organisation.dto.js.map +1 -1
- package/dist/organisation/entities/organisation.entity.js +2 -0
- package/dist/organisation/entities/organisation.entity.js.map +1 -1
- package/dist/organisation-memberships/entities/organisation-membership.entity.d.ts +1 -1
- package/dist/organisation-memberships/entities/organisation-membership.entity.js +3 -1
- package/dist/organisation-memberships/entities/organisation-membership.entity.js.map +1 -1
- package/dist/organisation-subscriptions/all-subscriptions.controller.js +2 -1
- package/dist/organisation-subscriptions/all-subscriptions.controller.js.map +1 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.js +3 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.js.map +1 -1
- package/dist/payment-sessions/payment-session.controller.js +2 -1
- package/dist/payment-sessions/payment-session.controller.js.map +1 -1
- package/dist/root-app/app.controller.js +2 -1
- package/dist/root-app/app.controller.js.map +1 -1
- package/dist/root-app/core-app.module.js +22 -2
- package/dist/root-app/core-app.module.js.map +1 -1
- package/dist/smtp-email-client/email.controller.js +3 -1
- package/dist/smtp-email-client/email.controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-checkout-controller.d.ts +2 -2
- package/dist/stripe-client/controllers/stripe-checkout-controller.js +3 -3
- package/dist/stripe-client/controllers/stripe-checkout-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-customer-portal-controller.d.ts +2 -2
- package/dist/stripe-client/controllers/stripe-customer-portal-controller.js +2 -2
- package/dist/stripe-client/controllers/stripe-customer-portal-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-events-controller.js +2 -1
- package/dist/stripe-client/controllers/stripe-events-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-webhook-controller.js +3 -1
- package/dist/stripe-client/controllers/stripe-webhook-controller.js.map +1 -1
- package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.d.ts +1 -1
- package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.js +4 -4
- package/dist/stripe-client/models/StripeCheckoutSessionRequestDto.js.map +1 -1
- package/dist/stripe-client/services/auth-stripe-checkout.service.d.ts +15 -0
- package/dist/stripe-client/services/auth-stripe-checkout.service.js +65 -0
- package/dist/stripe-client/services/auth-stripe-checkout.service.js.map +1 -0
- package/dist/stripe-client/services/queued-payment-event.handler.d.ts +1 -1
- package/dist/stripe-client/services/queued-payment-event.handler.js +11 -8
- package/dist/stripe-client/services/queued-payment-event.handler.js.map +1 -1
- package/dist/stripe-client/services/stripe-checkout.service.d.ts +3 -12
- package/dist/stripe-client/services/stripe-checkout.service.js +14 -57
- package/dist/stripe-client/services/stripe-checkout.service.js.map +1 -1
- package/dist/stripe-client/stripe-account.module.js +3 -0
- package/dist/stripe-client/stripe-account.module.js.map +1 -1
- package/dist/super-powers/super-powers.controller.js +2 -1
- package/dist/super-powers/super-powers.controller.js.map +1 -1
- package/dist/user/dto/create-user.dto.js.map +1 -0
- package/dist/user/dto/update-user.dto.js.map +1 -0
- package/dist/{user-internal → user}/dto/userResponseDto.d.ts +0 -2
- package/dist/{user-internal → user}/dto/userResponseDto.js +0 -6
- package/dist/user/dto/userResponseDto.js.map +1 -0
- package/dist/{user-internal → user}/entities/user.entity.js +3 -1
- package/dist/user/entities/user.entity.js.map +1 -0
- package/dist/{user-internal → user}/user-internal.module.js +2 -2
- package/dist/user/user-internal.module.js.map +1 -0
- package/dist/{user-internal → user}/user.controller.js +2 -4
- package/dist/user/user.controller.js.map +1 -0
- package/dist/{user-internal → user}/user.service.d.ts +3 -4
- package/dist/{user-internal → user}/user.service.js +32 -16
- package/dist/user/user.service.js.map +1 -0
- package/dist/user-api-key/user-apikey.controller.js +5 -1
- package/dist/user-api-key/user-apikey.controller.js.map +1 -1
- package/dist/user-api-key/user-apikey.module.js +1 -1
- package/dist/user-api-key/user-apikey.module.js.map +1 -1
- package/dist/user-api-key/userApiKey.entity.d.ts +1 -1
- package/dist/user-api-key/userApiKey.entity.js +1 -1
- package/dist/user-api-key/userApiKey.entity.js.map +1 -1
- package/package.json +13 -10
- package/dist/user-internal/dto/create-user.dto.js.map +0 -1
- package/dist/user-internal/dto/update-user.dto.js.map +0 -1
- package/dist/user-internal/dto/userResponseDto.js.map +0 -1
- package/dist/user-internal/entities/user.entity.js.map +0 -1
- package/dist/user-internal/user-internal.module.js.map +0 -1
- package/dist/user-internal/user.controller.js.map +0 -1
- package/dist/user-internal/user.service.js.map +0 -1
- /package/dist/{user-internal → user}/dto/create-user.dto.d.ts +0 -0
- /package/dist/{user-internal → user}/dto/create-user.dto.js +0 -0
- /package/dist/{user-internal → user}/dto/update-user.dto.d.ts +0 -0
- /package/dist/{user-internal → user}/dto/update-user.dto.js +0 -0
- /package/dist/{user-internal → user}/entities/user.entity.d.ts +0 -0
- /package/dist/{user-internal → user}/user-internal.module.d.ts +0 -0
- /package/dist/{user-internal → user}/user.controller.d.ts +0 -0
|
@@ -9,7 +9,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
10
10
|
import "reflect-metadata";
|
|
11
11
|
import helmet from "helmet";
|
|
12
|
-
import { ClassSerializerInterceptor, Module, ValidationPipe, } from "@nestjs/common";
|
|
12
|
+
import { CacheModule, ClassSerializerInterceptor, Module, ValidationPipe, } from "@nestjs/common";
|
|
13
13
|
import { Logger, LoggerModule } from "nestjs-pino";
|
|
14
14
|
import { AppController } from "./app.controller.js";
|
|
15
15
|
import { AppService } from "./app.service.js";
|
|
@@ -23,6 +23,7 @@ import { HealthModule } from "../health/Health.module.js";
|
|
|
23
23
|
import { LoggerModule as LoggingConfigModule } from "../logger/logger.module.js";
|
|
24
24
|
import { LoggingConfigurationService } from "../logger/LoggingConfigurationService.js";
|
|
25
25
|
import { AuthzModule } from "../authorization/authz.module.js";
|
|
26
|
+
import ioredisCache from "cache-manager-ioredis-yet";
|
|
26
27
|
let CoreModule = class CoreModule {
|
|
27
28
|
static initApplication(
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
|
|
@@ -74,6 +75,25 @@ CoreModule = __decorate([
|
|
|
74
75
|
Module({
|
|
75
76
|
imports: [
|
|
76
77
|
ConfigModule.forRoot({ cache: true }),
|
|
78
|
+
CacheModule.registerAsync({
|
|
79
|
+
imports: [CoreConfigModule],
|
|
80
|
+
useFactory: async (configService
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
82
|
+
) => {
|
|
83
|
+
const redisUrl = new URL(configService.bullQueueHost || "redis://localhost");
|
|
84
|
+
return {
|
|
85
|
+
ttl: 60,
|
|
86
|
+
store: await ioredisCache.redisStore({
|
|
87
|
+
host: redisUrl.hostname,
|
|
88
|
+
password: redisUrl.password,
|
|
89
|
+
port: Number(redisUrl.port),
|
|
90
|
+
username: redisUrl.username,
|
|
91
|
+
maxRetriesPerRequest: 3,
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
inject: [CoreConfigurationService],
|
|
96
|
+
}),
|
|
77
97
|
LoggerModule.forRootAsync({
|
|
78
98
|
imports: [LoggingConfigModule],
|
|
79
99
|
inject: [LoggingConfigurationService],
|
|
@@ -113,7 +133,7 @@ CoreModule = __decorate([
|
|
|
113
133
|
],
|
|
114
134
|
controllers: [AppController],
|
|
115
135
|
providers: [AppService, SwaggerGen],
|
|
116
|
-
exports: [SwaggerGen, BullModule, LoggerModule, AuthzModule],
|
|
136
|
+
exports: [SwaggerGen, BullModule, LoggerModule, AuthzModule, CacheModule],
|
|
117
137
|
})
|
|
118
138
|
], CoreModule);
|
|
119
139
|
export { CoreModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-app.module.js","sourceRoot":"","sources":["../../src/root-app/core-app.module.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,+DAA+D;AAC/D,4DAA4D;AAC5D,OAAO,kBAAkB,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACH,0BAA0B,EAE1B,MAAM,EAEN,cAAc,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACpD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAC,gBAAgB,EAAC,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,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
12
|
};
|
|
13
13
|
import { InjectQueue } from "@nestjs/bull";
|
|
14
14
|
import { Controller, Get, UseGuards } from "@nestjs/common";
|
|
15
|
-
import { ApiBearerAuth, ApiOkResponse, ApiTags } from "@nestjs/swagger";
|
|
15
|
+
import { ApiBearerAuth, ApiOkResponse, ApiOperation, ApiTags, } from "@nestjs/swagger";
|
|
16
16
|
import { ClaimsAuthorisationGuard } from "../authorization/guards/ClaimsAuthorisationGuard.js";
|
|
17
17
|
import { DefaultAuthGuard } from "../authorization/guards/DefaultAuthGuard.js";
|
|
18
18
|
import { MandatoryUserClaims } from "../authorization/guards/MandatoryUserClaims.decorator.js";
|
|
@@ -75,6 +75,7 @@ __decorate([
|
|
|
75
75
|
], EmailClientController.prototype, "verify", null);
|
|
76
76
|
__decorate([
|
|
77
77
|
MandatoryUserClaims("read:all"),
|
|
78
|
+
ApiOperation({ tags: ["SuperPower"] }),
|
|
78
79
|
Get("peekalljobs"),
|
|
79
80
|
ApiOkResponse({ type: [QueueItemDto] }),
|
|
80
81
|
__metadata("design:type", Function),
|
|
@@ -83,6 +84,7 @@ __decorate([
|
|
|
83
84
|
], EmailClientController.prototype, "peekQueueJobs", null);
|
|
84
85
|
__decorate([
|
|
85
86
|
MandatoryUserClaims("read:all"),
|
|
87
|
+
ApiOperation({ tags: ["SuperPower"] }),
|
|
86
88
|
Get("peekfailedjobs")
|
|
87
89
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
88
90
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.controller.js","sourceRoot":"","sources":["../../src/smtp-email-client/email.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"email.controller.js","sourceRoot":"","sources":["../../src/smtp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E,aAAa,CAAC,EAAC,IAAI,EAAE,CAAC,YAAY,CAAC,EAAC,CAAC;;;;gEAerC;AA5DQ,qBAAqB;IAJjC,SAAS,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;IACrD,aAAa,EAAE;IACf,OAAO,CAAC,cAAc,CAAC;IACvB,UAAU,CAAC,cAAc,CAAC;IAIlB,WAAA,WAAW,CAAC,aAAa,CAAC,CAAA;qCADD,eAAe;GAFpC,qBAAqB,CA6DjC;SA7DY,qBAAqB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RequestWithUser } from "../../authorization/models/RequestWithUser.js";
|
|
2
2
|
import { StripeCheckoutSessionRequestDto } from "../models/StripeCheckoutSessionRequestDto.js";
|
|
3
|
-
import { StripeCheckoutService } from "../services/stripe-checkout.service.js";
|
|
4
3
|
import { StripeCheckoutSessionResponseDto } from "../models/StripeCheckoutSessionResponseDto.js";
|
|
4
|
+
import { AuthenticatedStripeCheckoutService } from "../services/auth-stripe-checkout.service.js";
|
|
5
5
|
/**
|
|
6
6
|
* This controller creates authenticated checkout sessions for Stripe.
|
|
7
7
|
* It adds the user's email address and user ID to the session.
|
|
@@ -11,6 +11,6 @@ import { StripeCheckoutSessionResponseDto } from "../models/StripeCheckoutSessio
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class StripeCheckoutController {
|
|
13
13
|
private readonly stripeService;
|
|
14
|
-
constructor(stripeService:
|
|
14
|
+
constructor(stripeService: AuthenticatedStripeCheckoutService);
|
|
15
15
|
createCheckoutSession(request: RequestWithUser, createSessionDto: StripeCheckoutSessionRequestDto): Promise<StripeCheckoutSessionResponseDto>;
|
|
16
16
|
}
|
|
@@ -14,8 +14,8 @@ import { UseGuards, Controller, Post, Body, Request } from "@nestjs/common";
|
|
|
14
14
|
import { AuthGuard } from "@nestjs/passport";
|
|
15
15
|
import { ApiBearerAuth, ApiTags, ApiOkResponse } from "@nestjs/swagger";
|
|
16
16
|
import { StripeCheckoutSessionRequestDto } from "../models/StripeCheckoutSessionRequestDto.js";
|
|
17
|
-
import { StripeCheckoutService } from "../services/stripe-checkout.service.js";
|
|
18
17
|
import { StripeCheckoutSessionResponseDto } from "../models/StripeCheckoutSessionResponseDto.js";
|
|
18
|
+
import { AuthenticatedStripeCheckoutService } from "../services/auth-stripe-checkout.service.js";
|
|
19
19
|
/**
|
|
20
20
|
* This controller creates authenticated checkout sessions for Stripe.
|
|
21
21
|
* It adds the user's email address and user ID to the session.
|
|
@@ -30,7 +30,7 @@ let StripeCheckoutController = class StripeCheckoutController {
|
|
|
30
30
|
}
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
32
|
async createCheckoutSession(request, createSessionDto) {
|
|
33
|
-
return this.stripeService.
|
|
33
|
+
return this.stripeService.createCheckoutSession(createSessionDto, request.user);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
__decorate([
|
|
@@ -51,7 +51,7 @@ StripeCheckoutController = __decorate([
|
|
|
51
51
|
ApiTags("Payments")
|
|
52
52
|
// eslint-disable-next-line @darraghor/nestjs-typed/injectable-should-be-provided
|
|
53
53
|
,
|
|
54
|
-
__metadata("design:paramtypes", [
|
|
54
|
+
__metadata("design:paramtypes", [AuthenticatedStripeCheckoutService])
|
|
55
55
|
], StripeCheckoutController);
|
|
56
56
|
export { StripeCheckoutController };
|
|
57
57
|
//# sourceMappingURL=stripe-checkout-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-checkout-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-checkout-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,+BAA+B,EAAC,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"stripe-checkout-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-checkout-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,+BAA+B,EAAC,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAC,gCAAgC,EAAC,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAC,kCAAkC,EAAC,MAAM,6CAA6C,CAAC;AAE/F;;;;;;GAMG;AAMI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEZ;IADrB,YACqB,aAAiD;QAAjD,kBAAa,GAAb,aAAa,CAAoC;IACnE,CAAC;IAKE,AADN,6DAA6D;IAC7D,KAAK,CAAC,qBAAqB,CACZ,OAAwB,EAC3B,gBAAiD;QAEzD,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAC3C,gBAAgB,EAChB,OAAO,CAAC,IAAI,CACf,CAAC;IACN,CAAC;CACJ,CAAA;AATS;IAHL,IAAI,CAAC,kBAAkB,CAAC;IACxB,aAAa,CAAC,EAAC,IAAI,EAAE,gCAAgC,EAAC,CAAC;IACxD,6DAA6D;;IAExD,WAAA,OAAO,EAAE,CAAA;IACT,WAAA,IAAI,EAAE,CAAA;;6CAAmB,+BAA+B;;qEAM5D;AAhBQ,wBAAwB;IALpC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,aAAa,EAAE;IACf,UAAU,CAAC,iBAAiB,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAC;IACpB,iFAAiF;;qCAGzC,kCAAkC;GAF7D,wBAAwB,CAiBpC;SAjBY,wBAAwB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RequestWithUser } from "../../authorization/models/RequestWithUser.js";
|
|
2
|
-
import { StripeCheckoutService } from "./../services/stripe-checkout.service.js";
|
|
3
2
|
import { StripeCustomerPortalResponseDto } from "../models/StripeCustomerPortalResponseDto.js";
|
|
4
3
|
import { StripeCustomerPortalRequestDto } from "../models/StripeCustomerPortalRequestDto.js";
|
|
4
|
+
import { AuthenticatedStripeCheckoutService } from "../services/auth-stripe-checkout.service.js";
|
|
5
5
|
export declare class StripeCustomerPortalController {
|
|
6
6
|
private readonly stripeService;
|
|
7
|
-
constructor(stripeService:
|
|
7
|
+
constructor(stripeService: AuthenticatedStripeCheckoutService);
|
|
8
8
|
createCustomerPortalSession(request: RequestWithUser, body: StripeCustomerPortalRequestDto): Promise<StripeCustomerPortalResponseDto>;
|
|
9
9
|
}
|
|
@@ -13,9 +13,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { UseGuards, Controller, Post, Request, Body } from "@nestjs/common";
|
|
14
14
|
import { AuthGuard } from "@nestjs/passport";
|
|
15
15
|
import { ApiBearerAuth, ApiTags, ApiOkResponse } from "@nestjs/swagger";
|
|
16
|
-
import { StripeCheckoutService } from "./../services/stripe-checkout.service.js";
|
|
17
16
|
import { StripeCustomerPortalResponseDto } from "../models/StripeCustomerPortalResponseDto.js";
|
|
18
17
|
import { StripeCustomerPortalRequestDto } from "../models/StripeCustomerPortalRequestDto.js";
|
|
18
|
+
import { AuthenticatedStripeCheckoutService } from "../services/auth-stripe-checkout.service.js";
|
|
19
19
|
let StripeCustomerPortalController = class StripeCustomerPortalController {
|
|
20
20
|
stripeService;
|
|
21
21
|
constructor(stripeService) {
|
|
@@ -45,7 +45,7 @@ __decorate([
|
|
|
45
45
|
StripeCustomerPortalController = __decorate([
|
|
46
46
|
Controller("payments/stripe"),
|
|
47
47
|
ApiTags("Payments"),
|
|
48
|
-
__metadata("design:paramtypes", [
|
|
48
|
+
__metadata("design:paramtypes", [AuthenticatedStripeCheckoutService])
|
|
49
49
|
], StripeCustomerPortalController);
|
|
50
50
|
export { StripeCustomerPortalController };
|
|
51
51
|
//# sourceMappingURL=stripe-customer-portal-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-customer-portal-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-customer-portal-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"stripe-customer-portal-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-customer-portal-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAC,+BAA+B,EAAC,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAC,8BAA8B,EAAC,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAC,kCAAkC,EAAC,MAAM,6CAA6C,CAAC;AAIxF,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAElB;IADrB,YACqB,aAAiD;QAAjD,kBAAa,GAAb,aAAa,CAAoC;IACnE,CAAC;IAUE,AADN,6DAA6D;IAC7D,KAAK,CAAC,2BAA2B,CAClB,OAAwB,EAC3B,IAAoC;QAE5C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,2BAA2B,CACvD,IAAI,EACJ,OAAO,CAAC,IAAI,CACf,CAAC;IACN,CAAC;CACJ,CAAA;AATS;IARL,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,aAAa,EAAE;IACf,IAAI,CAAC,yBAAyB,CAAC;IAC/B,aAAa,CAAC;QACX,IAAI,EAAE,+BAA+B;QACrC,WAAW,EAAE,gCAAgC;KAChD,CAAC;IACF,6DAA6D;;IAExD,WAAA,OAAO,EAAE,CAAA;IACT,WAAA,IAAI,EAAE,CAAA;;6CAAO,8BAA8B;;iFAM/C;AArBQ,8BAA8B;IAF1C,UAAU,CAAC,iBAAiB,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAC;qCAGoB,kCAAkC;GAF7D,8BAA8B,CAsB1C;SAtBY,8BAA8B"}
|
|
@@ -11,7 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import { UseGuards, Controller, Request, Get, Query } from "@nestjs/common";
|
|
14
|
-
import { ApiBearerAuth, ApiTags, ApiOkResponse, ApiQuery } from "@nestjs/swagger";
|
|
14
|
+
import { ApiBearerAuth, ApiTags, ApiOkResponse, ApiQuery, ApiOperation, } from "@nestjs/swagger";
|
|
15
15
|
import { StripeCheckoutService } from "../services/stripe-checkout.service.js";
|
|
16
16
|
import { StripeCheckoutEvent } from "../entities/stripe-checkout-event.entity.js";
|
|
17
17
|
import { ClaimsAuthorisationGuard } from "../../authorization/guards/ClaimsAuthorisationGuard.js";
|
|
@@ -29,6 +29,7 @@ let StripeEventsController = class StripeEventsController {
|
|
|
29
29
|
};
|
|
30
30
|
__decorate([
|
|
31
31
|
MandatoryUserClaims("read:all"),
|
|
32
|
+
ApiOperation({ tags: ["SuperPower"] }),
|
|
32
33
|
Get(),
|
|
33
34
|
ApiQuery({ name: "take", required: true, type: Number }),
|
|
34
35
|
ApiQuery({ name: "skip", required: true, type: Number }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-events-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-events-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"stripe-events-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-events-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EACH,aAAa,EACb,OAAO,EACP,aAAa,EACb,QAAQ,EACR,YAAY,GACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,wCAAwC,CAAC;AAE7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAC,wBAAwB,EAAC,MAAM,wDAAwD,CAAC;AAChG,OAAO,EAAC,gBAAgB,EAAC,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAC,mBAAmB,EAAC,MAAM,6DAA6D,CAAC;AAWzF,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACF;IAA7B,YAA6B,aAAoC;QAApC,kBAAa,GAAb,aAAa,CAAuB;IAAG,CAAC;IAS/D,AADN,6DAA6D;IAC7D,KAAK,CAAC,aAAa,CACJ,OAAwB,EAC1B,KAAiB;QAE1B,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;AANS;IAPL,mBAAmB,CAAC,UAAU,CAAC;IAC/B,YAAY,CAAC,EAAC,IAAI,EAAE,CAAC,YAAY,CAAC,EAAC,CAAC;IACpC,GAAG,EAAE;IACL,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;IACtD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;IACtD,aAAa,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;IAC1D,6DAA6D;;IAExD,WAAA,OAAO,EAAE,CAAA;IACT,WAAA,KAAK,EAAE,CAAA;;;;2DAGX;AAfQ,sBAAsB;IAJlC,SAAS,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;IACrD,aAAa,EAAE;IACf,UAAU,CAAC,wBAAwB,CAAC;IACpC,OAAO,CAAC,UAAU,CAAC;qCAE4B,qBAAqB;GADxD,sBAAsB,CAgBlC;SAhBY,sBAAsB"}
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { InjectQueue } from "@nestjs/bull";
|
|
14
14
|
import { Controller, Get, Post, Req, UseGuards, } from "@nestjs/common";
|
|
15
|
-
import { ApiTags, ApiOkResponse, ApiBadRequestResponse, ApiBearerAuth, } from "@nestjs/swagger";
|
|
15
|
+
import { ApiTags, ApiOkResponse, ApiBadRequestResponse, ApiBearerAuth, ApiOperation, } from "@nestjs/swagger";
|
|
16
16
|
import { StripeWebhookHandler } from "./../services/stripe-webhook-handler.service.js";
|
|
17
17
|
import { QueueItemDto } from "../../root-app/models/QueueItemDto.js";
|
|
18
18
|
import { ClaimsAuthorisationGuard } from "../../authorization/guards/ClaimsAuthorisationGuard.js";
|
|
@@ -85,6 +85,7 @@ __decorate([
|
|
|
85
85
|
__decorate([
|
|
86
86
|
UseGuards(DefaultAuthGuard, ClaimsAuthorisationGuard),
|
|
87
87
|
ApiBearerAuth(),
|
|
88
|
+
ApiOperation({ tags: ["SuperPower"] }),
|
|
88
89
|
MandatoryUserClaims("read:all"),
|
|
89
90
|
Get("peekalljobs"),
|
|
90
91
|
ApiOkResponse({ type: [QueueItemDto] }),
|
|
@@ -95,6 +96,7 @@ __decorate([
|
|
|
95
96
|
__decorate([
|
|
96
97
|
UseGuards(DefaultAuthGuard, ClaimsAuthorisationGuard),
|
|
97
98
|
ApiBearerAuth(),
|
|
99
|
+
ApiOperation({ tags: ["SuperPower"] }),
|
|
98
100
|
MandatoryUserClaims("read:all"),
|
|
99
101
|
Get("peekfailedjobs")
|
|
100
102
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-webhook-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-webhook-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,UAAU,EACV,GAAG,EACH,IAAI,EAEJ,GAAG,EACH,SAAS,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,aAAa,
|
|
1
|
+
{"version":3,"file":"stripe-webhook-controller.js","sourceRoot":"","sources":["../../../src/stripe-client/controllers/stripe-webhook-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,UAAU,EACV,GAAG,EACH,IAAI,EAEJ,GAAG,EACH,SAAS,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,OAAO,EACP,aAAa,EACb,qBAAqB,EACrB,aA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AerC;AAlEQ,uBAAuB;IAFnC,UAAU,CAAC,iBAAiB,CAAC;IAC7B,OAAO,CAAC,UAAU,CAAC;IAIX,WAAA,WAAW,CAAC,eAAe,CAAC,CAAA;qCADU,oBAAoB;GAFtD,uBAAuB,CAmEnC;SAnEY,uBAAuB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StripeCheckoutLineItem } from "./StripeCheckoutLineItem.js";
|
|
2
2
|
export declare class StripeCheckoutSessionRequestDto {
|
|
3
|
-
|
|
3
|
+
organisationUuid?: string;
|
|
4
4
|
lineItems: StripeCheckoutLineItem[];
|
|
5
5
|
mode: "subscription" | "payment" | "setup";
|
|
6
6
|
successFrontendPath: string;
|
|
@@ -14,7 +14,7 @@ import { Type } from "class-transformer";
|
|
|
14
14
|
import { IsArray, IsIn, IsOptional, IsString, ValidateNested, } from "class-validator";
|
|
15
15
|
import { StripeCheckoutLineItem } from "./StripeCheckoutLineItem.js";
|
|
16
16
|
export class StripeCheckoutSessionRequestDto {
|
|
17
|
-
|
|
17
|
+
organisationUuid;
|
|
18
18
|
lineItems;
|
|
19
19
|
// eslint-disable-next-line @darraghor/nestjs-typed/validated-non-primitive-property-needs-type-decorator
|
|
20
20
|
mode;
|
|
@@ -25,7 +25,7 @@ __decorate([
|
|
|
25
25
|
ApiPropertyOptional(),
|
|
26
26
|
IsOptional(),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
|
-
], StripeCheckoutSessionRequestDto.prototype, "
|
|
28
|
+
], StripeCheckoutSessionRequestDto.prototype, "organisationUuid", void 0);
|
|
29
29
|
__decorate([
|
|
30
30
|
ApiProperty({ isArray: true, type: StripeCheckoutLineItem }),
|
|
31
31
|
IsArray(),
|
|
@@ -40,14 +40,14 @@ __decorate([
|
|
|
40
40
|
], StripeCheckoutSessionRequestDto.prototype, "mode", void 0);
|
|
41
41
|
__decorate([
|
|
42
42
|
ApiProperty({
|
|
43
|
-
description: "The
|
|
43
|
+
description: "The path on frontend to which Stripe should redirect the customer after payment. This is appended to the host configured in the StripeClientConfigurationService",
|
|
44
44
|
}),
|
|
45
45
|
IsString(),
|
|
46
46
|
__metadata("design:type", String)
|
|
47
47
|
], StripeCheckoutSessionRequestDto.prototype, "successFrontendPath", void 0);
|
|
48
48
|
__decorate([
|
|
49
49
|
ApiPropertyOptional({
|
|
50
|
-
description: "The
|
|
50
|
+
description: "The path on frontend to which Stripe should redirect the customer after payment cancellation. This is appended to the host configured in the StripeClientConfigurationService",
|
|
51
51
|
}),
|
|
52
52
|
IsOptional(),
|
|
53
53
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StripeCheckoutSessionRequestDto.js","sourceRoot":"","sources":["../../../src/stripe-client/models/StripeCheckoutSessionRequestDto.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,0CAA0C;;;;;;;;;;AAE1C,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,cAAc,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AAEnE,MAAM,OAAO,+BAA+B;IAGxC,
|
|
1
|
+
{"version":3,"file":"StripeCheckoutSessionRequestDto.js","sourceRoot":"","sources":["../../../src/stripe-client/models/StripeCheckoutSessionRequestDto.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,0CAA0C;;;;;;;;;;AAE1C,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,cAAc,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAC;AAEnE,MAAM,OAAO,+BAA+B;IAGxC,gBAAgB,CAAU;IAM1B,SAAS,CAA4B;IAErC,yGAAyG;IAGzG,IAAI,CAAwC;IAO5C,mBAAmB,CAAU;IAO7B,kBAAkB,CAAU;CAC/B;AA5BG;IAAC,mBAAmB,EAAE;IACrB,UAAU,EAAE;;yEACa;AAE1B;IAAC,WAAW,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,sBAAsB,EAAC,CAAC;IAC1D,OAAO,EAAE;IACT,cAAc,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;;kEACE;AAGrC;IAAC,WAAW,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;IAC3B,IAAI,CAAC,CAAC,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;;6DACC;AAE5C;IAAC,WAAW,CAAC;QACT,WAAW,EACP,kKAAkK;KACzK,CAAC;IACD,QAAQ,EAAE;;4EACkB;AAE7B;IAAC,mBAAmB,CAAC;QACjB,WAAW,EACP,+KAA+K;KACtL,CAAC;IACD,UAAU,EAAE;;2EACe"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RequestUser } from "../../authorization/models/RequestWithUser.js";
|
|
2
|
+
import { StripeCheckoutSessionRequestDto } from "../models/StripeCheckoutSessionRequestDto.js";
|
|
3
|
+
import { StripeCheckoutSessionResponseDto } from "../models/StripeCheckoutSessionResponseDto.js";
|
|
4
|
+
import { StripeCustomerPortalResponseDto } from "../models/StripeCustomerPortalResponseDto.js";
|
|
5
|
+
import { StripeCustomerPortalRequestDto } from "../models/StripeCustomerPortalRequestDto.js";
|
|
6
|
+
import { OrganisationSubscriptionService } from "../../organisation-subscriptions/organisation-subscriptions.service.js";
|
|
7
|
+
import { StripeCheckoutService } from "./stripe-checkout.service.js";
|
|
8
|
+
export declare class AuthenticatedStripeCheckoutService {
|
|
9
|
+
private readonly organisationSubscriptionService;
|
|
10
|
+
private readonly stripeCheckoutService;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(organisationSubscriptionService: OrganisationSubscriptionService, stripeCheckoutService: StripeCheckoutService);
|
|
13
|
+
createCustomerPortalSession(parameters: StripeCustomerPortalRequestDto, user: RequestUser): Promise<StripeCustomerPortalResponseDto>;
|
|
14
|
+
createCheckoutSession(parameters: StripeCheckoutSessionRequestDto, user: RequestUser): Promise<StripeCheckoutSessionResponseDto>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var AuthenticatedStripeCheckoutService_1;
|
|
11
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
12
|
+
import { Injectable, Logger } from "@nestjs/common";
|
|
13
|
+
import { OrganisationSubscriptionService } from "../../organisation-subscriptions/organisation-subscriptions.service.js";
|
|
14
|
+
import { StripeCheckoutService } from "./stripe-checkout.service.js";
|
|
15
|
+
let AuthenticatedStripeCheckoutService = AuthenticatedStripeCheckoutService_1 = class AuthenticatedStripeCheckoutService {
|
|
16
|
+
organisationSubscriptionService;
|
|
17
|
+
stripeCheckoutService;
|
|
18
|
+
logger = new Logger(AuthenticatedStripeCheckoutService_1.name);
|
|
19
|
+
constructor(organisationSubscriptionService, stripeCheckoutService) {
|
|
20
|
+
this.organisationSubscriptionService = organisationSubscriptionService;
|
|
21
|
+
this.stripeCheckoutService = stripeCheckoutService;
|
|
22
|
+
}
|
|
23
|
+
// must set the org id to the customer id field so we can get this later
|
|
24
|
+
async createCustomerPortalSession(parameters, user) {
|
|
25
|
+
// is the user an owner of the organisation with the subscription record
|
|
26
|
+
const subscriptionRecord = await this.organisationSubscriptionService.findOne(parameters.subscriptionRecordUuid);
|
|
27
|
+
if (!user.memberships ||
|
|
28
|
+
!user.memberships
|
|
29
|
+
.filter((m) => m.roles?.some((r) => r.name === "owner"))
|
|
30
|
+
.map((m) => m.organisation.uuid)
|
|
31
|
+
.includes(subscriptionRecord.organisation.uuid)) {
|
|
32
|
+
{
|
|
33
|
+
this.logger.error("Create Stripe session error. Not an owner of the organisation", {
|
|
34
|
+
userUuid: user.uuid,
|
|
35
|
+
organisationUuid: subscriptionRecord.organisation.uuid,
|
|
36
|
+
});
|
|
37
|
+
throw new Error("You are not a member of the organisation associated with this billing account");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return this.stripeCheckoutService.createStripePortalSession(subscriptionRecord.paymentSystemCustomerId, parameters.returnUrl);
|
|
41
|
+
}
|
|
42
|
+
async createCheckoutSession(parameters, user) {
|
|
43
|
+
// is the current user the owner of the org?
|
|
44
|
+
if (!parameters.organisationUuid ||
|
|
45
|
+
!user.memberships ||
|
|
46
|
+
!user.memberships
|
|
47
|
+
.filter((m) => m.roles?.some((r) => r.name === "owner"))
|
|
48
|
+
.map((m) => m.organisation.uuid)
|
|
49
|
+
.includes(parameters.organisationUuid)) {
|
|
50
|
+
this.logger.error("Create Stripe session error. Not an owner of the organisation", {
|
|
51
|
+
userUuid: user.uuid,
|
|
52
|
+
organisationUuid: parameters.organisationUuid,
|
|
53
|
+
});
|
|
54
|
+
throw new Error("You are not the owner of this organisation");
|
|
55
|
+
}
|
|
56
|
+
return this.stripeCheckoutService.createCheckoutSession(parameters);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
AuthenticatedStripeCheckoutService = AuthenticatedStripeCheckoutService_1 = __decorate([
|
|
60
|
+
Injectable(),
|
|
61
|
+
__metadata("design:paramtypes", [OrganisationSubscriptionService,
|
|
62
|
+
StripeCheckoutService])
|
|
63
|
+
], AuthenticatedStripeCheckoutService);
|
|
64
|
+
export { AuthenticatedStripeCheckoutService };
|
|
65
|
+
//# sourceMappingURL=auth-stripe-checkout.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-stripe-checkout.service.js","sourceRoot":"","sources":["../../../src/stripe-client/services/auth-stripe-checkout.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,yDAAyD;AACzD,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAMlD,OAAO,EAAC,+BAA+B,EAAC,MAAM,wEAAwE,CAAC;AACvH,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AAG5D,IAAM,kCAAkC,0CAAxC,MAAM,kCAAkC;IAKtB;IACA;IALJ,MAAM,GAAG,IAAI,MAAM,CAChC,oCAAkC,CAAC,IAAI,CAC1C,CAAC;IACF,YACqB,+BAAgE,EAChE,qBAA4C;QAD5C,oCAA+B,GAA/B,+BAA+B,CAAiC;QAChE,0BAAqB,GAArB,qBAAqB,CAAuB;IAC9D,CAAC;IAEJ,wEAAwE;IACjE,KAAK,CAAC,2BAA2B,CACpC,UAA0C,EAC1C,IAAiB;QAEjB,wEAAwE;QACxE,MAAM,kBAAkB,GACpB,MAAM,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAC9C,UAAU,CAAC,sBAAsB,CACpC,CAAC;QACN,IACI,CAAC,IAAI,CAAC,WAAW;YACjB,CAAC,IAAI,CAAC,WAAW;iBACZ,MAAM,CAAC,CAAC,CAAC,EAAE,E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ChD,CACJ,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;QAED,OAAO,IAAI,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAtEY,kCAAkC;IAD9C,UAAU,EAAE;qCAM6C,+BAA+B;QACzC,qBAAqB;GANxD,kCAAkC,CAsE9C;SAtEY,kCAAkC"}
|
|
@@ -14,7 +14,7 @@ export declare class StripeQueuedEventHandler {
|
|
|
14
14
|
onActive(job: Job<Stripe.Event>): void;
|
|
15
15
|
onComplete(job: Job<Stripe.Event>): void;
|
|
16
16
|
mapCheckoutSessionToSubFulfilment(fullSession: Stripe.Response<Stripe.Checkout.Session>): SaveOrganisationSubscriptionRecordDto[];
|
|
17
|
-
private
|
|
17
|
+
private createFulfilmentDto;
|
|
18
18
|
mapInvoiceToSubFulfilment(fullInvoice: Stripe.Response<Stripe.Invoice>): SaveOrganisationSubscriptionRecordDto[];
|
|
19
19
|
private mapPaymentType;
|
|
20
20
|
private mapNewValidUntil;
|
|
@@ -52,14 +52,14 @@ let StripeQueuedEventHandler = StripeQueuedEventHandler_1 = class StripeQueuedEv
|
|
|
52
52
|
// for one-off products use today + 100 years
|
|
53
53
|
const subs = [];
|
|
54
54
|
for (const lineItem of fullSession.line_items.data) {
|
|
55
|
-
const subscriptionFulfilmentDto = this.
|
|
55
|
+
const subscriptionFulfilmentDto = this.createFulfilmentDto(lineItem.price?.product, fullSession.customer, fullSession.customer_email, fullSession.customer_details?.email);
|
|
56
56
|
subscriptionFulfilmentDto.paymentSystemMode = this.mapPaymentType(lineItem.price?.type, fullSession.mode);
|
|
57
57
|
subscriptionFulfilmentDto.validUntil = this.mapNewValidUntil(subscriptionFulfilmentDto.paymentSystemMode, true, fullSession.subscription
|
|
58
|
-
|
|
58
|
+
?.current_period_end);
|
|
59
59
|
subscriptionFulfilmentDto.paymentSystemTransactionId =
|
|
60
60
|
fullSession.mode === "subscription" ||
|
|
61
61
|
lineItem.price?.type === "recurring"
|
|
62
|
-
? fullSession.subscription
|
|
62
|
+
? fullSession.subscription?.id
|
|
63
63
|
: fullSession.id;
|
|
64
64
|
subscriptionFulfilmentDto.millerPaymentReferenceUuid =
|
|
65
65
|
fullSession.client_reference_id ?? undefined;
|
|
@@ -67,7 +67,7 @@ let StripeQueuedEventHandler = StripeQueuedEventHandler_1 = class StripeQueuedEv
|
|
|
67
67
|
}
|
|
68
68
|
return subs;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
createFulfilmentDto(product, customer, altEmail, altEmail2) {
|
|
71
71
|
const subscriptionFulfilmentDto = new SaveOrganisationSubscriptionRecordDto();
|
|
72
72
|
subscriptionFulfilmentDto.paymentSystemName = "stripe";
|
|
73
73
|
subscriptionFulfilmentDto.paymentSystemProductId = product?.id;
|
|
@@ -86,7 +86,7 @@ let StripeQueuedEventHandler = StripeQueuedEventHandler_1 = class StripeQueuedEv
|
|
|
86
86
|
// for one-off products use today + 100 years
|
|
87
87
|
const subs = [];
|
|
88
88
|
for (const lineItem of fullInvoice.lines.data) {
|
|
89
|
-
const subscriptionFulfilmentDto = this.
|
|
89
|
+
const subscriptionFulfilmentDto = this.createFulfilmentDto(lineItem.price?.product, fullInvoice.customer, fullInvoice.customer_email);
|
|
90
90
|
const fullSubscription = fullInvoice.subscription;
|
|
91
91
|
subscriptionFulfilmentDto.paymentSystemMode = this.mapPaymentType(lineItem.price?.type);
|
|
92
92
|
subscriptionFulfilmentDto.validUntil = this.mapNewValidUntil(subscriptionFulfilmentDto.paymentSystemMode, fullSubscription.status === "active" ||
|
|
@@ -130,7 +130,7 @@ let StripeQueuedEventHandler = StripeQueuedEventHandler_1 = class StripeQueuedEv
|
|
|
130
130
|
// for one-off products use today + 100 years
|
|
131
131
|
const subs = [];
|
|
132
132
|
for (const lineItem of fullSubscription.items.data) {
|
|
133
|
-
const subscriptionFulfilmentDto = this.
|
|
133
|
+
const subscriptionFulfilmentDto = this.createFulfilmentDto(lineItem.price?.product, fullSubscription.customer);
|
|
134
134
|
subscriptionFulfilmentDto.paymentSystemMode = "subscription";
|
|
135
135
|
subscriptionFulfilmentDto.paymentSystemTransactionId =
|
|
136
136
|
fullSubscription.id;
|
|
@@ -340,8 +340,11 @@ __decorate([
|
|
|
340
340
|
StripeQueuedEventHandler = StripeQueuedEventHandler_1 = __decorate([
|
|
341
341
|
Injectable(),
|
|
342
342
|
Processor("stripe-events")
|
|
343
|
-
// This is just
|
|
344
|
-
//
|
|
343
|
+
// This is just a looong example with notes. You should create your own handler
|
|
344
|
+
// with this as a reference
|
|
345
|
+
// You likely only need to handle the "checkout.session.completed" event for purchases
|
|
346
|
+
// and the "customer.subscription.updated" event for subscription updates
|
|
347
|
+
// https://stripe.com/docs/billing/subscriptions/webhooks
|
|
345
348
|
// eslint-disable-next-line @darraghor/nestjs-typed/injectable-should-be-provided
|
|
346
349
|
,
|
|
347
350
|
__param(0, Inject("StripeClient")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queued-payment-event.handler.js","sourceRoot":"","sources":["../../../src/stripe-client/services/queued-payment-event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAAgD;AAChD,6DAA6D;AAC7D,mDAAmD;AACnD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,SAAS,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,qCAAqC,EAAC,MAAM,mEAAmE,CAAC;AACxH,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,+BAA+B,EAAC,MAAM,wEAAwE,CAAC;
|
|
1
|
+
{"version":3,"file":"queued-payment-event.handler.js","sourceRoot":"","sources":["../../../src/stripe-client/services/queued-payment-event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAAgD;AAChD,6DAA6D;AAC7D,mDAAmD;AACnD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,OAAO,EACP,SAAS,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,qCAAqC,EAAC,MAAM,mEAAmE,CAAC;AACxH,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,+BAA+B,EAAC,MAAM,wEAAwE,CAAC;AAWhH,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAIZ;IAEA;IACA;IANJ,MAAM,GAAG,IAAI,MAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IACpE,YAEqB,MAAc,EAEd,6BAA8D,EAC9D,+BAAgE;QAHhE,WAAM,GAAN,MAAM,CAAQ;QAEd,kCAA6B,GAA7B,6BAA6B,CAAiC;QAC9D,oCAA+B,GAA/B,+BAA+B,CAAiC;IAClF,CAAC;IAEJ,OAAO,CAAC,GAAsB,EAAE,KAAY;QACxC,IAAI,CAAC,MAAM,CAAC,KAAK;QACb,0KAA0K;QAC1K,cAAc,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,OAAc,EAAE;QACnE,sEAAsE;QACtE,EAAC,UAAU,EAAE,KAAK,EAAC,CACtB,CAAC;IACN,CAAC;IAGD,0DAA0D;IAC1D,QAAQ,CA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A2B;IAC3B,sFAAsF;IACtF,yEAAyE;IACzE,yDAAyD;IAEzD,iFAAiF;;IAIxE,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;IAEtB,WAAA,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;qCADb,MAAM;QAEiB,UAAU;QACR,+BAA+B;GAP5E,wBAAwB,CAibpC;SAjbY,wBAAwB"}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import Stripe from "stripe";
|
|
2
|
-
import { RequestUser } from "../../authorization/models/RequestWithUser.js";
|
|
3
2
|
import { StripeCheckoutSessionRequestDto } from "../models/StripeCheckoutSessionRequestDto.js";
|
|
4
3
|
import { StripeCheckoutSessionResponseDto } from "../models/StripeCheckoutSessionResponseDto.js";
|
|
5
4
|
import { StripeClientConfigurationService } from "../StripeClientConfigurationService.js";
|
|
6
5
|
import { PaymentSessionService } from "../../payment-sessions/payment-session.service.js";
|
|
7
|
-
import { StripeCustomerPortalResponseDto } from "../models/StripeCustomerPortalResponseDto.js";
|
|
8
|
-
import { StripeCustomerPortalRequestDto } from "../models/StripeCustomerPortalRequestDto.js";
|
|
9
6
|
import { StripeCheckoutEvent } from "../entities/stripe-checkout-event.entity.js";
|
|
10
7
|
import { Repository } from "typeorm";
|
|
11
|
-
import {
|
|
12
|
-
/**
|
|
13
|
-
* Is this doing too much? probably.
|
|
14
|
-
*/
|
|
8
|
+
import { StripeCustomerPortalResponseDto } from "../models/StripeCustomerPortalResponseDto.js";
|
|
15
9
|
export declare class StripeCheckoutService {
|
|
16
10
|
private readonly clientInstance;
|
|
17
11
|
private readonly stripeClientConfigurationService;
|
|
18
12
|
private readonly paymentSessionService;
|
|
19
|
-
private readonly organisationSubscriptionService;
|
|
20
13
|
private readonly stripeCheckoutEventRepository;
|
|
21
14
|
private readonly logger;
|
|
22
|
-
constructor(clientInstance: Stripe, stripeClientConfigurationService: StripeClientConfigurationService, paymentSessionService: PaymentSessionService,
|
|
23
|
-
createCustomerPortalSession(parameters: StripeCustomerPortalRequestDto, user: RequestUser): Promise<StripeCustomerPortalResponseDto>;
|
|
24
|
-
createAuthenticatedCheckoutSession(parameters: StripeCheckoutSessionRequestDto, user: RequestUser): Promise<StripeCheckoutSessionResponseDto>;
|
|
15
|
+
constructor(clientInstance: Stripe, stripeClientConfigurationService: StripeClientConfigurationService, paymentSessionService: PaymentSessionService, stripeCheckoutEventRepository: Repository<StripeCheckoutEvent>);
|
|
25
16
|
createCheckoutSession(parameters: StripeCheckoutSessionRequestDto): Promise<StripeCheckoutSessionResponseDto>;
|
|
26
|
-
|
|
17
|
+
createStripePortalSession(paymentSystemCustomerId: string, returnUrl: string): Promise<StripeCustomerPortalResponseDto>;
|
|
27
18
|
getLast(take: number, skip: number): Promise<StripeCheckoutEvent[]>;
|
|
28
19
|
}
|