@saasicat/core 1.0.0-rc.2 → 1.0.0-rc.20

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/index.cjs CHANGED
@@ -20,49 +20,91 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ACTIVE_SUBSCRIPTION_CONTRACT_STATUSES: () => ACTIVE_SUBSCRIPTION_CONTRACT_STATUSES,
23
24
  AUTH_ERROR_CODES: () => AUTH_ERROR_CODES,
24
25
  BILLING_ERROR_CODES: () => BILLING_ERROR_CODES,
26
+ BUNDLE_PRICE_LOOKUP_LIMIT: () => BUNDLE_PRICE_LOOKUP_LIMIT,
27
+ CATALOGUE_KEYS: () => CATALOGUE_KEYS,
25
28
  CATALOG_ERROR_CODES: () => CATALOG_ERROR_CODES,
26
29
  CONTRACT_ERROR_CODES: () => CONTRACT_ERROR_CODES,
27
30
  ERROR_MESSAGES_DE: () => ERROR_MESSAGES_DE,
28
31
  ERROR_MESSAGES_EN: () => ERROR_MESSAGES_EN,
29
32
  FEATURE_NOT_LICENSED: () => FEATURE_NOT_LICENSED,
33
+ LEGAL_IDENTITY_FIELDS: () => LEGAL_IDENTITY_FIELDS,
34
+ MARKETING_PRIORITY_MAX: () => MARKETING_PRIORITY_MAX,
35
+ MARKETING_PRIORITY_MIN: () => MARKETING_PRIORITY_MIN,
30
36
  OTP_RATE_LIMIT_MAX_SENDS: () => OTP_RATE_LIMIT_MAX_SENDS,
31
37
  OTP_RATE_LIMIT_WINDOW_MINUTES: () => OTP_RATE_LIMIT_WINDOW_MINUTES,
32
38
  OTP_TTL_MINUTES: () => OTP_TTL_MINUTES,
33
39
  OTP_VERIFY_MAX_ATTEMPTS: () => OTP_VERIFY_MAX_ATTEMPTS,
34
40
  PASSWORD_RESET_TTL_MINUTES: () => PASSWORD_RESET_TTL_MINUTES,
41
+ PAYMENT_ERROR_CODES: () => PAYMENT_ERROR_CODES,
42
+ PAYMENT_METHOD_TYPES: () => PAYMENT_METHOD_TYPES,
35
43
  PENDING_CHECKOUT_TTL_DAYS: () => PENDING_CHECKOUT_TTL_DAYS,
36
44
  PENDING_EMAIL_TTL_HOURS: () => PENDING_EMAIL_TTL_HOURS,
37
45
  PENDING_ONBOARDING_TTL_DAYS: () => PENDING_ONBOARDING_TTL_DAYS,
38
46
  PLATFORM_ERROR_CODES: () => PLATFORM_ERROR_CODES,
39
47
  PROMO_ERROR_CODES: () => PROMO_ERROR_CODES,
48
+ PaymentCallbackRejectedError: () => PaymentCallbackRejectedError,
40
49
  PersistenceCapabilityError: () => PersistenceCapabilityError,
41
50
  PlatformUserExistsError: () => PlatformUserExistsError,
42
51
  REGISTRATION_ERROR_CODES: () => REGISTRATION_ERROR_CODES,
43
52
  REGISTRATION_RESUME_TTL_MINUTES: () => REGISTRATION_RESUME_TTL_MINUTES,
44
53
  REGISTRATION_STEP_BY_STATUS: () => REGISTRATION_STEP_BY_STATUS,
54
+ SETTINGS_ERROR_CODES: () => SETTINGS_ERROR_CODES,
45
55
  SETUP_ERROR_CODES: () => SETUP_ERROR_CODES,
56
+ SUBSCRIBER_ERROR_CODES: () => SUBSCRIBER_ERROR_CODES,
46
57
  applyPromo: () => applyPromo,
47
58
  assertPersistenceCapabilities: () => assertPersistenceCapabilities,
48
59
  buildActivePlanVersionWhere: () => buildActivePlanVersionWhere,
49
60
  buildActiveVersionWhere: () => buildActiveVersionWhere,
50
61
  buildFeatureRequiresIndex: () => buildFeatureRequiresIndex,
62
+ bundleDraftDefaults: () => bundleDraftDefaults,
63
+ bundleStemDefaults: () => bundleStemDefaults,
64
+ canonicalJson: () => canonicalJson,
51
65
  classifyBundleVersionDiff: () => classifyBundleVersionDiff,
66
+ classifyIssuerChange: () => classifyIssuerChange,
52
67
  classifyPlanDiff: () => classifyPlanDiff,
53
68
  collectUnsatisfiedRequires: () => collectUnsatisfiedRequires,
69
+ contractPartiesOf: () => contractPartiesOf,
54
70
  coverageExcludingSelf: () => coverageExcludingSelf,
71
+ definedFields: () => definedFields,
72
+ diffSettings: () => diffSettings,
73
+ formatCustomerNumber: () => formatCustomerNumber,
55
74
  formatErrorMessage: () => formatErrorMessage,
75
+ identityCorrectionDelta: () => identityCorrectionDelta,
56
76
  isBundleRedundant: () => isBundleRedundant,
77
+ isPaymentCallbackRejectedError: () => isPaymentCallbackRejectedError,
57
78
  isPlatformUserExistsError: () => isPlatformUserExistsError,
58
79
  isVersionEditable: () => isVersionEditable,
80
+ issuerIdentityOf: () => issuerIdentityOf,
81
+ keepOneRecommended: () => keepOneRecommended,
59
82
  missingRequiresFor: () => missingRequiresFor,
83
+ movedIdentityFields: () => movedIdentityFields,
60
84
  pickActivePromo: () => pickActivePromo,
85
+ planCatalogSettingsOf: () => planCatalogSettingsOf,
86
+ previousUtcDay: () => previousUtcDay,
61
87
  promoStatus: () => promoStatus,
88
+ readQuotaRecord: () => readQuotaRecord,
89
+ readQuotaValue: () => readQuotaValue,
90
+ recordedIssuerIdentity: () => recordedIssuerIdentity,
62
91
  resolveBundleAvailability: () => resolveBundleAvailability,
63
92
  resolveErrorMessage: () => resolveErrorMessage,
93
+ sameLegalIdentity: () => sameLegalIdentity,
64
94
  selectChargeableBundles: () => selectChargeableBundles,
65
- startOfUtcDay: () => startOfUtcDay
95
+ settingsSubtreeOf: () => settingsSubtreeOf,
96
+ startOfUtcDay: () => startOfUtcDay,
97
+ subscriberFromRegistration: () => subscriberFromRegistration,
98
+ subscriberPaymentMethodColumns: () => subscriberPaymentMethodColumns,
99
+ toBundleStemRow: () => toBundleStemRow,
100
+ toContractLineItemRecord: () => toContractLineItemRecord,
101
+ toPlanRow: () => toPlanRow,
102
+ toPlanVersionRow: () => toPlanVersionRow,
103
+ toRunningContractIssuer: () => toRunningContractIssuer,
104
+ toSubscriberCorrectionRecord: () => toSubscriberCorrectionRecord,
105
+ toSubscriberPaymentMethodRecord: () => toSubscriberPaymentMethodRecord,
106
+ toSubscriberRecord: () => toSubscriberRecord,
107
+ toSubscriptionContractRecord: () => toSubscriptionContractRecord
66
108
  });
67
109
  module.exports = __toCommonJS(index_exports);
68
110
 
@@ -70,6 +112,11 @@ module.exports = __toCommonJS(index_exports);
70
112
  function startOfUtcDay(date) {
71
113
  return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
72
114
  }
