@mj-biz-apps/orders-core-entities-server 5.48.0 → 5.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/ChangeSubscriptionProductOperation.d.ts +45 -0
  2. package/dist/ChangeSubscriptionProductOperation.d.ts.map +1 -0
  3. package/dist/ChangeSubscriptionProductOperation.js +198 -0
  4. package/dist/ChangeSubscriptionProductOperation.js.map +1 -0
  5. package/dist/ContractIncrease.d.ts +60 -0
  6. package/dist/ContractIncrease.d.ts.map +1 -0
  7. package/dist/ContractIncrease.js +108 -0
  8. package/dist/ContractIncrease.js.map +1 -0
  9. package/dist/GetRenewalWorklistOperation.d.ts +52 -0
  10. package/dist/GetRenewalWorklistOperation.d.ts.map +1 -0
  11. package/dist/GetRenewalWorklistOperation.js +361 -0
  12. package/dist/GetRenewalWorklistOperation.js.map +1 -0
  13. package/dist/OrderEntityServer.d.ts +14 -0
  14. package/dist/OrderEntityServer.d.ts.map +1 -1
  15. package/dist/OrderEntityServer.js +57 -0
  16. package/dist/OrderEntityServer.js.map +1 -1
  17. package/dist/RenewalPassMode.d.ts +40 -0
  18. package/dist/RenewalPassMode.d.ts.map +1 -0
  19. package/dist/RenewalPassMode.js +63 -0
  20. package/dist/RenewalPassMode.js.map +1 -0
  21. package/dist/RenewalPricing.d.ts +209 -0
  22. package/dist/RenewalPricing.d.ts.map +1 -0
  23. package/dist/RenewalPricing.js +396 -0
  24. package/dist/RenewalPricing.js.map +1 -0
  25. package/dist/SetRenewalSettingsOperation.d.ts +34 -0
  26. package/dist/SetRenewalSettingsOperation.d.ts.map +1 -0
  27. package/dist/SetRenewalSettingsOperation.js +135 -0
  28. package/dist/SetRenewalSettingsOperation.js.map +1 -0
  29. package/dist/SpawnRenewalsOperation.d.ts +83 -105
  30. package/dist/SpawnRenewalsOperation.d.ts.map +1 -1
  31. package/dist/SpawnRenewalsOperation.js +352 -467
  32. package/dist/SpawnRenewalsOperation.js.map +1 -1
  33. package/dist/SubscriptionEntityServer.d.ts +10 -2
  34. package/dist/SubscriptionEntityServer.d.ts.map +1 -1
  35. package/dist/SubscriptionEntityServer.js +16 -1
  36. package/dist/SubscriptionEntityServer.js.map +1 -1
  37. package/dist/index.d.ts +9 -2
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +7 -1
  40. package/dist/index.js.map +1 -1
  41. package/package.json +2 -2
