@carlonicora/nestjs-neo4jsonapi 1.31.2 → 1.32.0
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/common/helpers/define-entity.d.ts +29 -0
- package/dist/common/helpers/define-entity.d.ts.map +1 -1
- package/dist/common/helpers/define-entity.js +42 -1
- package/dist/common/helpers/define-entity.js.map +1 -1
- package/dist/common/interfaces/entity.descriptor.interface.d.ts +2 -2
- package/dist/common/interfaces/entity.descriptor.interface.d.ts.map +1 -1
- package/dist/common/interfaces/entity.descriptor.interface.js +2 -1
- package/dist/common/interfaces/entity.descriptor.interface.js.map +1 -1
- package/dist/common/interfaces/entity.schema.interface.d.ts +19 -1
- package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
- package/dist/core/email/templates/en/paymentFailure.hbs +56 -0
- package/dist/core/email/templates/en/paymentSuccessAdmin.hbs +31 -0
- package/dist/core/email/templates/en/paymentSuccessCustomer.hbs +51 -0
- package/dist/core/email/templates/en/subscriptionStatusChange.hbs +48 -0
- package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.d.ts.map +1 -1
- package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.js +13 -0
- package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.js.map +1 -1
- package/dist/core/jsonapi/serialisers/jsonapi.paginator.d.ts +3 -0
- package/dist/core/jsonapi/serialisers/jsonapi.paginator.d.ts.map +1 -1
- package/dist/core/jsonapi/serialisers/jsonapi.paginator.js +6 -0
- package/dist/core/jsonapi/serialisers/jsonapi.paginator.js.map +1 -1
- package/dist/core/jsonapi/services/jsonapi.service.d.ts.map +1 -1
- package/dist/core/jsonapi/services/jsonapi.service.js +6 -0
- package/dist/core/jsonapi/services/jsonapi.service.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.d.ts +2 -0
- package/dist/core/neo4j/abstracts/abstract.service.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.js +8 -4
- package/dist/core/neo4j/abstracts/abstract.service.js.map +1 -1
- package/dist/core/neo4j/services/neo4j.service.d.ts +9 -0
- package/dist/core/neo4j/services/neo4j.service.d.ts.map +1 -1
- package/dist/core/neo4j/services/neo4j.service.js +95 -1
- package/dist/core/neo4j/services/neo4j.service.js.map +1 -1
- package/dist/foundations/audit/entities/audit.entity.d.ts +1 -1
- package/dist/foundations/audit/entities/audit.entity.d.ts.map +1 -1
- package/dist/foundations/audit/serialisers/audit.serialiser.js +2 -2
- package/dist/foundations/audit/serialisers/audit.serialiser.js.map +1 -1
- package/dist/foundations/auth/entities/auth.entity.d.ts +1 -1
- package/dist/foundations/auth/entities/auth.entity.d.ts.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.d.ts +1 -1
- package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.js +31 -13
- package/dist/foundations/auth/repositories/auth.repository.js.map +1 -1
- package/dist/foundations/auth/serialisers/auth.serialiser.js +2 -2
- package/dist/foundations/auth/serialisers/auth.serialiser.js.map +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/company/company.module.d.ts.map +1 -1
- package/dist/foundations/company/company.module.js +9 -5
- package/dist/foundations/company/company.module.js.map +1 -1
- package/dist/foundations/company/entities/company.d.ts +44 -0
- package/dist/foundations/company/entities/company.d.ts.map +1 -0
- package/dist/foundations/company/entities/company.js +47 -0
- package/dist/foundations/company/entities/company.js.map +1 -0
- package/dist/foundations/company/entities/company.meta.d.ts +1 -1
- package/dist/foundations/company/entities/company.meta.d.ts.map +1 -1
- package/dist/foundations/company/index.d.ts +1 -2
- package/dist/foundations/company/index.d.ts.map +1 -1
- package/dist/foundations/company/index.js +3 -3
- package/dist/foundations/company/index.js.map +1 -1
- package/dist/foundations/company/repositories/company.repository.d.ts +26 -1
- package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
- package/dist/foundations/company/repositories/company.repository.js +67 -11
- package/dist/foundations/company/repositories/company.repository.js.map +1 -1
- package/dist/foundations/company/services/company.service.d.ts +4 -1
- package/dist/foundations/company/services/company.service.d.ts.map +1 -1
- package/dist/foundations/company/services/company.service.js +11 -6
- package/dist/foundations/company/services/company.service.js.map +1 -1
- package/dist/foundations/content/entities/content.entity.d.ts +1 -1
- package/dist/foundations/content/entities/content.entity.d.ts.map +1 -1
- package/dist/foundations/content/serialisers/content.serialiser.js +3 -3
- package/dist/foundations/content/serialisers/content.serialiser.js.map +1 -1
- package/dist/foundations/module/queries/feature.module.query.d.ts +3 -1
- package/dist/foundations/module/queries/feature.module.query.d.ts.map +1 -1
- package/dist/foundations/module/queries/feature.module.query.js +27 -15
- package/dist/foundations/module/queries/feature.module.query.js.map +1 -1
- package/dist/foundations/notification/entities/notification.entity.d.ts +1 -1
- package/dist/foundations/notification/entities/notification.entity.d.ts.map +1 -1
- package/dist/foundations/notification/serialisers/notifications.serialiser.js +2 -2
- package/dist/foundations/notification/serialisers/notifications.serialiser.js.map +1 -1
- package/dist/foundations/oauth/entities/oauth.client.entity.d.ts +2 -2
- package/dist/foundations/oauth/entities/oauth.client.entity.d.ts.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.d.ts.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js.map +1 -1
- package/dist/foundations/relevancy/services/relevancy.service.js +1 -1
- package/dist/foundations/relevancy/services/relevancy.service.js.map +1 -1
- package/dist/foundations/role/entities/role.d.ts +28 -0
- package/dist/foundations/role/entities/role.d.ts.map +1 -0
- package/dist/foundations/role/entities/role.js +33 -0
- package/dist/foundations/role/entities/role.js.map +1 -0
- package/dist/foundations/role/entities/role.meta.d.ts +1 -1
- package/dist/foundations/role/entities/role.meta.d.ts.map +1 -1
- package/dist/foundations/role/repositories/role.repository.d.ts +1 -1
- package/dist/foundations/role/repositories/role.repository.d.ts.map +1 -1
- package/dist/foundations/role/repositories/role.repository.js +7 -7
- package/dist/foundations/role/repositories/role.repository.js.map +1 -1
- package/dist/foundations/role/role.module.d.ts.map +1 -1
- package/dist/foundations/role/role.module.js +3 -4
- package/dist/foundations/role/role.module.js.map +1 -1
- package/dist/foundations/role/services/role.service.js +5 -5
- package/dist/foundations/role/services/role.service.js.map +1 -1
- package/dist/foundations/stripe-customer/entities/stripe-customer.entity.d.ts +1 -1
- package/dist/foundations/stripe-customer/entities/stripe-customer.entity.d.ts.map +1 -1
- package/dist/foundations/stripe-price/dtos/stripe-price.dto.d.ts +12 -0
- package/dist/foundations/stripe-price/dtos/stripe-price.dto.d.ts.map +1 -1
- package/dist/foundations/stripe-price/dtos/stripe-price.dto.js +47 -1
- package/dist/foundations/stripe-price/dtos/stripe-price.dto.js.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts +2 -0
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.map.d.ts.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.map.js +1 -0
- package/dist/foundations/stripe-price/entities/stripe-price.map.js.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.model.d.ts.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.model.js +2 -1
- package/dist/foundations/stripe-price/entities/stripe-price.model.js.map +1 -1
- package/dist/foundations/stripe-price/repositories/stripe-price.repository.d.ts +3 -0
- package/dist/foundations/stripe-price/repositories/stripe-price.repository.d.ts.map +1 -1
- package/dist/foundations/stripe-price/repositories/stripe-price.repository.js +64 -4
- package/dist/foundations/stripe-price/repositories/stripe-price.repository.js.map +1 -1
- package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.d.ts.map +1 -1
- package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.js +5 -0
- package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.js.map +1 -1
- package/dist/foundations/stripe-price/services/stripe-price-admin.service.d.ts.map +1 -1
- package/dist/foundations/stripe-price/services/stripe-price-admin.service.js +10 -0
- package/dist/foundations/stripe-price/services/stripe-price-admin.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts +11 -0
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js +22 -0
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js.map +1 -1
- package/dist/foundations/stripe-subscription/services/feature-sync.service.d.ts +33 -0
- package/dist/foundations/stripe-subscription/services/feature-sync.service.d.ts.map +1 -0
- package/dist/foundations/stripe-subscription/services/feature-sync.service.js +155 -0
- package/dist/foundations/stripe-subscription/services/feature-sync.service.js.map +1 -0
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js +11 -0
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/stripe-subscription.module.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/stripe-subscription.module.js +3 -0
- package/dist/foundations/stripe-subscription/stripe-subscription.module.js.map +1 -1
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts +3 -1
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts.map +1 -1
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js +79 -9
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js.map +1 -1
- package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.d.ts +26 -1
- package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.d.ts.map +1 -1
- package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.js +124 -2
- package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.js.map +1 -1
- package/dist/foundations/stripe-webhook/stripe-webhook.module.d.ts.map +1 -1
- package/dist/foundations/stripe-webhook/stripe-webhook.module.js +2 -0
- package/dist/foundations/stripe-webhook/stripe-webhook.module.js.map +1 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts +1 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts.map +1 -1
- package/dist/foundations/user/controllers/user.controller.d.ts +1 -1
- package/dist/foundations/user/controllers/user.controller.d.ts.map +1 -1
- package/dist/foundations/user/entities/user.d.ts +124 -0
- package/dist/foundations/user/entities/user.d.ts.map +1 -0
- package/dist/foundations/user/entities/user.js +81 -0
- package/dist/foundations/user/entities/user.js.map +1 -0
- package/dist/foundations/user/entities/user.meta.d.ts +1 -1
- package/dist/foundations/user/entities/user.meta.d.ts.map +1 -1
- package/dist/foundations/user/index.d.ts +1 -4
- package/dist/foundations/user/index.d.ts.map +1 -1
- package/dist/foundations/user/index.js +6 -23
- package/dist/foundations/user/index.js.map +1 -1
- package/dist/foundations/user/repositories/user.repository.d.ts +13 -1
- package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
- package/dist/foundations/user/repositories/user.repository.js +85 -21
- package/dist/foundations/user/repositories/user.repository.js.map +1 -1
- package/dist/foundations/user/services/user.service.d.ts.map +1 -1
- package/dist/foundations/user/services/user.service.js +12 -12
- package/dist/foundations/user/services/user.service.js.map +1 -1
- package/dist/foundations/user/user.module.d.ts.map +1 -1
- package/dist/foundations/user/user.module.js +7 -8
- package/dist/foundations/user/user.module.js.map +1 -1
- package/dist/openapi/factories/entity-schema.factory.js +12 -0
- package/dist/openapi/factories/entity-schema.factory.js.map +1 -1
- package/dist/openapi/schemas/jsonapi-base.schemas.d.ts +1 -0
- package/dist/openapi/schemas/jsonapi-base.schemas.d.ts.map +1 -1
- package/dist/openapi/schemas/jsonapi-base.schemas.js.map +1 -1
- package/dist/tools/migrate-entity/__tests__/ast-parser.spec.js +331 -0
- package/dist/tools/migrate-entity/__tests__/descriptor-generator.spec.js +482 -0
- package/dist/tools/migrate-entity/__tests__/file-discovery.spec.js +190 -0
- package/dist/tools/migrate-entity/__tests__/integration.spec.js +261 -0
- package/dist/tools/migrate-entity/index.js +2 -2
- package/dist/tools/migrate-entity/lib/ast-parser.js +255 -10
- package/dist/tools/migrate-entity/lib/descriptor-generator.js +384 -55
- package/dist/tools/migrate-entity/lib/entity-migrator.js +112 -9
- package/dist/tools/migrate-entity/lib/module-updater.js +25 -9
- package/dist/tools/migrate-entity/lib/reference-updater.js +110 -24
- package/package.json +2 -2
- package/dist/foundations/company/entities/company.entity.d.ts +0 -18
- package/dist/foundations/company/entities/company.entity.d.ts.map +0 -1
- package/dist/foundations/company/entities/company.entity.js +0 -3
- package/dist/foundations/company/entities/company.entity.js.map +0 -1
- package/dist/foundations/company/entities/company.map.d.ts +0 -8
- package/dist/foundations/company/entities/company.map.d.ts.map +0 -1
- package/dist/foundations/company/entities/company.map.js +0 -23
- package/dist/foundations/company/entities/company.map.js.map +0 -1
- package/dist/foundations/company/entities/company.model.d.ts +0 -4
- package/dist/foundations/company/entities/company.model.d.ts.map +0 -1
- package/dist/foundations/company/entities/company.model.js +0 -17
- package/dist/foundations/company/entities/company.model.js.map +0 -1
- package/dist/foundations/company/serialisers/company.serialiser.d.ts +0 -14
- package/dist/foundations/company/serialisers/company.serialiser.d.ts.map +0 -1
- package/dist/foundations/company/serialisers/company.serialiser.js +0 -76
- package/dist/foundations/company/serialisers/company.serialiser.js.map +0 -1
- package/dist/foundations/role/entities/role.entity.d.ts +0 -9
- package/dist/foundations/role/entities/role.entity.d.ts.map +0 -1
- package/dist/foundations/role/entities/role.entity.js +0 -3
- package/dist/foundations/role/entities/role.entity.js.map +0 -1
- package/dist/foundations/role/entities/role.map.d.ts +0 -8
- package/dist/foundations/role/entities/role.map.d.ts.map +0 -1
- package/dist/foundations/role/entities/role.map.js +0 -15
- package/dist/foundations/role/entities/role.map.js.map +0 -1
- package/dist/foundations/role/entities/role.model.d.ts +0 -4
- package/dist/foundations/role/entities/role.model.d.ts.map +0 -1
- package/dist/foundations/role/entities/role.model.js +0 -15
- package/dist/foundations/role/entities/role.model.js.map +0 -1
- package/dist/foundations/role/serialisers/role.serialiser.d.ts +0 -12
- package/dist/foundations/role/serialisers/role.serialiser.d.ts.map +0 -1
- package/dist/foundations/role/serialisers/role.serialiser.js +0 -46
- package/dist/foundations/role/serialisers/role.serialiser.js.map +0 -1
- package/dist/foundations/user/entities/user.entity.d.ts +0 -26
- package/dist/foundations/user/entities/user.entity.d.ts.map +0 -1
- package/dist/foundations/user/entities/user.entity.js +0 -3
- package/dist/foundations/user/entities/user.entity.js.map +0 -1
- package/dist/foundations/user/entities/user.map.d.ts +0 -8
- package/dist/foundations/user/entities/user.map.d.ts.map +0 -1
- package/dist/foundations/user/entities/user.map.js +0 -27
- package/dist/foundations/user/entities/user.map.js.map +0 -1
- package/dist/foundations/user/entities/user.model.d.ts +0 -7
- package/dist/foundations/user/entities/user.model.d.ts.map +0 -1
- package/dist/foundations/user/entities/user.model.js +0 -30
- package/dist/foundations/user/entities/user.model.js.map +0 -1
- package/dist/foundations/user/serialisers/user.serialiser.d.ts +0 -14
- package/dist/foundations/user/serialisers/user.serialiser.d.ts.map +0 -1
- package/dist/foundations/user/serialisers/user.serialiser.js +0 -80
- package/dist/foundations/user/serialisers/user.serialiser.js.map +0 -1
|
@@ -20,13 +20,14 @@ const stripe_invoice_repository_1 = require("../../stripe-invoice/repositories/s
|
|
|
20
20
|
const stripe_price_repository_1 = require("../../stripe-price/repositories/stripe-price.repository");
|
|
21
21
|
const stripe_subscription_repository_1 = require("../../stripe-subscription/repositories/stripe-subscription.repository");
|
|
22
22
|
const stripe_subscription_admin_service_1 = require("../../stripe-subscription/services/stripe-subscription-admin.service");
|
|
23
|
+
const feature_sync_service_1 = require("../../stripe-subscription/services/feature-sync.service");
|
|
23
24
|
const token_allocation_service_1 = require("../../stripe-subscription/services/token-allocation.service");
|
|
24
25
|
const stripe_service_1 = require("../../stripe/services/stripe.service");
|
|
25
26
|
const stripe_invoice_admin_service_1 = require("../../stripe-invoice/services/stripe-invoice-admin.service");
|
|
26
27
|
const stripe_webhook_event_repository_1 = require("../repositories/stripe-webhook-event.repository");
|
|
27
28
|
const stripe_webhook_notification_service_1 = require("../services/stripe-webhook-notification.service");
|
|
28
29
|
let StripeWebhookProcessor = class StripeWebhookProcessor extends bullmq_1.WorkerHost {
|
|
29
|
-
constructor(stripeWebhookEventRepository, subscriptionService, stripeCustomerRepository, subscriptionRepository, stripeInvoiceRepository, stripePriceRepository, notificationService, tokenAllocationService, stripeService, companyRepository, stripeInvoiceAdminService, logger) {
|
|
30
|
+
constructor(stripeWebhookEventRepository, subscriptionService, stripeCustomerRepository, subscriptionRepository, stripeInvoiceRepository, stripePriceRepository, notificationService, tokenAllocationService, featureSyncService, stripeService, companyRepository, stripeInvoiceAdminService, logger) {
|
|
30
31
|
super();
|
|
31
32
|
this.stripeWebhookEventRepository = stripeWebhookEventRepository;
|
|
32
33
|
this.subscriptionService = subscriptionService;
|
|
@@ -36,6 +37,7 @@ let StripeWebhookProcessor = class StripeWebhookProcessor extends bullmq_1.Worke
|
|
|
36
37
|
this.stripePriceRepository = stripePriceRepository;
|
|
37
38
|
this.notificationService = notificationService;
|
|
38
39
|
this.tokenAllocationService = tokenAllocationService;
|
|
40
|
+
this.featureSyncService = featureSyncService;
|
|
39
41
|
this.stripeService = stripeService;
|
|
40
42
|
this.companyRepository = companyRepository;
|
|
41
43
|
this.stripeInvoiceAdminService = stripeInvoiceAdminService;
|
|
@@ -126,19 +128,28 @@ let StripeWebhookProcessor = class StripeWebhookProcessor extends bullmq_1.Worke
|
|
|
126
128
|
stripeCustomerId: stripeCustomer.id,
|
|
127
129
|
});
|
|
128
130
|
if (company) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
this.logger.debug(`Company ${company.id} subscription marked active`);
|
|
135
|
-
}
|
|
136
|
-
else if (subscription.status === "canceled") {
|
|
131
|
+
// NOTE: We do NOT mark isActiveSubscription=true here based on subscription status.
|
|
132
|
+
// The subscription should only be marked active when payment is confirmed (invoice.paid).
|
|
133
|
+
// The TokenAllocationService.allocateTokensOnPayment handles setting isActiveSubscription=true.
|
|
134
|
+
if (subscription.status === "canceled") {
|
|
137
135
|
await this.companyRepository.markSubscriptionStatus({
|
|
138
136
|
companyId: company.id,
|
|
139
137
|
isActiveSubscription: false,
|
|
140
138
|
});
|
|
141
139
|
this.logger.debug(`Company ${company.id} subscription marked inactive (canceled)`);
|
|
140
|
+
// Remove features (non-blocking, smart removal)
|
|
141
|
+
try {
|
|
142
|
+
const featureResult = await this.featureSyncService.removeFeaturesOnSubscriptionEnd({
|
|
143
|
+
stripeSubscriptionId: subscription.id,
|
|
144
|
+
});
|
|
145
|
+
if (featureResult.success && featureResult.featuresRemoved?.length) {
|
|
146
|
+
this.logger.debug(`Feature removal: ${featureResult.featuresRemoved.length} features removed for subscription ${subscription.id}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.logger.error(`Feature removal failed for ${subscription.id}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
151
|
+
// Don't throw - feature removal failure should not fail webhook
|
|
152
|
+
}
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
else {
|
|
@@ -267,6 +278,40 @@ let StripeWebhookProcessor = class StripeWebhookProcessor extends bullmq_1.Worke
|
|
|
267
278
|
this.logger.error(`Token allocation failed for subscription ${subscriptionId}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
268
279
|
// Don't throw - token allocation failure should not fail webhook processing
|
|
269
280
|
}
|
|
281
|
+
// Sync features (non-blocking)
|
|
282
|
+
try {
|
|
283
|
+
const featureResult = await this.featureSyncService.syncFeaturesOnPayment({
|
|
284
|
+
stripeSubscriptionId: subscriptionId,
|
|
285
|
+
});
|
|
286
|
+
if (featureResult.success && featureResult.featuresAdded?.length) {
|
|
287
|
+
this.logger.debug(`Feature sync: ${featureResult.featuresAdded.length} features added for subscription ${subscriptionId}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
this.logger.error(`Feature sync failed for ${subscriptionId}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
292
|
+
// Don't throw - feature sync failure should not fail webhook
|
|
293
|
+
}
|
|
294
|
+
// Send payment success notifications (non-blocking)
|
|
295
|
+
try {
|
|
296
|
+
await this.notificationService.sendPaymentSuccessToCompanyAdmins({
|
|
297
|
+
stripeCustomerId,
|
|
298
|
+
stripeInvoiceId: invoice.id,
|
|
299
|
+
amount: invoice.amount_paid / 100, // Convert cents to dollars
|
|
300
|
+
currency: invoice.currency,
|
|
301
|
+
isOneTimePurchase: false,
|
|
302
|
+
});
|
|
303
|
+
await this.notificationService.sendPaymentSuccessToPlatformAdmins({
|
|
304
|
+
stripeCustomerId,
|
|
305
|
+
stripeInvoiceId: invoice.id,
|
|
306
|
+
amount: invoice.amount_paid / 100,
|
|
307
|
+
currency: invoice.currency,
|
|
308
|
+
isOneTimePurchase: false,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
this.logger.error(`Failed to send payment success notifications for invoice ${invoice.id}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
313
|
+
// Don't throw - notification failure should not fail webhook processing
|
|
314
|
+
}
|
|
270
315
|
}
|
|
271
316
|
}
|
|
272
317
|
async handleCustomerEvent(eventType, customer) {
|
|
@@ -320,6 +365,30 @@ let StripeWebhookProcessor = class StripeWebhookProcessor extends bullmq_1.Worke
|
|
|
320
365
|
this.logger.error(`Extra token allocation failed for one-time purchase ${paymentIntent.id}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
321
366
|
// Don't throw - token allocation failure should not fail webhook processing
|
|
322
367
|
}
|
|
368
|
+
// Send payment success notifications (non-blocking)
|
|
369
|
+
const stripeCustomerId = typeof paymentIntent.customer === "string" ? paymentIntent.customer : paymentIntent.customer?.id;
|
|
370
|
+
if (stripeCustomerId) {
|
|
371
|
+
try {
|
|
372
|
+
await this.notificationService.sendPaymentSuccessToCompanyAdmins({
|
|
373
|
+
stripeCustomerId,
|
|
374
|
+
stripePaymentIntentId: paymentIntent.id,
|
|
375
|
+
amount: paymentIntent.amount / 100, // Convert cents to dollars
|
|
376
|
+
currency: paymentIntent.currency,
|
|
377
|
+
isOneTimePurchase: true,
|
|
378
|
+
});
|
|
379
|
+
await this.notificationService.sendPaymentSuccessToPlatformAdmins({
|
|
380
|
+
stripeCustomerId,
|
|
381
|
+
stripePaymentIntentId: paymentIntent.id,
|
|
382
|
+
amount: paymentIntent.amount / 100,
|
|
383
|
+
currency: paymentIntent.currency,
|
|
384
|
+
isOneTimePurchase: true,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
this.logger.error(`Failed to send payment success notifications for payment intent ${paymentIntent.id}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
389
|
+
// Don't throw - notification failure should not fail webhook processing
|
|
390
|
+
}
|
|
391
|
+
}
|
|
323
392
|
return;
|
|
324
393
|
}
|
|
325
394
|
// Regular subscription payment flow
|
|
@@ -405,6 +474,7 @@ exports.StripeWebhookProcessor = StripeWebhookProcessor = __decorate([
|
|
|
405
474
|
stripe_price_repository_1.StripePriceRepository,
|
|
406
475
|
stripe_webhook_notification_service_1.StripeWebhookNotificationService,
|
|
407
476
|
token_allocation_service_1.TokenAllocationService,
|
|
477
|
+
feature_sync_service_1.FeatureSyncService,
|
|
408
478
|
stripe_service_1.StripeService,
|
|
409
479
|
company_repository_1.CompanyRepository,
|
|
410
480
|
stripe_invoice_admin_service_1.StripeInvoiceAdminService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-webhook.processor.js","sourceRoot":"","sources":["../../../../src/foundations/stripe-webhook/processors/stripe-webhook.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsE;AACtE,mCAA6B;AAE7B,6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|
1
|
+
{"version":3,"file":"stripe-webhook.processor.js","sourceRoot":"","sources":["../../../../src/foundations/stripe-webhook/processors/stripe-webhook.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsE;AACtE,mCAA6B;AAE7B,6DAAyD;AACzD,mDAA0D;AAC1D,sFAAkF;AAClF,8GAAyG;AACzG,2GAAsG;AACtG,qGAAgG;AAChG,0HAAqH;AACrH,4HAAsH;AACtH,kGAA6F;AAC7F,0GAAqG;AACrG,yEAAqE;AACrE,6GAAuG;AACvG,qGAA+F;AAC/F,yGAAmG;AAU5F,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,mBAAU;IACpD,YACmB,4BAA0D,EAC1D,mBAAmD,EACnD,wBAAkD,EAClD,sBAAoD,EACpD,uBAAgD,EAChD,qBAA4C,EAC5C,mBAAqD,EACrD,sBAA8C,EAC9C,kBAAsC,EACtC,aAA4B,EAC5B,iBAAoC,EACpC,yBAAoD,EACpD,MAAyB;QAE1C,KAAK,EAAE,CAAC;QAdS,iCAA4B,GAA5B,4BAA4B,CAA8B;QAC1D,wBAAmB,GAAnB,mBAAmB,CAAgC;QACnD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,2BAAsB,GAAtB,sBAAsB,CAA8B;QACpD,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,wBAAmB,GAAnB,mBAAmB,CAAkC;QACrD,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,kBAAa,GAAb,aAAa,CAAe;QAC5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,8BAAyB,GAAzB,yBAAyB,CAA2B;QACpD,WAAM,GAAN,MAAM,CAAmB;IAG5C,CAAC;IAGD,QAAQ,CAAC,GAA8B;QACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,GAAG,CAAC,IAAI,CAAC,SAA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DAEhB;AAGD;IADC,IAAA,sBAAa,EAAC,QAAQ,CAAC;;qCACX,YAAG;;qDAIf;AAGD;IADC,IAAA,sBAAa,EAAC,WAAW,CAAC;;qCACV,YAAG;;yDAEnB;iCAlCU,sBAAsB;IADlC,IAAA,kBAAS,EAAC,kBAAO,CAAC,eAAe,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;qCAG7B,8DAA4B;QACrC,kEAA8B;QACzB,qDAAwB;QAC1B,6DAA4B;QAC3B,mDAAuB;QACzB,+CAAqB;QACvB,sEAAgC;QAC7B,iDAAsB;QAC1B,yCAAkB;QACvB,8BAAa;QACT,sCAAiB;QACT,wDAAyB;QAC5C,2BAAiB;GAdjC,sBAAsB,CA+flC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Queue } from "bullmq";
|
|
2
|
+
import { ClsService } from "nestjs-cls";
|
|
2
3
|
import { AppLoggingService } from "../../../core/logging";
|
|
4
|
+
import { CompanyRepository } from "../../company/repositories/company.repository";
|
|
3
5
|
import { StripeCustomerRepository } from "../../stripe-customer/repositories/stripe-customer.repository";
|
|
4
6
|
import { StripeInvoiceRepository } from "../../stripe-invoice/repositories/stripe-invoice.repository";
|
|
7
|
+
import { UserRepository } from "../../user/repositories/user.repository";
|
|
5
8
|
export interface StripeWebhookPaymentFailureNotificationParams {
|
|
6
9
|
stripeCustomerId: string;
|
|
7
10
|
stripeInvoiceId?: string;
|
|
@@ -10,6 +13,15 @@ export interface StripeWebhookPaymentFailureNotificationParams {
|
|
|
10
13
|
amount?: number;
|
|
11
14
|
currency?: string;
|
|
12
15
|
}
|
|
16
|
+
export interface StripeWebhookPaymentSuccessNotificationParams {
|
|
17
|
+
stripeCustomerId: string;
|
|
18
|
+
stripeInvoiceId?: string;
|
|
19
|
+
stripePaymentIntentId?: string;
|
|
20
|
+
amount: number;
|
|
21
|
+
currency: string;
|
|
22
|
+
companyName?: string;
|
|
23
|
+
isOneTimePurchase?: boolean;
|
|
24
|
+
}
|
|
13
25
|
/**
|
|
14
26
|
* StripeWebhookNotificationService
|
|
15
27
|
*
|
|
@@ -27,8 +39,11 @@ export declare class StripeWebhookNotificationService {
|
|
|
27
39
|
private readonly emailQueue;
|
|
28
40
|
private readonly stripeCustomerRepository;
|
|
29
41
|
private readonly stripeInvoiceRepository;
|
|
42
|
+
private readonly userRepository;
|
|
43
|
+
private readonly companyRepository;
|
|
44
|
+
private readonly cls;
|
|
30
45
|
private readonly logger;
|
|
31
|
-
constructor(emailQueue: Queue, stripeCustomerRepository: StripeCustomerRepository, stripeInvoiceRepository: StripeInvoiceRepository, logger: AppLoggingService);
|
|
46
|
+
constructor(emailQueue: Queue, stripeCustomerRepository: StripeCustomerRepository, stripeInvoiceRepository: StripeInvoiceRepository, userRepository: UserRepository, companyRepository: CompanyRepository, cls: ClsService, logger: AppLoggingService);
|
|
32
47
|
/**
|
|
33
48
|
* Send payment failure notification email
|
|
34
49
|
*/
|
|
@@ -37,5 +52,15 @@ export declare class StripeWebhookNotificationService {
|
|
|
37
52
|
* Send subscription status change notification
|
|
38
53
|
*/
|
|
39
54
|
sendSubscriptionStatusChangeEmail(stripeCustomerId: string, status: string, subscriptionId: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Send payment success notification to company admins
|
|
57
|
+
* Includes invoice link and thank you message
|
|
58
|
+
*/
|
|
59
|
+
sendPaymentSuccessToCompanyAdmins(params: StripeWebhookPaymentSuccessNotificationParams): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Send payment success notification to platform administrators
|
|
62
|
+
* Minimal details: company name and amount only
|
|
63
|
+
*/
|
|
64
|
+
sendPaymentSuccessToPlatformAdmins(params: StripeWebhookPaymentSuccessNotificationParams): Promise<void>;
|
|
40
65
|
}
|
|
41
66
|
//# sourceMappingURL=stripe-webhook-notification.service.d.ts.map
|
package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-webhook-notification.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/stripe-webhook/services/stripe-webhook-notification.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"stripe-webhook-notification.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/stripe-webhook/services/stripe-webhook-notification.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+DAA+D,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,MAAM,WAAW,6CAA6C;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6CAA6C;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,qBACa,gCAAgC;IAEb,OAAO,CAAC,QAAQ,CAAC,UAAU;IACvD,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBANsB,UAAU,EAAE,KAAK,EAC7C,wBAAwB,EAAE,wBAAwB,EAClD,uBAAuB,EAAE,uBAAuB,EAChD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,iBAAiB;IAG5C;;OAEG;IACG,sBAAsB,CAAC,MAAM,EAAE,6CAA6C,GAAG,OAAO,CAAC,IAAI,CAAC;IAwDlG;;OAEG;IACG,iCAAiC,CACrC,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IAsChB;;;OAGG;IACG,iCAAiC,CAAC,MAAM,EAAE,6CAA6C,GAAG,OAAO,CAAC,IAAI,CAAC;IA6D7G;;;OAGG;IACG,kCAAkC,CAAC,MAAM,EAAE,6CAA6C,GAAG,OAAO,CAAC,IAAI,CAAC;CA8D/G"}
|
|
@@ -16,10 +16,13 @@ exports.StripeWebhookNotificationService = void 0;
|
|
|
16
16
|
const bullmq_1 = require("@nestjs/bullmq");
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const bullmq_2 = require("bullmq");
|
|
19
|
-
const
|
|
19
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
20
20
|
const queue_id_1 = require("../../../config/enums/queue.id");
|
|
21
|
+
const logging_1 = require("../../../core/logging");
|
|
22
|
+
const company_repository_1 = require("../../company/repositories/company.repository");
|
|
21
23
|
const stripe_customer_repository_1 = require("../../stripe-customer/repositories/stripe-customer.repository");
|
|
22
24
|
const stripe_invoice_repository_1 = require("../../stripe-invoice/repositories/stripe-invoice.repository");
|
|
25
|
+
const user_repository_1 = require("../../user/repositories/user.repository");
|
|
23
26
|
/**
|
|
24
27
|
* StripeWebhookNotificationService
|
|
25
28
|
*
|
|
@@ -34,10 +37,13 @@ const stripe_invoice_repository_1 = require("../../stripe-invoice/repositories/s
|
|
|
34
37
|
* - Enriches notifications with customer and invoice data
|
|
35
38
|
*/
|
|
36
39
|
let StripeWebhookNotificationService = class StripeWebhookNotificationService {
|
|
37
|
-
constructor(emailQueue, stripeCustomerRepository, stripeInvoiceRepository, logger) {
|
|
40
|
+
constructor(emailQueue, stripeCustomerRepository, stripeInvoiceRepository, userRepository, companyRepository, cls, logger) {
|
|
38
41
|
this.emailQueue = emailQueue;
|
|
39
42
|
this.stripeCustomerRepository = stripeCustomerRepository;
|
|
40
43
|
this.stripeInvoiceRepository = stripeInvoiceRepository;
|
|
44
|
+
this.userRepository = userRepository;
|
|
45
|
+
this.companyRepository = companyRepository;
|
|
46
|
+
this.cls = cls;
|
|
41
47
|
this.logger = logger;
|
|
42
48
|
}
|
|
43
49
|
/**
|
|
@@ -122,6 +128,119 @@ let StripeWebhookNotificationService = class StripeWebhookNotificationService {
|
|
|
122
128
|
this.logger.error(`Failed to queue subscription notification for ${stripeCustomerId}: ${errorMsg}`);
|
|
123
129
|
}
|
|
124
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Send payment success notification to company admins
|
|
133
|
+
* Includes invoice link and thank you message
|
|
134
|
+
*/
|
|
135
|
+
async sendPaymentSuccessToCompanyAdmins(params) {
|
|
136
|
+
const { stripeCustomerId, stripeInvoiceId, stripePaymentIntentId, amount, currency, isOneTimePurchase } = params;
|
|
137
|
+
try {
|
|
138
|
+
// Run in CLS context since this may be called from a worker without HTTP context
|
|
139
|
+
await this.cls.run(async () => {
|
|
140
|
+
// Find all company admins for this Stripe customer
|
|
141
|
+
const companyAdmins = await this.userRepository.findCompanyAdminsByStripeCustomerId({ stripeCustomerId });
|
|
142
|
+
if (companyAdmins.length === 0) {
|
|
143
|
+
this.logger.warn(`No company admins found for Stripe customer ${stripeCustomerId} - skipping notification`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Get invoice details if available
|
|
147
|
+
let invoiceDetails = null;
|
|
148
|
+
if (stripeInvoiceId) {
|
|
149
|
+
invoiceDetails = await this.stripeInvoiceRepository.findByStripeInvoiceId({ stripeInvoiceId });
|
|
150
|
+
}
|
|
151
|
+
// Queue email for each company admin
|
|
152
|
+
for (const admin of companyAdmins) {
|
|
153
|
+
await this.emailQueue.add("billing-notification", {
|
|
154
|
+
jobType: "payment-success-customer",
|
|
155
|
+
payload: {
|
|
156
|
+
to: admin.email,
|
|
157
|
+
customerName: admin.name || "Customer",
|
|
158
|
+
stripeCustomerId,
|
|
159
|
+
stripeInvoiceId,
|
|
160
|
+
stripePaymentIntentId,
|
|
161
|
+
amount,
|
|
162
|
+
currency: currency || "usd",
|
|
163
|
+
invoiceUrl: invoiceDetails?.stripeHostedInvoiceUrl,
|
|
164
|
+
invoiceNumber: invoiceDetails?.stripeInvoiceNumber || undefined,
|
|
165
|
+
isOneTimePurchase: isOneTimePurchase || false,
|
|
166
|
+
locale: "en",
|
|
167
|
+
},
|
|
168
|
+
}, {
|
|
169
|
+
attempts: 3,
|
|
170
|
+
backoff: {
|
|
171
|
+
type: "exponential",
|
|
172
|
+
delay: 5000,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
this.logger.log(`Queued payment success notification for ${companyAdmins.length} company admin(s) (customer: ${stripeCustomerId})`);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
181
|
+
this.logger.error(`Failed to queue payment success notification for company admins: ${errorMsg}`);
|
|
182
|
+
// Don't throw - notification failure shouldn't block webhook processing
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Send payment success notification to platform administrators
|
|
187
|
+
* Minimal details: company name and amount only
|
|
188
|
+
*/
|
|
189
|
+
async sendPaymentSuccessToPlatformAdmins(params) {
|
|
190
|
+
const { stripeCustomerId, amount, currency, companyName, isOneTimePurchase } = params;
|
|
191
|
+
try {
|
|
192
|
+
// Run in CLS context since this may be called from a worker without HTTP context
|
|
193
|
+
await this.cls.run(async () => {
|
|
194
|
+
// Find all platform administrators
|
|
195
|
+
const platformAdmins = await this.userRepository.findPlatformAdministrators();
|
|
196
|
+
if (platformAdmins.length === 0) {
|
|
197
|
+
this.logger.warn("No platform administrators found - skipping admin notification");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// Resolve company name if not provided
|
|
201
|
+
let resolvedCompanyName = companyName;
|
|
202
|
+
if (!resolvedCompanyName) {
|
|
203
|
+
const stripeCustomer = await this.stripeCustomerRepository.findByStripeCustomerId({ stripeCustomerId });
|
|
204
|
+
if (stripeCustomer) {
|
|
205
|
+
const company = await this.companyRepository.findByStripeCustomerId({
|
|
206
|
+
stripeCustomerId: stripeCustomer.id,
|
|
207
|
+
});
|
|
208
|
+
resolvedCompanyName = company?.name || "Unknown Company";
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
resolvedCompanyName = "Unknown Company";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Queue email for each platform admin
|
|
215
|
+
for (const admin of platformAdmins) {
|
|
216
|
+
await this.emailQueue.add("billing-notification", {
|
|
217
|
+
jobType: "payment-success-admin",
|
|
218
|
+
payload: {
|
|
219
|
+
to: admin.email,
|
|
220
|
+
adminName: admin.name || "Administrator",
|
|
221
|
+
companyName: resolvedCompanyName,
|
|
222
|
+
amount,
|
|
223
|
+
currency: currency || "usd",
|
|
224
|
+
isOneTimePurchase: isOneTimePurchase || false,
|
|
225
|
+
locale: "en",
|
|
226
|
+
},
|
|
227
|
+
}, {
|
|
228
|
+
attempts: 3,
|
|
229
|
+
backoff: {
|
|
230
|
+
type: "exponential",
|
|
231
|
+
delay: 5000,
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
this.logger.log(`Queued payment success admin notification for ${platformAdmins.length} platform admin(s)`);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
240
|
+
this.logger.error(`Failed to queue payment success admin notification: ${errorMsg}`);
|
|
241
|
+
// Don't throw - notification failure shouldn't block webhook processing
|
|
242
|
+
}
|
|
243
|
+
}
|
|
125
244
|
};
|
|
126
245
|
exports.StripeWebhookNotificationService = StripeWebhookNotificationService;
|
|
127
246
|
exports.StripeWebhookNotificationService = StripeWebhookNotificationService = __decorate([
|
|
@@ -130,6 +249,9 @@ exports.StripeWebhookNotificationService = StripeWebhookNotificationService = __
|
|
|
130
249
|
__metadata("design:paramtypes", [bullmq_2.Queue,
|
|
131
250
|
stripe_customer_repository_1.StripeCustomerRepository,
|
|
132
251
|
stripe_invoice_repository_1.StripeInvoiceRepository,
|
|
252
|
+
user_repository_1.UserRepository,
|
|
253
|
+
company_repository_1.CompanyRepository,
|
|
254
|
+
nestjs_cls_1.ClsService,
|
|
133
255
|
logging_1.AppLoggingService])
|
|
134
256
|
], StripeWebhookNotificationService);
|
|
135
257
|
//# sourceMappingURL=stripe-webhook-notification.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-webhook-notification.service.js","sourceRoot":"","sources":["../../../../src/foundations/stripe-webhook/services/stripe-webhook-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6C;AAC7C,2CAA4C;AAC5C,mCAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"stripe-webhook-notification.service.js","sourceRoot":"","sources":["../../../../src/foundations/strip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file":"stripe-webhook.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/stripe-webhook/stripe-webhook.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"stripe-webhook.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/stripe-webhook/stripe-webhook.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAmBlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAgCa,mBAAoB,YAAW,YAAY;IACtD,YAAY;CAGb"}
|
|
@@ -18,6 +18,7 @@ const stripe_price_module_1 = require("../stripe-price/stripe-price.module");
|
|
|
18
18
|
const stripe_subscription_module_1 = require("../stripe-subscription/stripe-subscription.module");
|
|
19
19
|
const stripe_module_1 = require("../stripe/stripe.module");
|
|
20
20
|
const company_module_1 = require("../company/company.module");
|
|
21
|
+
const user_module_1 = require("../user/user.module");
|
|
21
22
|
const stripe_webhook_controller_1 = require("./controllers/stripe-webhook.controller");
|
|
22
23
|
const stripe_webhook_event_model_1 = require("./entities/stripe-webhook-event.model");
|
|
23
24
|
const stripe_webhook_processor_1 = require("./processors/stripe-webhook.processor");
|
|
@@ -69,6 +70,7 @@ exports.StripeWebhookModule = StripeWebhookModule = __decorate([
|
|
|
69
70
|
(0, common_1.forwardRef)(() => stripe_price_module_1.StripePriceModule),
|
|
70
71
|
(0, common_1.forwardRef)(() => stripe_subscription_module_1.StripeSubscriptionModule),
|
|
71
72
|
(0, common_1.forwardRef)(() => company_module_1.CompanyModule),
|
|
73
|
+
(0, common_1.forwardRef)(() => user_module_1.UserModule),
|
|
72
74
|
bullmq_1.BullModule.registerQueue({ name: queue_id_1.QueueId.BILLING_WEBHOOK }),
|
|
73
75
|
bullmq_1.BullModule.registerQueue({ name: queue_id_1.QueueId.EMAIL }),
|
|
74
76
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-webhook.module.js","sourceRoot":"","sources":["../../../src/foundations/stripe-webhook/stripe-webhook.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAkE;AAClE,yGAA6F;AAC7F,+DAAiE;AACjE,0DAAsD;AACtD,sFAAiF;AACjF,mFAA8E;AAC9E,6EAAwE;AACxE,kGAA6F;AAC7F,2DAAuD;AACvD,8DAA0D;AAC1D,uFAAkF;AAClF,sFAAgF;AAChF,oFAA+E;AAC/E,oGAA8F;AAC9F,mGAA6F;AAC7F,wGAAkG;AAClG,8EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"stripe-webhook.module.js","sourceRoot":"","sources":["../../../src/foundations/stripe-webhook/stripe-webhook.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAkE;AAClE,yGAA6F;AAC7F,+DAAiE;AACjE,0DAAsD;AACtD,sFAAiF;AACjF,mFAA8E;AAC9E,6EAAwE;AACxE,kGAA6F;AAC7F,2DAAuD;AACvD,8DAA0D;AAC1D,qDAAiD;AACjD,uFAAkF;AAClF,sFAAgF;AAChF,oFAA+E;AAC/E,oGAA8F;AAC9F,mGAA6F;AAC7F,wGAAkG;AAClG,8EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAiCI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAAY;QACV,wBAAa,CAAC,QAAQ,CAAC,oDAAuB,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAJY,kDAAmB;8BAAnB,mBAAmB;IAhC/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,4BAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,6CAAoB,CAAC;YACtC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;YACrC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,uCAAiB,CAAC;YACnC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qDAAwB,CAAC;YAC1C,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC;YAC/B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,mBAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,kBAAO,CAAC,eAAe,EAAE,CAAC;YAC3D,mBAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,kBAAO,CAAC,KAAK,EAAE,CAAC;SAClD;QACD,WAAW,EAAE,CAAC,mDAAuB,CAAC;QACtC,SAAS,EAAE;YACT,WAAW;YACX,6CAAoB;YACpB,sEAAgC;YAChC,aAAa;YACb,8DAA4B;YAC5B,aAAa;YACb,8DAA4B;YAC5B,+BAA+B;YAC/B,IAAA,oDAAoB,EAAC,iDAAsB,CAAC;SAC7C;QACD,OAAO,EAAE;YACP,WAAW;YACX,6CAAoB;YACpB,sEAAgC;YAChC,aAAa;YACb,8DAA4B;SAC7B;KACF,CAAC;GACW,mBAAmB,CAI/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entity } from "../../../common/abstracts/entity";
|
|
2
|
-
import { Company } from "../../company/entities/company
|
|
2
|
+
import { Company } from "../../company/entities/company";
|
|
3
3
|
export type TokenUsage = Entity & {
|
|
4
4
|
inputTokens: number;
|
|
5
5
|
outputTokens: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenusage.entity.d.ts","sourceRoot":"","sources":["../../../../src/foundations/tokenusage/entities/tokenusage.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tokenusage.entity.d.ts","sourceRoot":"","sources":["../../../../src/foundations/tokenusage/entities/tokenusage.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IAEvB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { RelevancyService } from "../../relevancy";
|
|
|
8
8
|
import { UserPatchRateDTO } from "../../user/dtos/user.patch.rate.dto";
|
|
9
9
|
import { UserPostDTO } from "../../user/dtos/user.post.dto";
|
|
10
10
|
import { UserPutDTO } from "../../user/dtos/user.put.dto";
|
|
11
|
-
import { User } from "../entities/user
|
|
11
|
+
import { User } from "../entities/user";
|
|
12
12
|
import { UserCypherService } from "../services/user.cypher.service";
|
|
13
13
|
import { UserService } from "../services/user.service";
|
|
14
14
|
export declare class UserController {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/user/controllers/user.controller.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;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