@saasicat/nest 1.0.0-rc.2 → 1.0.0-rc.21

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.
Files changed (154) hide show
  1. package/README.md +44 -8
  2. package/dist/.build-stamp +1 -1
  3. package/dist/_entries.cjs +10214 -4796
  4. package/dist/admin/index.d.cts +5 -4
  5. package/dist/admin/index.d.ts +5 -4
  6. package/dist/admin/index.js +13 -9
  7. package/dist/{admin-resources.module-CpvzcfCc.d.cts → admin-resources.module-B4XNvdH-.d.cts} +1 -2
  8. package/dist/{admin-resources.module-DF5_Q7RD.d.ts → admin-resources.module-CWqdI9BV.d.ts} +1 -2
  9. package/dist/{admin-stats.service-TYiSUwIR.d.ts → admin-stats.service-CsLNt19Z.d.ts} +11 -7
  10. package/dist/{admin-stats.service-DfKupywR.d.cts → admin-stats.service-DrZrU8IJ.d.cts} +11 -7
  11. package/dist/{aggregation-B3CD0v_d.d.cts → aggregation-ChpZDh0g.d.ts} +39 -6
  12. package/dist/{aggregation-BFzW07DE.d.ts → aggregation-OpnhwzF5.d.cts} +39 -6
  13. package/dist/billing/index.d.cts +448 -108
  14. package/dist/billing/index.d.ts +448 -108
  15. package/dist/billing/index.js +108 -41
  16. package/dist/catalog/index.d.cts +74 -45
  17. package/dist/catalog/index.d.ts +74 -45
  18. package/dist/catalog/index.js +21 -13
  19. package/dist/catalog.module-C9O7BxRq.d.ts +180 -0
  20. package/dist/catalog.module-T-I5Ricz.d.cts +180 -0
  21. package/dist/checkout-offer/index.d.cts +17 -22
  22. package/dist/checkout-offer/index.d.ts +17 -22
  23. package/dist/checkout-offer/index.js +21 -7
  24. package/dist/checkout-offer.module-DFhGy6JO.d.cts +58 -0
  25. package/dist/checkout-offer.module-x7SP_dX4.d.ts +58 -0
  26. package/dist/checkout-offer.service-BeHgYikI.d.ts +242 -0
  27. package/dist/checkout-offer.service-CCVxG9b2.d.cts +242 -0
  28. package/dist/chunk-34XVPR6P.js +222 -0
  29. package/dist/{chunk-AOQJEYOL.js → chunk-3QVGA6JX.js} +3 -1
  30. package/dist/chunk-3RLWML2S.js +896 -0
  31. package/dist/{chunk-TXC3LHHB.js → chunk-4SDSYV4A.js} +21 -13
  32. package/dist/chunk-55QEDAMX.js +946 -0
  33. package/dist/chunk-5CKC7O52.js +140 -0
  34. package/dist/chunk-6PJE7EWO.js +185 -0
  35. package/dist/chunk-7NJKVC5X.js +353 -0
  36. package/dist/{chunk-RUNZ3X4C.js → chunk-AOS2JPDD.js} +1263 -185
  37. package/dist/{chunk-WOVQPXV4.js → chunk-CQ2ZZMTD.js} +702 -725
  38. package/dist/{chunk-NA6O63B7.js → chunk-F5X66HF5.js} +5 -5
  39. package/dist/chunk-FEQZCWUL.js +174 -0
  40. package/dist/{chunk-VIJ5NJWC.js → chunk-G6EZWECL.js} +107 -31
  41. package/dist/chunk-G7RQO2XO.js +0 -0
  42. package/dist/{chunk-N3L3AICU.js → chunk-GPQWGA6B.js} +5 -6
  43. package/dist/chunk-GZTL64QK.js +7 -0
  44. package/dist/{chunk-SABTXESR.js → chunk-J7NJRK3K.js} +17 -1
  45. package/dist/{chunk-SEPN52AD.js → chunk-JBCC6C3M.js} +566 -307
  46. package/dist/{chunk-I7GTA3RX.js → chunk-JQRA724W.js} +1 -1
  47. package/dist/{chunk-WXYJHZCN.js → chunk-JVAEKTJ4.js} +2 -14
  48. package/dist/chunk-KPEMTBOP.js +26 -0
  49. package/dist/chunk-LF6J4YYN.js +301 -0
  50. package/dist/{chunk-LTT736P3.js → chunk-LLYVYRGJ.js} +228 -387
  51. package/dist/{chunk-6Z7JR4EW.js → chunk-M47BNEY2.js} +1897 -633
  52. package/dist/{chunk-KFT5AIIH.js → chunk-NDLC5GYK.js} +206 -24
  53. package/dist/{chunk-O2J2HDXA.js → chunk-OOTEXP47.js} +3 -8
  54. package/dist/chunk-QPVDCKYS.js +702 -0
  55. package/dist/{chunk-NHVDCYK5.js → chunk-R5YCJBHY.js} +71 -106
  56. package/dist/{chunk-XBYAFEOR.js → chunk-S33SO5XX.js} +1 -1
  57. package/dist/chunk-SZ7RFPXA.js +10 -0
  58. package/dist/chunk-TBBZWZQT.js +98 -0
  59. package/dist/chunk-TOEFN7DN.js +295 -0
  60. package/dist/{chunk-7ZEGFL42.js → chunk-WHJSYKNC.js} +6 -6
  61. package/dist/chunk-WOEJ6K7M.js +55 -0
  62. package/dist/{chunk-AU3OOREM.js → chunk-XSSWYPP5.js} +16 -3
  63. package/dist/contract-line-item-money-B0Z3Ogur.d.cts +43 -0
  64. package/dist/contract-line-item-money-B0Z3Ogur.d.ts +43 -0
  65. package/dist/discovery/index.d.cts +2 -2
  66. package/dist/discovery/index.d.ts +2 -2
  67. package/dist/discovery/index.js +6 -6
  68. package/dist/{discovery.scanner-9cMqF95o.d.cts → discovery.scanner-DXKc6JkV.d.cts} +1 -1
  69. package/dist/{discovery.scanner-9cMqF95o.d.ts → discovery.scanner-DXKc6JkV.d.ts} +1 -1
  70. package/dist/{enforce-quota.interceptor-Df0e3OWe.d.cts → enforce-quota.interceptor-BFyVdWe8.d.cts} +6 -6
  71. package/dist/{enforce-quota.interceptor-DW3etVyI.d.ts → enforce-quota.interceptor-GaBXboGx.d.ts} +6 -6
  72. package/dist/entitlement/index.d.cts +27 -4
  73. package/dist/entitlement/index.d.ts +27 -4
  74. package/dist/entitlement/index.js +13 -8
  75. package/dist/index.d.cts +209 -28
  76. package/dist/index.d.ts +209 -28
  77. package/dist/index.js +285 -163
  78. package/dist/issuer-identity.check-CBO0vcsq.d.cts +197 -0
  79. package/dist/issuer-identity.check-Cz9CEMkZ.d.ts +197 -0
  80. package/dist/{module-options-COSEb0VW.d.ts → module-options-DmQ3G4sZ.d.ts} +135 -41
  81. package/dist/{module-options-BG3MzQva.d.cts → module-options-qAOwinHR.d.cts} +135 -41
  82. package/dist/payment-callback.service-CR84Xw1Z.d.cts +125 -0
  83. package/dist/payment-callback.service-CR84Xw1Z.d.ts +125 -0
  84. package/dist/payments/index.cjs +4 -0
  85. package/dist/payments/index.d.cts +187 -0
  86. package/dist/payments/index.d.ts +187 -0
  87. package/dist/payments/index.js +141 -0
  88. package/dist/payments.module-BdUq9ot_.d.cts +57 -0
  89. package/dist/payments.module-CQGv_VG7.d.ts +57 -0
  90. package/dist/plan-catalog-source-DWe-BGY1.d.cts +21 -0
  91. package/dist/plan-catalog-source-DWe-BGY1.d.ts +21 -0
  92. package/dist/{plan-resolution-Cgo_TR1H.d.cts → plan-resolution-CwUy_OqC.d.cts} +14 -0
  93. package/dist/{plan-resolution-Cgo_TR1H.d.ts → plan-resolution-CwUy_OqC.d.ts} +14 -0
  94. package/dist/{plan-versions.service-DChhbK6h.d.ts → plan-versions.service-C0N-Em2W.d.ts} +38 -64
  95. package/dist/{plan-versions.service-TPEtbN0r.d.cts → plan-versions.service-DARLh-qI.d.cts} +38 -64
  96. package/dist/platform/index.d.cts +52 -23
  97. package/dist/platform/index.d.ts +52 -23
  98. package/dist/platform/index.js +57 -36
  99. package/dist/promo/index.d.cts +23 -8
  100. package/dist/promo/index.d.ts +23 -8
  101. package/dist/promo/index.js +15 -7
  102. package/dist/{promo.module-DtvIycpt.d.cts → promo.module-CKkECmU8.d.cts} +9 -3
  103. package/dist/{promo.module-Z8h1PNX-.d.ts → promo.module-DuIJdK3U.d.ts} +9 -3
  104. package/dist/promo.service-BYBu6dy3.d.cts +215 -0
  105. package/dist/promo.service-CFjfF0Xm.d.ts +215 -0
  106. package/dist/registration/index.d.cts +104 -47
  107. package/dist/registration/index.d.ts +104 -47
  108. package/dist/registration/index.js +15 -9
  109. package/dist/subscriber/index.cjs +4 -0
  110. package/dist/subscriber/index.d.cts +28 -0
  111. package/dist/subscriber/index.d.ts +28 -0
  112. package/dist/subscriber/index.js +16 -0
  113. package/dist/subscriber.service-5W6Gi-1B.d.cts +68 -0
  114. package/dist/subscriber.service-5W6Gi-1B.d.ts +68 -0
  115. package/dist/subscription-contract/index.d.cts +4 -2
  116. package/dist/subscription-contract/index.d.ts +4 -2
  117. package/dist/subscription-contract/index.js +13 -5
  118. package/dist/{subscription-contract.module-fDFdQ0jm.d.ts → subscription-contract.module-BfIRpc1o.d.ts} +8 -2
  119. package/dist/{subscription-contract.module-CEK8HS5-.d.cts → subscription-contract.module-DTMuUJYd.d.cts} +8 -2
  120. package/dist/{subscription-contract.service-hD87MKyg.d.cts → subscription-contract.service-CPZrTM9C.d.ts} +32 -3
  121. package/dist/{subscription-contract.service-hD87MKyg.d.ts → subscription-contract.service-CfNApLuP.d.cts} +32 -3
  122. package/dist/tenant-billing.controller-BLqbsONe.d.ts +812 -0
  123. package/dist/tenant-billing.controller-DKbAqTbM.d.cts +812 -0
  124. package/dist/tenant-billing.module-ClbjzocC.d.cts +364 -0
  125. package/dist/tenant-billing.module-DohgJJ2m.d.ts +364 -0
  126. package/dist/tenant-billing.tokens-G-1xOlMr.d.cts +129 -0
  127. package/dist/tenant-billing.tokens-G-1xOlMr.d.ts +129 -0
  128. package/dist/testing/index.d.cts +44 -17
  129. package/dist/testing/index.d.ts +44 -17
  130. package/dist/testing/index.js +189 -40
  131. package/package.json +24 -4
  132. package/dist/catalog.module-BDDO6iwq.d.cts +0 -103
  133. package/dist/catalog.module-BTnMsE6u.d.ts +0 -103
  134. package/dist/checkout-offer.module-CMtiQJTT.d.ts +0 -39
  135. package/dist/checkout-offer.module-CVpWrzbe.d.cts +0 -39
  136. package/dist/checkout-offer.service-BLOv2HOo.d.cts +0 -49
  137. package/dist/checkout-offer.service-BLOv2HOo.d.ts +0 -49
  138. package/dist/chunk-57V6ZTI6.js +0 -22
  139. package/dist/chunk-BSK6YBLI.js +0 -87
  140. package/dist/chunk-DQKCK7DX.js +0 -217
  141. package/dist/chunk-VXEYLNIB.js +0 -632
  142. package/dist/chunk-WUDYIPYH.js +0 -715
  143. package/dist/define-saasicat-DROBe-b1.d.ts +0 -69
  144. package/dist/define-saasicat-vGBCkFys.d.cts +0 -69
  145. package/dist/promo.service-BJbKAmw3.d.cts +0 -112
  146. package/dist/promo.service-BJbKAmw3.d.ts +0 -112
  147. package/dist/tenant-billing.controller-BQ67mlmI.d.ts +0 -438
  148. package/dist/tenant-billing.controller-DS8kB8a7.d.cts +0 -438
  149. package/dist/tenant-billing.module-BznC3XtW.d.cts +0 -299
  150. package/dist/tenant-billing.module-wUbsQSFG.d.ts +0 -299
  151. /package/dist/{chunk-2FR6ZL7R.js → chunk-BHZOH2DY.js} +0 -0
  152. /package/dist/{chunk-2SLTRKXC.js → chunk-DFOW3JVO.js} +0 -0
  153. /package/dist/{chunk-DBZGV3HC.js → chunk-DU56UKEH.js} +0 -0
  154. /package/dist/{chunk-OYNHOY45.js → chunk-GAUEVIAE.js} +0 -0