@@ -0,0 +1,361 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ /**
8
+ * `Orders.GetRenewalWorklist` — what the Renewals page shows.
9
+ *
10
+ * THE QUESTION. Accounting and the product teams both ask it, from different sides: "which
11
+ * subscriptions end soon, which of them will renew by themselves and when, which have already
12
+ * renewed and at what price, and which does somebody have to act on?". Today that is answered by
13
+ * reading subscriptions one at a time. This operation answers it for a window, one row per
14
+ * subscription, with the order that bought the expiring term and the renewal order beside it.
15
+ *
16
+ * WHY AN OPERATION. "Ends inside the window" moves with the calendar, the renewal price moves with
17
+ * the catalog and the increase ladder, and "has a renewal order" is a join a view cannot express
18
+ * without a stored flag that would go stale. So it is computed per request, like the overdue and
19
+ * billing worklists, and read-only like them.
20
+ *
21
+ * ONE RULE, NOT TWO. The state of each row (`State`, `AutoRenewOn`) is decided by
22
+ * `ClassifyRenewal` in orders-entities from the facts the renewal pass selects by, and the
23
+ * projected price comes from the same `RenewalPricer` the pass places with. A page that priced or
24
+ * classified on its own would disagree with the job on exactly the rows people look at.
25
+ *
26
+ * WHICH TERM IS "THE EXPIRING ONE". A subscription that has not renewed shows its latest term. One
27
+ * that HAS renewed shows the term before the latest, with the latest term's order as the renewal:
28
+ * once the renewal books, the subscription's latest term is the new one and would otherwise drop
29
+ * out of a list of what is ending — exactly when accounting wants to see that it renewed, and for
30
+ * how much.
31
+ *
32
+ * Every date that crosses the boundary is `YYYY-MM-DD`. A `date` column comes back from the driver
33
+ * as a `Date` at UTC midnight; it is read with `ToISODate`, never stringified.
34
+ */
35
+ import { BaseRemotableOperation, LogError } from '@memberjunction/core';
36
+ import { RegisterClass } from '@memberjunction/global';
37
+ import { BusinessTimeZoneEngine } from '@mj-biz-apps/common-entities';
38
+ import { OrdersGetRenewalWorklistOperation as OrdersGetRenewalWorklistOperationBase, AddDays, ClassifyRenewal, DaysBetweenDays, ToISODate, } from '@mj-biz-apps/orders-entities';
39
+ import { RequireDate, RequireUUIDs } from './sql-guards.js';
40
+ import { EffectiveLeadDays, RenewalPricer } from './RenewalPricing.js';
41
+ import { LoadRenewalPass } from './RenewalPassMode.js';
42
+ const money = (v) => (v == null ? null : Math.round((Number(v) + Number.EPSILON) * 100) / 100);
43
+ const LINE_COLUMNS = `
44
+ ol.ID, ol.OrderHeaderID, ol.ProductID, ol.Quantity, ol.UnitPrice, ol.DiscountPct, ol.LineTotalNet,
45
+ ol.PriceOverridden, ol.ProductPriceID, ol.ServicePeriodStart, ol.ServicePeriodEnd, ol.RenewsSubscriptionID,
46
+ oh.OrderNumber, oh.OrderDate, oh.Status AS OrderStatus, oh.Balance AS OrderBalance`;
47
+ let GetRenewalWorklistOperation = class GetRenewalWorklistOperation extends OrdersGetRenewalWorklistOperationBase {
48
+ async InternalExecute(input, provider, user) {
49
+ // The BUSINESS day, not the UTC one (#209): the same correction the other worklists take, so
50
+ // this list and the renewal pass agree about which day it is.
51
+ await BusinessTimeZoneEngine.Instance.Config(false, user, provider);
52
+ const asOf = RequireDate(input?.AsOfDate ?? BusinessTimeZoneEngine.Instance.Today(), 'AsOfDate');
53
+ const windowDays = Math.max(0, Math.floor(Number(input?.WindowDays ?? 90)));
54
+ const lookbackDays = Math.max(0, Math.floor(Number(input?.LookbackDays ?? 30)));
55
+ const windowStart = AddDays(asOf, -lookbackDays);
56
+ const windowEnd = AddDays(asOf, windowDays);
57
+ const maxCount = Math.max(1, Math.floor(Number(input?.MaxCount ?? 500)));
58
+ const companyIDs = input?.CompanyIDs?.length ? RequireUUIDs(input.CompanyIDs, 'CompanyIDs') : [];
59
+ const project = input?.Project !== false;
60
+ let subjects;
61
+ try {
62
+ subjects = await this.findSubjects(provider, asOf, windowStart, windowEnd, companyIDs, maxCount + 1);
63
+ }
64
+ catch (err) {
65
+ return this.empty(`Could not read the subscriptions ending in the window: ${err instanceof Error ? err.message : String(err)}`, asOf, windowStart, windowEnd);
66
+ }
67
+ const truncated = subjects.length > maxCount;
68
+ if (truncated)
69
+ subjects = subjects.slice(0, maxCount);
70
+ const pass = await LoadRenewalPass(provider, user);
71
+ if (!subjects.length)
72
+ return { Success: true, Rows: [], RowCount: 0, Truncated: false, AsOfDate: asOf, WindowStart: windowStart, WindowEnd: windowEnd, PassMode: pass.Mode, PassNextRunAt: pass.NextRunAt };
73
+ // Which term is expiring: the latest, unless the latest is the renewal of one ending in the window.
74
+ const picked = subjects.map((s) => {
75
+ const latestEnd = ToISODate(s.LatestTermEnd) ?? '';
76
+ const priorEnd = ToISODate(s.PriorTermEnd);
77
+ const latestInWindow = latestEnd >= windowStart && latestEnd <= windowEnd;
78
+ const renewed = !latestInWindow && !!priorEnd && priorEnd >= windowStart && priorEnd <= windowEnd;
79
+ return { subject: s, renewed };
80
+ });
81
+ const lineIDs = new Set();
82
+ for (const { subject, renewed } of picked) {
83
+ lineIDs.add(String(subject.LatestOrderLineID).toLowerCase());
84
+ if (renewed && subject.PriorOrderLineID)
85
+ lineIDs.add(String(subject.PriorOrderLineID).toLowerCase());
86
+ }
87
+ const unrenewed = picked.filter((p) => !p.renewed).map((p) => String(p.subject.SubscriptionID).toLowerCase());
88
+ let lines;
89
+ let pending;
90
+ try {
91
+ [lines, pending] = await Promise.all([this.loadLines(provider, [...lineIDs]), this.loadPendingRenewals(provider, unrenewed)]);
92
+ }
93
+ catch (err) {
94
+ return this.empty(`Could not read the orders behind the subscriptions: ${err instanceof Error ? err.message : String(err)}`, asOf, windowStart, windowEnd);
95
+ }
96
+ const pricer = project ? new RenewalPricer(provider, user) : null;
97
+ const rows = [];
98
+ for (const { subject, renewed } of picked) {
99
+ const expiring = renewed
100
+ ? {
101
+ TermID: String(subject.PriorTermID),
102
+ TermNumber: Number(subject.PriorTermNumber),
103
+ Start: ToISODate(subject.PriorTermStart) ?? '',
104
+ End: ToISODate(subject.PriorTermEnd) ?? '',
105
+ Status: String(subject.PriorTermStatus),
106
+ OrderLineID: String(subject.PriorOrderLineID),
107
+ Quantity: Number(subject.PriorQuantity ?? 1),
108
+ }
109
+ : {
110
+ TermID: String(subject.LatestTermID),
111
+ TermNumber: Number(subject.LatestTermNumber),
112
+ Start: ToISODate(subject.LatestTermStart) ?? '',
113
+ End: ToISODate(subject.LatestTermEnd) ?? '',
114
+ Status: String(subject.LatestTermStatus),
115
+ OrderLineID: String(subject.LatestOrderLineID),
116
+ Quantity: Number(subject.LatestQuantity ?? 1),
117
+ };
118
+ const current = lines.get(expiring.OrderLineID.toLowerCase()) ?? null;
119
+ const renewal = renewed
120
+ ? (lines.get(String(subject.LatestOrderLineID).toLowerCase()) ?? null)
121
+ : (pending.get(String(subject.SubscriptionID).toLowerCase()) ?? null);
122
+ const providerBilled = subject.ProviderSubscriptionID != null;
123
+ const leadDays = EffectiveLeadDays(subject);
124
+ const classified = ClassifyRenewal({
125
+ Status: subject.SubscriptionStatus,
126
+ AutoRenew: !!subject.AutoRenew,
127
+ ProviderBilled: providerBilled,
128
+ RenewalBooked: renewed,
129
+ RenewalPending: !renewed && !!renewal,
130
+ TermEndDate: expiring.End,
131
+ LeadDays: leadDays,
132
+ AsOf: asOf,
133
+ });
134
+ const row = {
135
+ SubscriptionID: subject.SubscriptionID,
136
+ SubscriptionNumber: subject.SubscriptionNumber,
137
+ Status: subject.SubscriptionStatus,
138
+ AutoRenew: !!subject.AutoRenew,
139
+ ProviderBilled: providerBilled,
140
+ ContactID: subject.BeneficiaryPersonID,
141
+ ContactName: subject.ContactName,
142
+ AccountID: subject.HolderOrganizationID,
143
+ AccountName: subject.AccountName,
144
+ CompanyID: subject.CompanyID,
145
+ CompanyName: subject.CompanyName ?? '',
146
+ ProductID: subject.ProductID,
147
+ ProductName: subject.ProductName ?? '',
148
+ SubscriptionTypeName: subject.SubscriptionTypeName ?? '',
149
+ StartDate: ToISODate(subject.SubscriptionStartDate) ?? '',
150
+ TermNumber: expiring.TermNumber,
151
+ TermStartDate: expiring.Start,
152
+ TermEndDate: expiring.End,
153
+ DaysUntilEnd: expiring.End ? DaysBetweenDays(asOf, expiring.End) : 0,
154
+ LeadDays: leadDays,
155
+ State: classified.State,
156
+ AutoRenewOn: classified.AutoRenewOn,
157
+ CurrentOrderID: current?.OrderHeaderID ?? null,
158
+ CurrentOrderNumber: current?.OrderNumber ?? null,
159
+ CurrentOrderDate: current ? ToISODate(current.OrderDate) : null,
160
+ CurrentOrderStatus: current?.OrderStatus ?? null,
161
+ CurrentUnitPrice: money(current?.UnitPrice),
162
+ CurrentQuantity: current ? Number(current.Quantity) : null,
163
+ CurrentLineTotal: money(current?.LineTotalNet),
164
+ CurrentOrderBalance: money(current?.OrderBalance),
165
+ RenewalOrderID: renewal?.OrderHeaderID ?? null,
166
+ RenewalOrderNumber: renewal?.OrderNumber ?? null,
167
+ RenewalOrderDate: renewal ? ToISODate(renewal.OrderDate) : null,
168
+ RenewalOrderStatus: renewal?.OrderStatus ?? null,
169
+ RenewalUnitPrice: money(renewal?.UnitPrice),
170
+ RenewalQuantity: renewal ? Number(renewal.Quantity) : null,
171
+ RenewalLineTotal: money(renewal?.LineTotalNet),
172
+ RenewalTermStart: renewed ? ToISODate(subject.LatestTermStart) : null,
173
+ RenewalTermEnd: renewed ? ToISODate(subject.LatestTermEnd) : null,
174
+ RenewalBooked: renewed,
175
+ SubscriptionIncreasePercent: subject.SubscriptionIncreasePercent == null ? null : Number(subject.SubscriptionIncreasePercent),
176
+ };
177
+ // The projection: only where a renewal would still be placed, and only where the pass's
178
+ // own rules would let it be. The figure is the pass's, so a person can check it early.
179
+ const projectable = pricer && !renewal && !providerBilled && ['DueNow', 'Scheduled', 'WillEnd', 'Lapsed'].includes(classified.State);
180
+ if (projectable) {
181
+ const subjectForPricer = {
182
+ SubscriptionID: subject.SubscriptionID,
183
+ SubscriptionNumber: subject.SubscriptionNumber,
184
+ SubscriptionStatus: subject.SubscriptionStatus,
185
+ SubscriptionTypeID: subject.SubscriptionTypeID,
186
+ CompanyID: subject.CompanyID,
187
+ ProductID: subject.ProductID,
188
+ HolderOrganizationID: subject.HolderOrganizationID,
189
+ BeneficiaryPersonID: subject.BeneficiaryPersonID,
190
+ SubscriptionRenewalLeadDays: subject.SubscriptionRenewalLeadDays,
191
+ TypeRenewalLeadDays: subject.TypeRenewalLeadDays,
192
+ TermID: expiring.TermID,
193
+ TermNumber: expiring.TermNumber,
194
+ TermStartDate: expiring.Start,
195
+ TermEndDate: expiring.End,
196
+ TermQuantity: expiring.Quantity,
197
+ OrderLineID: expiring.OrderLineID,
198
+ SubscriptionStartDate: ToISODate(subject.SubscriptionStartDate) ?? expiring.Start,
199
+ SubscriptionIncreasePercent: subject.SubscriptionIncreasePercent == null ? null : Number(subject.SubscriptionIncreasePercent),
200
+ CarryDiscountOnRenewal: !!subject.CarryDiscountOnRenewal,
201
+ DefaultCustomerPaymentMethodID: subject.DefaultCustomerPaymentMethodID,
202
+ AutoRenew: !!subject.AutoRenew,
203
+ };
204
+ try {
205
+ const priced = await pricer.Price(subjectForPricer, { SourceLine: current, IncludePromotions: false });
206
+ const unit = priced.Price.UnitPrice;
207
+ row.ProjectedUnitPrice = money(unit);
208
+ row.ProjectedQuantity = priced.Quantity;
209
+ row.ProjectedLineTotal = money(unit * priced.Quantity * (1 - Number(priced.Price.DiscountPct ?? 0)));
210
+ row.ProjectedBasePrice = money(priced.Price.BasePrice);
211
+ row.ProjectedBasePriceSource = priced.Price.BaseSource;
212
+ row.ProjectedIncreasePercent = priced.Price.IncreasePercent;
213
+ row.ProjectedIncreaseSource = priced.Price.IncreaseSource;
214
+ row.ProjectedIncreaseSetPercent = priced.Price.IncreaseSetPercent;
215
+ row.ProjectedIncreaseSetSource = priced.Price.IncreaseSetSource;
216
+ row.ProjectedIncreaseApplied = priced.Price.IncreaseApplied;
217
+ row.ProjectedProductID = priced.ProductID;
218
+ row.ProjectedProductName = priced.ProductName;
219
+ row.ProjectedTermStart = priced.Term?.Start ?? null;
220
+ row.ProjectedTermEnd = priced.Term?.End ?? null;
221
+ }
222
+ catch (err) {
223
+ // Reported on the row, never fatal: the list is still the list, and the reason is
224
+ // the thing a person needs to fix before the pass meets the same wall.
225
+ const message = err instanceof Error ? err.message : String(err);
226
+ LogError(`Orders.GetRenewalWorklist: ${subject.SubscriptionNumber} could not be projected: ${message}`);
227
+ row.ProjectionProblem = message;
228
+ }
229
+ }
230
+ rows.push(row);
231
+ }
232
+ return { Success: true, Rows: rows, RowCount: rows.length, Truncated: truncated, AsOfDate: asOf, WindowStart: windowStart, WindowEnd: windowEnd, PassMode: pass.Mode, PassNextRunAt: pass.NextRunAt };
233
+ }
234
+ /**
235
+ * Subscriptions whose latest term, or whose previous term when the latest continues it, ends inside
236
+ * the window. Raw SQL, like the renewal pass's own selection, because "the two most recent terms per
237
+ * subscription" is a window function and awkward as round trips. The display names come from
238
+ * `vwSubscriptions`, the same view the subscription list reads.
239
+ */
240
+ async findSubjects(provider, asOf, windowStart, windowEnd, companyIDs, top) {
241
+ const db = provider;
242
+ const companies = companyIDs.length ? `AND s.CompanyID IN (${companyIDs.map((id) => `'${id}'`).join(',')})` : '';
243
+ const rows = (await db.ExecuteSQL(`
244
+ WITH ranked AS (
245
+ SELECT st.ID, st.SubscriptionID, st.TermNumber, st.StartDate, st.EndDate, st.Status, st.OrderLineID, st.Quantity,
246
+ ROW_NUMBER() OVER (PARTITION BY st.SubscriptionID ORDER BY st.TermNumber DESC) AS rn
247
+ FROM __mj_BizAppsOrders.SubscriptionTerm st
248
+ )
249
+ SELECT TOP ${top}
250
+ s.ID AS SubscriptionID,
251
+ s.SubscriptionNumber,
252
+ s.Status AS SubscriptionStatus,
253
+ s.SubscriptionTypeID,
254
+ s.CompanyID,
255
+ s.ProductID,
256
+ s.HolderOrganizationID,
257
+ s.BeneficiaryPersonID,
258
+ s.AutoRenew,
259
+ s.ProviderSubscriptionID,
260
+ s.RenewalLeadDays AS SubscriptionRenewalLeadDays,
261
+ t.RenewalLeadDays AS TypeRenewalLeadDays,
262
+ s.StartDate AS SubscriptionStartDate,
263
+ s.RenewalIncreasePercent AS SubscriptionIncreasePercent,
264
+ s.CarryDiscountOnRenewal,
265
+ s.DefaultCustomerPaymentMethodID,
266
+ vs.Company AS CompanyName,
267
+ vs.Product AS ProductName,
268
+ vs.SubscriptionType AS SubscriptionTypeName,
269
+ vs.HolderOrganization AS AccountName,
270
+ vs.BeneficiaryPerson AS ContactName,
271
+ l.ID AS LatestTermID,
272
+ l.TermNumber AS LatestTermNumber,
273
+ l.StartDate AS LatestTermStart,
274
+ l.EndDate AS LatestTermEnd,
275
+ l.Status AS LatestTermStatus,
276
+ l.OrderLineID AS LatestOrderLineID,
277
+ l.Quantity AS LatestQuantity,
278
+ p.ID AS PriorTermID,
279
+ p.TermNumber AS PriorTermNumber,
280
+ p.StartDate AS PriorTermStart,
281
+ p.EndDate AS PriorTermEnd,
282
+ p.Status AS PriorTermStatus,
283
+ p.OrderLineID AS PriorOrderLineID,
284
+ p.Quantity AS PriorQuantity
285
+ FROM __mj_BizAppsOrders.Subscription s
286
+ JOIN __mj_BizAppsOrders.vwSubscriptions vs ON vs.ID = s.ID
287
+ JOIN __mj_BizAppsOrders.SubscriptionType t ON t.ID = s.SubscriptionTypeID
288
+ JOIN ranked l ON l.SubscriptionID = s.ID AND l.rn = 1
289
+ LEFT JOIN ranked p ON p.SubscriptionID = s.ID AND p.rn = 2
290
+ WHERE (
291
+ l.EndDate BETWEEN '${windowStart}' AND '${windowEnd}'
292
+ -- Renewed: the previous term ends in the window and the latest one continues it. Only
293
+ -- while that previous term is still running: once it has ended the renewal is simply the
294
+ -- current term, and it comes back into the list when ITS end nears. The lookback is for
295
+ -- terms that ended without renewing.
296
+ OR (p.EndDate BETWEEN '${asOf}' AND '${windowEnd}' AND l.StartDate >= p.EndDate)
297
+ )
298
+ ${companies}
299
+ ORDER BY CASE WHEN l.EndDate BETWEEN '${windowStart}' AND '${windowEnd}' THEN l.EndDate ELSE p.EndDate END, s.SubscriptionNumber
300
+ `));
301
+ return Array.isArray(rows) ? rows : [];
302
+ }
303
+ /** Order lines and their headers by line ID (lower-cased), in chunks the driver is happy with. */
304
+ async loadLines(provider, lineIDs) {
305
+ const db = provider;
306
+ const out = new Map();
307
+ const ids = RequireUUIDs(lineIDs, 'OrderLineID');
308
+ for (let i = 0; i < ids.length; i += 500) {
309
+ const chunk = ids.slice(i, i + 500);
310
+ const rows = (await db.ExecuteSQL(`
311
+ SELECT${LINE_COLUMNS}
312
+ FROM __mj_BizAppsOrders.OrderLine ol
313
+ JOIN __mj_BizAppsOrders.vwOrderHeaders oh ON oh.ID = ol.OrderHeaderID
314
+ WHERE ol.ID IN (${chunk.map((id) => `'${id}'`).join(',')})
315
+ `));
316
+ for (const row of Array.isArray(rows) ? rows : [])
317
+ out.set(String(row.ID).toLowerCase(), row);
318
+ }
319
+ return out;
320
+ }
321
+ /**
322
+ * A live renewal order that has not produced a term, per subscription (lower-cased ID): the renewal
323
+ * pass's own second guard, read the same way. Newest first, so a subscription with two drafts
324
+ * shows the latest.
325
+ */
326
+ async loadPendingRenewals(provider, subscriptionIDs) {
327
+ const db = provider;
328
+ const out = new Map();
329
+ const ids = RequireUUIDs(subscriptionIDs, 'SubscriptionID');
330
+ for (let i = 0; i < ids.length; i += 500) {
331
+ const chunk = ids.slice(i, i + 500);
332
+ const rows = (await db.ExecuteSQL(`
333
+ SELECT${LINE_COLUMNS}
334
+ FROM __mj_BizAppsOrders.OrderLine ol
335
+ JOIN __mj_BizAppsOrders.vwOrderHeaders oh ON oh.ID = ol.OrderHeaderID
336
+ WHERE ol.RenewsSubscriptionID IN (${chunk.map((id) => `'${id}'`).join(',')})
337
+ AND oh.Status <> 'Voided'
338
+ AND NOT EXISTS (SELECT 1 FROM __mj_BizAppsOrders.SubscriptionTerm st WHERE st.OrderLineID = ol.ID)
339
+ ORDER BY oh.OrderDate DESC, oh.OrderNumber DESC
340
+ `));
341
+ for (const row of Array.isArray(rows) ? rows : []) {
342
+ const key = String(row.RenewsSubscriptionID).toLowerCase();
343
+ if (!out.has(key))
344
+ out.set(key, row);
345
+ }
346
+ }
347
+ return out;
348
+ }
349
+ empty(message, asOf, windowStart, windowEnd) {
350
+ return { Success: false, Message: message, Rows: [], RowCount: 0, Truncated: false, AsOfDate: asOf, WindowStart: windowStart, WindowEnd: windowEnd, PassMode: 'Unknown' };
351
+ }
352
+ };
353
+ GetRenewalWorklistOperation = __decorate([
354
+ RegisterClass(BaseRemotableOperation, 'Orders.GetRenewalWorklist')
355
+ ], GetRenewalWorklistOperation);
356
+ export { GetRenewalWorklistOperation };
357
+ /** Registers {@link GetRenewalWorklistOperation}. Called from the server bootstrap. */
358
+ export function LoadGetRenewalWorklistOperation() {
359
+ void GetRenewalWorklistOperation;
360
+ }
361
+ //# sourceMappingURL=GetRenewalWorklistOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetRenewalWorklistOperation.js","sourceRoot":"","sources":["../src/GetRenewalWorklistOperation.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAyC,MAAM,sBAAsB,CAAC;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC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AC,GAAG,CAAC,GAAG,CAAC;oBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,IAAY,EAAE,WAAmB,EAAE,SAAiB;QAC/E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9K,CAAC;CACJ,CAAA;AA1TY,2BAA2B;IADvC,aAAa,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;GACtD,2BAA2B,CA0TvC;;AAED,uFAAuF;AACvF,MAAM,UAAU,+BAA+B;IAC3C,KAAK,2BAA2B,CAAC;AACrC,CAAC"}
@@ -54,6 +54,20 @@ export declare class OrderEntityServer extends OrderHeaderEntity {
54
54
  * Change the price and both judge it as usual.
55
55
  */
56
56
  MarkRenewalPriced(line: mjBizAppsOrdersOrderLineEntity): void;
57
+ /** Whether the marks the renewal pass persisted for this order have been read into the map above. */
58
+ private _persistedRenewalMarksLoaded;
59
+ /**
60
+ * Read back the marks for a renewal order saved by an EARLIER object: the pass leaves a draft for a
61
+ * person to confirm from the order form, and that confirm runs in a fresh entity whose map is
62
+ * empty. Without this, the pass's own price reads as a typed one and the concession gate refuses
63
+ * the confirm the pass would have made without question (golive #304 would have come back).
64
+ *
65
+ * The persisted record is the `RenewalOrderSpawned` event the pass writes per renewed subscription
66
+ * in the same transaction as the order, carrying the unit price it placed. A line that renews that
67
+ * subscription at that price is the pass's line, unedited. A read that fails leaves the line
68
+ * unmarked, which is the cautious side: the gate then judges it as a stated price.
69
+ */
70
+ private loadPersistedRenewalMarks;
57
71
  /** True for a line the renewal pass priced whose price is unchanged; matched by entity or saved ID. */
58
72
  private isUneditedRenewalPrice;
59
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OrderEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKH,mBAAmB,EAEnB,iBAAiB,EAUjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAGH,iBAAiB,EAIjB,8BAA8B,EAoBjC,MAAM,8BAA8B,CAAC;AAStC,OAAO,EAAmE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+C9H,OAAO,EAAuX,KAAK,qBAAqB,EAAgD,KAAK,eAAe,EAAiH,MAAM,8BAA8B,CAAC;AAIlnB,OAAO,EAWH,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE/B,MAAM,2BAA2B,CAAC;AAanC,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,8BAA8B,CAAC;IACrC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC/B;AAkJD,qBACa,iBAAkB,SAAQ,iBAAiB;IACpD,yHAAyH;cACtG,4BAA4B,IAAI,OAAO;IAI1D,6FAA6F;IAC7F,OAAO,CAAC,gBAAgB,CAA4D;IACpF,6FAA6F;IAC7F,OAAO,CAAC,mBAAmB,CAAqD;IAEhF;;;;;;;;OAQG;IACI,iBAAiB,CAAC,IAAI,EAAE,8BAA8B,GAAG,IAAI;IAIpE,uGAAuG;IACvG,OAAO,CAAC,sBAAsB;IAS9B;;;;;;OAMG;IACa,aAAa,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAGpE,wFAAwF;IACxF,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,QAAQ,CAAyB;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mBAAmB;CAcpC;AAgED,0FAA0F;AAC1F,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
@@ -149,6 +149,8 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
149
149
  this._priceComponents = new Map();
150
150
  /** Lines the renewal pass priced, with the price it wrote; see {@link MarkRenewalPriced}. */
151
151
  this._renewalPricedLines = new Map();
152
+ /** Whether the marks the renewal pass persisted for this order have been read into the map above. */
153
+ this._persistedRenewalMarksLoaded = false;
152
154
  /** Why a line owes no tax, by line index — written as a zero-amount component (D73). */
153
155
  this._taxReasons = new Map();
154
156
  this._manualDiscounts = [];
@@ -215,6 +217,55 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
215
217
  MarkRenewalPriced(line) {
216
218
  this._renewalPricedLines.set(line, Number(line.UnitPrice));
217
219
  }
220
+ /**
221
+ * Read back the marks for a renewal order saved by an EARLIER object: the pass leaves a draft for a
222
+ * person to confirm from the order form, and that confirm runs in a fresh entity whose map is
223
+ * empty. Without this, the pass's own price reads as a typed one and the concession gate refuses
224
+ * the confirm the pass would have made without question (golive #304 would have come back).
225
+ *
226
+ * The persisted record is the `RenewalOrderSpawned` event the pass writes per renewed subscription
227
+ * in the same transaction as the order, carrying the unit price it placed. A line that renews that
228
+ * subscription at that price is the pass's line, unedited. A read that fails leaves the line
229
+ * unmarked, which is the cautious side: the gate then judges it as a stated price.
230
+ */
231
+ async loadPersistedRenewalMarks() {
232
+ if (this._persistedRenewalMarksLoaded || !this.IsSaved)
233
+ return;
234
+ this._persistedRenewalMarksLoaded = true;
235
+ const lines = this.Lines.Items.filter((line) => !!line.RenewsSubscriptionID && !this._renewalPricedLines.has(line));
236
+ if (!lines.length)
237
+ return;
238
+ try {
239
+ const rv = new RunView(this.ProviderToUse);
240
+ const result = await rv.RunView({
241
+ EntityName: SUBSCRIPTION_EVENT_ENTITY,
242
+ ExtraFilter: `RelatedOrderHeaderID='${RequireUUID(String(this.ID), 'OrderHeaderID')}' AND EventType='RenewalOrderSpawned'`,
243
+ Fields: ['SubscriptionID', 'EventData'],
244
+ ResultType: 'simple',
245
+ }, this.ContextCurrentUser);
246
+ if (!result.Success)
247
+ throw new Error(result.ErrorMessage || 'the renewal events could not be read');
248
+ const placed = new Map();
249
+ for (const row of result.Results) {
250
+ try {
251
+ const data = JSON.parse(row.EventData ?? '{}');
252
+ if (data.UnitPrice != null && Number.isFinite(Number(data.UnitPrice)))
253
+ placed.set(String(row.SubscriptionID).toLowerCase(), Number(data.UnitPrice));
254
+ }
255
+ catch {
256
+ /* an event without readable data marks nothing */
257
+ }
258
+ }
259
+ for (const line of lines) {
260
+ const price = placed.get(String(line.RenewsSubscriptionID).toLowerCase());
261
+ if (price != null)
262
+ this._renewalPricedLines.set(line, price);
263
+ }
264
+ }
265
+ catch (err) {
266
+ LogError(`Order ${this.OrderNumber ?? this.ID}: the renewal pass's price marks could not be read: ${err instanceof Error ? err.message : String(err)}`);
267
+ }
268
+ }
218
269
  /** True for a line the renewal pass priced whose price is unchanged; matched by entity or saved ID. */
219
270
  isUneditedRenewalPrice(line) {
220
271
  for (const [marked, price] of this._renewalPricedLines) {
@@ -476,6 +527,9 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
476
527
  // review and the no-deal check), and before it decides subscriptions.
477
528
  if (booking && this.IsSaved && !this.Lines.IsLoaded)
478
529
  await this.Lines.Load();
530
+ // A renewal draft the pass left: its price marks live in the event it wrote, not in this object.
531
+ if (booking && this.IsSaved)
532
+ await this.loadPersistedRenewalMarks();
479
533
  // NO CONFIRM AHEAD OF A CONCESSION'S APPROVAL. Checked before anything is priced or booked,
480
534
  // for the same reason as the status move above: a refused confirm must change nothing.
481
535
  if (booking && !(await this.passesConcessionGate()))
@@ -1040,6 +1094,9 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
1040
1094
  async PreviewConcessionProblems() {
1041
1095
  if (this.IsSaved && !this.Lines.IsLoaded)
1042
1096
  await this.Lines.Load();
1097
+ // The same marks confirm reads: a draft the renewal pass left is judged on the pass's own
1098
+ // prices here too, or the form's Confirm stays disabled on an order the save would book.
1099
+ await this.loadPersistedRenewalMarks();
1043
1100
  return this.concessionGateProblems();
1044
1101
  }
1045
1102
  /** The gate's problems, one clause each as `FindUnapprovedConcessions` words them. None without a context user. */