@carlonicora/nestjs-neo4jsonapi 7.1.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/core/email/templates/en/cardExpiring.hbs +28 -0
- package/dist/core/email/templates/en/paymentFailure.hbs +4 -0
- 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/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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.factory.d.ts","sourceRoot":"","sources":["../../src/bootstrap/app.module.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAwB7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"app.module.factory.d.ts","sourceRoot":"","sources":["../../src/bootstrap/app.module.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAwB7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,CAkKpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.factory.js","sourceRoot":"","sources":["../../src/bootstrap/app.module.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,
|
|
1
|
+
{"version":3,"file":"app.module.factory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,CAAC,CAAC,KAAK;qCAC/D,CAAC;gCACJ,CAAC;6BACF,CAAC;4BACF,8BAAa;yBACd;wBACH,CAAC,CAAC,EAAE,CAAC;iBACR;gBACD,MAAM,EAAE,IAAI;gBACZ,WAAW,EAAE,EAAE;gBACf,SAAS,EAAE;oBACT,mEAAmE;oBACnE,2EAA2E;oBAC3E,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,gBAAS,EAAE,QAAQ,EAAE,6CAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACrF,qEAAqE;oBACrE,0DAA0D;oBAC1D,EAAE,OAAO,EAAE,iCAAmB,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,EAAE;iBAClF;gBACD,OAAO,EAAE,CAAC,iCAAmB,CAAC;aAC/B,CAAC;QACJ,CAAC;KACF,CAAA;IA7JK,kBAAkB;QADvB,IAAA,eAAM,EAAC,EAAE,CAAC;OACL,kBAAkB,CA6JvB;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { ReferralModuleConfig } from "../foundations/referral/interfaces/referra
|
|
|
8
8
|
import { HandbookModuleConfig } from "../foundations/handbook/interfaces/handbook.config.interface";
|
|
9
9
|
import { HowToModuleConfig } from "../foundations/how-to/interfaces/how-to.config.interface";
|
|
10
10
|
import { BlogModuleConfig } from "../foundations/blog/interfaces/blog.config.interface";
|
|
11
|
+
import { BillingModuleConfig } from "../foundations/billing/interfaces/billing.config.interface";
|
|
11
12
|
import { EmailAutomationModuleConfig } from "../foundations/email-automation/interfaces/email-automation.config.interface";
|
|
12
13
|
import { UserActivityModuleConfig } from "../foundations/user-activity/interfaces/user-activity.config.interface";
|
|
13
14
|
import { AnalyticsModuleConfig } from "../foundations/analytics/interfaces/analytics.config.interface";
|
|
@@ -159,6 +160,25 @@ export interface BootstrapOptions {
|
|
|
159
160
|
* ```
|
|
160
161
|
*/
|
|
161
162
|
emailAutomation?: EmailAutomationModuleConfig;
|
|
163
|
+
/**
|
|
164
|
+
* Configuration for the billing module.
|
|
165
|
+
* Forwarded to `FoundationsModule.forRoot({ billing })`, exactly like
|
|
166
|
+
* `emailAutomation` above. The module is always mounted; every key is optional.
|
|
167
|
+
*
|
|
168
|
+
* Omitted keeps the defaults: failed-card grace on, the library
|
|
169
|
+
* billing email sender off (apps that consume `QueueId.EMAIL` with their own
|
|
170
|
+
* processor keep it), every billing email on, deletion 30 days after a
|
|
171
|
+
* subscription ends.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* billing: {
|
|
176
|
+
* emailSender: { enabled: true },
|
|
177
|
+
* deletion: { afterSubscriptionEndedDays: 365 },
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
billing?: BillingModuleConfig;
|
|
162
182
|
/**
|
|
163
183
|
* Configuration for the first-party web analytics feature module.
|
|
164
184
|
* Forwarded to `FoundationsModule.forRoot({ analytics })`, exactly like
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.options.d.ts","sourceRoot":"","sources":["../../src/bootstrap/bootstrap.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,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AAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;CAC9E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Your card expires before your next payment</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body style="margin: 0; padding: 0; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
|
|
9
|
+
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width: 600px; margin: 0 auto;">
|
|
10
|
+
<tr><td>{{> header}}</td></tr>
|
|
11
|
+
<tr>
|
|
12
|
+
<td style="padding: 32px;">
|
|
13
|
+
<h1 style="color: #1a1a1a; font-size: 24px; font-weight: 600; margin: 0 0 24px 0; line-height: 1.3;">Your card expires before your next payment</h1>
|
|
14
|
+
<p style="color: #333333; font-size: 16px; line-height: 1.6; margin: 0 0 16px 0;">Hi {{customerName}},</p>
|
|
15
|
+
<p style="color: #333333; font-size: 16px; line-height: 1.6; margin: 0 0 24px 0;">Your subscription renews on <strong>{{renewalDate}}</strong>, but the {{cardBrand}} card ending in <strong>{{cardLast4}}</strong> expires before then.</p>
|
|
16
|
+
<p style="color: #333333; font-size: 16px; line-height: 1.6; margin: 0 0 24px 0;">Add a new card before that date and the renewal goes through as usual.</p>
|
|
17
|
+
{{#if updatePaymentUrl}}
|
|
18
|
+
<div style="text-align: center; margin: 32px 0 16px 0;">
|
|
19
|
+
<a href="{{updatePaymentUrl}}" style="display: inline-block; background: #1a1a1a; color: #ffffff; padding: 14px 28px; text-decoration: none; border-radius: 4px; font-weight: 600; font-size: 16px;">Update your card</a>
|
|
20
|
+
</div>
|
|
21
|
+
{{/if}}
|
|
22
|
+
<p style="color: #999999; font-size: 14px; line-height: 1.5; margin: 24px 0 0 0;">Already updated it? Then you can ignore this email.</p>
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<tr><td>{{> footer}}</td></tr>
|
|
26
|
+
</table>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -20,12 +20,16 @@
|
|
|
20
20
|
{{#if errorMessage}}<p style="margin: 0; font-size: 14px; color: #ef4444;"><strong>Error:</strong> {{errorMessage}}</p>{{/if}}
|
|
21
21
|
</div>
|
|
22
22
|
{{/if}}
|
|
23
|
+
{{#if keepsAccess}}
|
|
24
|
+
<p style="color: #333333; font-size: 16px; line-height: 1.6; margin: 0 0 24px 0;">Nothing has stopped: everything keeps working while we retry. Update your card so it doesn't run out.</p>
|
|
25
|
+
{{else}}
|
|
23
26
|
<p style="color: #333333; font-size: 16px; line-height: 1.6; margin: 0 0 16px 0;"><strong>What you need to do:</strong></p>
|
|
24
27
|
<ul style="color: #333333; font-size: 16px; line-height: 1.8; margin: 0 0 24px 0; padding-left: 24px;">
|
|
25
28
|
<li>Verify your payment method is up to date</li>
|
|
26
29
|
<li>Ensure sufficient funds are available</li>
|
|
27
30
|
<li>Update your payment information if needed</li>
|
|
28
31
|
</ul>
|
|
32
|
+
{{/if}}
|
|
29
33
|
{{#if invoiceUrl}}
|
|
30
34
|
<div style="text-align: center; margin: 32px 0 16px 0;">
|
|
31
35
|
<a href="{{invoiceUrl}}" style="display: inline-block; background: #1a1a1a; color: #ffffff; padding: 14px 28px; text-decoration: none; border-radius: 4px; font-weight: 600; font-size: 16px;">View Invoice</a>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { BillingModuleConfig } from "./interfaces/billing.config.interface";
|
|
3
|
+
/**
|
|
4
|
+
* BillingModule — per-app billing settings and billing housekeeping.
|
|
5
|
+
*
|
|
6
|
+
* - `BILLING_CONFIG` (global): the resolved settings every billing service reads
|
|
7
|
+
* - `BillingLifecycleCron` (worker only): hourly card-expiry check
|
|
8
|
+
* - `BillingEmailProcessor` (worker only, opt-in): the library billing email sender on `QueueId.EMAIL`
|
|
9
|
+
*
|
|
10
|
+
* Always mounted by `FoundationsModule`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Through bootstrap, which forwards it to FoundationsModule
|
|
15
|
+
* bootstrap({ billing: { emailSender: { enabled: true } } })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class BillingModule {
|
|
19
|
+
/**
|
|
20
|
+
* Configure the BillingModule.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Optional configuration merged key by key over DEFAULT_BILLING_CONFIG
|
|
23
|
+
*/
|
|
24
|
+
static forRoot(config?: BillingModuleConfig): DynamicModule;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=billing.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.module.d.ts","sourceRoot":"","sources":["../../../src/foundations/billing/billing.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAQjE,OAAO,EAAkB,mBAAmB,EAAwB,MAAM,uCAAuC,CAAC;AAIlH;;;;;;;;;;;;;;GAcG;AACH,qBACa,aAAa;IACxB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,aAAa;CA2B5D"}
|
|
@@ -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":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,4BAA4B,GAC5B,0BAA0B,GAC1B,uBAAuB,GACvB,uBAAuB,GACvB,aAAa,GACb,kBAAkB,GAClB,wBAAwB,GACxB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,6BAA6B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAA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