@@ -1,9 +1,24 @@
1
1
  import {
2
- codedError
3
- } from "./chunk-57V6ZTI6.js";
2
+ CheckoutOfferService
3
+ } from "./chunk-55QEDAMX.js";
4
+ import {
5
+ grossFromNet,
6
+ netFromGross
7
+ } from "./chunk-6PJE7EWO.js";
8
+ import {
9
+ PaymentCallbackService,
10
+ PaymentGatewayRegistry,
11
+ SUBSCRIBER_PAYMENT_METHOD_REPOSITORY_TOKEN,
12
+ refuseForeignReturnUrls
13
+ } from "./chunk-7NJKVC5X.js";
4
14
  import {
5
- asProvider
6
- } from "./chunk-SABTXESR.js";
15
+ INVOICE_ADDRESS_FIELDS,
16
+ settleNewSubscriberDetails
17
+ } from "./chunk-LF6J4YYN.js";
18
+ import {
19
+ asProvider,
20
+ codedError
21
+ } from "./chunk-J7NJRK3K.js";
7
22
  import {
8
23
  __name
9
24
  } from "./chunk-SHUYVCID.js";
@@ -52,8 +67,6 @@ var USER_ACCOUNT_LOOKUP_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/UserAc
52
67
  var SLUG_AVAILABILITY_CHECK_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/SlugAvailabilityCheck");
53
68
  var PASSWORD_HASHER_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PasswordHasher");
54
69
  var PLAN_CATALOG_LOOKUP_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PlanCatalogLookup");
55
- var PAYMENT_PROVIDER_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PaymentProvider");
56
- var PAYMENT_EVENT_LOG_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/PaymentEventLog");
57
70
  var ACTIVATION_ORCHESTRATOR_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/ActivationOrchestrator");
58
71
  var REGISTRATION_AUDIT_LOGGER_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/RegistrationAuditLogger");
59
72
  var REGISTRATION_RESUME_TOKEN_SIGNER_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/RegistrationResumeTokenSigner");
@@ -64,9 +77,9 @@ var REGISTRATION_PROMO_PREVIEW_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest
64
77
  var REGISTRATION_CONFIG_TOKEN = /* @__PURE__ */ Symbol.for("saasicat/nest/RegistrationConfig");
65
78
 
66
79
  // src/registration/pending-registration.service.ts
67
- import { BadRequestException, Inject, Injectable, Logger, NotFoundException, Optional } from "@nestjs/common";
80
+ import { BadRequestException, Inject as Inject2, Injectable as Injectable2, Logger as Logger2, NotFoundException, Optional as Optional2 } from "@nestjs/common";
68
81
  import { REGISTRATION_ERROR_CODES, REGISTRATION_RESUME_TTL_MINUTES } from "@saasicat/core";
69
- import { OTP_RATE_LIMIT_MAX_SENDS, OTP_RATE_LIMIT_WINDOW_MINUTES, OTP_TTL_MINUTES, OTP_VERIFY_MAX_ATTEMPTS, PENDING_CHECKOUT_TTL_DAYS, PENDING_EMAIL_TTL_HOURS, PENDING_ONBOARDING_TTL_DAYS, REGISTRATION_STEP_BY_STATUS } from "@saasicat/core";
82
+ import { OTP_RATE_LIMIT_MAX_SENDS, OTP_RATE_LIMIT_WINDOW_MINUTES, OTP_TTL_MINUTES, OTP_VERIFY_MAX_ATTEMPTS, PENDING_EMAIL_TTL_HOURS, PENDING_ONBOARDING_TTL_DAYS, REGISTRATION_STEP_BY_STATUS } from "@saasicat/core";
70
83
 
71
84
  // src/registration/pricing.ts