115
+ function previousUtcDay(value) {
116
+ const result = new Date(value);
117
+ result.setUTCDate(result.getUTCDate() - 1);
118
+ return result;
119
+ }
73
120
  function buildActivePlanVersionWhere(asOf, options = {}) {
74
121
  const asOfDayStart = startOfUtcDay(asOf);
75
122
  const validityWindow = [
@@ -86,6 +133,57 @@ function buildActivePlanVersionWhere(asOf, options = {}) {
86
133
  }
87
134
  var buildActiveVersionWhere = buildActivePlanVersionWhere;
88
135
 
136
+ // src/bundle-draft-defaults.ts
137
+ function bundleDraftDefaults(data) {
138
+ return {
139
+ baseVersionId: data.baseVersionId ?? null,
140
+ features: data.features,
141
+ quotas: data.quotas ?? {},
142
+ compatibility: data.compatibility ?? {},
143
+ pricingOverrides: data.pricingOverrides ?? [],
144
+ monthlyNet: data.monthlyNet ?? null,
145
+ yearlyNet: data.yearlyNet ?? null,
146
+ marketed: data.marketed ?? true,
147
+ changeNote: data.changeNote ?? "",
148
+ createdByUserId: data.createdByUserId ?? null
149
+ };
150
+ }
151
+ function bundleStemDefaults(data) {
152
+ return {
153
+ bundleKey: data.bundleKey,
154
+ label: data.label,
155
+ description: data.description ?? null,
156
+ icon: data.icon ?? null,
157
+ sortOrder: data.sortOrder ?? 0,
158
+ i18n: data.i18n ?? {}
159
+ };
160
+ }
161
+ function toBundleStemRow(row) {
162
+ return {
163
+ id: row.id,
164
+ bundleKey: row.bundleKey,
165
+ label: row.label,
166
+ description: row.description,
167
+ icon: row.icon,
168
+ sortOrder: row.sortOrder,
169
+ i18n: row.i18n !== null && typeof row.i18n === "object" && !Array.isArray(row.i18n) ? row.i18n : {},
170
+ createdAt: row.createdAt.toISOString(),
171
+ updatedAt: row.updatedAt.toISOString(),
172
+ deletedAt: row.deletedAt?.toISOString() ?? null
173
+ };
174
+ }
175
+ function definedFields(data, keys) {
176
+ const patch = {};
177
+ for (const key of keys) {
178
+ if (data[key] !== void 0) patch[key] = data[key];
179
+ }
180
+ return patch;
181
+ }
182
+
183
+ // src/catalog-entry.types.ts
184
+ var MARKETING_PRIORITY_MIN = 0;
185
+ var MARKETING_PRIORITY_MAX = 1e4;
186
+
89
187
  // src/promotion.types.ts
90
188
  function promoStatus(promo, today = /* @__PURE__ */ new Date()) {
91
189
  const from = new Date(promo.validFrom);
@@ -130,25 +228,29 @@ function applyPromo(promo, basePrice) {
130
228
  return null;
131
229
  }
132
230
 
231
+ // src/quota-value.ts
232
+ function readQuotaValue(value) {
233
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
234
+ if (typeof value !== "string") return null;
235
+ if (value.trim() === "") return null;
236
+ const parsed = Number(value);
237
+ return Number.isFinite(parsed) ? parsed : null;
238
+ }
239
+ var UNCOUNTABLE = -1;
240
+ function readQuotaRecord(value) {
241
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return {};
242
+ const quotas = {};
243
+ for (const [key, entry] of Object.entries(value)) {
244
+ quotas[key] = readQuotaValue(entry) ?? UNCOUNTABLE;
245
+ }
246
+ return quotas;
247
+ }
248
+
133
249
  // src/version-diff.ts
134
250
  function classifyPlanDiff(oldV, newV) {
135
251
  const changes = [];
136
252
  appendFeatureChanges(changes, oldV.features, newV.features);
137
- appendNumberChange(changes, "maxUsers", oldV.maxUsers, newV.maxUsers, "higherIsBetter");
138
- appendNumberChange(
139
- changes,
140
- "maxVehicles",
141
- oldV.maxVehicles,
142
- newV.maxVehicles,
143
- "higherIsBetter"
144
- );
145
- appendNumberChange(
146
- changes,
147
- "maxStorageGb",
148
- oldV.maxStorageGb,
149
- newV.maxStorageGb,
150
- "higherIsBetter"
151
- );
253
+ appendQuotaChanges(changes, oldV.quotas, newV.quotas);
152
254
  appendDecimalChange(changes, "monthlyNet", oldV.monthlyNet, newV.monthlyNet, "lowerIsBetter");
153
255
  appendDecimalChange(changes, "yearlyNet", oldV.yearlyNet, newV.yearlyNet, "lowerIsBetter");
154
256
  return buildResult(changes);
@@ -195,11 +297,6 @@ function appendFeatureChanges(out, oldFeatures, newFeatures) {
195
297
  });
196
298
  }
197
299
  }
198
- function appendNumberChange(out, field, oldValue, newValue, polarity) {
199
- if (oldValue === newValue) return;
200
- const direction = directionFromCmp(newValue - oldValue, polarity);
201
- out.push({ field, oldValue, newValue, direction });
202
- }
203
300
  function appendDecimalChange(out, field, oldValue, newValue, polarity) {
204
301
  const oldNum = toNumber(oldValue);
205
302
  const newNum = toNumber(newValue);
@@ -230,16 +327,31 @@ function buildResult(changes) {
230
327
  return { nonRegressive, changes };
231
328
  }
232
329
  function appendQuotaChanges(out, oldQuotas, newQuotas) {
330
+ const at = (quotas, key) => Object.hasOwn(quotas, key) ? quotas[key] : 0;
233
331
  const allKeys = /* @__PURE__ */ new Set([...Object.keys(oldQuotas), ...Object.keys(newQuotas)]);
234
332
  for (const key of allKeys) {
235
- const oldValue = oldQuotas[key] ?? 0;
236
- const newValue = newQuotas[key] ?? 0;
333
+ const oldRaw = at(oldQuotas, key);
334
+ const newRaw = at(newQuotas, key);
335
+ if (oldRaw === newRaw) continue;
336
+ const oldValue = toQuotaNumber(oldRaw);
337
+ const newValue = toQuotaNumber(newRaw);
237
338
  if (oldValue === newValue) continue;
238
- const direction = directionFromQuotaCmp(oldValue, newValue);
239
- out.push({ field: `quotas.${key}`, oldValue, newValue, direction });
339
+ out.push({
340
+ field: `quotas.${key}`,
341
+ oldValue: reportableQuota(oldRaw, oldValue),
342
+ newValue: reportableQuota(newRaw, newValue),
343
+ direction: directionFromQuotaCmp(oldValue, newValue)
344
+ });
240
345
  }
241
346
  }
347
+ function toQuotaNumber(value) {
348
+ return readQuotaValue(value) ?? Number.NaN;
349
+ }
350
+ function reportableQuota(raw, asNumber) {
351
+ return Number.isFinite(asNumber) ? asNumber : String(raw);
352
+ }
242
353
  function directionFromQuotaCmp(oldValue, newValue) {
354
+ if (!Number.isFinite(oldValue) || !Number.isFinite(newValue)) return "REGRESSION";
243
355
  if (oldValue === -1 && newValue !== -1) return "REGRESSION";
244
356
  if (newValue === -1 && oldValue !== -1) return "IMPROVEMENT";
245
357
  return newValue > oldValue ? "IMPROVEMENT" : "REGRESSION";
@@ -267,6 +379,60 @@ function appendNullableDecimalChange(out, field, oldValue, newValue, polarity) {
267
379
  appendDecimalChange(out, field, oldValue, newValue, polarity);
268
380
  }
269
381
 
382
+ // src/settings-subtree.ts
383
+ var CATALOGUE_KEYS = /* @__PURE__ */ new Set([
384
+ "schemaVersion",
385
+ "features",
386
+ "plans"
387
+ ]);
388
+ function planCatalogSettingsOf(catalog) {
389
+ return settingsSubtreeOf(catalog);
390
+ }
391
+ function settingsSubtreeOf(catalog) {
392
+ const settings = {};
393
+ for (const [key, value] of Object.entries(catalog)) {
394
+ if (CATALOGUE_KEYS.has(key)) continue;
395
+ if (value === void 0) continue;
396
+ settings[key] = value;
397
+ }
398
+ return settings;
399
+ }
400
+ function canonicalJson(value) {
401
+ const json = JSON.stringify(value, (_key, member) => {
402
+ if (member && typeof member === "object" && !Array.isArray(member)) {
403
+ const sorted = {};
404
+ for (const name of Object.keys(member).sort()) {
405
+ sorted[name] = member[name];
406
+ }
407
+ return sorted;
408
+ }
409
+ return member;
410
+ });
411
+ return json ?? "undefined";
412
+ }
413
+ function isPlainObject(value) {
414
+ return value !== null && typeof value === "object" && !Array.isArray(value);
415
+ }
416
+ function diffSettings(before, after) {
417
+ const differences = [];
418
+ collectDifferences(before, after, [], differences);
419
+ return differences.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
420
+ }
421
+ function isObjectOrAbsent(value) {
422
+ return value === void 0 || isPlainObject(value);
423
+ }
424
+ function collectDifferences(before, after, path, out) {
425
+ if (isObjectOrAbsent(before) && isObjectOrAbsent(after) && (before || after)) {
426
+ const names = /* @__PURE__ */ new Set([...Object.keys(before ?? {}), ...Object.keys(after ?? {})]);
427
+ for (const name of names) {
428
+ collectDifferences(before?.[name], after?.[name], [...path, name], out);
429
+ }
430
+ return;
431
+ }
432
+ if (canonicalJson(before) === canonicalJson(after)) return;
433
+ out.push({ path: path.join("."), before, after });
434
+ }
435
+
270
436
  // src/ports/persistence-ports.types.ts
271
437
  var PersistenceCapabilityError = class extends Error {
272
438
  constructor(missing, requiredBy) {
@@ -337,6 +503,8 @@ var CATALOG_ERROR_CODES = {
337
503
  BUNDLE_VERSION_SUPERSEDED: "BUNDLE_VERSION_SUPERSEDED",
338
504
  BUNDLE_VERSION_REGRESSION: "BUNDLE_VERSION_REGRESSION",
339
505
  BUNDLE_VERSION_ZERO_PRICE: "BUNDLE_VERSION_ZERO_PRICE",
506
+ BUNDLE_VERSION_NO_PRICE: "BUNDLE_VERSION_NO_PRICE",
507
+ BUNDLE_VERSION_NOT_PRICED_FOR_PLAN: "BUNDLE_VERSION_NOT_PRICED_FOR_PLAN",
340
508
  BUNDLE_VERSION_DISCARD_NOT_IMPLEMENTED: "BUNDLE_VERSION_DISCARD_NOT_IMPLEMENTED",
341
509
  BUNDLE_VERSION_VALID_FROM_REQUIRED: "BUNDLE_VERSION_VALID_FROM_REQUIRED",
342
510
  BUNDLE_VERSION_VALID_FROM_INVALID: "BUNDLE_VERSION_VALID_FROM_INVALID",
@@ -366,7 +534,12 @@ var CATALOG_ERROR_CODES = {
366
534
  // ── discovery ──
367
535
  QUOTA_NOT_IN_DISCOVERY_SNAPSHOT: "QUOTA_NOT_IN_DISCOVERY_SNAPSHOT",
368
536
  DISCOVERY_STATUS_TRANSITION_INVALID: "DISCOVERY_STATUS_TRANSITION_INVALID",
369
- DISCOVERY_NOT_INITIALIZED: "DISCOVERY_NOT_INITIALIZED"
537
+ DISCOVERY_NOT_INITIALIZED: "DISCOVERY_NOT_INITIALIZED",
538
+ // ── catalogue import ──
539
+ /** The uploaded document is not a plan catalog — unparseable, or not an object. */
540
+ PLAN_CATALOG_UNREADABLE: "PLAN_CATALOG_UNREADABLE",
541
+ /** It parsed, and then failed the schema or a cross-field rule. */
542
+ PLAN_CATALOG_INVALID: "PLAN_CATALOG_INVALID"
370
543
  };
371
544
  var BILLING_ERROR_CODES = {
372
545
  /**
@@ -378,6 +551,8 @@ var BILLING_ERROR_CODES = {
378
551
  BUNDLE_ALREADY_SUBSCRIBED: "BUNDLE_ALREADY_SUBSCRIBED",
379
552
  BUNDLE_INCOMPATIBLE_WITH_PLAN: "BUNDLE_INCOMPATIBLE_WITH_PLAN",
380
553
  BUNDLE_NOT_SELF_SERVICE: "BUNDLE_NOT_SELF_SERVICE",
554
+ BUNDLE_CYCLE_EXCEEDS_PLAN: "BUNDLE_CYCLE_EXCEEDS_PLAN",
555
+ BUNDLE_NOT_PRICED_FOR_THIS_PLAN: "BUNDLE_NOT_PRICED_FOR_THIS_PLAN",
381
556
  SUBSCRIPTION_BUNDLE_ALREADY_CANCELLED: "SUBSCRIPTION_BUNDLE_ALREADY_CANCELLED",
382
557
  SUBSCRIPTION_BUNDLE_NOT_CANCELLED: "SUBSCRIPTION_BUNDLE_NOT_CANCELLED",
383
558
  SUBSCRIPTION_BUNDLE_CANCELLATION_EFFECTIVE: "SUBSCRIPTION_BUNDLE_CANCELLATION_EFFECTIVE",
@@ -392,8 +567,91 @@ var BILLING_ERROR_CODES = {
392
567
  PLAN_NOT_IN_CATALOG: "PLAN_NOT_IN_CATALOG",
393
568
  /** Plan exists but cannot be booked via self-service. */
394
569
  PLAN_NOT_SELF_SERVICE: "PLAN_NOT_SELF_SERVICE",
570
+ /**
571
+ * Plan carries no price for the requested billing cycle, so it is not sold
572
+ * in it: a plan without a yearly price is a monthly plan.
573
+ */
574
+ PLAN_NOT_SOLD_IN_CYCLE: "PLAN_NOT_SOLD_IN_CYCLE",
395
575
  /** Plan change refused. Carries `blockers[]` with their own codes. */
396
576
  PLAN_CHANGE_BLOCKED: "PLAN_CHANGE_BLOCKED",
577
+ /**
578
+ * The subscription moved between the read a request was decided on and the
579
+ * write it attempted, so nothing was written. The caller reloads and asks
580
+ * again.
581
+ */
582
+ SUBSCRIPTION_CHANGED: "SUBSCRIPTION_CHANGED",
583
+ /**
584
+ * The tenant has no subscription to act on.
585
+ *
586
+ * `SUBSCRIPTION_NOT_FOUND` states the same fact on the read routes. Both
587
+ * are already on the wire and a code is renamed only deliberately, so both
588
+ * are named here rather than one being dropped behind a consumer's back.
589
+ */
590
+ NO_SUBSCRIPTION: "NO_SUBSCRIPTION",
591
+ /**
592
+ * The cancellation date the reader was shown is no longer the one the rules
593
+ * return, so the confirmation is refused rather than silently applied.
594
+ * Carries the recomputed dates, so the page can re-ask instead of guessing.
595
+ */
596
+ CANCELLATION_TERMS_CHANGED: "CANCELLATION_TERMS_CHANGED",
597
+ // ── the preview routes' own blockers and warnings ──
598
+ //
599
+ // These travel inside a 200 response, in `blockers[]` and `warnings[]`, not
600
+ // as thrown errors — but they are read by a person and so belong in the same
601
+ // catalogue. Each carries `params` with the values its sentence names. Two
602
+ // routes emit them: the plan-change preview and the bundle preview.
603
+ //
604
+ // Three of them used to construct their code from the subject:
605
+ // `VEHICLES_OVER_TARGET`, `ENTERPRISE_LOCKED`, `PRO_NOT_SELF_SERVICE`. That
606
+ // made the set grow with every quota and plan an installation defines, so no
607
+ // catalogue could be complete against it and no guard could check one. The
608
+ // subject is a parameter now.
609
+ /** The subscription has ended; its plan can no longer be changed. */
610
+ SUBSCRIPTION_ENDED: "SUBSCRIPTION_ENDED",
611
+ /** An active special contract blocks self-service plan changes. */
612
+ PLAN_LOCKED: "PLAN_LOCKED",
613
+ /** Current usage of one quota exceeds what the target plan allows. */
614
+ QUOTA_OVER_TARGET: "QUOTA_OVER_TARGET",
615
+ /** The change drops features the tenant has today. */
616
+ FEATURE_LOST: "FEATURE_LOST",
617
+ FEATURES_LOST: "FEATURES_LOST",
618
+ /** Target plan and cycle already match what is in place. */
619
+ NO_CHANGE: "NO_CHANGE",
620
+ /** A shorter cycle cannot start inside the term already running. */
621
+ CYCLE_SHORTENS_AT_TERM_END: "CYCLE_SHORTENS_AT_TERM_END",
622
+ /** A cancelled subscription cannot change its billing cycle. */
623
+ CANCELLATION_LOCKS_THE_CYCLE: "CANCELLATION_LOCKS_THE_CYCLE",
624
+ /**
625
+ * A bundle the tenant already holds runs past the cycle they are moving to.
626
+ *
627
+ * Its own code rather than `BUNDLE_CYCLE_EXCEEDS_PLAN`, which states the
628
+ * same rule about a booking that has not been made yet. The two need
629
+ * different sentences: this one can name the day the obstacle lifts and
630
+ * tell the reader to cancel the booking, and that advice is wrong for
631
+ * someone who is only about to book. One template cannot serve both.
632
+ */
633
+ BUNDLE_BOOKING_OUTLASTS_TARGET_CYCLE: "BUNDLE_BOOKING_OUTLASTS_TARGET_CYCLE",
634
+ /**
635
+ * Features of the previewed bundle are already covered by the plan or by
636
+ * another booked bundle. A warning rather than a blocker: paying twice is
637
+ * the customer's decision, and the preview only has to say so first.
638
+ */
639
+ REDUNDANT_FEATURES: "REDUNDANT_FEATURES",
640
+ /**
641
+ * A booking's minimum term outlasts the period being cancelled, so the
642
+ * cancellation takes effect at the end of the term, not of the period.
643
+ */
644
+ MINIMUM_TERM_BINDS: "MINIMUM_TERM_BINDS",
645
+ /**
646
+ * The previewed bundle requires features that neither the plan nor an
647
+ * active booking provides.
648
+ *
649
+ * The same string is a `StrictModeWarningCode` in `bundle.types.ts`, where
650
+ * it names the catalogue-authoring reading of the rule and travels with its
651
+ * own message. This declaration is the booking preview's blocker, which a
652
+ * tenant reads and therefore needs a shipped text for.
653
+ */
654
+ BUNDLE_FEATURE_DEPENDENCY_UNSATISFIED: "BUNDLE_FEATURE_DEPENDENCY_UNSATISFIED",
397
655
  NO_PENDING_PLAN_VERSION: "NO_PENDING_PLAN_VERSION",
398
656
  ONBOARDING_CREATE_FAILED: "ONBOARDING_CREATE_FAILED",
399
657
  BUNDLE_PREVIEW_ARGUMENT_AMBIGUOUS: "BUNDLE_PREVIEW_ARGUMENT_AMBIGUOUS",
@@ -413,20 +671,57 @@ var CONTRACT_ERROR_CODES = {
413
671
  CHECKOUT_OFFER_BUNDLE_LINE_ITEMS_REQUIRED: "CHECKOUT_OFFER_BUNDLE_LINE_ITEMS_REQUIRED",
414
672
  CHECKOUT_OFFER_BUNDLE_VERSION_NOT_BOOKABLE: "CHECKOUT_OFFER_BUNDLE_VERSION_NOT_BOOKABLE",
415
673
  CHECKOUT_OFFER_FEATURE_DEPENDENCY_UNSATISFIED: "CHECKOUT_OFFER_FEATURE_DEPENDENCY_UNSATISFIED",
674
+ CHECKOUT_OFFER_PLAN_NOT_OFFERED: "CHECKOUT_OFFER_PLAN_NOT_OFFERED",
675
+ CHECKOUT_OFFER_BUNDLE_NOT_OFFERED: "CHECKOUT_OFFER_BUNDLE_NOT_OFFERED",
676
+ CHECKOUT_OFFER_PROMO_CODE_NOT_ACCEPTED: "CHECKOUT_OFFER_PROMO_CODE_NOT_ACCEPTED",
677
+ CHECKOUT_OFFER_PRICE_NOT_CURRENT: "CHECKOUT_OFFER_PRICE_NOT_CURRENT",
416
678
  SUBSCRIPTION_CONTRACT_LINE_ITEMS_REQUIRED: "SUBSCRIPTION_CONTRACT_LINE_ITEMS_REQUIRED",
417
679
  SUBSCRIPTION_CONTRACT_PLAN_LINE_ITEM_REQUIRED: "SUBSCRIPTION_CONTRACT_PLAN_LINE_ITEM_REQUIRED",
418
680
  SUBSCRIPTION_CONTRACT_INVALID_DATE: "SUBSCRIPTION_CONTRACT_INVALID_DATE",
419
681
  SUBSCRIPTION_CONTRACT_INVALID_WINDOW: "SUBSCRIPTION_CONTRACT_INVALID_WINDOW",
682
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_TAX_MISMATCH: "SUBSCRIPTION_CONTRACT_LINE_ITEM_TAX_MISMATCH",
683
+ SUBSCRIPTION_CONTRACT_TAX_RATE_NOT_PERCENT: "SUBSCRIPTION_CONTRACT_TAX_RATE_NOT_PERCENT",
684
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_CURRENCY_MISMATCH: "SUBSCRIPTION_CONTRACT_LINE_ITEM_CURRENCY_MISMATCH",
420
685
  SUBSCRIPTION_CONTRACT_TERMINATION_BEFORE_START: "SUBSCRIPTION_CONTRACT_TERMINATION_BEFORE_START",
421
686
  // ── stage 3 ──
422
687
  CHECKOUT_OFFER_NOT_FOUND: "CHECKOUT_OFFER_NOT_FOUND",
423
688
  CHECKOUT_OFFER_EXPIRED: "CHECKOUT_OFFER_EXPIRED",
424
689
  CHECKOUT_OFFER_ALREADY_CONSUMED: "CHECKOUT_OFFER_ALREADY_CONSUMED",
425
690
  CHECKOUT_OFFER_NOT_CONSUMED: "CHECKOUT_OFFER_NOT_CONSUMED",
691
+ /**
692
+ * The offer changed between the checks of `conclude` and the transaction
693
+ * that consumed it, so the contract checked is not the one the offer now
694
+ * describes. Nothing was written; load the offer and conclude it again.
695
+ */
696
+ CHECKOUT_OFFER_CHANGED: "CHECKOUT_OFFER_CHANGED",
426
697
  SUBSCRIPTION_CONTRACT_NOT_FOUND: "SUBSCRIPTION_CONTRACT_NOT_FOUND",
427
698
  NO_ACTIVE_SUBSCRIPTION_CONTRACT: "NO_ACTIVE_SUBSCRIPTION_CONTRACT",
428
699
  SUBSCRIPTION_CONTRACT_ALREADY_CLOSED: "SUBSCRIPTION_CONTRACT_ALREADY_CLOSED"
429
700
  };
701
+ var SUBSCRIBER_ERROR_CODES = {
702
+ /**
703
+ * A contract, a plan change or a booking for a tenant that has no
704
+ * subscriber. Nothing is agreed or charged without the party to it.
705
+ * Carries `tenantId`.
706
+ */
707
+ SUBSCRIBER_REQUIRED: "SUBSCRIBER_REQUIRED",
708
+ /** The tenant already has a live subscriber. Carries `tenantId`. */
709
+ SUBSCRIBER_ALREADY_EXISTS: "SUBSCRIBER_ALREADY_EXISTS",
710
+ SUBSCRIBER_NOT_FOUND: "SUBSCRIBER_NOT_FOUND",
711
+ SUBSCRIBER_LEGAL_NAME_REQUIRED: "SUBSCRIBER_LEGAL_NAME_REQUIRED",
712
+ /**
713
+ * A detail that has a form — the country, the invoice email — is not in it,
714
+ * or one sign-up requires — the billing address — is missing. Carries `field`.
715
+ */
716
+ SUBSCRIBER_DETAIL_INVALID: "SUBSCRIBER_DETAIL_INVALID",
717
+ /** A contact change named a field of the legal identity. Carries `field`. */
718
+ SUBSCRIBER_IDENTITY_NOT_A_CONTACT: "SUBSCRIBER_IDENTITY_NOT_A_CONTACT",
719
+ SUBSCRIBER_CORRECTION_REASON_REQUIRED: "SUBSCRIBER_CORRECTION_REASON_REQUIRED",
720
+ SUBSCRIBER_CORRECTION_ACTOR_REQUIRED: "SUBSCRIBER_CORRECTION_ACTOR_REQUIRED",
721
+ SUBSCRIBER_CORRECTION_CHANGES_NOTHING: "SUBSCRIBER_CORRECTION_CHANGES_NOTHING",
722
+ /** The operator declared another legal entity: that is a transfer, not an edit. */
723
+ SUBSCRIBER_TAKEOVER_IS_A_TRANSFER: "SUBSCRIBER_TAKEOVER_IS_A_TRANSFER"
724
+ };
430
725
  var REGISTRATION_ERROR_CODES = {
431
726
  PENDING_REGISTRATION_NOT_FOUND: "PENDING_REGISTRATION_NOT_FOUND",
432
727
  PENDING_REGISTRATION_EXPIRED: "PENDING_REGISTRATION_EXPIRED",
@@ -452,6 +747,12 @@ var AUTH_ERROR_CODES = {
452
747
  /** Neither `tenantId` nor `userId` could be resolved from the request. */
453
748
  TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING",
454
749
  TENANT_ADMIN_REQUIRED: "TENANT_ADMIN_REQUIRED",
750
+ /**
751
+ * The tenant's billing area — its payment method, and later its invoices
752
+ * and account — needs the billing permission, which the application maps
753
+ * to its roles and the tenant's administrator holds by default.
754
+ */
755
+ BILLING_PERMISSION_REQUIRED: "BILLING_PERMISSION_REQUIRED",
455
756
  SUPER_ADMIN_REQUIRED: "SUPER_ADMIN_REQUIRED",
456
757
  /** TOTP MFA has never been set up for this user. */
457
758
  MFA_NOT_SET_UP: "MFA_NOT_SET_UP",
@@ -479,6 +780,26 @@ var PROMO_ERROR_CODES = {
479
780
  PROMO_WOULD_PRODUCE_ZERO_INVOICE: "PROMO_WOULD_PRODUCE_ZERO_INVOICE",
480
781
  PROMO_MAX_REDEMPTIONS_LOWERED: "PROMO_MAX_REDEMPTIONS_LOWERED"
481
782
  };
783
+ var PAYMENT_ERROR_CODES = {
784
+ /**
785
+ * No gateway account takes new payment methods:
786
+ * `config/saas.yaml#payments.newPaymentMethods` names none.
787
+ */
788
+ PAYMENTS_NOT_CONFIGURED: "PAYMENTS_NOT_CONFIGURED",
789
+ /** A callback arrived for an account `config/saas.yaml#payments.accounts` does not name. Carries `account`. */
790
+ PAYMENT_GATEWAY_ACCOUNT_UNKNOWN: "PAYMENT_GATEWAY_ACCOUNT_UNKNOWN",
791
+ /** A callback the gateway did not send: its signature does not verify. */
792
+ PAYMENT_CALLBACK_REJECTED: "PAYMENT_CALLBACK_REJECTED",
793
+ /**
794
+ * A success or cancel URL at an origin `config/saas.yaml#payments.returnUrlOrigins`
795
+ * does not name. Carries `field`.
796
+ */
797
+ PAYMENT_RETURN_URL_NOT_ALLOWED: "PAYMENT_RETURN_URL_NOT_ALLOWED"
798
+ };
799
+ var SETTINGS_ERROR_CODES = {
800
+ /** No recorded change has this id, or the installation keeps no record at all. */
801
+ SETTINGS_CHANGE_NOT_FOUND: "SETTINGS_CHANGE_NOT_FOUND"
802
+ };
482
803
  var PLATFORM_ERROR_CODES = {
483
804
  ...SETUP_ERROR_CODES,
484
805
  ...AUTH_ERROR_CODES,
@@ -486,7 +807,10 @@ var PLATFORM_ERROR_CODES = {
486
807
  ...CATALOG_ERROR_CODES,
487
808
  ...BILLING_ERROR_CODES,
488
809
  ...CONTRACT_ERROR_CODES,
489
- ...REGISTRATION_ERROR_CODES
810
+ ...SUBSCRIBER_ERROR_CODES,
811
+ ...REGISTRATION_ERROR_CODES,
812
+ ...PAYMENT_ERROR_CODES,
813
+ ...SETTINGS_ERROR_CODES
490
814
  };
491
815
 
492
816
  // src/errors.ts
@@ -565,6 +889,19 @@ function selectChargeableBundles(planFeatures, selectedBundles) {
565
889
  }
566
890
  }
567
891
 
892
+ // src/payment-gateway.types.ts
893
+ var PAYMENT_CALLBACK_REJECTED = "PAYMENT_CALLBACK_REJECTED";
894
+ var PaymentCallbackRejectedError = class extends Error {
895
+ code = PAYMENT_CALLBACK_REJECTED;
896
+ constructor(reason) {
897
+ super(`Payment callback rejected: ${reason}`);
898
+ this.name = "PaymentCallbackRejectedError";
899
+ }
900
+ };
901
+ function isPaymentCallbackRejectedError(err) {
902
+ return err instanceof Error && err.code === PAYMENT_CALLBACK_REJECTED;
903
+ }
904
+
568
905
  // src/registration.types.ts
569
906
  var PENDING_EMAIL_TTL_HOURS = 72;
570
907
  var PENDING_ONBOARDING_TTL_DAYS = 14;
@@ -584,6 +921,418 @@ var REGISTRATION_STEP_BY_STATUS = {
584
921
  };
585
922
  var REGISTRATION_RESUME_TTL_MINUTES = 60;
586
923
 
924
+ // src/plan-mapping.ts
925
+ function toPlanRow(row) {
926
+ return {
927
+ id: row.id,
928
+ planKey: row.planKey,
929
+ label: row.label,
930
+ description: row.description,
931
+ icon: row.icon,
932
+ sortOrder: row.sortOrder,
933
+ createdAt: row.createdAt.toISOString(),
934
+ updatedAt: row.updatedAt.toISOString(),
935
+ deletedAt: toIsoOrNull(row.deletedAt)
936
+ };
937
+ }
938
+ function toPlanVersionRow(row, planKey, fields) {
939
+ const mapped = {
940
+ id: row.id,
941
+ version: row.version,
942
+ baseVersionId: row.baseVersionId,
943
+ planId: planKey,
944
+ features: toFeatureKeys(row.features),
945
+ quotas: toQuotaEffects(row.quotas),
946
+ monthlyNet: String(row.monthlyNet),
947
+ yearlyNet: String(row.yearlyNet),
948
+ marketed: row.marketed,
949
+ publishedAt: toIsoOrNull(row.publishedAt),
950
+ supersededAt: toIsoOrNull(row.supersededAt),
951
+ publishedChanges: Array.isArray(row.publishedChanges) ? row.publishedChanges : null,
952
+ changeNote: row.changeNote,
953
+ nonRegressive: row.nonRegressive,
954
+ validFrom: fields.validityWindows ? toIsoOrNull(row.validFrom) : null,
955
+ validUntil: fields.validityWindows ? toIsoOrNull(row.validUntil) : null,
956
+ createdByUserId: row.createdByUserId,
957
+ publishedByUserId: row.publishedByUserId,
958
+ createdAt: row.createdAt.toISOString(),
959
+ updatedAt: row.updatedAt.toISOString()
960
+ };
961
+ if (fields.endsAt) {
962
+ mapped.endsAt = toIsoOrNull(row.endsAt);
963
+ }
964
+ return mapped;
965
+ }
966
+ function toIsoOrNull(value) {
967
+ return value ? value.toISOString() : null;
968
+ }
969
+ function toFeatureKeys(value) {
970
+ if (!Array.isArray(value)) return [];
971
+ return value.filter((entry) => typeof entry === "string");
972
+ }
973
+ function toQuotaEffects(value) {
974
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
975
+ return {};
976
+ }
977
+ const quotas = {};
978
+ for (const [key, entry] of Object.entries(value)) {
979
+ quotas[key] = readQuotaValue(entry) ?? Number.NaN;
980
+ }
981
+ return quotas;
982
+ }
983
+
984
+ // src/legal-identity.ts
985
+ var LEGAL_IDENTITY_FIELDS = [
986
+ "legalName",
987
+ "vatId",
988
+ "taxNumber"
989
+ ];
990
+ function sameLegalIdentity(before, after) {
991
+ return LEGAL_IDENTITY_FIELDS.every((field) => before[field] === after[field]);
992
+ }
993
+ function movedIdentityFields(before, after) {
994
+ return LEGAL_IDENTITY_FIELDS.filter((field) => before[field] !== after[field]);
995
+ }
996
+
997
+ // src/issuer-identity.ts
998
+ function issuerIdentityOf(issuer) {
999
+ if (!issuer) return null;
1000
+ return identityOf({
1001
+ legalName: issuer.legalName,
1002
+ vatId: issuer.vatId,
1003
+ taxNumber: issuer.taxNumber
1004
+ });
1005
+ }
1006
+ function recordedIssuerIdentity(settings) {
1007
+ const issuer = settings?.issuer;
1008
+ if (issuer === null || typeof issuer !== "object" || Array.isArray(issuer)) return null;
1009
+ return identityOf(issuer);
1010
+ }
1011
+ function identityOf(source) {
1012
+ const legalName = textOrNull(source.legalName);
1013
+ if (legalName === null) return null;
1014
+ return {
1015
+ legalName,
1016
+ vatId: textOrNull(source.vatId),
1017
+ taxNumber: textOrNull(source.taxNumber)
1018
+ };
1019
+ }
1020
+ function classifyIssuerChange(recorded, issuer) {
1021
+ const current = issuerIdentityOf(issuer);
1022
+ if (!recorded)
1023
+ return current ? { kind: "first-naming", identity: current } : { kind: "none-named" };
1024
+ if (current && sameLegalIdentity(recorded, current))
1025
+ return { kind: "unchanged", identity: current };
1026
+ if (!current) {
1027
+ const moved2 = LEGAL_IDENTITY_FIELDS.filter((field) => recorded[field] !== null);
1028
+ return {
1029
+ kind: "undeclared",
1030
+ recorded,
1031
+ current: null,
1032
+ moved: moved2,
1033
+ fault: { kind: "names-no-issuer" }
1034
+ };
1035
+ }
1036
+ const moved = movedIdentityFields(recorded, current);
1037
+ const fault = faultIn(issuer?.correctionOf, recorded, moved);
1038
+ if (fault) return { kind: "undeclared", recorded, current, moved, fault };
1039
+ const declaration = issuer?.correctionOf;
1040
+ return { kind: "corrected", recorded, current, moved, reason: declaration.reason };
1041
+ }
1042
+ function faultIn(declaration, recorded, moved) {
1043
+ if (!declaration) return { kind: "absent" };
1044
+ for (const field of LEGAL_IDENTITY_FIELDS) {
1045
+ if (!Object.prototype.hasOwnProperty.call(declaration, field)) continue;
1046
+ const declared = textOrNull(declaration[field]);
1047
+ if (declared !== recorded[field]) {
1048
+ return { kind: "names-another-value", field, declared, recorded: recorded[field] };
1049
+ }
1050
+ }
1051
+ for (const field of moved) {
1052
+ if (Object.prototype.hasOwnProperty.call(declaration, field)) continue;
1053
+ return { kind: "leaves-a-field-out", field, recorded: recorded[field] };
1054
+ }
1055
+ return null;
1056
+ }
1057
+ function textOrNull(value) {
1058
+ if (typeof value !== "string") return null;
1059
+ const trimmed = value.trim();
1060
+ return trimmed === "" ? null : trimmed;
1061
+ }
1062
+
1063
+ // src/subscriber-mapping.ts
1064
+ function formatCustomerNumber(prefix, sequence) {
1065
+ return `${prefix}${sequence}`;
1066
+ }
1067
+ function toSubscriberRecord(row, tenantId) {
1068
+ return {
1069
+ id: row.id,
1070
+ customerNumber: formatCustomerNumber(row.customerNumberPrefix, row.customerSequence),
1071
+ legalName: row.legalName,
1072
+ addressLine1: row.addressLine1,
1073
+ addressLine2: row.addressLine2,
1074
+ postalCode: row.postalCode,
1075
+ city: row.city,
1076
+ country: row.country,
1077
+ vatId: row.vatId,
1078
+ taxNumber: row.taxNumber,
1079
+ invoiceEmail: row.invoiceEmail,
1080
+ tenantId,
1081
+ migrated: row.migrated,
1082
+ createdAt: row.createdAt,
1083
+ updatedAt: row.updatedAt
1084
+ };
1085
+ }
1086
+ function toSubscriberCorrectionRecord(row) {
1087
+ return {
1088
+ id: row.id,
1089
+ subscriberId: row.subscriberId,
1090
+ previous: toIdentityValues(row.previous),
1091
+ corrected: toIdentityValues(row.corrected),
1092
+ reason: row.reason,
1093
+ correctedBy: row.correctedBy,
1094
+ correctedAt: row.correctedAt
1095
+ };
1096
+ }
1097
+ function identityCorrectionDelta(current, corrected) {
1098
+ const previous = {};
1099
+ const next = {};
1100
+ for (const field of LEGAL_IDENTITY_FIELDS) {
1101
+ const value = corrected[field];
1102
+ if (value === void 0 || value === current[field]) continue;
1103
+ previous[field] = current[field];
1104
+ next[field] = value;
1105
+ }
1106
+ return {
1107
+ previous,
1108
+ corrected: next
1109
+ };
1110
+ }
1111
+ function contractPartiesOf(subscriber, issuer) {
1112
+ const party = {
1113
+ customerNumber: subscriber.customerNumber,
1114
+ legalName: subscriber.legalName,
1115
+ vatId: subscriber.vatId,
1116
+ taxNumber: subscriber.taxNumber,
1117
+ addressLine1: subscriber.addressLine1,
1118
+ addressLine2: subscriber.addressLine2,
1119
+ postalCode: subscriber.postalCode,
1120
+ city: subscriber.city,
1121
+ country: subscriber.country
1122
+ };
1123
+ return {
1124
+ subscriberId: subscriber.id,
1125
+ subscriber: party,
1126
+ issuer: issuer ? issuerPartyOf(issuer) : null
1127
+ };
1128
+ }
1129
+ function issuerPartyOf(issuer) {
1130
+ const identity = issuerIdentityOf(issuer);
1131
+ return {
1132
+ legalName: identity?.legalName ?? "",
1133
+ vatId: identity?.vatId ?? null,
1134
+ taxNumber: identity?.taxNumber ?? null,
1135
+ // Settled like the three above rather than copied verbatim: one copy
1136
+ // whose halves were settled differently is a row that reads two ways,
1137
+ // and a city written with a trailing space is not another city.
1138
+ addressLine1: settledText(issuer.addressLine1),
1139
+ addressLine2: settledText(issuer.addressLine2),
1140
+ postalCode: settledText(issuer.postalCode),
1141
+ city: settledText(issuer.city),
1142
+ country: settledText(issuer.country)
1143
+ };
1144
+ }
1145
+ function settledText(value) {
1146
+ if (typeof value !== "string") return null;
1147
+ const trimmed = value.trim();
1148
+ return trimmed === "" ? null : trimmed;
1149
+ }
1150
+ function subscriberFromRegistration(pending) {
1151
+ return {
1152
+ legalName: pending.tenantName,
1153
+ invoiceEmail: pending.email,
1154
+ addressLine1: pending.addressLine1,
1155
+ addressLine2: pending.addressLine2,
1156
+ postalCode: pending.postalCode,
1157
+ city: pending.city,
1158
+ country: pending.country,
1159
+ vatId: pending.vatId,
1160
+ taxNumber: pending.taxNumber
1161
+ };
1162
+ }
1163
+ function toIdentityValues(value) {
1164
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return {};
1165
+ const source = value;
1166
+ const values = {};
1167
+ for (const field of LEGAL_IDENTITY_FIELDS) {
1168
+ if (!Object.prototype.hasOwnProperty.call(source, field)) continue;
1169
+ const entry = source[field];
1170
+ values[field] = typeof entry === "string" ? entry : null;
1171
+ }
1172
+ return values;
1173
+ }
1174
+
1175
+ // src/subscriber-payment-method-mapping.ts
1176
+ var PAYMENT_METHOD_TYPES = ["card", "sepa_debit"];
1177
+ var STATUSES = ["ACTIVE", "REPLACED"];
1178
+ function toSubscriberPaymentMethodRecord(row) {
1179
+ return {
1180
+ id: row.id,
1181
+ subscriberId: row.subscriberId,
1182
+ gatewayAccount: row.gatewayAccount,
1183
+ provider: row.provider,
1184
+ customerRef: row.customerRef,
1185
+ paymentMethodRef: row.paymentMethodRef,
1186
+ type: oneOf(PAYMENT_METHOD_TYPES, row.type, "type", row.id),
1187
+ brand: row.brand,
1188
+ last4: row.last4,
1189
+ expiryMonth: row.expiryMonth,
1190
+ expiryYear: row.expiryYear,
1191
+ country: row.country,
1192
+ bankCode: row.bankCode,
1193
+ mandateReference: row.mandateReference,
1194
+ status: oneOf(STATUSES, row.status, "status", row.id),
1195
+ confirmedAt: row.confirmedAt,
1196
+ replacedAt: row.replacedAt,
1197
+ createdAt: row.createdAt
1198
+ };
1199
+ }
1200
+ function subscriberPaymentMethodColumns(data) {
1201
+ return {
1202
+ subscriberId: data.subscriberId,
1203
+ gatewayAccount: data.gatewayAccount,
1204
+ provider: data.provider,
1205
+ customerRef: data.customerRef,
1206
+ paymentMethodRef: data.paymentMethodRef,
1207
+ type: data.type,
1208
+ brand: data.brand,
1209
+ last4: data.last4,
1210
+ expiryMonth: data.expiryMonth,
1211
+ expiryYear: data.expiryYear,
1212
+ country: data.country,
1213
+ bankCode: data.bankCode,
1214
+ mandateReference: data.mandateReference,
1215
+ confirmedAt: data.confirmedAt
1216
+ };
1217
+ }
1218
+ function oneOf(allowed, value, column, id) {
1219
+ const match = allowed.find((entry) => entry === value);
1220
+ if (match === void 0) {
1221
+ throw new Error(
1222
+ `subscriber_payment_methods row '${id}' holds ${column} '${value}', which is none of ${allowed.join(", ")}.`
1223
+ );
1224
+ }
1225
+ return match;
1226
+ }
1227
+
1228
+ // src/subscription-contract-mapping.ts
1229
+ function toSubscriptionContractRecord(row, lineItems) {
1230
+ return {
1231
+ id: row.id,
1232
+ tenantId: row.tenantId,
1233
+ subscriberId: row.subscriberId,
1234
+ subscriber: toSubscriberParty(row.subscriberSnapshot),
1235
+ issuer: isPlainObject2(row.issuerSnapshot) ? toIssuerParty(row.issuerSnapshot) : null,
1236
+ partiesMigrated: row.partiesMigrated,
1237
+ status: row.status,
1238
+ effectiveFrom: row.effectiveFrom,
1239
+ effectiveUntil: row.effectiveUntil,
1240
+ originalOfferId: row.originalOfferId,
1241
+ originalPlanVersionId: row.originalPlanVersionId,
1242
+ originalBundleVersionIds: toStringArray(row.originalBundleVersionIds),
1243
+ entitlementSnapshot: isPlainObject2(row.entitlementSnapshot) ? row.entitlementSnapshot : null,
1244
+ priceSnapshot: row.priceSnapshot,
1245
+ promotionSnapshots: toUnknownArray(row.promotionSnapshots),
1246
+ promoCodeSnapshots: toUnknownArray(row.promoCodeSnapshots),
1247
+ termsSnapshot: toRecordOrNull(row.termsSnapshot),
1248
+ lineItems: lineItems.map(toContractLineItemRecord),
1249
+ createdAt: row.createdAt,
1250
+ updatedAt: row.updatedAt
1251
+ };
1252
+ }
1253
+ function toContractLineItemRecord(row) {
1254
+ return {
1255
+ id: row.id,
1256
+ contractId: row.contractId,
1257
+ kind: row.kind,
1258
+ sourceKey: row.sourceKey,
1259
+ sourceVersionId: row.sourceVersionId,
1260
+ titleSnapshot: row.titleSnapshot,
1261
+ descriptionSnapshot: row.descriptionSnapshot,
1262
+ quantity: row.quantity,
1263
+ unit: row.unit,
1264
+ priceNet: Number(row.priceNet),
1265
+ priceGross: Number(row.priceGross),
1266
+ billingCycle: row.billingCycle,
1267
+ currency: row.currency,
1268
+ taxRate: Number(row.taxRate),
1269
+ taxAmount: Number(row.taxAmount),
1270
+ minimumTermUntil: row.minimumTermUntil,
1271
+ featuresSnapshot: toStringArray(row.featuresSnapshot),
1272
+ quotaEffectsSnapshot: toQuotaEffects2(row.quotaEffectsSnapshot),
1273
+ metadata: toRecordOrNull(row.metadata),
1274
+ createdAt: row.createdAt
1275
+ };
1276
+ }
1277
+ function toSubscriberParty(value) {
1278
+ const source = isPlainObject2(value) ? value : {};
1279
+ return {
1280
+ customerNumber: stringOr(source.customerNumber, ""),
1281
+ ...toIssuerParty(source)
1282
+ };
1283
+ }
1284
+ function toRunningContractIssuer(row) {
1285
+ const issuer = isPlainObject2(row.issuerSnapshot) ? row.issuerSnapshot : null;
1286
+ return {
1287
+ id: row.id,
1288
+ tenantId: row.tenantId,
1289
+ issuerLegalName: issuer ? stringOrNull(issuer.legalName) : null,
1290
+ effectiveFrom: row.effectiveFrom
1291
+ };
1292
+ }
1293
+ function toIssuerParty(value) {
1294
+ const source = value;
1295
+ return {
1296
+ legalName: stringOr(source.legalName, ""),
1297
+ vatId: stringOrNull(source.vatId),
1298
+ taxNumber: stringOrNull(source.taxNumber),
1299
+ addressLine1: stringOrNull(source.addressLine1),
1300
+ addressLine2: stringOrNull(source.addressLine2),
1301
+ postalCode: stringOrNull(source.postalCode),
1302
+ city: stringOrNull(source.city),
1303
+ country: stringOrNull(source.country)
1304
+ };
1305
+ }
1306
+ function stringOr(value, fallback) {
1307
+ return typeof value === "string" ? value : fallback;
1308
+ }
1309
+ function stringOrNull(value) {
1310
+ return typeof value === "string" ? value : null;
1311
+ }
1312
+ function isPlainObject2(value) {
1313
+ return value !== null && typeof value === "object" && !Array.isArray(value);
1314
+ }
1315
+ function toUnknownArray(value) {
1316
+ return Array.isArray(value) ? value : [];
1317
+ }
1318
+ function toRecordOrNull(value) {
1319
+ return isPlainObject2(value) ? value : null;
1320
+ }
1321
+ function toStringArray(value) {
1322
+ if (!Array.isArray(value)) return [];
1323
+ return value.filter((entry) => typeof entry === "string");
1324
+ }
1325
+ function toQuotaEffects2(value) {
1326
+ return isPlainObject2(value) ? readQuotaRecord(value) : {};
1327
+ }
1328
+
1329
+ // src/subscription-contract.types.ts
1330
+ var BUNDLE_PRICE_LOOKUP_LIMIT = 200;
1331
+ var ACTIVE_SUBSCRIPTION_CONTRACT_STATUSES = [
1332
+ "active",
1333
+ "scheduled"
1334
+ ];
1335
+
587
1336
  // src/version-editability.ts
588
1337
  function isVersionEditable(v, now = /* @__PURE__ */ new Date()) {
589
1338
  if (v.publishedAt === null) {
@@ -611,6 +1360,17 @@ function isVersionEditable(v, now = /* @__PURE__ */ new Date()) {
611
1360
  return { editable: true, reason: "pre-active" };
612
1361
  }
613
1362
 
1363
+ // src/recommended-plan.ts
1364
+ function keepOneRecommended(plans, inRequestedLocale) {
1365
+ const recommended = plans.filter((plan) => plan.highlight);
1366
+ if (recommended.length === 0) return null;
1367
+ const winner = recommended.find((plan) => inRequestedLocale.has(plan.planKey)) ?? recommended[0];
1368
+ for (const plan of recommended) {
1369
+ if (plan !== winner) plan.highlight = false;
1370
+ }
1371
+ return winner;
1372
+ }
1373
+
614
1374
  // src/error-messages.ts
615
1375
  var ERROR_MESSAGES_EN = {
616
1376
  // ── setup ──
@@ -624,6 +1384,7 @@ var ERROR_MESSAGES_EN = {
624
1384
  NO_TENANT_ASSIGNED: "No tenant assigned",
625
1385
  TENANT_CONTEXT_MISSING: "No tenant ID found on the request",
626
1386
  TENANT_ADMIN_REQUIRED: "This action requires the TENANT_ADMIN role.",
1387
+ BILLING_PERMISSION_REQUIRED: "This part of the billing area requires the billing permission.",
627
1388
  SUPER_ADMIN_REQUIRED: "Only the SUPER_ADMIN role is allowed",
628
1389
  MFA_NOT_SET_UP: "Run the MFA setup via the CLI first.",
629
1390
  MFA_REQUIRED: "TOTP code required in the X-Mfa-Code header.",
@@ -655,6 +1416,8 @@ var ERROR_MESSAGES_EN = {
655
1416
  BUNDLE_VERSION_SUPERSEDED: "BundleVersion '{bundleVersionId}' has been superseded by a newer version.",
656
1417
  BUNDLE_VERSION_REGRESSION: "This bundle version is regressive (feature removed / quota lowered / price raised). Publishing requires an explicit `forceRegressive: true` (UI confirmation dialog with MFA).",
657
1418
  BUNDLE_VERSION_ZERO_PRICE: "A bundle version cannot be published with an explicit price of 0.00 (guard against seed placeholders). For free bundles leave it null, or set allowZeroPrice.",
1419
+ BUNDLE_VERSION_NO_PRICE: "This bundle version cannot be published without a price: neither a base price nor any plan override resolves one.",
1420
+ BUNDLE_VERSION_NOT_PRICED_FOR_PLAN: "This bundle is offered to plan '{planKey}', which is sold {billingCycle}, and no {billingCycle} price resolves for it \u2014 neither a base price nor a plan override.",
658
1421
  BUNDLE_VERSION_DISCARD_NOT_IMPLEMENTED: "Discard is not implemented in the current repository. Implement BundleRepository.deleteDraft.",
659
1422
  BUNDLE_VERSION_VALID_FROM_REQUIRED: "Published bundle versions must keep a validFrom. Set a new future date, or edit the draft before publishing.",
660
1423
  BUNDLE_VERSION_VALID_FROM_INVALID: "validFrom '{validFrom}' is not a valid date",
@@ -668,22 +1431,27 @@ var ERROR_MESSAGES_EN = {
668
1431
  PLAN_VERSION_NOT_FOUND: "PlanVersion '{versionId}' not found",
669
1432
  BUNDLE_NOT_FOUND: "Bundle '{bundleId}' not found",
670
1433
  BUNDLE_VERSION_NOT_FOUND: "BundleVersion '{bundleVersionId}' not found",
671
- FEATURE_NOT_FOUND: "Feature '{featureKey}' not found in project '{projectKey}'",
672
- QUOTA_NOT_FOUND: "Quota '{quotaKey}' not found in project '{projectKey}'",
1434
+ FEATURE_NOT_FOUND: "Feature '{featureKey}' not found",
1435
+ QUOTA_NOT_FOUND: "Quota '{quotaKey}' not found",
673
1436
  PROMOTION_NOT_FOUND: "Promotion '{promotionId}' not found",
674
1437
  MARKETING_PROJECTION_NOT_FOUND: "MarketingProjection '{projectionId}' not found",
675
- PLAN_ALREADY_EXISTS: "Plan '{planKey}' already exists in project '{projectKey}'",
676
- BUNDLE_ALREADY_EXISTS: "Bundle '{bundleKey}' already exists in project '{projectKey}'",
1438
+ PLAN_ALREADY_EXISTS: "Plan '{planKey}' already exists",
1439
+ BUNDLE_ALREADY_EXISTS: "Bundle '{bundleKey}' already exists",
677
1440
  MARKETING_PROJECTION_ALREADY_EXISTS: "Marketing projection for {targetType}/{targetVersionId}/{locale} already exists \u2014 use PATCH to edit it",
678
1441
  PLAN_DRAFT_ALREADY_EXISTS: "Plan '{planKey}' already has a draft version v{draftVersion}; publish or discard it first",
679
1442
  BUNDLE_DRAFT_ALREADY_EXISTS: "Bundle '{bundleKey}' already has a draft version v{draftVersion}; publish or discard it first",
680
1443
  QUOTA_NOT_IN_DISCOVERY_SNAPSHOT: "Quota '{quotaKey}' is not in the discovery snapshot \u2014 a quota that is not declared in code cannot be approved",
681
1444
  DISCOVERY_STATUS_TRANSITION_INVALID: "Transition '{from}' \u2192 '{to}' is not allowed",
682
1445
  DISCOVERY_NOT_INITIALIZED: "Approval requires a discovery snapshot \u2014 discovery is not initialised (#25)",
1446
+ // ── catalogue import ──
1447
+ PLAN_CATALOG_UNREADABLE: "That file is not a plan catalog \u2014 it could not be read as one. Check that it is the YAML your app declares its plans in.",
1448
+ PLAN_CATALOG_INVALID: "The plan catalog was read, and then rejected: {message}",
683
1449
  // ── billing ──
684
1450
  BUNDLE_ALREADY_SUBSCRIBED: "Subscription '{subscriptionId}' has already actively booked this bundle.",
685
1451
  BUNDLE_INCOMPATIBLE_WITH_PLAN: "BundleVersion '{bundleVersionId}' is not compatible with plan '{planKey}'. Allowed: [{allowedPlanKeys}].",
686
1452
  BUNDLE_NOT_SELF_SERVICE: "Bundle '{bundleKey}' is only activated via a special contract. Please contact the contract manager.",
1453
+ BUNDLE_CYCLE_EXCEEDS_PLAN: "A yearly bundle cannot run beside a monthly plan: it would still be committed on every day the plan could end.",
1454
+ BUNDLE_NOT_PRICED_FOR_THIS_PLAN: "This bundle has no {billingCycle} price for the {planKey} plan, so it cannot be booked from here.",
687
1455
  SUBSCRIPTION_BUNDLE_ALREADY_CANCELLED: "SubscriptionBundle '{subscriptionBundleId}' is already cancelled.",
688
1456
  SUBSCRIPTION_BUNDLE_NOT_CANCELLED: "SubscriptionBundle '{subscriptionBundleId}' is not cancelled.",
689
1457
  SUBSCRIPTION_BUNDLE_CANCELLATION_EFFECTIVE: "Cancellation already in effect \u2014 book the bundle again.",
@@ -692,9 +1460,25 @@ var ERROR_MESSAGES_EN = {
692
1460
  SUBSCRIPTION_BUNDLE_NOT_FOUND: "SubscriptionBundle '{subscriptionBundleId}' not found",
693
1461
  TENANT_NOT_FOUND: "Tenant {slug} not found",
694
1462
  NO_ACTIVE_PLAN_VERSION: "No plan version for {planId} active as of {asOf} \u2014 neither the validFrom window is satisfied nor is a latest-live version available.",
695
- PLAN_NOT_IN_CATALOG: 'Plan "{planKey}" is not in the catalog ({projectKey})',
696
- PLAN_NOT_SELF_SERVICE: "{planKey} is not activated via self-service.",
1463
+ PLAN_NOT_IN_CATALOG: 'Plan "{planKey}" is not in the catalog',
1464
+ PLAN_NOT_SELF_SERVICE: "{planName} is only activated via a special contract. Please contact the contract manager.",
1465
+ PLAN_NOT_SOLD_IN_CYCLE: "{planName} has no price for this billing rhythm and cannot be booked in it.",
697
1466
  PLAN_CHANGE_BLOCKED: "Plan change during onboarding is blocked.",
1467
+ SUBSCRIPTION_CHANGED: "This subscription changed while the request was being decided. Reload it.",
1468
+ NO_SUBSCRIPTION: "This tenant has no subscription to cancel.",
1469
+ CANCELLATION_TERMS_CHANGED: "The effective date changed since it was shown. Confirm the new one.",
1470
+ SUBSCRIPTION_ENDED: "This subscription has ended. Its plan can no longer be changed.",
1471
+ PLAN_LOCKED: "Active {planName} special contract \u2014 please contact the contract manager to change plans.",
1472
+ QUOTA_OVER_TARGET: "Current usage {used} exceeds the target limit {targetMax} ({quotaKey}) in the {planName} plan. Please reduce usage first.",
1473
+ FEATURE_LOST: "Switching means losing access to one feature. Existing data is retained and never deleted \u2014 upgrading again unlocks it.",
1474
+ FEATURES_LOST: "Switching means losing access to {count} features. Existing data is retained and never deleted \u2014 upgrading again unlocks it.",
1475
+ NO_CHANGE: "Target plan and billing cycle already match the current state.",
1476
+ CANCELLATION_LOCKS_THE_CYCLE: "This subscription is cancelled, so its billing cycle cannot change. The plan can \u2014 keep the current cycle to change it today.",
1477
+ CYCLE_SHORTENS_AT_TERM_END: "A monthly {planName} cannot start inside the yearly term you are in. The upgrade takes effect when that term ends; to have it today, keep the yearly cycle.",
1478
+ BUNDLE_BOOKING_OUTLASTS_TARGET_CYCLE: "A yearly bundle is booked until {until}. A monthly plan cannot carry it \u2014 cancel the bundle first, or keep the yearly cycle.",
1479
+ REDUNDANT_FEATURES: "The plan or another booked bundle already includes {count} of the features in this bundle \u2014 booking it pays for them twice.",
1480
+ MINIMUM_TERM_BINDS: "The minimum term extends beyond the end of the period \u2014 the cancellation only takes effect when the minimum term ends.",
1481
+ BUNDLE_FEATURE_DEPENDENCY_UNSATISFIED: "The bundle requires [{features}] \u2014 present neither in the plan nor in the active bundles.",
698
1482
  NO_PENDING_PLAN_VERSION: "There is no pending plan version awaiting confirmation.",
699
1483
  ONBOARDING_CREATE_FAILED: "The account could not be created. Please try again.",
700
1484
  BUNDLE_PREVIEW_ARGUMENT_AMBIGUOUS: "Exactly one of bundleVersionId (add preview) or subscriptionBundleId (cancel preview) must be given.",
@@ -722,18 +1506,37 @@ var ERROR_MESSAGES_EN = {
722
1506
  CHECKOUT_OFFER_BUNDLE_LINE_ITEMS_REQUIRED: "Every selected bundle version requires a frozen bundle line item.",
723
1507
  CHECKOUT_OFFER_BUNDLE_VERSION_NOT_BOOKABLE: "At least one bundle version from the checkout offer is no longer bookable.",
724
1508
  CHECKOUT_OFFER_FEATURE_DEPENDENCY_UNSATISFIED: "The selected plan does not cover all feature dependencies: [{missingRequires}] are missing from the plan + selected bundles.",
1509
+ CHECKOUT_OFFER_PLAN_NOT_OFFERED: "Plan '{planKey}' is not offered with a {billingCycle} price at the moment.",
1510
+ CHECKOUT_OFFER_BUNDLE_NOT_OFFERED: "Bundle version '{bundleVersionId}' cannot be added to this offer ({reason}).",
1511
+ CHECKOUT_OFFER_PROMO_CODE_NOT_ACCEPTED: "The promo code cannot be applied to this offer ({reason}).",
1512
+ CHECKOUT_OFFER_PRICE_NOT_CURRENT: "The prices of checkout offer '{offerId}' no longer match the catalogue; create a new offer.",
725
1513
  SUBSCRIPTION_CONTRACT_LINE_ITEMS_REQUIRED: "A subscription contract requires at least one line item.",
726
1514
  SUBSCRIPTION_CONTRACT_PLAN_LINE_ITEM_REQUIRED: "A subscription contract requires exactly one plan base item.",
727
1515
  SUBSCRIPTION_CONTRACT_INVALID_DATE: "{field} must be a valid date.",
728
1516
  SUBSCRIPTION_CONTRACT_INVALID_WINDOW: "effectiveUntil must be after effectiveFrom.",
1517
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_TAX_MISMATCH: "A line item's taxAmount must be exactly priceGross minus priceNet.",
1518
+ SUBSCRIPTION_CONTRACT_TAX_RATE_NOT_PERCENT: "A subscription contract states a tax rate of {taxRate} at {field}, which is not a percentage: a rate lies from 0 to 100, and a value between 0 and 1 is refused as a fraction.",
729
1519
  SUBSCRIPTION_CONTRACT_TERMINATION_BEFORE_START: "effectiveUntil must be after the effectiveFrom of the contract.",
1520
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_CURRENCY_MISMATCH: "A line item must be booked in the currency its contract was priced in.",
730
1521
  CHECKOUT_OFFER_NOT_FOUND: "CheckoutOffer '{offerId}' not found",
731
1522
  CHECKOUT_OFFER_EXPIRED: "Checkout offer '{offerId}' has expired and cannot be {action}",
732
1523
  CHECKOUT_OFFER_ALREADY_CONSUMED: "Checkout offer '{offerId}' has already been consumed and cannot be {action}",
733
1524
  CHECKOUT_OFFER_NOT_CONSUMED: "CheckoutOffer '{offerId}' must be consumed before the contract is created",
1525
+ CHECKOUT_OFFER_CHANGED: "Checkout offer '{offerId}' changed while it was being concluded. Load it again.",
734
1526
  SUBSCRIPTION_CONTRACT_NOT_FOUND: "SubscriptionContract '{contractId}' not found",
735
1527
  NO_ACTIVE_SUBSCRIPTION_CONTRACT: "No active subscription contract for tenant {tenantId}",
736
1528
  SUBSCRIPTION_CONTRACT_ALREADY_CLOSED: "SubscriptionContract '{contractId}' is already closed",
1529
+ // ── subscriber ──
1530
+ SUBSCRIBER_REQUIRED: "Tenant '{tenantId}' has no subscriber. Nothing is agreed or charged without the party to it: create the tenant's subscriber first.",
1531
+ SUBSCRIBER_ALREADY_EXISTS: "Tenant '{tenantId}' already has a subscriber.",
1532
+ SUBSCRIBER_NOT_FOUND: "Subscriber '{subscriberId}' not found",
1533
+ SUBSCRIBER_LEGAL_NAME_REQUIRED: "A subscriber needs its legal name.",
1534
+ SUBSCRIBER_DETAIL_INVALID: "The subscriber's {field} is not valid.",
1535
+ SUBSCRIBER_IDENTITY_NOT_A_CONTACT: "{field} is part of the subscriber's legal identity and changes only as a correction, with a reason.",
1536
+ SUBSCRIBER_CORRECTION_REASON_REQUIRED: "A correction of the legal identity needs a reason.",
1537
+ SUBSCRIBER_CORRECTION_ACTOR_REQUIRED: "A correction of the legal identity has to say who makes it.",
1538
+ SUBSCRIBER_CORRECTION_CHANGES_NOTHING: "The correction changes nothing: every value it names is already recorded.",
1539
+ SUBSCRIBER_TAKEOVER_IS_A_TRANSFER: "Another legal entity taking over a subscriber is a transfer, not a correction, and cannot be recorded as an edit.",
737
1540
  // ── registration ──
738
1541
  PENDING_REGISTRATION_NOT_FOUND: "This registration could not be found. It may have already been completed or discarded.",
739
1542
  PENDING_REGISTRATION_EXPIRED: "This registration has expired. Please start again.",
@@ -749,8 +1552,15 @@ var ERROR_MESSAGES_EN = {
749
1552
  PLAN_NOT_AVAILABLE: "This plan is not available.",
750
1553
  PLAN_NOT_SELECTED: "Please select a plan first.",
751
1554
  MODEL_NOT_AVAILABLE: "This option is not available.",
1555
+ // ── payments ──
1556
+ PAYMENTS_NOT_CONFIGURED: "Payment methods cannot be set up here yet.",
1557
+ PAYMENT_GATEWAY_ACCOUNT_UNKNOWN: "No payment gateway account is configured under '{account}'.",
1558
+ PAYMENT_CALLBACK_REJECTED: "The payment callback could not be verified.",
1559
+ PAYMENT_RETURN_URL_NOT_ALLOWED: "The {field} leads to a site this installation does not return to.",
752
1560
  // ── entitlement (code lives in upsell.types.ts) ──
753
- [FEATURE_NOT_LICENSED]: "Feature {featureKeys} is not included in the current plan."
1561
+ [FEATURE_NOT_LICENSED]: "Feature {featureKeys} is not included in the current plan.",
1562
+ // ── settings ──
1563
+ SETTINGS_CHANGE_NOT_FOUND: "No recorded settings change has this id."
754
1564
  };
755
1565
  function formatErrorMessage(template, params = {}) {
756
1566
  return template.replace(/\{(\w+)\}/g, (match, name) => {
@@ -781,6 +1591,7 @@ var ERROR_MESSAGES_DE = {
781
1591
  NO_TENANT_ASSIGNED: "Kein Mandant zugeordnet",
782
1592
  TENANT_CONTEXT_MISSING: "Am Request wurde keine Mandanten-ID gefunden",
783
1593
  TENANT_ADMIN_REQUIRED: "Diese Aktion erfordert die Rolle TENANT_ADMIN.",
1594
+ BILLING_PERMISSION_REQUIRED: "Dieser Teil der Abrechnung erfordert die Abrechnungs-Berechtigung.",
784
1595
  SUPER_ADMIN_REQUIRED: "Nur die Rolle SUPER_ADMIN ist zugelassen",
785
1596
  MFA_NOT_SET_UP: "Richte MFA zuerst \xFCber die CLI ein.",
786
1597
  MFA_REQUIRED: "TOTP-Code im Header X-Mfa-Code erforderlich.",
@@ -812,6 +1623,8 @@ var ERROR_MESSAGES_DE = {
812
1623
  BUNDLE_VERSION_SUPERSEDED: "BundleVersion '{bundleVersionId}' wurde durch eine neuere Version abgel\xF6st.",
813
1624
  BUNDLE_VERSION_REGRESSION: "Diese Bundle-Version ist regressiv (Feature entfernt / Quota gesenkt / Preis erh\xF6ht). Das Ver\xF6ffentlichen erfordert ein ausdr\xFCckliches `forceRegressive: true` (Best\xE4tigungsdialog in der UI mit MFA).",
814
1625
  BUNDLE_VERSION_ZERO_PRICE: "Eine Bundle-Version l\xE4sst sich nicht mit einem ausdr\xFCcklichen Preis von 0,00 ver\xF6ffentlichen (Schutz vor Seed-Platzhaltern). Kostenlose Bundles l\xE4sst du auf null, oder du setzt allowZeroPrice.",
1626
+ BUNDLE_VERSION_NO_PRICE: "Diese Bundle-Version kann ohne Preis nicht ver\xF6ffentlicht werden: weder ein Grundpreis noch eine Plan-\xDCberschreibung ergibt einen.",
1627
+ BUNDLE_VERSION_NOT_PRICED_FOR_PLAN: "Dieses Bundle wird dem Plan '{planKey}' angeboten, der {billingCycle} verkauft wird, und daf\xFCr ergibt sich kein {billingCycle} Preis \u2014 weder als Grundpreis noch als Plan-\xDCberschreibung.",
815
1628
  BUNDLE_VERSION_DISCARD_NOT_IMPLEMENTED: "Das Verwerfen ist im aktuellen Repository nicht implementiert. Implementiere BundleRepository.deleteDraft.",
816
1629
  BUNDLE_VERSION_VALID_FROM_REQUIRED: "Ver\xF6ffentlichte Bundle-Versionen m\xFCssen ein validFrom behalten. Setze ein neues Datum in der Zukunft, oder bearbeite den Entwurf vor dem Ver\xF6ffentlichen.",
817
1630
  BUNDLE_VERSION_VALID_FROM_INVALID: "validFrom '{validFrom}' ist kein g\xFCltiges Datum",
@@ -825,22 +1638,27 @@ var ERROR_MESSAGES_DE = {
825
1638
  PLAN_VERSION_NOT_FOUND: "PlanVersion '{versionId}' nicht gefunden",
826
1639
  BUNDLE_NOT_FOUND: "Bundle '{bundleId}' nicht gefunden",
827
1640
  BUNDLE_VERSION_NOT_FOUND: "BundleVersion '{bundleVersionId}' nicht gefunden",
828
- FEATURE_NOT_FOUND: "Feature '{featureKey}' im Projekt '{projectKey}' nicht gefunden",
829
- QUOTA_NOT_FOUND: "Quota '{quotaKey}' im Projekt '{projectKey}' nicht gefunden",
1641
+ FEATURE_NOT_FOUND: "Feature '{featureKey}' nicht gefunden",
1642
+ QUOTA_NOT_FOUND: "Quota '{quotaKey}' nicht gefunden",
830
1643
  PROMOTION_NOT_FOUND: "Promotion '{promotionId}' nicht gefunden",
831
1644
  MARKETING_PROJECTION_NOT_FOUND: "MarketingProjection '{projectionId}' nicht gefunden",
832
- PLAN_ALREADY_EXISTS: "Plan '{planKey}' gibt es im Projekt '{projectKey}' bereits",
833
- BUNDLE_ALREADY_EXISTS: "Bundle '{bundleKey}' gibt es im Projekt '{projectKey}' bereits",
1645
+ PLAN_ALREADY_EXISTS: "Plan '{planKey}' gibt es bereits",
1646
+ BUNDLE_ALREADY_EXISTS: "Bundle '{bundleKey}' gibt es bereits",
834
1647
  MARKETING_PROJECTION_ALREADY_EXISTS: "F\xFCr {targetType}/{targetVersionId}/{locale} gibt es bereits eine Marketing-Projektion \u2014 bearbeite sie per PATCH",
835
1648
  PLAN_DRAFT_ALREADY_EXISTS: "Plan '{planKey}' hat bereits die Entwurfsversion v{draftVersion}; ver\xF6ffentliche oder verwirf sie zuerst",
836
1649
  BUNDLE_DRAFT_ALREADY_EXISTS: "Bundle '{bundleKey}' hat bereits die Entwurfsversion v{draftVersion}; ver\xF6ffentliche oder verwirf sie zuerst",
837
1650
  QUOTA_NOT_IN_DISCOVERY_SNAPSHOT: "Quota '{quotaKey}' steht nicht im Discovery-Snapshot \u2014 eine Quota, die im Code nicht deklariert ist, l\xE4sst sich nicht freigeben",
838
1651
  DISCOVERY_STATUS_TRANSITION_INVALID: "Der \xDCbergang '{from}' \u2192 '{to}' ist nicht erlaubt",
839
1652
  DISCOVERY_NOT_INITIALIZED: "Die Freigabe braucht einen Discovery-Snapshot \u2014 Discovery ist nicht initialisiert (#25)",
1653
+ // ── catalogue import ──
1654
+ PLAN_CATALOG_UNREADABLE: "Diese Datei ist kein Plankatalog \u2014 sie lie\xDF sich nicht als einer lesen. Pr\xFCfe, ob es die YAML-Datei ist, in der deine App ihre Pl\xE4ne deklariert.",
1655
+ PLAN_CATALOG_INVALID: "Der Plankatalog wurde gelesen und dann abgelehnt: {message}",
840
1656
  // ── billing ──
841
1657
  BUNDLE_ALREADY_SUBSCRIBED: "Abonnement '{subscriptionId}' hat dieses Bundle bereits aktiv gebucht.",
842
1658
  BUNDLE_INCOMPATIBLE_WITH_PLAN: "BundleVersion '{bundleVersionId}' passt nicht zum Plan '{planKey}'. Erlaubt: [{allowedPlanKeys}].",
843
1659
  BUNDLE_NOT_SELF_SERVICE: "Bundle '{bundleKey}' wird nur \xFCber einen Sondervertrag freigeschaltet. Bitte wende dich an die Vertragsverwaltung.",
1660
+ BUNDLE_CYCLE_EXCEEDS_PLAN: "Ein j\xE4hrlich abgerechnetes Bundle passt nicht zu einem monatlich abgerechneten Plan: es w\xE4re an jedem Tag gebunden, an dem der Plan enden kann.",
1661
+ BUNDLE_NOT_PRICED_FOR_THIS_PLAN: "F\xFCr dieses Bundle ist im Plan {planKey} kein {billingCycle} Preis hinterlegt, es kann hier deshalb nicht gebucht werden.",
844
1662
  SUBSCRIPTION_BUNDLE_ALREADY_CANCELLED: "SubscriptionBundle '{subscriptionBundleId}' ist bereits gek\xFCndigt.",
845
1663
  SUBSCRIPTION_BUNDLE_NOT_CANCELLED: "SubscriptionBundle '{subscriptionBundleId}' ist nicht gek\xFCndigt.",
846
1664
  SUBSCRIPTION_BUNDLE_CANCELLATION_EFFECTIVE: "Die K\xFCndigung ist bereits wirksam \u2014 buche das Bundle einfach neu.",
@@ -849,9 +1667,25 @@ var ERROR_MESSAGES_DE = {
849
1667
  SUBSCRIPTION_BUNDLE_NOT_FOUND: "SubscriptionBundle '{subscriptionBundleId}' nicht gefunden",
850
1668
  TENANT_NOT_FOUND: "Mandant {slug} nicht gefunden",
851
1669
  NO_ACTIVE_PLAN_VERSION: "Zum {asOf} ist keine Planversion f\xFCr {planId} aktiv \u2014 weder ist das validFrom-Fenster erf\xFCllt, noch steht eine j\xFCngste Live-Version bereit.",
852
- PLAN_NOT_IN_CATALOG: 'Plan "{planKey}" steht nicht im Katalog ({projectKey})',
853
- PLAN_NOT_SELF_SERVICE: "{planKey} wird nicht per Self-Service freigeschaltet.",
1670
+ PLAN_NOT_IN_CATALOG: 'Plan "{planKey}" steht nicht im Katalog',
1671
+ PLAN_NOT_SELF_SERVICE: "{planName} wird nur \xFCber einen Sondervertrag freigeschaltet. Bitte wenden Sie sich an die Vertragsverwaltung.",
1672
+ PLAN_NOT_SOLD_IN_CYCLE: "{planName} hat f\xFCr diesen Abrechnungsrhythmus keinen Preis und kann darin nicht gebucht werden.",
854
1673
  PLAN_CHANGE_BLOCKED: "W\xE4hrend des Onboardings ist ein Planwechsel gesperrt.",
1674
+ SUBSCRIPTION_CHANGED: "Dieses Abonnement hat sich ge\xE4ndert, w\xE4hrend die Anfrage entschieden wurde. Bitte lade es neu.",
1675
+ NO_SUBSCRIPTION: "Dieser Mandant hat kein Abonnement, das gek\xFCndigt werden kann.",
1676
+ CANCELLATION_TERMS_CHANGED: "Das Wirksamkeitsdatum hat sich seit der Anzeige ge\xE4ndert. Bitte best\xE4tige das neue Datum.",
1677
+ SUBSCRIPTION_ENDED: "Dieses Abonnement ist beendet. Sein Paket kann nicht mehr gewechselt werden.",
1678
+ PLAN_LOCKED: "Aktiver Sondervertrag {planName} \u2014 f\xFCr einen Paketwechsel wenden Sie sich bitte an die Vertragsverwaltung.",
1679
+ QUOTA_OVER_TARGET: "Aktuelle Nutzung {used} \xFCberschreitet das Ziel-Limit {targetMax} ({quotaKey}) im Paket {planName}. Bitte zuerst die Nutzung reduzieren.",
1680
+ FEATURE_LOST: "Beim Wechsel verlieren Sie den Zugriff auf eine Funktion. Vorhandene Daten bleiben erhalten und werden nie gel\xF6scht \u2014 ein sp\xE4teres Upgrade schaltet sie wieder frei.",
1681
+ FEATURES_LOST: "Beim Wechsel verlieren Sie den Zugriff auf {count} Funktionen. Vorhandene Daten bleiben erhalten und werden nie gel\xF6scht \u2014 ein sp\xE4teres Upgrade schaltet sie wieder frei.",
1682
+ NO_CHANGE: "Zielpaket und Abrechnungsrhythmus entsprechen bereits dem aktuellen Stand.",
1683
+ CANCELLATION_LOCKS_THE_CYCLE: "Dieses Abonnement ist gek\xFCndigt, sein Abrechnungsrhythmus kann daher nicht wechseln. Das Paket schon \u2014 behalten Sie den aktuellen Rhythmus, um es heute zu wechseln.",
1684
+ CYCLE_SHORTENS_AT_TERM_END: "Ein monatlich abgerechnetes {planName} kann nicht innerhalb der laufenden Jahreslaufzeit beginnen. Das Upgrade greift zum Ende dieser Laufzeit; wer es sofort m\xF6chte, beh\xE4lt den j\xE4hrlichen Rhythmus.",
1685
+ BUNDLE_BOOKING_OUTLASTS_TARGET_CYCLE: "Ein j\xE4hrlich abgerechnetes Bundle ist bis {until} gebucht. Ein monatlich abgerechnetes Paket kann es nicht tragen \u2014 k\xFCndigen Sie das Bundle zuerst, oder behalten Sie den j\xE4hrlichen Rhythmus.",
1686
+ REDUNDANT_FEATURES: "Der Plan oder ein anderes gebuchtes Bundle enth\xE4lt bereits {count} der Funktionen aus diesem Bundle \u2014 mit der Buchung werden sie doppelt bezahlt.",
1687
+ MINIMUM_TERM_BINDS: "Die Mindestlaufzeit reicht \xFCber das Ende der Periode hinaus \u2014 die K\xFCndigung wird erst zum Ende der Mindestlaufzeit wirksam.",
1688
+ BUNDLE_FEATURE_DEPENDENCY_UNSATISFIED: "Das Bundle setzt [{features}] voraus \u2014 weder im Plan noch in den aktiven Bundles vorhanden.",
855
1689
  NO_PENDING_PLAN_VERSION: "Es wartet keine Planversion auf eine Best\xE4tigung.",
856
1690
  ONBOARDING_CREATE_FAILED: "Das Konto konnte nicht angelegt werden. Bitte versuche es noch einmal.",
857
1691
  BUNDLE_PREVIEW_ARGUMENT_AMBIGUOUS: "Genau eines von bundleVersionId (Vorschau f\xFCrs Buchen) oder subscriptionBundleId (Vorschau f\xFCrs K\xFCndigen) muss angegeben sein.",
@@ -879,18 +1713,37 @@ var ERROR_MESSAGES_DE = {
879
1713
  CHECKOUT_OFFER_BUNDLE_LINE_ITEMS_REQUIRED: "Jede gew\xE4hlte Bundle-Version braucht eine eingefrorene Bundle-Position.",
880
1714
  CHECKOUT_OFFER_BUNDLE_VERSION_NOT_BOOKABLE: "Mindestens eine Bundle-Version aus dem Checkout-Angebot ist nicht mehr buchbar.",
881
1715
  CHECKOUT_OFFER_FEATURE_DEPENDENCY_UNSATISFIED: "Der gew\xE4hlte Plan deckt nicht alle Feature-Abh\xE4ngigkeiten ab: [{missingRequires}] fehlen in Plan und gew\xE4hlten Bundles.",
1716
+ CHECKOUT_OFFER_PLAN_NOT_OFFERED: "Plan '{planKey}' wird derzeit nicht mit einem Preis f\xFCr den Rhythmus {billingCycle} angeboten.",
1717
+ CHECKOUT_OFFER_BUNDLE_NOT_OFFERED: "Bundle-Version '{bundleVersionId}' kann diesem Angebot nicht hinzugef\xFCgt werden ({reason}).",
1718
+ CHECKOUT_OFFER_PROMO_CODE_NOT_ACCEPTED: "Der Rabattcode kann auf dieses Angebot nicht angewendet werden ({reason}).",
1719
+ CHECKOUT_OFFER_PRICE_NOT_CURRENT: "Die Preise des Angebots '{offerId}' stimmen nicht mehr mit dem Katalog \xFCberein; bitte ein neues Angebot erstellen.",
882
1720
  SUBSCRIPTION_CONTRACT_LINE_ITEMS_REQUIRED: "Ein Abo-Vertrag braucht mindestens eine Position.",
883
1721
  SUBSCRIPTION_CONTRACT_PLAN_LINE_ITEM_REQUIRED: "Ein Abo-Vertrag braucht genau eine Plan-Grundposition.",
884
1722
  SUBSCRIPTION_CONTRACT_INVALID_DATE: "{field} muss ein g\xFCltiges Datum sein.",
885
1723
  SUBSCRIPTION_CONTRACT_INVALID_WINDOW: "effectiveUntil muss nach effectiveFrom liegen.",
1724
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_TAX_MISMATCH: "taxAmount einer Position muss exakt priceGross minus priceNet sein.",
1725
+ SUBSCRIPTION_CONTRACT_TAX_RATE_NOT_PERCENT: "Ein Abo-Vertrag nennt bei {field} einen Steuersatz von {taxRate}, der kein Prozentsatz ist: Ein Satz liegt zwischen 0 und 100, und ein Wert zwischen 0 und 1 wird als Bruch abgelehnt.",
1726
+ SUBSCRIPTION_CONTRACT_LINE_ITEM_CURRENCY_MISMATCH: "Eine Position muss in der W\xE4hrung gebucht sein, in der ihr Vertrag bepreist ist.",
886
1727
  SUBSCRIPTION_CONTRACT_TERMINATION_BEFORE_START: "effectiveUntil muss nach dem effectiveFrom des Vertrags liegen.",
887
1728
  CHECKOUT_OFFER_NOT_FOUND: "CheckoutOffer '{offerId}' nicht gefunden",
888
1729
  CHECKOUT_OFFER_EXPIRED: "Checkout-Angebot '{offerId}' ist abgelaufen \u2014 '{action}' ist nicht mehr m\xF6glich",
889
1730
  CHECKOUT_OFFER_ALREADY_CONSUMED: "Checkout-Angebot '{offerId}' wurde bereits eingel\xF6st \u2014 '{action}' ist nicht mehr m\xF6glich",
890
1731
  CHECKOUT_OFFER_NOT_CONSUMED: "CheckoutOffer '{offerId}' muss eingel\xF6st sein, bevor der Vertrag entsteht",
1732
+ CHECKOUT_OFFER_CHANGED: "Checkout-Angebot '{offerId}' hat sich w\xE4hrend des Abschlusses ge\xE4ndert. Bitte neu laden.",
891
1733
  SUBSCRIPTION_CONTRACT_NOT_FOUND: "SubscriptionContract '{contractId}' nicht gefunden",
892
1734
  NO_ACTIVE_SUBSCRIPTION_CONTRACT: "Kein aktiver Abo-Vertrag f\xFCr Mandant {tenantId}",
893
1735
  SUBSCRIPTION_CONTRACT_ALREADY_CLOSED: "SubscriptionContract '{contractId}' ist bereits geschlossen",
1736
+ // ── subscriber ──
1737
+ SUBSCRIBER_REQUIRED: "Mandant '{tenantId}' hat keinen Vertragspartner. Ohne ihn wird nichts vereinbart oder berechnet: Zuerst muss der Vertragspartner des Mandanten angelegt werden.",
1738
+ SUBSCRIBER_ALREADY_EXISTS: "Mandant '{tenantId}' hat bereits einen Vertragspartner.",
1739
+ SUBSCRIBER_NOT_FOUND: "Vertragspartner '{subscriberId}' nicht gefunden",
1740
+ SUBSCRIBER_LEGAL_NAME_REQUIRED: "Ein Vertragspartner braucht seinen rechtlichen Namen.",
1741
+ SUBSCRIBER_DETAIL_INVALID: "Das Feld {field} des Vertragspartners ist ung\xFCltig.",
1742
+ SUBSCRIBER_IDENTITY_NOT_A_CONTACT: "{field} geh\xF6rt zur rechtlichen Identit\xE4t des Vertragspartners und \xE4ndert sich nur als Korrektur mit Begr\xFCndung.",
1743
+ SUBSCRIBER_CORRECTION_REASON_REQUIRED: "Eine Korrektur der rechtlichen Identit\xE4t braucht eine Begr\xFCndung.",
1744
+ SUBSCRIBER_CORRECTION_ACTOR_REQUIRED: "Eine Korrektur der rechtlichen Identit\xE4t muss nennen, wer sie vornimmt.",
1745
+ SUBSCRIBER_CORRECTION_CHANGES_NOTHING: "Die Korrektur \xE4ndert nichts: Jeder genannte Wert ist bereits erfasst.",
1746
+ SUBSCRIBER_TAKEOVER_IS_A_TRANSFER: "\xDCbernimmt eine andere Rechtsperson, ist das eine \xDCbertragung und keine Korrektur; sie l\xE4sst sich nicht als \xC4nderung erfassen.",
894
1747
  // ── registration ──
895
1748
  PENDING_REGISTRATION_NOT_FOUND: "Diese Registrierung konnten wir nicht finden. Vielleicht ist sie bereits abgeschlossen oder verworfen.",
896
1749
  PENDING_REGISTRATION_EXPIRED: "Diese Registrierung ist abgelaufen. Bitte fange noch einmal von vorn an.",
@@ -906,52 +1759,101 @@ var ERROR_MESSAGES_DE = {
906
1759
  PLAN_NOT_AVAILABLE: "Dieser Plan steht nicht zur Verf\xFCgung.",
907
1760
  PLAN_NOT_SELECTED: "Bitte w\xE4hle zuerst einen Plan aus.",
908
1761
  MODEL_NOT_AVAILABLE: "Diese Option steht nicht zur Verf\xFCgung.",
1762
+ // ── payments ──
1763
+ PAYMENTS_NOT_CONFIGURED: "Zahlungsmethoden k\xF6nnen hier noch nicht hinterlegt werden.",
1764
+ PAYMENT_GATEWAY_ACCOUNT_UNKNOWN: "Unter '{account}' ist kein Konto eines Zahlungsanbieters eingerichtet.",
1765
+ PAYMENT_CALLBACK_REJECTED: "Die R\xFCckmeldung des Zahlungsanbieters lie\xDF sich nicht pr\xFCfen.",
1766
+ PAYMENT_RETURN_URL_NOT_ALLOWED: "Die {field} f\xFChrt auf eine Seite, zu der diese Installation nicht zur\xFCckleitet.",
909
1767
  // ── entitlement (code lives in upsell.types.ts) ──
910
- [FEATURE_NOT_LICENSED]: "Das Feature {featureKeys} ist im aktuellen Plan nicht enthalten."
1768
+ [FEATURE_NOT_LICENSED]: "Das Feature {featureKeys} ist im aktuellen Plan nicht enthalten.",
1769
+ // ── settings ──
1770
+ SETTINGS_CHANGE_NOT_FOUND: "Keine aufgezeichnete Einstellungs\xE4nderung hat diese ID."
911
1771
  };
912
1772
  // Annotate the CommonJS export names for ESM import in node:
913
1773
  0 && (module.exports = {
1774
+ ACTIVE_SUBSCRIPTION_CONTRACT_STATUSES,
914
1775
  AUTH_ERROR_CODES,
915
1776
  BILLING_ERROR_CODES,
1777
+ BUNDLE_PRICE_LOOKUP_LIMIT,
1778
+ CATALOGUE_KEYS,
916
1779
  CATALOG_ERROR_CODES,
917
1780
  CONTRACT_ERROR_CODES,
918
1781
  ERROR_MESSAGES_DE,
919
1782
  ERROR_MESSAGES_EN,
920
1783
  FEATURE_NOT_LICENSED,
1784
+ LEGAL_IDENTITY_FIELDS,
1785
+ MARKETING_PRIORITY_MAX,
1786
+ MARKETING_PRIORITY_MIN,
921
1787
  OTP_RATE_LIMIT_MAX_SENDS,
922
1788
  OTP_RATE_LIMIT_WINDOW_MINUTES,
923
1789
  OTP_TTL_MINUTES,
924
1790
  OTP_VERIFY_MAX_ATTEMPTS,
925
1791
  PASSWORD_RESET_TTL_MINUTES,
1792
+ PAYMENT_ERROR_CODES,
1793
+ PAYMENT_METHOD_TYPES,
926
1794
  PENDING_CHECKOUT_TTL_DAYS,
927
1795
  PENDING_EMAIL_TTL_HOURS,
928
1796
  PENDING_ONBOARDING_TTL_DAYS,
929
1797
  PLATFORM_ERROR_CODES,
930
1798
  PROMO_ERROR_CODES,
1799
+ PaymentCallbackRejectedError,
931
1800
  PersistenceCapabilityError,
932
1801
  PlatformUserExistsError,
933
1802
  REGISTRATION_ERROR_CODES,
934
1803
  REGISTRATION_RESUME_TTL_MINUTES,
935
1804
  REGISTRATION_STEP_BY_STATUS,
1805
+ SETTINGS_ERROR_CODES,
936
1806
  SETUP_ERROR_CODES,
1807
+ SUBSCRIBER_ERROR_CODES,
937
1808
  applyPromo,
938
1809
  assertPersistenceCapabilities,
939
1810
  buildActivePlanVersionWhere,
940
1811
  buildActiveVersionWhere,
941
1812
  buildFeatureRequiresIndex,
1813
+ bundleDraftDefaults,
1814
+ bundleStemDefaults,
1815
+ canonicalJson,
942
1816
  classifyBundleVersionDiff,
1817
+ classifyIssuerChange,
943
1818
  classifyPlanDiff,
944
1819
  collectUnsatisfiedRequires,
1820
+ contractPartiesOf,
945
1821
  coverageExcludingSelf,
1822
+ definedFields,
1823
+ diffSettings,
1824
+ formatCustomerNumber,
946
1825
  formatErrorMessage,
1826
+ identityCorrectionDelta,
947
1827
  isBundleRedundant,
1828
+ isPaymentCallbackRejectedError,
948
1829
  isPlatformUserExistsError,
949
1830
  isVersionEditable,
1831
+ issuerIdentityOf,
1832
+ keepOneRecommended,
950
1833
  missingRequiresFor,
1834
+ movedIdentityFields,
951
1835
  pickActivePromo,
1836
+ planCatalogSettingsOf,
1837
+ previousUtcDay,
952
1838
  promoStatus,
1839
+ readQuotaRecord,
1840
+ readQuotaValue,
1841
+ recordedIssuerIdentity,
953
1842
  resolveBundleAvailability,
954
1843
  resolveErrorMessage,
1844
+ sameLegalIdentity,
955
1845
  selectChargeableBundles,
956
- startOfUtcDay
1846
+ settingsSubtreeOf,
1847
+ startOfUtcDay,
1848
+ subscriberFromRegistration,
1849
+ subscriberPaymentMethodColumns,
1850
+ toBundleStemRow,
1851
+ toContractLineItemRecord,
1852
+ toPlanRow,
1853
+ toPlanVersionRow,
1854
+ toRunningContractIssuer,
1855
+ toSubscriberCorrectionRecord,
1856
+ toSubscriberPaymentMethodRecord,
1857
+ toSubscriberRecord,
1858
+ toSubscriptionContractRecord
957
1859
  });