@carlonicora/nestjs-neo4jsonapi 7.0.0 → 8.0.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/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +1 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +20 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/common/decorators/audit.decorator.d.ts +3 -0
- package/dist/common/decorators/audit.decorator.d.ts.map +1 -1
- package/dist/common/decorators/audit.decorator.js +15 -2
- package/dist/common/decorators/audit.decorator.js.map +1 -1
- package/dist/common/decorators/cache-invalidate.decorator.d.ts.map +1 -1
- package/dist/common/decorators/cache-invalidate.decorator.js +3 -11
- package/dist/common/decorators/cache-invalidate.decorator.js.map +1 -1
- package/dist/common/decorators/handler-wrapper.d.ts +13 -0
- package/dist/common/decorators/handler-wrapper.d.ts.map +1 -0
- package/dist/common/decorators/handler-wrapper.js +25 -0
- package/dist/common/decorators/handler-wrapper.js.map +1 -0
- package/dist/common/decorators/validate-id.decorator.d.ts.map +1 -1
- package/dist/common/decorators/validate-id.decorator.js +3 -11
- package/dist/common/decorators/validate-id.decorator.js.map +1 -1
- package/dist/core/email/templates/en/cardExpiring.hbs +28 -0
- package/dist/core/email/templates/en/paymentFailure.hbs +4 -0
- package/dist/foundations/ai-connection/controllers/ai-connection.controller.d.ts +2 -1
- package/dist/foundations/ai-connection/controllers/ai-connection.controller.d.ts.map +1 -1
- package/dist/foundations/ai-connection/controllers/ai-connection.controller.js +5 -4
- package/dist/foundations/ai-connection/controllers/ai-connection.controller.js.map +1 -1
- package/dist/foundations/analytics/controllers/analytics.admin.controller.d.ts +2 -1
- package/dist/foundations/analytics/controllers/analytics.admin.controller.d.ts.map +1 -1
- package/dist/foundations/analytics/controllers/analytics.admin.controller.js +5 -4
- package/dist/foundations/analytics/controllers/analytics.admin.controller.js.map +1 -1
- package/dist/foundations/billing/billing.module.d.ts +26 -0
- package/dist/foundations/billing/billing.module.d.ts.map +1 -0
- package/dist/foundations/billing/billing.module.js +74 -0
- package/dist/foundations/billing/billing.module.js.map +1 -0
- package/dist/foundations/billing/cron/billing-lifecycle.cron.d.ts +16 -0
- package/dist/foundations/billing/cron/billing-lifecycle.cron.d.ts.map +1 -0
- package/dist/foundations/billing/cron/billing-lifecycle.cron.js +52 -0
- package/dist/foundations/billing/cron/billing-lifecycle.cron.js.map +1 -0
- package/dist/foundations/billing/index.d.ts +7 -0
- package/dist/foundations/billing/index.d.ts.map +1 -0
- package/dist/foundations/billing/index.js +28 -0
- package/dist/foundations/billing/index.js.map +1 -0
- package/dist/foundations/billing/interfaces/billing.config.interface.d.ts +71 -0
- package/dist/foundations/billing/interfaces/billing.config.interface.d.ts.map +1 -0
- package/dist/foundations/billing/interfaces/billing.config.interface.js +41 -0
- package/dist/foundations/billing/interfaces/billing.config.interface.js.map +1 -0
- package/dist/foundations/billing/processors/billing-email.jobs.d.ts +127 -0
- package/dist/foundations/billing/processors/billing-email.jobs.d.ts.map +1 -0
- package/dist/foundations/billing/processors/billing-email.jobs.js +196 -0
- package/dist/foundations/billing/processors/billing-email.jobs.js.map +1 -0
- package/dist/foundations/billing/processors/billing-email.processor.d.ts +33 -0
- package/dist/foundations/billing/processors/billing-email.processor.d.ts.map +1 -0
- package/dist/foundations/billing/processors/billing-email.processor.js +95 -0
- package/dist/foundations/billing/processors/billing-email.processor.js.map +1 -0
- package/dist/foundations/billing/services/card-expiry-warning.service.d.ts +58 -0
- package/dist/foundations/billing/services/card-expiry-warning.service.d.ts.map +1 -0
- package/dist/foundations/billing/services/card-expiry-warning.service.js +90 -0
- package/dist/foundations/billing/services/card-expiry-warning.service.js.map +1 -0
- package/dist/foundations/company/repositories/company.repository.d.ts +2 -0
- package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
- package/dist/foundations/company/repositories/company.repository.js +2 -2
- package/dist/foundations/company/repositories/company.repository.js.map +1 -1
- package/dist/foundations/foundations.modules.d.ts +3 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +3 -1
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/handbook/controllers/handbook.controller.d.ts +1 -1
- package/dist/foundations/handbook/controllers/handbook.controller.d.ts.map +1 -1
- package/dist/foundations/handbook/controllers/handbook.controller.js +5 -4
- package/dist/foundations/handbook/controllers/handbook.controller.js.map +1 -1
- package/dist/foundations/index.d.ts +1 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +1 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/notification/controllers/notification.controller.d.ts.map +1 -1
- package/dist/foundations/notification/controllers/notification.controller.js +0 -1
- package/dist/foundations/notification/controllers/notification.controller.js.map +1 -1
- package/dist/foundations/role/controllers/role.controller.d.ts +1 -1
- package/dist/foundations/role/controllers/role.controller.d.ts.map +1 -1
- package/dist/foundations/role/controllers/role.controller.js +4 -3
- package/dist/foundations/role/controllers/role.controller.js.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code-checkout.controller.d.ts +2 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code-checkout.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code-checkout.controller.js +5 -6
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code-checkout.controller.js.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code.controller.d.ts +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code.controller.js +5 -4
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon-code.controller.js.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.controller.d.ts +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.controller.js +5 -4
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.controller.js.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.public.controller.d.ts +1 -0
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.public.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.public.controller.js +4 -0
- package/dist/foundations/stripe-coupon/controllers/stripe-coupon.public.controller.js.map +1 -1
- package/dist/foundations/stripe-coupon/dtos/stripe-coupon-code.automatic.query.dto.d.ts +8 -0
- package/dist/foundations/stripe-coupon/dtos/stripe-coupon-code.automatic.query.dto.d.ts.map +1 -0
- package/dist/foundations/stripe-coupon/dtos/stripe-coupon-code.automatic.query.dto.js +25 -0
- package/dist/foundations/stripe-coupon/dtos/stripe-coupon-code.automatic.query.dto.js.map +1 -0
- package/dist/foundations/stripe-coupon/entities/stripe-coupon-code.js +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon-code.js.map +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon-offer.d.ts +5 -0
- package/dist/foundations/stripe-coupon/entities/stripe-coupon-offer.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon-offer.js.map +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon.d.ts +25 -2
- package/dist/foundations/stripe-coupon/entities/stripe-coupon.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon.js +1 -1
- package/dist/foundations/stripe-coupon/entities/stripe-coupon.js.map +1 -1
- package/dist/foundations/stripe-coupon/index.d.ts +1 -0
- package/dist/foundations/stripe-coupon/index.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/index.js +1 -0
- package/dist/foundations/stripe-coupon/index.js.map +1 -1
- package/dist/foundations/stripe-coupon/services/stripe-coupon-api.service.d.ts +5 -8
- package/dist/foundations/stripe-coupon/services/stripe-coupon-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/services/stripe-coupon-api.service.js +9 -9
- package/dist/foundations/stripe-coupon/services/stripe-coupon-api.service.js.map +1 -1
- package/dist/foundations/stripe-coupon/services/stripe-coupon-offer.service.js.map +1 -1
- package/dist/foundations/stripe-coupon/services/stripe-coupon.service.d.ts +36 -3
- package/dist/foundations/stripe-coupon/services/stripe-coupon.service.d.ts.map +1 -1
- package/dist/foundations/stripe-coupon/services/stripe-coupon.service.js +69 -33
- package/dist/foundations/stripe-coupon/services/stripe-coupon.service.js.map +1 -1
- package/dist/foundations/stripe-customer/services/stripe-customer-api.service.d.ts +17 -0
- package/dist/foundations/stripe-customer/services/stripe-customer-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-customer/services/stripe-customer-api.service.js +40 -0
- package/dist/foundations/stripe-customer/services/stripe-customer-api.service.js.map +1 -1
- package/dist/foundations/stripe-invoice/entities/stripe-invoice.entity.d.ts +1 -1
- package/dist/foundations/stripe-invoice/entities/stripe-invoice.entity.d.ts.map +1 -1
- package/dist/foundations/stripe-invoice/serialisers/stripe-invoice.serialiser.js +2 -2
- package/dist/foundations/stripe-invoice/serialisers/stripe-invoice.serialiser.js.map +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts +13 -0
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js +21 -0
- package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.d.ts +1 -3
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js +5 -38
- package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js.map +1 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.d.ts +60 -0
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.d.ts.map +1 -0
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.discount.d.ts +1 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.discount.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.js +61 -0
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.js.map +1 -0
- package/dist/foundations/stripe-subscription/index.d.ts +1 -4
- package/dist/foundations/stripe-subscription/index.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/index.js +4 -8
- package/dist/foundations/stripe-subscription/index.js.map +1 -1
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts +93 -165
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js +206 -274
- package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts +34 -36
- 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 +20 -72
- package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts +1 -29
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js +1 -53
- package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js.map +1 -1
- package/dist/foundations/stripe-subscription/stripe-subscription.module.d.ts +3 -3
- package/dist/foundations/stripe-subscription/stripe-subscription.module.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/stripe-subscription.module.js +8 -7
- package/dist/foundations/stripe-subscription/stripe-subscription.module.js.map +1 -1
- package/dist/foundations/stripe-usage/entities/stripe-usage-record.entity.d.ts +1 -1
- package/dist/foundations/stripe-usage/entities/stripe-usage-record.entity.d.ts.map +1 -1
- package/dist/foundations/stripe-usage/serialisers/stripe-usage-record.serialiser.js +2 -2
- package/dist/foundations/stripe-usage/serialisers/stripe-usage-record.serialiser.js.map +1 -1
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts +6 -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 +73 -15
- 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 +24 -2
- 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 +88 -20
- package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.js.map +1 -1
- package/package.json +1 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.entity.d.ts +0 -27
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.entity.d.ts.map +0 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.entity.js +0 -3
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.entity.js.map +0 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.map.d.ts +0 -8
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.map.d.ts.map +0 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.map.js +0 -30
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.map.js.map +0 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.model.d.ts +0 -4
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.model.d.ts.map +0 -1
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.model.js +0 -17
- package/dist/foundations/stripe-subscription/entities/stripe-subscription.model.js.map +0 -1
- package/dist/foundations/stripe-subscription/serialisers/stripe-subscription.serialiser.d.ts +0 -9
- package/dist/foundations/stripe-subscription/serialisers/stripe-subscription.serialiser.d.ts.map +0 -1
- package/dist/foundations/stripe-subscription/serialisers/stripe-subscription.serialiser.js +0 -59
- package/dist/foundations/stripe-subscription/serialisers/stripe-subscription.serialiser.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var BillingModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BillingModule = void 0;
|
|
11
|
+
const bullmq_1 = require("@nestjs/bullmq");
|
|
12
|
+
const common_1 = require("@nestjs/common");
|
|
13
|
+
const conditional_service_decorator_1 = require("../../common/decorators/conditional-service.decorator");
|
|
14
|
+
const queue_id_1 = require("../../config/enums/queue.id");
|
|
15
|
+
const email_module_1 = require("../../core/email/email.module");
|
|
16
|
+
const stripe_customer_module_1 = require("../stripe-customer/stripe-customer.module");
|
|
17
|
+
const stripe_subscription_module_1 = require("../stripe-subscription/stripe-subscription.module");
|
|
18
|
+
const stripe_webhook_module_1 = require("../stripe-webhook/stripe-webhook.module");
|
|
19
|
+
const billing_lifecycle_cron_1 = require("./cron/billing-lifecycle.cron");
|
|
20
|
+
const billing_config_interface_1 = require("./interfaces/billing.config.interface");
|
|
21
|
+
const billing_email_processor_1 = require("./processors/billing-email.processor");
|
|
22
|
+
const card_expiry_warning_service_1 = require("./services/card-expiry-warning.service");
|
|
23
|
+
/**
|
|
24
|
+
* BillingModule — per-app billing settings and billing housekeeping.
|
|
25
|
+
*
|
|
26
|
+
* - `BILLING_CONFIG` (global): the resolved settings every billing service reads
|
|
27
|
+
* - `BillingLifecycleCron` (worker only): hourly card-expiry check
|
|
28
|
+
* - `BillingEmailProcessor` (worker only, opt-in): the library billing email sender on `QueueId.EMAIL`
|
|
29
|
+
*
|
|
30
|
+
* Always mounted by `FoundationsModule`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Through bootstrap, which forwards it to FoundationsModule
|
|
35
|
+
* bootstrap({ billing: { emailSender: { enabled: true } } })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
let BillingModule = BillingModule_1 = class BillingModule {
|
|
39
|
+
/**
|
|
40
|
+
* Configure the BillingModule.
|
|
41
|
+
*
|
|
42
|
+
* @param config - Optional configuration merged key by key over DEFAULT_BILLING_CONFIG
|
|
43
|
+
*/
|
|
44
|
+
static forRoot(config) {
|
|
45
|
+
const resolved = (0, billing_config_interface_1.resolveBillingConfig)(config);
|
|
46
|
+
const configProvider = {
|
|
47
|
+
provide: billing_config_interface_1.BILLING_CONFIG,
|
|
48
|
+
useValue: resolved,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
module: BillingModule_1,
|
|
52
|
+
global: true,
|
|
53
|
+
imports: [
|
|
54
|
+
bullmq_1.BullModule.registerQueue({ name: queue_id_1.QueueId.EMAIL }),
|
|
55
|
+
email_module_1.EmailModule,
|
|
56
|
+
stripe_subscription_module_1.StripeSubscriptionModule,
|
|
57
|
+
stripe_customer_module_1.StripeCustomerModule,
|
|
58
|
+
stripe_webhook_module_1.StripeWebhookModule,
|
|
59
|
+
],
|
|
60
|
+
providers: [
|
|
61
|
+
configProvider,
|
|
62
|
+
card_expiry_warning_service_1.CardExpiryWarningService,
|
|
63
|
+
(0, conditional_service_decorator_1.createWorkerProvider)(billing_lifecycle_cron_1.BillingLifecycleCron),
|
|
64
|
+
...(resolved.emailSender.enabled ? [(0, conditional_service_decorator_1.createWorkerProvider)(billing_email_processor_1.BillingEmailProcessor)] : []),
|
|
65
|
+
],
|
|
66
|
+
exports: [billing_config_interface_1.BILLING_CONFIG],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.BillingModule = BillingModule;
|
|
71
|
+
exports.BillingModule = BillingModule = BillingModule_1 = __decorate([
|
|
72
|
+
(0, common_1.Module)({})
|
|
73
|
+
], BillingModule);
|
|
74
|
+
//# sourceMappingURL=billing.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.module.js","sourceRoot":"","sources":["../../../src/foundations/billing/billing.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAiE;AACjE,yGAA6F;AAC7F,0DAAsD;AACtD,gEAA4D;AAC5D,sFAAiF;AACjF,kGAA6F;AAC7F,mFAA8E;AAC9E,0EAAqE;AACrE,oFAAkH;AAClH,kFAA6E;AAC7E,wFAAkF;AAElF;;;;;;;;;;;;;;GAcG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAA4B;QACzC,MAAM,QAAQ,GAAG,IAAA,+CAAoB,EAAC,MAAM,CAAC,CAAC;QAE9C,MAAM,cAAc,GAAa;YAC/B,OAAO,EAAE,yCAAc;YACvB,QAAQ,EAAE,QAAQ;SACnB,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,eAAa;YACrB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,mBAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,kBAAO,CAAC,KAAK,EAAE,CAAC;gBACjD,0BAAW;gBACX,qDAAwB;gBACxB,6CAAoB;gBACpB,2CAAmB;aACpB;YACD,SAAS,EAAE;gBACT,cAAc;gBACd,sDAAwB;gBACxB,IAAA,oDAAoB,EAAC,6CAAoB,CAAC;gBAC1C,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,oDAAoB,EAAC,+CAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACvF;YACD,OAAO,EAAE,CAAC,yCAAc,CAAC;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AAjCY,sCAAa;wBAAb,aAAa;IADzB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,aAAa,CAiCzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
2
|
+
import { CardExpiryWarningService } from "../services/card-expiry-warning.service";
|
|
3
|
+
/**
|
|
4
|
+
* BillingLifecycleCron — hourly billing housekeeping, registered on worker
|
|
5
|
+
* instances only (`createWorkerProvider`).
|
|
6
|
+
*
|
|
7
|
+
* Checks the cards that expire before their renewal. A failure is logged, never
|
|
8
|
+
* thrown, so the next hourly run tries again.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BillingLifecycleCron {
|
|
11
|
+
private readonly cardExpiryWarningService;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
constructor(cardExpiryWarningService: CardExpiryWarningService, logger: AppLoggingService);
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=billing-lifecycle.cron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-lifecycle.cron.d.ts","sourceRoot":"","sources":["../../../../src/foundations/billing/cron/billing-lifecycle.cron.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnF;;;;;;GAMG;AACH,qBACa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,wBAAwB,EAAE,wBAAwB,EAClD,MAAM,EAAE,iBAAiB;IAItC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAU3B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BillingLifecycleCron = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
15
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
16
|
+
const card_expiry_warning_service_1 = require("../services/card-expiry-warning.service");
|
|
17
|
+
/**
|
|
18
|
+
* BillingLifecycleCron — hourly billing housekeeping, registered on worker
|
|
19
|
+
* instances only (`createWorkerProvider`).
|
|
20
|
+
*
|
|
21
|
+
* Checks the cards that expire before their renewal. A failure is logged, never
|
|
22
|
+
* thrown, so the next hourly run tries again.
|
|
23
|
+
*/
|
|
24
|
+
let BillingLifecycleCron = class BillingLifecycleCron {
|
|
25
|
+
constructor(cardExpiryWarningService, logger) {
|
|
26
|
+
this.cardExpiryWarningService = cardExpiryWarningService;
|
|
27
|
+
this.logger = logger;
|
|
28
|
+
}
|
|
29
|
+
async run() {
|
|
30
|
+
const now = new Date();
|
|
31
|
+
try {
|
|
32
|
+
const { checked, warned } = await this.cardExpiryWarningService.processDue({ now });
|
|
33
|
+
this.logger.log(`Billing lifecycle: ${checked} card(s) checked, ${warned} warned`, "BillingLifecycleCron");
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.logger.error(`Failed to check expiring cards: ${error.message}`, "BillingLifecycleCron");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.BillingLifecycleCron = BillingLifecycleCron;
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, schedule_1.Cron)(schedule_1.CronExpression.EVERY_HOUR),
|
|
43
|
+
__metadata("design:type", Function),
|
|
44
|
+
__metadata("design:paramtypes", []),
|
|
45
|
+
__metadata("design:returntype", Promise)
|
|
46
|
+
], BillingLifecycleCron.prototype, "run", null);
|
|
47
|
+
exports.BillingLifecycleCron = BillingLifecycleCron = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__metadata("design:paramtypes", [card_expiry_warning_service_1.CardExpiryWarningService,
|
|
50
|
+
logging_service_1.AppLoggingService])
|
|
51
|
+
], BillingLifecycleCron);
|
|
52
|
+
//# sourceMappingURL=billing-lifecycle.cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-lifecycle.cron.js","sourceRoot":"","sources":["../../../../src/foundations/billing/cron/billing-lifecycle.cron.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAwD;AACxD,oFAAmF;AACnF,yFAAmF;AAEnF;;;;;;GAMG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACmB,wBAAkD,EAClD,MAAyB;QADzB,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,WAAM,GAAN,MAAM,CAAmB;IACzC,CAAC;IAGE,AAAN,KAAK,CAAC,GAAG;QACP,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,IAAI,CAAC;YACH,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YACpF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,OAAO,qBAAqB,MAAM,SAAS,EAAE,sBAAsB,CAAC,CAAC;QAC7G,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAoC,KAAe,CAAC,OAAO,EAAE,EAAE,sBAAsB,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;CACF,CAAA;AAjBY,oDAAoB;AAOzB;IADL,IAAA,eAAI,EAAC,yBAAc,CAAC,UAAU,CAAC;;;;+CAU/B;+BAhBU,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAGkC,sDAAwB;QAC1C,mCAAiB;GAHjC,oBAAoB,CAiBhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./billing.module";
|
|
2
|
+
export * from "./interfaces/billing.config.interface";
|
|
3
|
+
export * from "./processors/billing-email.jobs";
|
|
4
|
+
export * from "./processors/billing-email.processor";
|
|
5
|
+
export * from "./cron/billing-lifecycle.cron";
|
|
6
|
+
export * from "./services/card-expiry-warning.service";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/billing/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uCAAuC,CAAC;AAGtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Module
|
|
18
|
+
__exportStar(require("./billing.module"), exports);
|
|
19
|
+
// Config
|
|
20
|
+
__exportStar(require("./interfaces/billing.config.interface"), exports);
|
|
21
|
+
// Sender
|
|
22
|
+
__exportStar(require("./processors/billing-email.jobs"), exports);
|
|
23
|
+
__exportStar(require("./processors/billing-email.processor"), exports);
|
|
24
|
+
// Cron
|
|
25
|
+
__exportStar(require("./cron/billing-lifecycle.cron"), exports);
|
|
26
|
+
// Services
|
|
27
|
+
__exportStar(require("./services/card-expiry-warning.service"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/foundations/billing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS;AACT,mDAAiC;AAEjC,SAAS;AACT,wEAAsD;AAEtD,SAAS;AACT,kEAAgD;AAChD,uEAAqD;AAErD,OAAO;AACP,gEAA8C;AAE9C,WAAW;AACX,yEAAuD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three billing emails an app can switch off one by one.
|
|
3
|
+
*/
|
|
4
|
+
export type BillingEmailKey = "paymentFailed" | "cardExpiring" | "subscriptionEnded";
|
|
5
|
+
/**
|
|
6
|
+
* App-relative paths the billing emails link to. The sender prefixes each with
|
|
7
|
+
* the app URL (`app.url`, trailing slash removed).
|
|
8
|
+
*/
|
|
9
|
+
export type BillingLinks = {
|
|
10
|
+
billing: string;
|
|
11
|
+
paymentMethod: string;
|
|
12
|
+
subscribe: string;
|
|
13
|
+
resubscribe: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One email job the library sender handles: the template id and the mapping from
|
|
17
|
+
* the queued payload to the template data.
|
|
18
|
+
*/
|
|
19
|
+
export interface BillingEmailJobDefinition {
|
|
20
|
+
template: string;
|
|
21
|
+
toTemplateData: (payload: Record<string, unknown>, ctx: {
|
|
22
|
+
appUrl: string;
|
|
23
|
+
locale: string;
|
|
24
|
+
links: BillingLinks;
|
|
25
|
+
}) => Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Configuration for the BillingModule. Every key is optional; omitted keys keep
|
|
29
|
+
* the value in `DEFAULT_BILLING_CONFIG`.
|
|
30
|
+
*/
|
|
31
|
+
export interface BillingModuleConfig {
|
|
32
|
+
/**
|
|
33
|
+
* The library billing email sender (a BullMQ worker on `QueueId.EMAIL`).
|
|
34
|
+
* OFF by default: apps that consume the email queue with their own processor
|
|
35
|
+
* keep doing so. `extraJobs` adds or overrides job types for the app.
|
|
36
|
+
*/
|
|
37
|
+
emailSender?: {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
extraJobs?: Record<string, BillingEmailJobDefinition>;
|
|
40
|
+
};
|
|
41
|
+
/** Per-email switches. Default: every email on. */
|
|
42
|
+
emails?: Partial<Record<BillingEmailKey, boolean>>;
|
|
43
|
+
/** Keep full access while Stripe retries a failed renewal, for GMs who have paid before. Default on. */
|
|
44
|
+
failedCardGrace?: boolean;
|
|
45
|
+
/** Days between a subscription ending and the company's deletion date. Default 30. */
|
|
46
|
+
deletion?: {
|
|
47
|
+
afterSubscriptionEndedDays?: number;
|
|
48
|
+
};
|
|
49
|
+
/** App-relative paths used in billing emails. */
|
|
50
|
+
links?: Partial<BillingLinks>;
|
|
51
|
+
}
|
|
52
|
+
export type ResolvedBillingConfig = {
|
|
53
|
+
emailSender: {
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
extraJobs: Record<string, BillingEmailJobDefinition>;
|
|
56
|
+
};
|
|
57
|
+
emails: Record<BillingEmailKey, boolean>;
|
|
58
|
+
failedCardGrace: boolean;
|
|
59
|
+
deletion: {
|
|
60
|
+
afterSubscriptionEndedDays: number;
|
|
61
|
+
};
|
|
62
|
+
links: BillingLinks;
|
|
63
|
+
};
|
|
64
|
+
export declare const DEFAULT_BILLING_CONFIG: ResolvedBillingConfig;
|
|
65
|
+
export declare const BILLING_CONFIG: unique symbol;
|
|
66
|
+
/**
|
|
67
|
+
* Merges an app's billing config over the defaults, key by key: a partial
|
|
68
|
+
* `emails` or `links` object keeps every key it does not name.
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveBillingConfig(config?: BillingModuleConfig): ResolvedBillingConfig;
|
|
71
|
+
//# sourceMappingURL=billing.config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.config.interface.d.ts","sourceRoot":"","sources":["../../../../src/foundations/billing/interfaces/billing.config.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,mBAAmB,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,CACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,KACzD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;KAAE,CAAC;IAC3F,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,wGAAwG;IACxG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sFAAsF;IACtF,QAAQ,CAAC,EAAE;QAAE,0BAA0B,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAC/B;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;KAAE,CAAC;IACxF,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACzC,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE;QAAE,0BAA0B,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAWpC,CAAC;AAEF,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CAcxF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BILLING_CONFIG = exports.DEFAULT_BILLING_CONFIG = void 0;
|
|
4
|
+
exports.resolveBillingConfig = resolveBillingConfig;
|
|
5
|
+
exports.DEFAULT_BILLING_CONFIG = {
|
|
6
|
+
emailSender: { enabled: false, extraJobs: {} },
|
|
7
|
+
emails: { paymentFailed: true, cardExpiring: true, subscriptionEnded: true },
|
|
8
|
+
failedCardGrace: true,
|
|
9
|
+
deletion: { afterSubscriptionEndedDays: 30 },
|
|
10
|
+
links: {
|
|
11
|
+
billing: "/settings/billing",
|
|
12
|
+
paymentMethod: "/settings/billing",
|
|
13
|
+
subscribe: "/settings/billing?action=subscribe",
|
|
14
|
+
resubscribe: "/settings/billing",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
exports.BILLING_CONFIG = Symbol("BILLING_CONFIG");
|
|
18
|
+
/**
|
|
19
|
+
* Merges an app's billing config over the defaults, key by key: a partial
|
|
20
|
+
* `emails` or `links` object keeps every key it does not name.
|
|
21
|
+
*/
|
|
22
|
+
function resolveBillingConfig(config) {
|
|
23
|
+
return {
|
|
24
|
+
emailSender: {
|
|
25
|
+
enabled: config?.emailSender?.enabled ?? exports.DEFAULT_BILLING_CONFIG.emailSender.enabled,
|
|
26
|
+
extraJobs: { ...exports.DEFAULT_BILLING_CONFIG.emailSender.extraJobs, ...(config?.emailSender?.extraJobs ?? {}) },
|
|
27
|
+
},
|
|
28
|
+
emails: { ...exports.DEFAULT_BILLING_CONFIG.emails, ...stripUndefined(config?.emails) },
|
|
29
|
+
failedCardGrace: config?.failedCardGrace ?? exports.DEFAULT_BILLING_CONFIG.failedCardGrace,
|
|
30
|
+
deletion: {
|
|
31
|
+
afterSubscriptionEndedDays: config?.deletion?.afterSubscriptionEndedDays ?? exports.DEFAULT_BILLING_CONFIG.deletion.afterSubscriptionEndedDays,
|
|
32
|
+
},
|
|
33
|
+
links: { ...exports.DEFAULT_BILLING_CONFIG.links, ...stripUndefined(config?.links) },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function stripUndefined(value) {
|
|
37
|
+
if (!value)
|
|
38
|
+
return {};
|
|
39
|
+
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=billing.config.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.config.interface.js","sourceRoot":"","sources":["../../../../src/foundations/billing/interfaces/billing.config.interface.ts"],"names":[],"mappings":";;;AAuEA,oDAcC;AAjCY,QAAA,sBAAsB,GAA0B;IAC3D,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IAC9C,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAC5E,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,EAAE,0BAA0B,EAAE,EAAE,EAAE;IAC5C,KAAK,EAAE;QACL,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,mBAAmB;QAClC,SAAS,EAAE,oCAAoC;QAC/C,WAAW,EAAE,mBAAmB;KACjC;CACF,CAAC;AAEW,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,MAA4B;IAC/D,OAAO;QACL,WAAW,EAAE;YACX,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,IAAI,8BAAsB,CAAC,WAAW,CAAC,OAAO;YACnF,SAAS,EAAE,EAAE,GAAG,8BAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE;SAC1G;QACD,MAAM,EAAE,EAAE,GAAG,8BAAsB,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QAC/E,eAAe,EAAE,MAAM,EAAE,eAAe,IAAI,8BAAsB,CAAC,eAAe;QAClF,QAAQ,EAAE;YACR,0BAA0B,EACxB,MAAM,EAAE,QAAQ,EAAE,0BAA0B,IAAI,8BAAsB,CAAC,QAAQ,CAAC,0BAA0B;SAC7G;QACD,KAAK,EAAE,EAAE,GAAG,8BAAsB,CAAC,KAAK,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;KAC7E,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAmB,KAAS;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAe,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { BillingEmailJobDefinition } from "../interfaces/billing.config.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Job types the library billing email sender handles out of the box.
|
|
4
|
+
*
|
|
5
|
+
* The mapping below is copied from only35's `apps/api/src/processors/email.processor.ts`
|
|
6
|
+
* (every job type except the app-specific `cull-completed`), with the hard-coded
|
|
7
|
+
* paths turned into the configurable `links`. `card-expiring` is new.
|
|
8
|
+
*/
|
|
9
|
+
export type LibraryBillingJobType = "payment-failure" | "subscription-status-change" | "payment-success-customer" | "payment-success-admin" | "trial-ending-reminder" | "trial-ended" | "deletion-warning" | "subscription-cancelled" | "company-deleted" | "referral-invite" | "referral-reward" | "card-expiring";
|
|
10
|
+
export interface BillingEmailJobData {
|
|
11
|
+
jobType: string;
|
|
12
|
+
payload: Record<string, unknown> & {
|
|
13
|
+
to: string;
|
|
14
|
+
locale?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface PaymentFailureEmailParams {
|
|
18
|
+
to: string;
|
|
19
|
+
customerName: string;
|
|
20
|
+
stripeCustomerId: string;
|
|
21
|
+
stripeInvoiceId?: string;
|
|
22
|
+
stripePaymentIntentId?: string;
|
|
23
|
+
amount?: number;
|
|
24
|
+
currency?: string;
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
invoiceUrl?: string;
|
|
27
|
+
invoiceNumber?: string;
|
|
28
|
+
keepsAccess?: boolean;
|
|
29
|
+
locale?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SubscriptionStatusEmailParams {
|
|
32
|
+
to: string;
|
|
33
|
+
customerName: string;
|
|
34
|
+
stripeCustomerId: string;
|
|
35
|
+
subscriptionId: string;
|
|
36
|
+
status: string;
|
|
37
|
+
locale?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PaymentSuccessCustomerEmailParams {
|
|
40
|
+
to: string;
|
|
41
|
+
customerName: string;
|
|
42
|
+
stripeCustomerId: string;
|
|
43
|
+
stripeInvoiceId?: string;
|
|
44
|
+
stripePaymentIntentId?: string;
|
|
45
|
+
amount: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
invoiceUrl?: string;
|
|
48
|
+
invoiceNumber?: string;
|
|
49
|
+
isOneTimePurchase: boolean;
|
|
50
|
+
locale?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface PaymentSuccessAdminEmailParams {
|
|
53
|
+
to: string;
|
|
54
|
+
adminName: string;
|
|
55
|
+
companyName: string;
|
|
56
|
+
amount: number;
|
|
57
|
+
currency: string;
|
|
58
|
+
isOneTimePurchase: boolean;
|
|
59
|
+
locale?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface TrialEndingReminderEmailParams {
|
|
62
|
+
to: string;
|
|
63
|
+
customerName: string;
|
|
64
|
+
stripeCustomerId: string;
|
|
65
|
+
stripeSubscriptionId: string;
|
|
66
|
+
trialEndDate: string;
|
|
67
|
+
locale?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface TrialEndedEmailParams {
|
|
70
|
+
to: string;
|
|
71
|
+
customerName: string;
|
|
72
|
+
companyName: string;
|
|
73
|
+
stripeCustomerId: string;
|
|
74
|
+
stripeSubscriptionId: string;
|
|
75
|
+
trialEndDate: string;
|
|
76
|
+
dataRemovalDate: string;
|
|
77
|
+
locale?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface DeletionWarningEmailParams {
|
|
80
|
+
to: string;
|
|
81
|
+
companyName: string;
|
|
82
|
+
daysRemaining: number;
|
|
83
|
+
deletionDate: string;
|
|
84
|
+
reason: "trial_expired" | "subscription_cancelled";
|
|
85
|
+
isTrialExpired: boolean;
|
|
86
|
+
isSubscriptionCancelled: boolean;
|
|
87
|
+
locale?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface SubscriptionCancelledEmailParams {
|
|
90
|
+
to: string;
|
|
91
|
+
companyName: string;
|
|
92
|
+
dataRemovalDate: string;
|
|
93
|
+
locale?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface CompanyDeletedEmailParams {
|
|
96
|
+
to: string;
|
|
97
|
+
companyName: string;
|
|
98
|
+
reason: "trial_expired" | "subscription_cancelled" | "immediate_deletion";
|
|
99
|
+
deletionDate: string;
|
|
100
|
+
locale?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ReferralInviteEmailParams {
|
|
103
|
+
to: string;
|
|
104
|
+
referralCode: string;
|
|
105
|
+
companyName: string;
|
|
106
|
+
inviterName: string;
|
|
107
|
+
inviterEmail: string;
|
|
108
|
+
referralUrl: string;
|
|
109
|
+
locale?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface ReferralRewardEmailParams {
|
|
112
|
+
to: string;
|
|
113
|
+
userName: string;
|
|
114
|
+
tokensAwarded: number;
|
|
115
|
+
locale?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface CardExpiringEmailParams {
|
|
118
|
+
to: string;
|
|
119
|
+
customerName: string;
|
|
120
|
+
stripeCustomerId: string;
|
|
121
|
+
renewalDate: string;
|
|
122
|
+
cardBrand: string;
|
|
123
|
+
cardLast4: string;
|
|
124
|
+
locale?: string;
|
|
125
|
+
}
|
|
126
|
+
export declare const LIBRARY_BILLING_EMAIL_JOBS: Record<LibraryBillingJobType, BillingEmailJobDefinition>;
|
|
127
|
+
//# sourceMappingURL=billing-email.jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-email.jobs.d.ts","sourceRoot":"","sources":["../../../../src/foundations/billing/processors/billing-email.jobs.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LIBRARY_BILLING_EMAIL_JOBS = void 0;
|
|
4
|
+
const email_helpers_1 = require("../../../core/email/email.helpers");
|
|
5
|
+
/** Narrows the queued payload to the shape a job expects. */
|
|
6
|
+
function asParams(payload) {
|
|
7
|
+
return payload;
|
|
8
|
+
}
|
|
9
|
+
exports.LIBRARY_BILLING_EMAIL_JOBS = {
|
|
10
|
+
"payment-failure": {
|
|
11
|
+
template: "paymentFailure",
|
|
12
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
13
|
+
const params = asParams(payload);
|
|
14
|
+
return {
|
|
15
|
+
to: params.to,
|
|
16
|
+
customerName: params.customerName,
|
|
17
|
+
stripeInvoiceId: params.stripeInvoiceId,
|
|
18
|
+
stripePaymentIntentId: params.stripePaymentIntentId,
|
|
19
|
+
amount: params.amount,
|
|
20
|
+
currency: params.currency,
|
|
21
|
+
errorMessage: params.errorMessage,
|
|
22
|
+
invoiceUrl: params.invoiceUrl,
|
|
23
|
+
invoiceNumber: params.invoiceNumber,
|
|
24
|
+
updatePaymentUrl: `${appUrl}${links.paymentMethod}`,
|
|
25
|
+
keepsAccess: params.keepsAccess ?? false,
|
|
26
|
+
locale,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
"subscription-status-change": {
|
|
31
|
+
template: "subscriptionStatusChange",
|
|
32
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
33
|
+
const params = asParams(payload);
|
|
34
|
+
return {
|
|
35
|
+
to: params.to,
|
|
36
|
+
customerName: params.customerName,
|
|
37
|
+
subscriptionId: params.subscriptionId,
|
|
38
|
+
status: params.status,
|
|
39
|
+
dashboardUrl: `${appUrl}${links.billing}`,
|
|
40
|
+
locale,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
"payment-success-customer": {
|
|
45
|
+
template: "paymentSuccessCustomer",
|
|
46
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
47
|
+
const params = asParams(payload);
|
|
48
|
+
return {
|
|
49
|
+
to: params.to,
|
|
50
|
+
customerName: params.customerName,
|
|
51
|
+
amount: params.amount,
|
|
52
|
+
currency: params.currency?.toUpperCase() || "USD",
|
|
53
|
+
invoiceUrl: params.invoiceUrl,
|
|
54
|
+
invoiceNumber: params.invoiceNumber,
|
|
55
|
+
isOneTimePurchase: params.isOneTimePurchase,
|
|
56
|
+
billingDashboardUrl: `${appUrl}${links.billing}`,
|
|
57
|
+
locale,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
"payment-success-admin": {
|
|
62
|
+
template: "paymentSuccessAdmin",
|
|
63
|
+
toTemplateData: (payload, { locale }) => {
|
|
64
|
+
const params = asParams(payload);
|
|
65
|
+
return {
|
|
66
|
+
to: params.to,
|
|
67
|
+
adminName: params.adminName,
|
|
68
|
+
companyName: params.companyName,
|
|
69
|
+
amount: params.amount,
|
|
70
|
+
currency: params.currency?.toUpperCase() || "USD",
|
|
71
|
+
isOneTimePurchase: params.isOneTimePurchase,
|
|
72
|
+
locale,
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
"trial-ending-reminder": {
|
|
77
|
+
template: "trialEndingReminder",
|
|
78
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
79
|
+
const params = asParams(payload);
|
|
80
|
+
return {
|
|
81
|
+
to: params.to,
|
|
82
|
+
customerName: params.customerName,
|
|
83
|
+
trialEndDate: (0, email_helpers_1.formatEmailDate)(params.trialEndDate, locale),
|
|
84
|
+
upgradeUrl: `${appUrl}${links.subscribe}`,
|
|
85
|
+
locale,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
"trial-ended": {
|
|
90
|
+
template: "trialEndedWithoutPayment",
|
|
91
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
92
|
+
const params = asParams(payload);
|
|
93
|
+
return {
|
|
94
|
+
to: params.to,
|
|
95
|
+
customerName: params.customerName,
|
|
96
|
+
companyName: params.companyName,
|
|
97
|
+
trialEndDate: (0, email_helpers_1.formatEmailDate)(params.trialEndDate, locale),
|
|
98
|
+
dataRemovalDate: (0, email_helpers_1.formatEmailDate)(params.dataRemovalDate, locale),
|
|
99
|
+
upgradeUrl: `${appUrl}${links.resubscribe}`,
|
|
100
|
+
locale,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
"deletion-warning": {
|
|
105
|
+
template: "deletionWarning",
|
|
106
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
107
|
+
const params = asParams(payload);
|
|
108
|
+
const subject = params.daysRemaining === 1
|
|
109
|
+
? `Final Warning: Your ${params.companyName} data will be deleted tomorrow`
|
|
110
|
+
: `Warning: Your ${params.companyName} data will be deleted in ${params.daysRemaining} days`;
|
|
111
|
+
return {
|
|
112
|
+
to: params.to,
|
|
113
|
+
subject,
|
|
114
|
+
companyName: params.companyName,
|
|
115
|
+
daysRemaining: params.daysRemaining,
|
|
116
|
+
deletionDate: (0, email_helpers_1.formatEmailDate)(params.deletionDate, locale),
|
|
117
|
+
isTrialExpired: params.isTrialExpired,
|
|
118
|
+
isSubscriptionCancelled: params.isSubscriptionCancelled,
|
|
119
|
+
isFinalWarning: params.daysRemaining === 1,
|
|
120
|
+
resubscribeUrl: `${appUrl}${links.resubscribe}`,
|
|
121
|
+
locale,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
"subscription-cancelled": {
|
|
126
|
+
template: "subscriptionCancelled",
|
|
127
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
128
|
+
const params = asParams(payload);
|
|
129
|
+
return {
|
|
130
|
+
to: params.to,
|
|
131
|
+
companyName: params.companyName,
|
|
132
|
+
dataRemovalDate: (0, email_helpers_1.formatEmailDate)(params.dataRemovalDate, locale),
|
|
133
|
+
resubscribeUrl: `${appUrl}${links.resubscribe}`,
|
|
134
|
+
locale,
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
"company-deleted": {
|
|
139
|
+
template: "companyDeleted",
|
|
140
|
+
toTemplateData: (payload, { locale }) => {
|
|
141
|
+
const params = asParams(payload);
|
|
142
|
+
return {
|
|
143
|
+
to: params.to,
|
|
144
|
+
companyName: params.companyName,
|
|
145
|
+
deletionDate: (0, email_helpers_1.formatEmailDate)(params.deletionDate, locale),
|
|
146
|
+
isTrialExpired: params.reason === "trial_expired",
|
|
147
|
+
isSubscriptionCancelled: params.reason === "subscription_cancelled",
|
|
148
|
+
isImmediateDeletion: params.reason === "immediate_deletion",
|
|
149
|
+
locale,
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
"referral-invite": {
|
|
154
|
+
template: "referralInvite",
|
|
155
|
+
toTemplateData: (payload, { locale }) => {
|
|
156
|
+
const params = asParams(payload);
|
|
157
|
+
return {
|
|
158
|
+
to: params.to,
|
|
159
|
+
referralCode: params.referralCode,
|
|
160
|
+
companyName: params.companyName,
|
|
161
|
+
inviterName: params.inviterName,
|
|
162
|
+
inviterEmail: params.inviterEmail,
|
|
163
|
+
referralUrl: params.referralUrl,
|
|
164
|
+
locale,
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
"referral-reward": {
|
|
169
|
+
template: "referralReward",
|
|
170
|
+
toTemplateData: (payload, { locale }) => {
|
|
171
|
+
const params = asParams(payload);
|
|
172
|
+
return {
|
|
173
|
+
to: params.to,
|
|
174
|
+
userName: params.userName,
|
|
175
|
+
tokensAwarded: params.tokensAwarded,
|
|
176
|
+
locale,
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
"card-expiring": {
|
|
181
|
+
template: "cardExpiring",
|
|
182
|
+
toTemplateData: (payload, { appUrl, locale, links }) => {
|
|
183
|
+
const params = asParams(payload);
|
|
184
|
+
return {
|
|
185
|
+
to: params.to,
|
|
186
|
+
customerName: params.customerName,
|
|
187
|
+
renewalDate: (0, email_helpers_1.formatEmailDate)(params.renewalDate, locale),
|
|
188
|
+
cardBrand: params.cardBrand,
|
|
189
|
+
cardLast4: params.cardLast4,
|
|
190
|
+
updatePaymentUrl: `${appUrl}${links.paymentMethod}`,
|
|
191
|
+
locale,
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=billing-email.jobs.js.map
|