@mj-biz-apps/orders-core-entities-server 5.48.0 → 5.50.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 (49) 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/ConcessionGate.d.ts +1 -1
  6. package/dist/ConcessionGate.d.ts.map +1 -1
  7. package/dist/ConcessionGate.js +3 -2
  8. package/dist/ConcessionGate.js.map +1 -1
  9. package/dist/ContractIncrease.d.ts +60 -0
  10. package/dist/ContractIncrease.d.ts.map +1 -0
  11. package/dist/ContractIncrease.js +108 -0
  12. package/dist/ContractIncrease.js.map +1 -0
  13. package/dist/GetRenewalWorklistOperation.d.ts +52 -0
  14. package/dist/GetRenewalWorklistOperation.d.ts.map +1 -0
  15. package/dist/GetRenewalWorklistOperation.js +361 -0
  16. package/dist/GetRenewalWorklistOperation.js.map +1 -0
  17. package/dist/OrderConcessionEntityServer.d.ts +31 -6
  18. package/dist/OrderConcessionEntityServer.d.ts.map +1 -1
  19. package/dist/OrderConcessionEntityServer.js +81 -7
  20. package/dist/OrderConcessionEntityServer.js.map +1 -1
  21. package/dist/OrderEntityServer.d.ts +14 -0
  22. package/dist/OrderEntityServer.d.ts.map +1 -1
  23. package/dist/OrderEntityServer.js +57 -0
  24. package/dist/OrderEntityServer.js.map +1 -1
  25. package/dist/RenewalPassMode.d.ts +40 -0
  26. package/dist/RenewalPassMode.d.ts.map +1 -0
  27. package/dist/RenewalPassMode.js +63 -0
  28. package/dist/RenewalPassMode.js.map +1 -0
  29. package/dist/RenewalPricing.d.ts +209 -0
  30. package/dist/RenewalPricing.d.ts.map +1 -0
  31. package/dist/RenewalPricing.js +396 -0
  32. package/dist/RenewalPricing.js.map +1 -0
  33. package/dist/SetRenewalSettingsOperation.d.ts +34 -0
  34. package/dist/SetRenewalSettingsOperation.d.ts.map +1 -0
  35. package/dist/SetRenewalSettingsOperation.js +135 -0
  36. package/dist/SetRenewalSettingsOperation.js.map +1 -0
  37. package/dist/SpawnRenewalsOperation.d.ts +83 -105
  38. package/dist/SpawnRenewalsOperation.d.ts.map +1 -1
  39. package/dist/SpawnRenewalsOperation.js +352 -467
  40. package/dist/SpawnRenewalsOperation.js.map +1 -1
  41. package/dist/SubscriptionEntityServer.d.ts +10 -2
  42. package/dist/SubscriptionEntityServer.d.ts.map +1 -1
  43. package/dist/SubscriptionEntityServer.js +16 -1
  44. package/dist/SubscriptionEntityServer.js.map +1 -1
  45. package/dist/index.d.ts +9 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +7 -1
  48. package/dist/index.js.map +1 -1
  49. package/package.json +2 -2