72
85
  function round2(value) {
@@ -83,12 +96,11 @@ function computeBreakdown(catalog, selection, promo) {
83
96
  ...model.quotaBase
84
97
  };
85
98
  const subtotalMonthlyNet = modelMonthlyNet;
86
- const factor = selection.billingCycle === "YEARLY" ? catalog.cycleDiscount : 1;
87
- const subtotalNet = round2(subtotalMonthlyNet * factor);
88
- const discountAmount = promo ? Math.min(round2(promo.discountAmount), subtotalNet) : 0;
99
+ const subtotalNet = selection.billingCycle === "YEARLY" ? round2(model.yearlyNet) : subtotalMonthlyNet;
100
+ const discountAmount = promo ? Math.min(netFromGross(round2(promo.discountAmount), catalog.vatRate), subtotalNet) : 0;
89
101
  const totalNet = Math.max(0, round2(subtotalNet - discountAmount));
90
- const totalGross = round2(totalNet * (1 + catalog.vatRate / 100));
91
- const yearlySavings = selection.billingCycle === "YEARLY" ? round2(subtotalMonthlyNet * 12 - subtotalMonthlyNet * catalog.cycleDiscount) : 0;
102
+ const totalGross = grossFromNet(totalNet, catalog.vatRate);
103
+ const yearlySavings = selection.billingCycle === "YEARLY" ? Math.max(0, round2(subtotalMonthlyNet * 12 - subtotalNet)) : 0;
92
104
  return {
93
105
  cycle: selection.billingCycle,
94
106
  effectiveQuotas,
@@ -119,7 +131,45 @@ function resolveModel(catalog, modelId) {
119
131
  }
120
132
  __name(resolveModel, "resolveModel");
121
133
 
122
- // src/registration/pending-registration.service.ts
134
+ // src/registration/registration-payment.service.ts
135
+ import { ConflictException, Inject, Injectable, Logger, Optional } from "@nestjs/common";
136
+ import { PAYMENT_ERROR_CODES, PENDING_CHECKOUT_TTL_DAYS } from "@saasicat/core";
137
+
138
+ // src/registration/billing-details.ts
139
+ import { UnprocessableEntityException } from "@nestjs/common";
140
+ import { SUBSCRIBER_ERROR_CODES } from "@saasicat/core";
141
+ var REQUIRED = INVOICE_ADDRESS_FIELDS;
142
+ function settleBillingDetails(pending, details) {
143
+ const settled = settleNewSubscriberDetails({
144
+ legalName: pending.tenantName,
145
+ invoiceEmail: pending.email,
146
+ addressLine1: details.addressLine1,
147
+ addressLine2: details.addressLine2,
148
+ postalCode: details.postalCode,
149
+ city: details.city,
150
+ country: details.country,
151
+ vatId: details.vatId,
152
+ taxNumber: details.taxNumber
153
+ });
154
+ const missing = REQUIRED.find((field) => settled[field] === null);
155
+ if (missing) {
156
+ throw new UnprocessableEntityException(codedError(SUBSCRIBER_ERROR_CODES.SUBSCRIBER_DETAIL_INVALID, {
157
+ field: missing
158
+ }));
159
+ }
160
+ return {
161
+ addressLine1: settled.addressLine1,
162
+ addressLine2: settled.addressLine2,
163
+ postalCode: settled.postalCode,
164
+ city: settled.city,
165
+ country: settled.country,
166
+ vatId: settled.vatId,
167
+ taxNumber: settled.taxNumber
168
+ };
169
+ }
170
+ __name(settleBillingDetails, "settleBillingDetails");
171
+
172
+ // src/registration/registration-payment.service.ts
123
173
  function _ts_decorate(decorators, target, key, desc) {
124
174
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
125
175
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -137,6 +187,228 @@ function _ts_param(paramIndex, decorator) {
137
187
  };
138
188
  }
139
189
  __name(_ts_param, "_ts_param");
190
+ var DAY_MS = 24 * 60 * 60 * 1e3;
191
+ function checkoutExpiresAt(startedAt) {
192
+ return new Date(startedAt.getTime() + PENDING_CHECKOUT_TTL_DAYS * DAY_MS);
193
+ }
194
+ __name(checkoutExpiresAt, "checkoutExpiresAt");
195
+ var FORM_OPENING_MS = 10 * 60 * 1e3;
196
+ function whileTheFormOpens(startedAt) {
197
+ return new Date(startedAt.getTime() + FORM_OPENING_MS);
198
+ }
199
+ __name(whileTheFormOpens, "whileTheFormOpens");
200
+ var RegistrationPaymentService = class _RegistrationPaymentService {
201
+ static {
202
+ __name(this, "RegistrationPaymentService");
203
+ }
204
+ repo;
205
+ orchestrator;
206
+ audit;
207
+ registry;
208
+ callbacks;
209
+ methods;
210
+ logger = new Logger(_RegistrationPaymentService.name);
211
+ constructor(repo, orchestrator, audit, registry = null, callbacks = null, methods = null) {
212
+ this.repo = repo;
213
+ this.orchestrator = orchestrator;
214
+ this.audit = audit;
215
+ this.registry = registry;
216
+ this.callbacks = callbacks;
217
+ this.methods = methods;
218
+ }
219
+ onModuleInit() {
220
+ this.payments().callbacks.handleSetupsOf("registration", {
221
+ confirmed: /* @__PURE__ */ __name((event, context) => this.activate(event, context), "confirmed"),
222
+ failed: /* @__PURE__ */ __name((event, context) => this.noteFailure(event, context), "failed")
223
+ });
224
+ }
225
+ async onApplicationBootstrap() {
226
+ const held = await this.repo.findOpenCheckoutAccounts(/* @__PURE__ */ new Date());
227
+ const unconfigured = this.payments().registry.unconfigured(held);
228
+ if (unconfigured.length === 0) return;
229
+ throw new Error(`Sign-ups are waiting for a payment method at ${unconfigured.map((name) => `'${name}'`).join(", ")}, which config/saas.yaml#payments.accounts no longer names, so their confirmations cannot arrive. List each account again, with its gateway bound, until those sign-ups have completed or expired.`);
230
+ }
231
+ /**
232
+ * Records the billing details and opens the gateway's form. Returns the
233
+ * record as it now stands, where to send the person, and what `confirm`
234
+ * hands on when the gateway confirmed on the spot. The checkout expires
235
+ * `PENDING_CHECKOUT_TTL_DAYS` after `startedAt`.
236
+ */
237
+ async startSetup(pending, billingDetails, urls, startedAt) {
238
+ const { registry } = this.payments();
239
+ refuseForeignReturnUrls(urls, registry.returnUrlOrigins());
240
+ const billing = settleBillingDetails(pending, billingDetails);
241
+ const account = registry.forNewPaymentMethods();
242
+ if (!account) {
243
+ throw new ConflictException(codedError(PAYMENT_ERROR_CODES.PAYMENTS_NOT_CONFIGURED));
244
+ }
245
+ const session = await account.gateway.startPaymentMethodSetup({
246
+ subject: {
247
+ kind: "registration",
248
+ pendingRegistrationId: pending.id
249
+ },
250
+ holder: {
251
+ name: pending.tenantName,
252
+ email: pending.email,
253
+ address: {
254
+ addressLine1: billing.addressLine1,
255
+ addressLine2: billing.addressLine2,
256
+ postalCode: billing.postalCode,
257
+ city: billing.city,
258
+ country: billing.country
259
+ },
260
+ customerRef: pending.checkoutGatewayAccount === account.name ? pending.gatewayCustomerRef : null
261
+ },
262
+ methods: account.methods,
263
+ successUrl: urls.successUrl,
264
+ cancelUrl: urls.cancelUrl
265
+ });
266
+ const updated = await this.repo.update(pending.id, {
267
+ ...billing,
268
+ status: "CHECKOUT_STARTED",
269
+ currentStep: 4,
270
+ checkoutSessionId: session.sessionRef,
271
+ checkoutGatewayAccount: account.name,
272
+ gatewayCustomerRef: session.customerRef,
273
+ checkoutStartedAt: startedAt,
274
+ expiresAt: checkoutExpiresAt(startedAt)
275
+ });
276
+ return {
277
+ updated,
278
+ sessionRef: session.sessionRef,
279
+ redirectUrl: session.redirectUrl,
280
+ confirmableUntil: session.confirmableUntil,
281
+ immediate: session.immediateCallback ? {
282
+ account: account.name,
283
+ callback: session.immediateCallback
284
+ } : null
285
+ };
286
+ }
287
+ /** Handles a confirmation the gateway gave when the setup started, like any callback. */
288
+ async confirm(started) {
289
+ if (!started.immediate) return;
290
+ await this.payments().callbacks.handle(started.immediate.account, started.immediate.callback);
291
+ }
292
+ async activate(event, context) {
293
+ const pending = await this.pendingFor(event, context);
294
+ if (!pending) return "nothing-to-do";
295
+ const { methods } = this.payments();
296
+ const result = await this.orchestrator.activate(pending, {
297
+ tx: context.tx
298
+ });
299
+ await methods.recordConfirmed({
300
+ ...event.paymentMethod,
301
+ subscriberId: result.subscriberId,
302
+ gatewayAccount: context.gatewayAccount,
303
+ provider: context.provider,
304
+ confirmedAt: event.occurredAt
305
+ }, context.tx);
306
+ await this.repo.delete(pending.id, context.tx);
307
+ context.afterCommit(async () => {
308
+ await this.record({
309
+ eventType: "PAYMENT_RECEIVED",
310
+ pendingRegistrationId: pending.id,
311
+ metadata: {
312
+ eventId: event.eventId,
313
+ sessionId: event.sessionRef
314
+ }
315
+ });
316
+ await this.record({
317
+ eventType: "ACTIVATION_COMPLETED",
318
+ pendingRegistrationId: pending.id,
319
+ metadata: {
320
+ ...result
321
+ }
322
+ });
323
+ this.logger.log(`Activation succeeded: pending=${pending.id} \u2192 user=${result.userId} tenant=${result.tenantId} subscriber=${result.subscriberId} subscription=${result.subscriptionId}`);
324
+ });
325
+ return "took-effect";
326
+ }
327
+ async noteFailure(event, context) {
328
+ const pending = await this.pendingFor(event, context);
329
+ context.afterCommit(() => this.record({
330
+ eventType: "PAYMENT_FAILED",
331
+ pendingRegistrationId: pending?.id ?? null,
332
+ metadata: {
333
+ eventId: event.eventId,
334
+ sessionId: event.sessionRef
335
+ }
336
+ }));
337
+ }
338
+ /**
339
+ * The sign-up a setup event is about, found by the session its account
340
+ * opened. `null` — and nothing done — when there is none waiting: it was
341
+ * activated already, or expired and was cleaned up, or the event names a
342
+ * different sign-up than the session belongs to.
343
+ */
344
+ async pendingFor(event, context) {
345
+ const pending = await this.repo.findByCheckoutSession(context.gatewayAccount, event.sessionRef);
346
+ const subject = event.subject;
347
+ if (!pending || pending.status !== "CHECKOUT_STARTED" || subject.kind !== "registration" || subject.pendingRegistrationId !== pending.id) {
348
+ this.logger.warn(`Payment event ${event.eventId} at '${context.gatewayAccount}' finds no sign-up waiting for session ${event.sessionRef}.`);
349
+ return null;
350
+ }
351
+ return pending;
352
+ }
353
+ payments() {
354
+ if (!this.registry || !this.callbacks || !this.methods) {
355
+ throw new Error("RegistrationModule takes the payment method of a sign-up through the payments module, and none is wired: configure `SaaSiCatModule.forRoot({ payments })`, or `PaymentsModule.forRoot` beside RegistrationModule.");
356
+ }
357
+ return {
358
+ registry: this.registry,
359
+ callbacks: this.callbacks,
360
+ methods: this.methods
361
+ };
362
+ }
363
+ async record(event) {
364
+ try {
365
+ await this.audit.log(event);
366
+ } catch (error) {
367
+ const message = error instanceof Error ? error.message : String(error);
368
+ this.logger.warn(`Audit log write failed (${event.eventType}): ${message}`);
369
+ }
370
+ }
371
+ };
372
+ RegistrationPaymentService = _ts_decorate([
373
+ Injectable(),
374
+ _ts_param(0, Inject(PENDING_REGISTRATION_REPOSITORY_TOKEN)),
375
+ _ts_param(1, Inject(ACTIVATION_ORCHESTRATOR_TOKEN)),
376
+ _ts_param(2, Inject(REGISTRATION_AUDIT_LOGGER_TOKEN)),
377
+ _ts_param(3, Optional()),
378
+ _ts_param(3, Inject(PaymentGatewayRegistry)),
379
+ _ts_param(4, Optional()),
380
+ _ts_param(4, Inject(PaymentCallbackService)),
381
+ _ts_param(5, Optional()),
382
+ _ts_param(5, Inject(SUBSCRIBER_PAYMENT_METHOD_REPOSITORY_TOKEN)),
383
+ _ts_metadata("design:type", Function),
384
+ _ts_metadata("design:paramtypes", [
385
+ typeof PendingRegistrationRepository === "undefined" ? Object : PendingRegistrationRepository,
386
+ typeof ActivationOrchestrator === "undefined" ? Object : ActivationOrchestrator,
387
+ typeof RegistrationAuditLogger === "undefined" ? Object : RegistrationAuditLogger,
388
+ Object,
389
+ Object,
390
+ Object
391
+ ])
392
+ ], RegistrationPaymentService);
393
+
394
+ // src/registration/pending-registration.service.ts
395
+ function _ts_decorate2(decorators, target, key, desc) {
396
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
397
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
398
+ 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;
399
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
400
+ }
401
+ __name(_ts_decorate2, "_ts_decorate");
402
+ function _ts_metadata2(k, v) {
403
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
404
+ }
405
+ __name(_ts_metadata2, "_ts_metadata");
406
+ function _ts_param2(paramIndex, decorator) {
407
+ return function(target, key) {
408
+ decorator(target, key, paramIndex);
409
+ };
410
+ }
411
+ __name(_ts_param2, "_ts_param");
140
412
  var PendingRegistrationService = class _PendingRegistrationService {
141
413
  static {
142
414
  __name(this, "PendingRegistrationService");
@@ -147,32 +419,30 @@ var PendingRegistrationService = class _PendingRegistrationService {
147
419
  slugCheck;
148
420
  passwordHasher;
149
421
  planCatalog;
150
- paymentProvider;
151
- paymentEventLog;
152
- activationOrchestrator;
422
+ payments;
153
423
  audit;
154
424
  resumeTokenSigner;
155
425
  resumeDelivery;
156
426
  resumeBaseUrl;
157
427
  configuratorLookup;
158
428
  promoPreview;
159
- logger = new Logger(_PendingRegistrationService.name);
160
- constructor(repo, otpDelivery, userLookup, slugCheck, passwordHasher, planCatalog, paymentProvider, paymentEventLog, activationOrchestrator, audit, resumeTokenSigner, resumeDelivery, resumeBaseUrl, configuratorLookup, promoPreview) {
429
+ checkoutOffers;
430
+ logger = new Logger2(_PendingRegistrationService.name);
431
+ constructor(repo, otpDelivery, userLookup, slugCheck, passwordHasher, planCatalog, payments, audit, resumeTokenSigner, resumeDelivery, resumeBaseUrl, configuratorLookup, promoPreview, checkoutOffers) {
161
432
  this.repo = repo;
162
433
  this.otpDelivery = otpDelivery;
163
434
  this.userLookup = userLookup;
164
435
  this.slugCheck = slugCheck;
165
436
  this.passwordHasher = passwordHasher;
166
437
  this.planCatalog = planCatalog;
167
- this.paymentProvider = paymentProvider;
168
- this.paymentEventLog = paymentEventLog;
169
- this.activationOrchestrator = activationOrchestrator;
438
+ this.payments = payments;
170
439
  this.audit = audit;
171
440
  this.resumeTokenSigner = resumeTokenSigner;
172
441
  this.resumeDelivery = resumeDelivery;
173
442
  this.resumeBaseUrl = resumeBaseUrl;
174
443
  this.configuratorLookup = configuratorLookup;
175
444
  this.promoPreview = promoPreview;
445
+ this.checkoutOffers = checkoutOffers;
176
446
  }
177
447
  async record(eventType, pendingRegistrationId, context, metadata) {
178
448
  try {
@@ -242,110 +512,60 @@ var PendingRegistrationService = class _PendingRegistrationService {
242
512
  if (!plan) {
243
513
  throw new BadRequestException(codedError(REGISTRATION_ERROR_CODES.PLAN_NOT_AVAILABLE));
244
514
  }
245
- const session = await this.paymentProvider.createCheckoutSession({
246
- pendingRegistrationId: pending.id,
247
- planId: pending.selectedPlanId,
248
- email: pending.email,
249
- successUrl: input.successUrl,
250
- cancelUrl: input.cancelUrl
251
- });
252
- const now = /* @__PURE__ */ new Date();
253
- const expiresAt = new Date(now.getTime() + PENDING_CHECKOUT_TTL_DAYS * 24 * 60 * 60 * 1e3);
254
- const updated = await this.repo.update(pending.id, {
255
- status: "CHECKOUT_STARTED",
256
- currentStep: 4,
257
- checkoutSessionId: session.sessionId,
258
- checkoutStartedAt: now,
259
- expiresAt
260
- });
261
- await this.record("CHECKOUT_STARTED", updated.id, context, {
262
- sessionId: session.sessionId,
263
- provider: session.provider
515
+ const startedAt = /* @__PURE__ */ new Date();
516
+ const offerId = input.checkoutOfferId;
517
+ const whileOpening = whileTheFormOpens(startedAt);
518
+ if (offerId) await this.holdPromoCodeOf(offerId, pending, whileOpening);
519
+ let started;
520
+ try {
521
+ started = await this.payments.startSetup(pending, input.billingDetails, {
522
+ successUrl: input.successUrl,
523
+ cancelUrl: input.cancelUrl
524
+ }, startedAt);
525
+ if (offerId) {
526
+ await this.holdPromoCodeOf(offerId, pending, started.confirmableUntil ?? checkoutExpiresAt(startedAt));
527
+ }
528
+ } catch (error) {
529
+ if (offerId) await this.giveBackHoldOf(offerId, whileOpening);
530
+ throw error;
531
+ }
532
+ await this.record("CHECKOUT_STARTED", pending.id, context, {
533
+ sessionId: started.sessionRef,
534
+ gatewayAccount: started.updated.checkoutGatewayAccount
264
535
  });
536
+ await this.payments.confirm(started);
265
537
  return {
266
- pendingRegistrationId: updated.id,
267
- status: updated.status,
268
- nextStep: REGISTRATION_STEP_BY_STATUS[updated.status],
269
- checkoutSessionId: session.sessionId,
270
- checkoutUrl: session.checkoutUrl
538
+ pendingRegistrationId: pending.id,
539
+ status: started.updated.status,
540
+ nextStep: REGISTRATION_STEP_BY_STATUS[started.updated.status],
541
+ checkoutSessionId: started.sessionRef,
542
+ checkoutUrl: started.redirectUrl
271
543
  };
272
544
  }
273
545
  /**
274
- * Processes a payment webhook idempotently:
275
- * 1. `tryClaim` pins the event ID via a @unique INSERT. Duplicates are
276
- * dropped silently (`ALREADY_PROCESSED`).
277
- * 2. On status `SUCCEEDED` the PendingRegistration is resolved from the
278
- * checkout session and the ActivationOrchestrator triggers the final
279
- * user+tenant+subscription creation in a single transaction.
280
- * 3. After activation the PendingRegistration is deleted.
281
- *
282
- * On errors in step 2/3 the EventLog entry remains — provider retries then
283
- * run into ALREADY_PROCESSED. Operational repair is done manually (status
284
- * inspection + cleanup).
546
+ * Gives back the slot a failed start took: its form did not open, or its
547
+ * slot could not be moved to the form's end. The failure is the answer the
548
+ * caller gets; a slot that cannot be given back here lapses with its short
549
+ * hold, so this failure is logged rather than put in the way of that answer.
285
550
  */
286
- async handlePaymentEvent(input, context) {
287
- const claimed = await this.paymentEventLog.tryClaim(input.eventId, {
288
- provider: input.provider,
289
- sessionId: input.sessionId,
290
- status: input.status,
291
- rawPayload: input.rawPayload
292
- });
293
- if (!claimed) {
294
- this.logger.warn(`Idempotency: payment event ${input.eventId} already processed \u2014 duplicate discarded.`);
295
- await this.record("PAYMENT_DUPLICATE_IGNORED", null, context, {
296
- eventId: input.eventId,
297
- sessionId: input.sessionId
298
- });
299
- return {
300
- activated: false,
301
- reason: "ALREADY_PROCESSED"
302
- };
303
- }
304
- if (input.status !== "SUCCEEDED") {
305
- await this.record("PAYMENT_FAILED", null, context, {
306
- eventId: input.eventId,
307
- sessionId: input.sessionId
308
- });
309
- return {
310
- activated: false,
311
- reason: "PAYMENT_NOT_SUCCEEDED"
312
- };
313
- }
314
- if (!input.sessionId) {
315
- return {
316
- activated: false,
317
- reason: "MISSING_SESSION_ID"
318
- };
319
- }
320
- const pending = await this.repo.findByCheckoutSession(input.sessionId);
321
- if (!pending) {
322
- return {
323
- activated: false,
324
- reason: "PENDING_REGISTRATION_NOT_FOUND"
325
- };
551
+ async giveBackHoldOf(checkoutOfferId, heldUntil) {
552
+ try {
553
+ await this.checkoutOffers?.releasePromoCodeHold(checkoutOfferId, heldUntil);
554
+ } catch (error) {
555
+ this.logger.error(`The promo code slot of checkout offer '${checkoutOfferId}' was not given back after its start failed; it lapses with its short hold.`, error instanceof Error ? error.stack : String(error));
326
556
  }
327
- if (pending.status !== "CHECKOUT_STARTED" && pending.status !== "PLAN_SELECTED") {
328
- return {
329
- activated: false,
330
- reason: "INVALID_STATE"
331
- };
557
+ }
558
+ /**
559
+ * Holds the promo code of the offer the sign-up concludes until `until`.
560
+ */
561
+ async holdPromoCodeOf(checkoutOfferId, pending, until) {
562
+ if (!this.checkoutOffers) {
563
+ throw new Error("startCheckout was given a checkoutOfferId, and no CheckoutOfferService is registered to hold its promo code: enable `checkoutOffer` in SaaSiCatModule.forRoot, or register CheckoutOfferModule globally beside RegistrationModule.");
332
564
  }
333
- await this.record("PAYMENT_RECEIVED", pending.id, context, {
334
- eventId: input.eventId,
335
- sessionId: input.sessionId
336
- });
337
- const result = await this.activationOrchestrator.activate(pending);
338
- await this.repo.delete(pending.id);
339
- await this.record("ACTIVATION_COMPLETED", pending.id, context, {
340
- userId: result.userId,
341
- tenantId: result.tenantId,
342
- subscriptionId: result.subscriptionId
565
+ await this.checkoutOffers.holdPromoCode(checkoutOfferId, {
566
+ email: pending.email,
567
+ until
343
568
  });
344
- this.logger.log(`Activation succeeded: pending=${pending.id} \u2192 user=${result.userId} tenant=${result.tenantId} subscription=${result.subscriptionId}`);
345
- return {
346
- activated: true,
347
- result
348
- };
349
569
  }
350
570
  /**
351
571
  * Deletes all PendingRegistration records with `expiresAt < now`.
@@ -811,45 +1031,43 @@ var PendingRegistrationService = class _PendingRegistrationService {
811
1031
  throw new Error(`Could not find a free slug for "${tenantName}".`);
812
1032
  }
813
1033
  };
814
- PendingRegistrationService = _ts_decorate([
815
- Injectable(),
816
- _ts_param(0, Inject(PENDING_REGISTRATION_REPOSITORY_TOKEN)),
817
- _ts_param(1, Inject(REGISTRATION_OTP_DELIVERY_TOKEN)),
818
- _ts_param(2, Inject(USER_ACCOUNT_LOOKUP_TOKEN)),
819
- _ts_param(3, Inject(SLUG_AVAILABILITY_CHECK_TOKEN)),
820
- _ts_param(4, Inject(PASSWORD_HASHER_TOKEN)),
821
- _ts_param(5, Inject(PLAN_CATALOG_LOOKUP_TOKEN)),
822
- _ts_param(6, Inject(PAYMENT_PROVIDER_TOKEN)),
823
- _ts_param(7, Inject(PAYMENT_EVENT_LOG_TOKEN)),
824
- _ts_param(8, Inject(ACTIVATION_ORCHESTRATOR_TOKEN)),
825
- _ts_param(9, Inject(REGISTRATION_AUDIT_LOGGER_TOKEN)),
826
- _ts_param(10, Optional()),
827
- _ts_param(10, Inject(REGISTRATION_RESUME_TOKEN_SIGNER_TOKEN)),
828
- _ts_param(11, Optional()),
829
- _ts_param(11, Inject(REGISTRATION_RESUME_DELIVERY_TOKEN)),
830
- _ts_param(12, Optional()),
831
- _ts_param(12, Inject(REGISTRATION_RESUME_BASE_URL_TOKEN)),
832
- _ts_param(13, Optional()),
833
- _ts_param(13, Inject(REGISTRATION_CONFIGURATOR_LOOKUP_TOKEN)),
834
- _ts_param(14, Optional()),
835
- _ts_param(14, Inject(REGISTRATION_PROMO_PREVIEW_TOKEN)),
836
- _ts_metadata("design:type", Function),
837
- _ts_metadata("design:paramtypes", [
1034
+ PendingRegistrationService = _ts_decorate2([
1035
+ Injectable2(),
1036
+ _ts_param2(0, Inject2(PENDING_REGISTRATION_REPOSITORY_TOKEN)),
1037
+ _ts_param2(1, Inject2(REGISTRATION_OTP_DELIVERY_TOKEN)),
1038
+ _ts_param2(2, Inject2(USER_ACCOUNT_LOOKUP_TOKEN)),
1039
+ _ts_param2(3, Inject2(SLUG_AVAILABILITY_CHECK_TOKEN)),
1040
+ _ts_param2(4, Inject2(PASSWORD_HASHER_TOKEN)),
1041
+ _ts_param2(5, Inject2(PLAN_CATALOG_LOOKUP_TOKEN)),
1042
+ _ts_param2(7, Inject2(REGISTRATION_AUDIT_LOGGER_TOKEN)),
1043
+ _ts_param2(8, Optional2()),
1044
+ _ts_param2(8, Inject2(REGISTRATION_RESUME_TOKEN_SIGNER_TOKEN)),
1045
+ _ts_param2(9, Optional2()),
1046
+ _ts_param2(9, Inject2(REGISTRATION_RESUME_DELIVERY_TOKEN)),
1047
+ _ts_param2(10, Optional2()),
1048
+ _ts_param2(10, Inject2(REGISTRATION_RESUME_BASE_URL_TOKEN)),
1049
+ _ts_param2(11, Optional2()),
1050
+ _ts_param2(11, Inject2(REGISTRATION_CONFIGURATOR_LOOKUP_TOKEN)),
1051
+ _ts_param2(12, Optional2()),
1052
+ _ts_param2(12, Inject2(REGISTRATION_PROMO_PREVIEW_TOKEN)),
1053
+ _ts_param2(13, Optional2()),
1054
+ _ts_param2(13, Inject2(CheckoutOfferService)),
1055
+ _ts_metadata2("design:type", Function),
1056
+ _ts_metadata2("design:paramtypes", [
838
1057
  typeof PendingRegistrationRepository === "undefined" ? Object : PendingRegistrationRepository,
839
1058
  typeof RegistrationOtpDelivery === "undefined" ? Object : RegistrationOtpDelivery,
840
1059
  typeof UserAccountLookup === "undefined" ? Object : UserAccountLookup,
841
1060
  typeof SlugAvailabilityCheck === "undefined" ? Object : SlugAvailabilityCheck,
842
1061
  typeof PasswordHasher === "undefined" ? Object : PasswordHasher,
843
1062
  typeof PlanCatalogLookup === "undefined" ? Object : PlanCatalogLookup,
844
- typeof PaymentProvider === "undefined" ? Object : PaymentProvider,
845
- typeof PaymentEventLog === "undefined" ? Object : PaymentEventLog,
846
- typeof ActivationOrchestrator === "undefined" ? Object : ActivationOrchestrator,
1063
+ typeof RegistrationPaymentService === "undefined" ? Object : RegistrationPaymentService,
847
1064
  typeof RegistrationAuditLogger === "undefined" ? Object : RegistrationAuditLogger,
848
1065
  typeof RegistrationResumeTokenSigner === "undefined" ? Object : RegistrationResumeTokenSigner,
849
1066
  typeof RegistrationResumeDelivery === "undefined" ? Object : RegistrationResumeDelivery,
850
1067
  String,
851
1068
  typeof RegistrationConfiguratorLookup === "undefined" ? Object : RegistrationConfiguratorLookup,
852
- typeof RegistrationPromoPreview === "undefined" ? Object : RegistrationPromoPreview
1069
+ typeof RegistrationPromoPreview === "undefined" ? Object : RegistrationPromoPreview,
1070
+ typeof CheckoutOfferService === "undefined" ? Object : CheckoutOfferService
853
1071
  ])
854
1072
  ], PendingRegistrationService);
855
1073
  function normalizeEmail(value) {
@@ -879,10 +1097,24 @@ function toSnapshot(pending) {
879
1097
  config: pending.configJson,
880
1098
  billingCycle: pending.billingCycle,
881
1099
  appliedPromoCode: pending.appliedPromoCode,
1100
+ billingDetails: billingDetailsOf(pending),
882
1101
  checkoutSessionId: pending.checkoutSessionId
883
1102
  };
884
1103
  }
885
1104
  __name(toSnapshot, "toSnapshot");
1105
+ function billingDetailsOf(pending) {
1106
+ if (!pending.addressLine1 || !pending.postalCode || !pending.city || !pending.country) return null;
1107
+ return {
1108
+ addressLine1: pending.addressLine1,
1109
+ addressLine2: pending.addressLine2,
1110
+ postalCode: pending.postalCode,
1111
+ city: pending.city,
1112
+ country: pending.country,
1113
+ vatId: pending.vatId,
1114
+ taxNumber: pending.taxNumber
1115
+ };
1116
+ }
1117
+ __name(billingDetailsOf, "billingDetailsOf");
886
1118
  function nullable(value) {
887
1119
  const trimmed = value?.trim();
888
1120
  return trimmed && trimmed.length > 0 ? trimmed : null;
@@ -890,25 +1122,25 @@ function nullable(value) {
890
1122
  __name(nullable, "nullable");
891
1123
 
892
1124
  // src/registration/cleanup.cron.ts
893
- import { Injectable as Injectable2, Logger as Logger2 } from "@nestjs/common";
1125
+ import { Injectable as Injectable3, Logger as Logger3 } from "@nestjs/common";
894
1126
  import { Cron, CronExpression } from "@nestjs/schedule";
895
- function _ts_decorate2(decorators, target, key, desc) {
1127
+ function _ts_decorate3(decorators, target, key, desc) {
896
1128
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
897
1129
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
898
1130
  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;
899
1131
  return c > 3 && r && Object.defineProperty(target, key, r), r;
900
1132
  }
901
- __name(_ts_decorate2, "_ts_decorate");
902
- function _ts_metadata2(k, v) {
1133
+ __name(_ts_decorate3, "_ts_decorate");
1134
+ function _ts_metadata3(k, v) {
903
1135
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
904
1136
  }
905
- __name(_ts_metadata2, "_ts_metadata");
1137
+ __name(_ts_metadata3, "_ts_metadata");
906
1138
  var RegistrationCleanupCron = class _RegistrationCleanupCron {
907
1139
  static {
908
1140
  __name(this, "RegistrationCleanupCron");
909
1141
  }
910
1142
  service;
911
- logger = new Logger2(_RegistrationCleanupCron.name);
1143
+ logger = new Logger3(_RegistrationCleanupCron.name);
912
1144
  constructor(service) {
913
1145
  this.service = service;
914
1146
  }
@@ -937,36 +1169,36 @@ var RegistrationCleanupCron = class _RegistrationCleanupCron {
937
1169
  }
938
1170
  }
939
1171
  };
940
- _ts_decorate2([
1172
+ _ts_decorate3([
941
1173
  Cron("15 4 * * *", {
942
1174
  timeZone: "Europe/Berlin"
943
1175
  }),
944
- _ts_metadata2("design:type", Function),
945
- _ts_metadata2("design:paramtypes", []),
946
- _ts_metadata2("design:returntype", Promise)
1176
+ _ts_metadata3("design:type", Function),
1177
+ _ts_metadata3("design:paramtypes", []),
1178
+ _ts_metadata3("design:returntype", Promise)
947
1179
  ], RegistrationCleanupCron.prototype, "runDaily", null);
948
- RegistrationCleanupCron = _ts_decorate2([
949
- Injectable2(),
950
- _ts_metadata2("design:type", Function),
951
- _ts_metadata2("design:paramtypes", [
1180
+ RegistrationCleanupCron = _ts_decorate3([
1181
+ Injectable3(),
1182
+ _ts_metadata3("design:type", Function),
1183
+ _ts_metadata3("design:paramtypes", [
952
1184
  typeof PendingRegistrationService === "undefined" ? Object : PendingRegistrationService
953
1185
  ])
954
1186
  ], RegistrationCleanupCron);
955
1187
 
956
1188
  // src/registration/ip-rate-limit.guard.ts
957
- import { HttpException, HttpStatus, Injectable as Injectable3 } from "@nestjs/common";
1189
+ import { HttpException, HttpStatus, Injectable as Injectable4 } from "@nestjs/common";
958
1190
  import { REGISTRATION_ERROR_CODES as REGISTRATION_ERROR_CODES2 } from "@saasicat/core";
959
- function _ts_decorate3(decorators, target, key, desc) {
1191
+ function _ts_decorate4(decorators, target, key, desc) {
960
1192
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
961
1193
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
962
1194
  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;
963
1195
  return c > 3 && r && Object.defineProperty(target, key, r), r;
964
1196
  }
965
- __name(_ts_decorate3, "_ts_decorate");
966
- function _ts_metadata3(k, v) {
1197
+ __name(_ts_decorate4, "_ts_decorate");
1198
+ function _ts_metadata4(k, v) {
967
1199
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
968
1200
  }
969
- __name(_ts_metadata3, "_ts_metadata");
1201
+ __name(_ts_metadata4, "_ts_metadata");
970
1202
  var BaseIpRateLimitGuard = class {
971
1203
  static {
972
1204
  __name(this, "BaseIpRateLimitGuard");
@@ -1010,10 +1242,10 @@ var BaseIpRateLimitGuard = class {
1010
1242
  return bucket.count > this.options.limit;
1011
1243
  }
1012
1244
  };
1013
- BaseIpRateLimitGuard = _ts_decorate3([
1014
- Injectable3(),
1015
- _ts_metadata3("design:type", Function),
1016
- _ts_metadata3("design:paramtypes", [
1245
+ BaseIpRateLimitGuard = _ts_decorate4([
1246
+ Injectable4(),
1247
+ _ts_metadata4("design:type", Function),
1248
+ _ts_metadata4("design:paramtypes", [
1017
1249
  Object
1018
1250
  ])
1019
1251
  ], BaseIpRateLimitGuard);
@@ -1026,13 +1258,13 @@ __name(ipFingerprint, "ipFingerprint");
1026
1258
 
1027
1259
  // src/registration/registration.module.ts
1028
1260
  import { Module } from "@nestjs/common";
1029
- function _ts_decorate4(decorators, target, key, desc) {
1261
+ function _ts_decorate5(decorators, target, key, desc) {
1030
1262
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1031
1263
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1032
1264
  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;
1033
1265
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1034
1266
  }
1035
- __name(_ts_decorate4, "_ts_decorate");
1267
+ __name(_ts_decorate5, "_ts_decorate");
1036
1268
  var RegistrationModule = class _RegistrationModule {
1037
1269
  static {
1038
1270
  __name(this, "RegistrationModule");
@@ -1046,10 +1278,9 @@ var RegistrationModule = class _RegistrationModule {
1046
1278
  asProvider(SLUG_AVAILABILITY_CHECK_TOKEN, options.slugAvailabilityCheck),
1047
1279
  asProvider(PASSWORD_HASHER_TOKEN, options.passwordHasher),
1048
1280
  asProvider(PLAN_CATALOG_LOOKUP_TOKEN, options.planCatalogLookup),
1049
- asProvider(PAYMENT_PROVIDER_TOKEN, options.paymentProvider),
1050
- asProvider(PAYMENT_EVENT_LOG_TOKEN, options.paymentEventLog),
1051
1281
  asProvider(ACTIVATION_ORCHESTRATOR_TOKEN, options.activationOrchestrator),
1052
1282
  asProvider(REGISTRATION_AUDIT_LOGGER_TOKEN, options.auditLogger),
1283
+ RegistrationPaymentService,
1053
1284
  PendingRegistrationService
1054
1285
  ];
1055
1286
  if (options.resumeTokenSigner) {
@@ -1088,23 +1319,23 @@ var RegistrationModule = class _RegistrationModule {
1088
1319
  };
1089
1320
  }
1090
1321
  };
1091
- RegistrationModule = _ts_decorate4([
1322
+ RegistrationModule = _ts_decorate5([
1092
1323
  Module({})
1093
1324
  ], RegistrationModule);
1094
1325
 
1095
1326
  // src/registration/dto/register-start.dto.ts
1096
1327
  import { Equals, IsEmail, IsIn, IsOptional, IsString, Matches, MaxLength, MinLength } from "class-validator";
1097
- function _ts_decorate5(decorators, target, key, desc) {
1328
+ function _ts_decorate6(decorators, target, key, desc) {
1098
1329
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1099
1330
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1100
1331
  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;
1101
1332
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1102
1333
  }
1103
- __name(_ts_decorate5, "_ts_decorate");
1104
- function _ts_metadata4(k, v) {
1334
+ __name(_ts_decorate6, "_ts_decorate");
1335
+ function _ts_metadata5(k, v) {
1105
1336
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1106
1337
  }
1107
- __name(_ts_metadata4, "_ts_metadata");
1338
+ __name(_ts_metadata5, "_ts_metadata");
1108
1339
  var RegisterStartDto = class {
1109
1340
  static {
1110
1341
  __name(this, "RegisterStartDto");
@@ -1123,78 +1354,78 @@ var RegisterStartDto = class {
1123
1354
  termsAccepted;
1124
1355
  locale;
1125
1356
  };
1126
- _ts_decorate5([
1357
+ _ts_decorate6([
1127
1358
  IsString(),
1128
1359
  MinLength(2),
1129
1360
  MaxLength(120),
1130
- _ts_metadata4("design:type", String)
1361
+ _ts_metadata5("design:type", String)
1131
1362
  ], RegisterStartDto.prototype, "tenantName", void 0);
1132
- _ts_decorate5([
1363
+ _ts_decorate6([
1133
1364
  IsOptional(),
1134
1365
  IsString(),
1135
1366
  Matches(/^[a-z0-9-]+$/, {
1136
1367
  message: "tenantSlug may only contain lower-case letters, digits and hyphens."
1137
1368
  }),
1138
1369
  MaxLength(60),
1139
- _ts_metadata4("design:type", String)
1370
+ _ts_metadata5("design:type", String)
1140
1371
  ], RegisterStartDto.prototype, "tenantSlug", void 0);
1141
- _ts_decorate5([
1372
+ _ts_decorate6([
1142
1373
  IsOptional(),
1143
1374
  IsString(),
1144
1375
  MaxLength(40),
1145
- _ts_metadata4("design:type", String)
1376
+ _ts_metadata5("design:type", String)
1146
1377
  ], RegisterStartDto.prototype, "salutation", void 0);
1147
- _ts_decorate5([
1378
+ _ts_decorate6([
1148
1379
  IsString(),
1149
1380
  MinLength(1),
1150
1381
  MaxLength(60),
1151
- _ts_metadata4("design:type", String)
1382
+ _ts_metadata5("design:type", String)
1152
1383
  ], RegisterStartDto.prototype, "firstName", void 0);
1153
- _ts_decorate5([
1384
+ _ts_decorate6([
1154
1385
  IsString(),
1155
1386
  MinLength(1),
1156
1387
  MaxLength(60),
1157
- _ts_metadata4("design:type", String)
1388
+ _ts_metadata5("design:type", String)
1158
1389
  ], RegisterStartDto.prototype, "lastName", void 0);
1159
- _ts_decorate5([
1390
+ _ts_decorate6([
1160
1391
  IsEmail(),
1161
1392
  MaxLength(160),
1162
- _ts_metadata4("design:type", String)
1393
+ _ts_metadata5("design:type", String)
1163
1394
  ], RegisterStartDto.prototype, "email", void 0);
1164
- _ts_decorate5([
1395
+ _ts_decorate6([
1165
1396
  IsString(),
1166
1397
  MinLength(8),
1167
1398
  MaxLength(160),
1168
- _ts_metadata4("design:type", String)
1399
+ _ts_metadata5("design:type", String)
1169
1400
  ], RegisterStartDto.prototype, "password", void 0);
1170
- _ts_decorate5([
1401
+ _ts_decorate6([
1171
1402
  Equals(true, {
1172
1403
  message: "The terms of service, privacy policy and data processing agreement must be accepted."
1173
1404
  }),
1174
- _ts_metadata4("design:type", Boolean)
1405
+ _ts_metadata5("design:type", Boolean)
1175
1406
  ], RegisterStartDto.prototype, "termsAccepted", void 0);
1176
- _ts_decorate5([
1407
+ _ts_decorate6([
1177
1408
  IsOptional(),
1178
1409
  IsIn([
1179
1410
  "de",
1180
1411
  "tr"
1181
1412
  ]),
1182
- _ts_metadata4("design:type", String)
1413
+ _ts_metadata5("design:type", String)
1183
1414
  ], RegisterStartDto.prototype, "locale", void 0);
1184
1415
 
1185
1416
  // src/registration/dto/verify-registration-otp.dto.ts
1186
1417
  import { IsEmail as IsEmail2, IsString as IsString2, Matches as Matches2 } from "class-validator";
1187
- function _ts_decorate6(decorators, target, key, desc) {
1418
+ function _ts_decorate7(decorators, target, key, desc) {
1188
1419
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1189
1420
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1190
1421
  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;
1191
1422
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1192
1423
  }
1193
- __name(_ts_decorate6, "_ts_decorate");
1194
- function _ts_metadata5(k, v) {
1424
+ __name(_ts_decorate7, "_ts_decorate");
1425
+ function _ts_metadata6(k, v) {
1195
1426
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1196
1427
  }
1197
- __name(_ts_metadata5, "_ts_metadata");
1428
+ __name(_ts_metadata6, "_ts_metadata");
1198
1429
  var VerifyRegistrationOtpDto = class {
1199
1430
  static {
1200
1431
  __name(this, "VerifyRegistrationOtpDto");
@@ -1202,55 +1433,55 @@ var VerifyRegistrationOtpDto = class {
1202
1433
  email;
1203
1434
  otp;
1204
1435
  };
1205
- _ts_decorate6([
1436
+ _ts_decorate7([
1206
1437
  IsEmail2(),
1207
- _ts_metadata5("design:type", String)
1438
+ _ts_metadata6("design:type", String)
1208
1439
  ], VerifyRegistrationOtpDto.prototype, "email", void 0);
1209
- _ts_decorate6([
1440
+ _ts_decorate7([
1210
1441
  IsString2(),
1211
1442
  Matches2(/^\d{6}$/, {
1212
1443
  message: "The OTP must be 6 digits."
1213
1444
  }),
1214
- _ts_metadata5("design:type", String)
1445
+ _ts_metadata6("design:type", String)
1215
1446
  ], VerifyRegistrationOtpDto.prototype, "otp", void 0);
1216
1447
 
1217
1448
  // src/registration/dto/resend-registration-otp.dto.ts
1218
1449
  import { IsEmail as IsEmail3 } from "class-validator";
1219
- function _ts_decorate7(decorators, target, key, desc) {
1450
+ function _ts_decorate8(decorators, target, key, desc) {
1220
1451
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1221
1452
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1222
1453
  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;
1223
1454
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1224
1455
  }
1225
- __name(_ts_decorate7, "_ts_decorate");
1226
- function _ts_metadata6(k, v) {
1456
+ __name(_ts_decorate8, "_ts_decorate");
1457
+ function _ts_metadata7(k, v) {
1227
1458
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1228
1459
  }
1229
- __name(_ts_metadata6, "_ts_metadata");
1460
+ __name(_ts_metadata7, "_ts_metadata");
1230
1461
  var ResendRegistrationOtpDto = class {
1231
1462
  static {
1232
1463
  __name(this, "ResendRegistrationOtpDto");
1233
1464
  }
1234
1465
  email;
1235
1466
  };
1236
- _ts_decorate7([
1467
+ _ts_decorate8([
1237
1468
  IsEmail3(),
1238
- _ts_metadata6("design:type", String)
1469
+ _ts_metadata7("design:type", String)
1239
1470
  ], ResendRegistrationOtpDto.prototype, "email", void 0);
1240
1471
 
1241
1472
  // src/registration/dto/select-plan.dto.ts
1242
1473
  import { IsString as IsString3, MaxLength as MaxLength2, MinLength as MinLength2 } from "class-validator";
1243
- function _ts_decorate8(decorators, target, key, desc) {
1474
+ function _ts_decorate9(decorators, target, key, desc) {
1244
1475
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1245
1476
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1246
1477
  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;
1247
1478
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1248
1479
  }
1249
- __name(_ts_decorate8, "_ts_decorate");
1250
- function _ts_metadata7(k, v) {
1480
+ __name(_ts_decorate9, "_ts_decorate");
1481
+ function _ts_metadata8(k, v) {
1251
1482
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1252
1483
  }
1253
- __name(_ts_metadata7, "_ts_metadata");
1484
+ __name(_ts_metadata8, "_ts_metadata");
1254
1485
  var SelectRegistrationPlanDto = class {
1255
1486
  static {
1256
1487
  __name(this, "SelectRegistrationPlanDto");
@@ -1258,116 +1489,146 @@ var SelectRegistrationPlanDto = class {
1258
1489
  pendingRegistrationId;
1259
1490
  planId;
1260
1491
  };
1261
- _ts_decorate8([
1492
+ _ts_decorate9([
1262
1493
  IsString3(),
1263
1494
  MinLength2(1),
1264
1495
  MaxLength2(80),
1265
- _ts_metadata7("design:type", String)
1496
+ _ts_metadata8("design:type", String)
1266
1497
  ], SelectRegistrationPlanDto.prototype, "pendingRegistrationId", void 0);
1267
- _ts_decorate8([
1498
+ _ts_decorate9([
1268
1499
  IsString3(),
1269
1500
  MinLength2(1),
1270
1501
  MaxLength2(40),
1271
- _ts_metadata7("design:type", String)
1502
+ _ts_metadata8("design:type", String)
1272
1503
  ], SelectRegistrationPlanDto.prototype, "planId", void 0);
1273
1504
 
1274
1505
  // src/registration/dto/start-checkout.dto.ts
1275
- import { IsString as IsString4, IsUrl, MaxLength as MaxLength3, MinLength as MinLength3 } from "class-validator";
1276
- function _ts_decorate9(decorators, target, key, desc) {
1506
+ import { Type } from "class-transformer";
1507
+ import { IsNotEmptyObject, IsOptional as IsOptional2, IsString as IsString4, IsUrl, Matches as Matches3, MaxLength as MaxLength3, MinLength as MinLength3, ValidateNested } from "class-validator";
1508
+ function _ts_decorate10(decorators, target, key, desc) {
1277
1509
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1278
1510
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1279
1511
  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;
1280
1512
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1281
1513
  }
1282
- __name(_ts_decorate9, "_ts_decorate");
1283
- function _ts_metadata8(k, v) {
1514
+ __name(_ts_decorate10, "_ts_decorate");
1515
+ function _ts_metadata9(k, v) {
1284
1516
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1285
1517
  }
1286
- __name(_ts_metadata8, "_ts_metadata");
1518
+ __name(_ts_metadata9, "_ts_metadata");
1519
+ var RegistrationBillingDetailsDto = class {
1520
+ static {
1521
+ __name(this, "RegistrationBillingDetailsDto");
1522
+ }
1523
+ addressLine1;
1524
+ addressLine2;
1525
+ postalCode;
1526
+ city;
1527
+ /** ISO 3166-1 alpha-2, e.g. `DE`. */
1528
+ country;
1529
+ vatId;
1530
+ taxNumber;
1531
+ };
1532
+ _ts_decorate10([
1533
+ IsString4(),
1534
+ MinLength3(1),
1535
+ MaxLength3(200),
1536
+ _ts_metadata9("design:type", String)
1537
+ ], RegistrationBillingDetailsDto.prototype, "addressLine1", void 0);
1538
+ _ts_decorate10([
1539
+ IsOptional2(),
1540
+ IsString4(),
1541
+ MaxLength3(200),
1542
+ _ts_metadata9("design:type", Object)
1543
+ ], RegistrationBillingDetailsDto.prototype, "addressLine2", void 0);
1544
+ _ts_decorate10([
1545
+ IsString4(),
1546
+ MinLength3(1),
1547
+ MaxLength3(20),
1548
+ _ts_metadata9("design:type", String)
1549
+ ], RegistrationBillingDetailsDto.prototype, "postalCode", void 0);
1550
+ _ts_decorate10([
1551
+ IsString4(),
1552
+ MinLength3(1),
1553
+ MaxLength3(100),
1554
+ _ts_metadata9("design:type", String)
1555
+ ], RegistrationBillingDetailsDto.prototype, "city", void 0);
1556
+ _ts_decorate10([
1557
+ Matches3(/^[A-Z]{2}$/),
1558
+ _ts_metadata9("design:type", String)
1559
+ ], RegistrationBillingDetailsDto.prototype, "country", void 0);
1560
+ _ts_decorate10([
1561
+ IsOptional2(),
1562
+ IsString4(),
1563
+ MaxLength3(30),
1564
+ _ts_metadata9("design:type", Object)
1565
+ ], RegistrationBillingDetailsDto.prototype, "vatId", void 0);
1566
+ _ts_decorate10([
1567
+ IsOptional2(),
1568
+ IsString4(),
1569
+ MaxLength3(30),
1570
+ _ts_metadata9("design:type", Object)
1571
+ ], RegistrationBillingDetailsDto.prototype, "taxNumber", void 0);
1287
1572
  var StartRegistrationCheckoutDto = class {
1288
1573
  static {
1289
1574
  __name(this, "StartRegistrationCheckoutDto");
1290
1575
  }
1291
1576
  pendingRegistrationId;
1577
+ billingDetails;
1292
1578
  successUrl;
1293
1579
  cancelUrl;
1580
+ /**
1581
+ * The checkout offer the sign-up concludes; its promo code is held until a
1582
+ * confirmation of the payment form can no longer arrive.
1583
+ */
1584
+ checkoutOfferId;
1294
1585
  };
1295
- _ts_decorate9([
1586
+ _ts_decorate10([
1296
1587
  IsString4(),
1297
1588
  MinLength3(1),
1298
1589
  MaxLength3(80),
1299
- _ts_metadata8("design:type", String)
1590
+ _ts_metadata9("design:type", String)
1300
1591
  ], StartRegistrationCheckoutDto.prototype, "pendingRegistrationId", void 0);
1301
- _ts_decorate9([
1592
+ _ts_decorate10([
1593
+ IsNotEmptyObject(),
1594
+ ValidateNested(),
1595
+ Type(() => RegistrationBillingDetailsDto),
1596
+ _ts_metadata9("design:type", typeof RegistrationBillingDetailsDto === "undefined" ? Object : RegistrationBillingDetailsDto)
1597
+ ], StartRegistrationCheckoutDto.prototype, "billingDetails", void 0);
1598
+ _ts_decorate10([
1302
1599
  IsUrl({
1303
- require_tld: false
1600
+ require_tld: false,
1601
+ require_protocol: true,
1602
+ protocols: [
1603
+ "https",
1604
+ "http"
1605
+ ]
1304
1606
  }),
1305
1607
  MaxLength3(500),
1306
- _ts_metadata8("design:type", String)
1608
+ _ts_metadata9("design:type", String)
1307
1609
  ], StartRegistrationCheckoutDto.prototype, "successUrl", void 0);
1308
- _ts_decorate9([
1610
+ _ts_decorate10([
1309
1611
  IsUrl({
1310
- require_tld: false
1612
+ require_tld: false,
1613
+ require_protocol: true,
1614
+ protocols: [
1615
+ "https",
1616
+ "http"
1617
+ ]
1311
1618
  }),
1312
1619
  MaxLength3(500),
1313
- _ts_metadata8("design:type", String)
1314
- ], StartRegistrationCheckoutDto.prototype, "cancelUrl", void 0);
1315
-
1316
- // src/registration/dto/payment-webhook.dto.ts
1317
- import { IsIn as IsIn2, IsObject, IsOptional as IsOptional2, IsString as IsString5, MaxLength as MaxLength4, MinLength as MinLength4 } from "class-validator";
1318
- function _ts_decorate10(decorators, target, key, desc) {
1319
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1320
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1321
- 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;
1322
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1323
- }
1324
- __name(_ts_decorate10, "_ts_decorate");
1325
- function _ts_metadata9(k, v) {
1326
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1327
- }
1328
- __name(_ts_metadata9, "_ts_metadata");
1329
- var PaymentWebhookDto = class {
1330
- static {
1331
- __name(this, "PaymentWebhookDto");
1332
- }
1333
- eventId;
1334
- sessionId;
1335
- provider;
1336
- status;
1337
- payload;
1338
- };
1339
- _ts_decorate10([
1340
- IsString5(),
1341
- MinLength4(1),
1342
- MaxLength4(120),
1343
- _ts_metadata9("design:type", String)
1344
- ], PaymentWebhookDto.prototype, "eventId", void 0);
1345
- _ts_decorate10([
1346
- IsOptional2(),
1347
- IsString5(),
1348
- MaxLength4(120),
1349
1620
  _ts_metadata9("design:type", String)
1350
- ], PaymentWebhookDto.prototype, "sessionId", void 0);
1351
- _ts_decorate10([
1352
- IsString5(),
1353
- MaxLength4(40),
1354
- _ts_metadata9("design:type", String)
1355
- ], PaymentWebhookDto.prototype, "provider", void 0);
1356
- _ts_decorate10([
1357
- IsIn2([
1358
- "SUCCEEDED",
1359
- "FAILED"
1360
- ]),
1361
- _ts_metadata9("design:type", String)
1362
- ], PaymentWebhookDto.prototype, "status", void 0);
1621
+ ], StartRegistrationCheckoutDto.prototype, "cancelUrl", void 0);
1363
1622
  _ts_decorate10([
1364
1623
  IsOptional2(),
1365
- IsObject(),
1366
- _ts_metadata9("design:type", typeof Record === "undefined" ? Object : Record)
1367
- ], PaymentWebhookDto.prototype, "payload", void 0);
1624
+ IsString4(),
1625
+ MinLength3(1),
1626
+ MaxLength3(80),
1627
+ _ts_metadata9("design:type", Object)
1628
+ ], StartRegistrationCheckoutDto.prototype, "checkoutOfferId", void 0);
1368
1629
 
1369
1630
  // src/registration/dto/continue-registration.dto.ts
1370
- import { IsString as IsString6, MaxLength as MaxLength5, MinLength as MinLength5 } from "class-validator";
1631
+ import { IsString as IsString5, MaxLength as MaxLength4, MinLength as MinLength4 } from "class-validator";
1371
1632
  function _ts_decorate11(decorators, target, key, desc) {
1372
1633
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1373
1634
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1386,15 +1647,15 @@ var ContinueRegistrationDto = class {
1386
1647
  token;
1387
1648
  };
1388
1649
  _ts_decorate11([
1389
- IsString6(),
1390
- MinLength5(10),
1391
- MaxLength5(2e3),
1650
+ IsString5(),
1651
+ MinLength4(10),
1652
+ MaxLength4(2e3),
1392
1653
  _ts_metadata10("design:type", String)
1393
1654
  ], ContinueRegistrationDto.prototype, "token", void 0);
1394
1655
 
1395
1656
  // src/registration/dto/save-configuration.dto.ts
1396
- import { IsIn as IsIn3, IsOptional as IsOptional3, IsString as IsString7, IsUUID, MaxLength as MaxLength6, MinLength as MinLength6, ValidateIf, ValidateNested } from "class-validator";
1397
- import { Type } from "class-transformer";
1657
+ import { IsIn as IsIn2, IsOptional as IsOptional3, IsString as IsString6, IsUUID, MaxLength as MaxLength5, MinLength as MinLength5, ValidateIf, ValidateNested as ValidateNested2 } from "class-validator";
1658
+ import { Type as Type2 } from "class-transformer";
1398
1659
  function _ts_decorate12(decorators, target, key, desc) {
1399
1660
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1400
1661
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1423,13 +1684,13 @@ var SaveRegistrationConfigSelectionDto = class {
1423
1684
  offerId;
1424
1685
  };
1425
1686
  _ts_decorate12([
1426
- IsString7(),
1427
- MinLength6(1),
1428
- MaxLength6(40),
1687
+ IsString6(),
1688
+ MinLength5(1),
1689
+ MaxLength5(40),
1429
1690
  _ts_metadata11("design:type", String)
1430
1691
  ], SaveRegistrationConfigSelectionDto.prototype, "modelId", void 0);
1431
1692
  _ts_decorate12([
1432
- IsIn3([
1693
+ IsIn2([
1433
1694
  "MONTHLY",
1434
1695
  "YEARLY"
1435
1696
  ]),
@@ -1437,8 +1698,8 @@ _ts_decorate12([
1437
1698
  ], SaveRegistrationConfigSelectionDto.prototype, "billingCycle", void 0);
1438
1699
  _ts_decorate12([
1439
1700
  IsOptional3(),
1440
- IsString7(),
1441
- MaxLength6(60),
1701
+ IsString6(),
1702
+ MaxLength5(60),
1442
1703
  _ts_metadata11("design:type", Object)
1443
1704
  ], SaveRegistrationConfigSelectionDto.prototype, "appliedPromoCode", void 0);
1444
1705
  _ts_decorate12([
@@ -1455,19 +1716,19 @@ var SaveRegistrationConfigDto = class {
1455
1716
  selection;
1456
1717
  };
1457
1718
  _ts_decorate12([
1458
- IsString7(),
1459
- MinLength6(1),
1460
- MaxLength6(80),
1719
+ IsString6(),
1720
+ MinLength5(1),
1721
+ MaxLength5(80),
1461
1722
  _ts_metadata11("design:type", String)
1462
1723
  ], SaveRegistrationConfigDto.prototype, "pendingRegistrationId", void 0);
1463
1724
  _ts_decorate12([
1464
- ValidateNested(),
1465
- Type(() => SaveRegistrationConfigSelectionDto),
1725
+ ValidateNested2(),
1726
+ Type2(() => SaveRegistrationConfigSelectionDto),
1466
1727
  _ts_metadata11("design:type", typeof SaveRegistrationConfigSelectionDto === "undefined" ? Object : SaveRegistrationConfigSelectionDto)
1467
1728
  ], SaveRegistrationConfigDto.prototype, "selection", void 0);
1468
1729
 
1469
1730
  // src/registration/dto/preview-promo.dto.ts
1470
- import { IsOptional as IsOptional4, IsString as IsString8, MaxLength as MaxLength7, MinLength as MinLength7 } from "class-validator";
1731
+ import { IsOptional as IsOptional4, IsString as IsString7, MaxLength as MaxLength6, MinLength as MinLength6 } from "class-validator";
1471
1732
  function _ts_decorate13(decorators, target, key, desc) {
1472
1733
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1473
1734
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1487,15 +1748,15 @@ var PreviewRegistrationPromoDto = class {
1487
1748
  code;
1488
1749
  };
1489
1750
  _ts_decorate13([
1490
- IsString8(),
1491
- MinLength7(1),
1492
- MaxLength7(80),
1751
+ IsString7(),
1752
+ MinLength6(1),
1753
+ MaxLength6(80),
1493
1754
  _ts_metadata12("design:type", String)
1494
1755
  ], PreviewRegistrationPromoDto.prototype, "pendingRegistrationId", void 0);
1495
1756
  _ts_decorate13([
1496
1757
  IsOptional4(),
1497
- IsString8(),
1498
- MaxLength7(60),
1758
+ IsString7(),
1759
+ MaxLength6(60),
1499
1760
  _ts_metadata12("design:type", String)
1500
1761
  ], PreviewRegistrationPromoDto.prototype, "code", void 0);
1501
1762
 
@@ -1510,8 +1771,6 @@ export {
1510
1771
  SLUG_AVAILABILITY_CHECK_TOKEN,
1511
1772
  PASSWORD_HASHER_TOKEN,
1512
1773
  PLAN_CATALOG_LOOKUP_TOKEN,
1513
- PAYMENT_PROVIDER_TOKEN,
1514
- PAYMENT_EVENT_LOG_TOKEN,
1515
1774
  ACTIVATION_ORCHESTRATOR_TOKEN,
1516
1775
  REGISTRATION_AUDIT_LOGGER_TOKEN,
1517
1776
  REGISTRATION_RESUME_TOKEN_SIGNER_TOKEN,
@@ -1531,8 +1790,8 @@ export {
1531
1790
  VerifyRegistrationOtpDto,
1532
1791
  ResendRegistrationOtpDto,
1533
1792
  SelectRegistrationPlanDto,
1793
+ RegistrationBillingDetailsDto,
1534
1794
  StartRegistrationCheckoutDto,
1535
- PaymentWebhookDto,
1536
1795
  ContinueRegistrationDto,
1537
1796
  SaveRegistrationConfigSelectionDto,
1538
1797
  SaveRegistrationConfigDto,