@@ -0,0 +1,52 @@
1
+ /**
2
+ * `Orders.GetRenewalWorklist` — what the Renewals page shows.
3
+ *
4
+ * THE QUESTION. Accounting and the product teams both ask it, from different sides: "which
5
+ * subscriptions end soon, which of them will renew by themselves and when, which have already
6
+ * renewed and at what price, and which does somebody have to act on?". Today that is answered by
7
+ * reading subscriptions one at a time. This operation answers it for a window, one row per
8
+ * subscription, with the order that bought the expiring term and the renewal order beside it.
9
+ *
10
+ * WHY AN OPERATION. "Ends inside the window" moves with the calendar, the renewal price moves with
11
+ * the catalog and the increase ladder, and "has a renewal order" is a join a view cannot express
12
+ * without a stored flag that would go stale. So it is computed per request, like the overdue and
13
+ * billing worklists, and read-only like them.
14
+ *
15
+ * ONE RULE, NOT TWO. The state of each row (`State`, `AutoRenewOn`) is decided by
16
+ * `ClassifyRenewal` in orders-entities from the facts the renewal pass selects by, and the
17
+ * projected price comes from the same `RenewalPricer` the pass places with. A page that priced or
18
+ * classified on its own would disagree with the job on exactly the rows people look at.
19
+ *
20
+ * WHICH TERM IS "THE EXPIRING ONE". A subscription that has not renewed shows its latest term. One
21
+ * that HAS renewed shows the term before the latest, with the latest term's order as the renewal:
22
+ * once the renewal books, the subscription's latest term is the new one and would otherwise drop
23
+ * out of a list of what is ending — exactly when accounting wants to see that it renewed, and for
24
+ * how much.
25
+ *
26
+ * Every date that crosses the boundary is `YYYY-MM-DD`. A `date` column comes back from the driver
27
+ * as a `Date` at UTC midnight; it is read with `ToISODate`, never stringified.
28
+ */
29
+ import { type IMetadataProvider, type UserInfo } from '@memberjunction/core';
30
+ import { OrdersGetRenewalWorklistOperation as OrdersGetRenewalWorklistOperationBase, type OrdersGetRenewalWorklistInput, type OrdersGetRenewalWorklistOutput } from '@mj-biz-apps/orders-entities';
31
+ export declare class GetRenewalWorklistOperation extends OrdersGetRenewalWorklistOperationBase {
32
+ protected InternalExecute(input: OrdersGetRenewalWorklistInput, provider: IMetadataProvider, user: UserInfo): Promise<OrdersGetRenewalWorklistOutput>;
33
+ /**
34
+ * Subscriptions whose latest term, or whose previous term when the latest continues it, ends inside
35
+ * the window. Raw SQL, like the renewal pass's own selection, because "the two most recent terms per
36
+ * subscription" is a window function and awkward as round trips. The display names come from
37
+ * `vwSubscriptions`, the same view the subscription list reads.
38
+ */
39
+ private findSubjects;
40
+ /** Order lines and their headers by line ID (lower-cased), in chunks the driver is happy with. */
41
+ private loadLines;
42
+ /**
43
+ * A live renewal order that has not produced a term, per subscription (lower-cased ID): the renewal
44
+ * pass's own second guard, read the same way. Newest first, so a subscription with two drafts
45
+ * shows the latest.
46
+ */
47
+ private loadPendingRenewals;
48
+ private empty;
49
+ }
50
+ /** Registers {@link GetRenewalWorklistOperation}. Called from the server bootstrap. */
51
+ export declare function LoadGetRenewalWorklistOperation(): void;
52
+ //# sourceMappingURL=GetRenewalWorklistOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetRenewalWorklistOperation.d.ts","sourceRoot":"","sources":["../src/GetRenewalWorklistOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAoC,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG/G,OAAO,EACH,iCAAiC,IAAI,qCAAqC,EAK1E,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EAEtC,MAAM,8BAA8B,CAAC;AA6DtC,qBACa,2BAA4B,SAAQ,qCAAqC;cAClE,eAAe,CAC3B,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACf,OAAO,CAAC,8BAA8B,CAAC;IA6L1C;;;;;OAKG;YACW,YAAY;IAiE1B,kGAAkG;YACpF,SAAS;IAiBvB;;;;OAIG;YACW,mBAAmB;IAuBjC,OAAO,CAAC,KAAK;CAGhB;AAED,uFAAuF;AACvF,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD"}
@@ -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
+ {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c,CAAC;YACjB,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBAChD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC3D,IAAI,CAAC,GAAG,CAAC,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"}
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * DECIDING ONE. The only change a recorded concession accepts is Pending → Approved or Rejected, by a
21
21
  * holder of the rule's role, with an optional note. A different concession is a new record: withdraw
22
- * a Pending one (delete it) and record again.
22
+ * the earlier one and record again.
23
23
  *
24
24
  * AN APPROVED DURATION CONCESSION EXTENDS ITS TERM (golive #221). It is checked when recorded and applied in
25
25
  * the approval's own transaction by ./TermExtension.ts: the term's end, the recognition schedule, access and an
@@ -74,10 +74,19 @@
74
74
  * or by a decision, raises accounting's acknowledgment task in the same transaction (./ConcessionAcknowledgment.ts).
75
75
  * A term extension raises its own, with the re-cut schedule. Withdrawing the concession closes its task.
76
76
  *
77
- * WITHDRAWING ONE. A Pending concession can be withdrawn, and so can one approved on the requester's
78
- * own authority while its order is not confirmed. No approver decided the second kind, and the
79
- * customer is not yet committed to it; withdrawing and recording it again is how it is measured
80
- * against a draft that has since changed (the confirm gate's share check).
77
+ * WITHDRAWING ONE (golive #403). Setting Status to Withdrawn takes a concession back and keeps it on the
78
+ * order as a record, stamped with who withdrew it and when; it then counts toward nothing (the share check,
79
+ * the confirm gate, the order's totals). A Pending concession can be withdrawn, and so can an Approved one
80
+ * while its order is not confirmed and it names no booked term: nothing was applied for it yet, and the
81
+ * customer is not committed to it. An approved one keeps its approver and decision date. Its requester can
82
+ * withdraw it without the right to update concessions, so a role that may record concessions but not edit
83
+ * them can still replace one (`CheckPermissions`); anyone else needs that right. Withdrawing closes the
84
+ * concession's open tasks. Withdrawn is final.
85
+ *
86
+ * DELETING ONE. Still allowed for a Pending concession, for one approved on the requester's own authority
87
+ * while its order is not confirmed, and for every concession of a draft line being removed. No approver
88
+ * decided the second kind; withdrawing and recording it again is how it is measured against a draft that
89
+ * has since changed (the confirm gate's share check).
81
90
  *
82
91
  * CONNECTS TO:
83
92
  * PURE: @mj-biz-apps/orders-entities ConcessionBehavior
@@ -90,7 +99,7 @@
90
99
  * ./TermShift.ts (a Shift concession reaching Approved)
91
100
  * GATE: OrderEntityServer (confirm) and the send-document action refuse while one is Pending
92
101
  */
93
- import { EntityDeleteOptions, EntitySaveOptions, type UserInfo } from '@memberjunction/core';
102
+ import { EntityDeleteOptions, EntityPermissionType, EntitySaveOptions, type UserInfo } from '@memberjunction/core';
94
103
  import { mjBizAppsOrdersOrderConcessionEntity } from '@mj-biz-apps/orders-entities';
95
104
  export declare class OrderConcessionEntityServer extends mjBizAppsOrdersOrderConcessionEntity {
96
105
  Save(options?: EntitySaveOptions): Promise<boolean>;
@@ -122,6 +131,22 @@ export declare class OrderConcessionEntityServer extends mjBizAppsOrdersOrderCon
122
131
  private approvalSummary;
123
132
  /** The concession's value as a share of what the line would have cost, kept by `prepareNew` for the summary. */
124
133
  private valuedPercent;
134
+ /** This save takes a recorded concession back: its Status moves to Withdrawn. */
135
+ get IsWithdrawal(): boolean;
136
+ /**
137
+ * A concession's requester may withdraw it without the right to update concessions (golive #403), so a role
138
+ * that records concessions but cannot edit them can still replace one. Only a withdrawal is let through:
139
+ * `saveWithdrawal` refuses one that changes anything but the status, before this check runs.
140
+ */
141
+ CheckPermissions(type: EntityPermissionType, throwError: boolean): boolean;
142
+ private get withdrawnByRequester();
143
+ /** Stamp who withdrew it and when, and close its open tasks, in one transaction. The row stays. */
144
+ private saveWithdrawal;
145
+ /**
146
+ * Why this concession cannot be withdrawn, or null. Pending: always. Approved: only while its order is not
147
+ * confirmed and it names no booked term, so nothing was applied for it and the customer is not committed to it.
148
+ */
149
+ private withdrawalProblem;
125
150
  /**
126
151
  * Set only by `OrderEntityServer` when it deletes a removed DRAFT line's dependents. A booked order
127
152
  * refuses line removals outright, so this never reaches a concession a customer was committed to.
@@ -1 +1 @@
1
- {"version":3,"file":"OrderConcessionEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderConcessionEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,OAAO,EAIH,mBAAmB,EACnB,iBAAiB,EAKjB,KAAK,QAAQ,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAWH,oCAAoC,EAKvC,MAAM,8BAA8B,CAAC;AAyFtC,qBACa,2BAA4B,SAAQ,oCAAoC;IAC3D,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IA+FzE,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,eAAe;IAavB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