@mj-biz-apps/orders-core-entities-server 5.47.1 → 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.
- package/dist/AmendArrangementOperation.d.ts.map +1 -1
- package/dist/AmendArrangementOperation.js +7 -0
- package/dist/AmendArrangementOperation.js.map +1 -1
- package/dist/ApplyAccountCreditOperation.d.ts.map +1 -1
- package/dist/ApplyAccountCreditOperation.js +5 -0
- package/dist/ApplyAccountCreditOperation.js.map +1 -1
- package/dist/CancelSubscriptionOperation.d.ts.map +1 -1
- package/dist/CancelSubscriptionOperation.js +7 -1
- package/dist/CancelSubscriptionOperation.js.map +1 -1
- package/dist/ChangeSubscriptionProductOperation.d.ts +45 -0
- package/dist/ChangeSubscriptionProductOperation.d.ts.map +1 -0
- package/dist/ChangeSubscriptionProductOperation.js +198 -0
- package/dist/ChangeSubscriptionProductOperation.js.map +1 -0
- package/dist/ContractIncrease.d.ts +60 -0
- package/dist/ContractIncrease.d.ts.map +1 -0
- package/dist/ContractIncrease.js +108 -0
- package/dist/ContractIncrease.js.map +1 -0
- package/dist/GatewayRenewalCredit.d.ts.map +1 -1
- package/dist/GatewayRenewalCredit.js +3 -1
- package/dist/GatewayRenewalCredit.js.map +1 -1
- package/dist/GetRenewalWorklistOperation.d.ts +52 -0
- package/dist/GetRenewalWorklistOperation.d.ts.map +1 -0
- package/dist/GetRenewalWorklistOperation.js +361 -0
- package/dist/GetRenewalWorklistOperation.js.map +1 -0
- package/dist/OrderEntityServer.d.ts +14 -0
- package/dist/OrderEntityServer.d.ts.map +1 -1
- package/dist/OrderEntityServer.js +57 -0
- package/dist/OrderEntityServer.js.map +1 -1
- package/dist/ProviderRefundBooking.d.ts.map +1 -1
- package/dist/ProviderRefundBooking.js +4 -2
- package/dist/ProviderRefundBooking.js.map +1 -1
- package/dist/RefundPaymentOperation.d.ts.map +1 -1
- package/dist/RefundPaymentOperation.js +6 -0
- package/dist/RefundPaymentOperation.js.map +1 -1
- package/dist/RenewalPassMode.d.ts +40 -0
- package/dist/RenewalPassMode.d.ts.map +1 -0
- package/dist/RenewalPassMode.js +63 -0
- package/dist/RenewalPassMode.js.map +1 -0
- package/dist/RenewalPricing.d.ts +209 -0
- package/dist/RenewalPricing.d.ts.map +1 -0
- package/dist/RenewalPricing.js +396 -0
- package/dist/RenewalPricing.js.map +1 -0
- package/dist/ReversalAuthority.d.ts +10 -0
- package/dist/ReversalAuthority.d.ts.map +1 -0
- package/dist/ReversalAuthority.js +38 -0
- package/dist/ReversalAuthority.js.map +1 -0
- package/dist/SetRenewalSettingsOperation.d.ts +34 -0
- package/dist/SetRenewalSettingsOperation.d.ts.map +1 -0
- package/dist/SetRenewalSettingsOperation.js +135 -0
- package/dist/SetRenewalSettingsOperation.js.map +1 -0
- package/dist/SpawnRenewalsOperation.d.ts +83 -105
- package/dist/SpawnRenewalsOperation.d.ts.map +1 -1
- package/dist/SpawnRenewalsOperation.js +352 -467
- package/dist/SpawnRenewalsOperation.js.map +1 -1
- package/dist/SubscriptionEntityServer.d.ts +10 -2
- package/dist/SubscriptionEntityServer.d.ts.map +1 -1
- package/dist/SubscriptionEntityServer.js +16 -1
- package/dist/SubscriptionEntityServer.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetRenewalSettingsOperation.js","sourceRoot":"","sources":["../src/SetRenewalSettingsOperation.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAyC,MAAM,sBAAsB,CAAC;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACH,iCAAiC,IAAI,qCAAqC,GAM7E,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAA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AAC;YACjE,QAAQ,CAAC,2CAA2C,EAAE,0BAA0B,OAAO,EAAE,CAAC,CAAC;YAC3F,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACjI,CAAC;IACL,CAAC;CACJ,CAAA;AAxEY,2BAA2B;IADvC,aAAa,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;GACtD,2BAA2B,CAwEvC;;AAED,0FAA0F;AAC1F,MAAM,UAAU,+BAA+B;IAC3C,sBAAsB;AAC1B,CAAC"}
|
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
* "Is a renewal an order the customer approves, or one the system places for them?" — BOTH, and
|
|
10
10
|
* `AutoRenew` is the switch. `AutoRenew = true` means the customer has already consented to
|
|
11
11
|
* recurring billing, so the system places a CONFIRMED order: it books, it invoices, and coverage
|
|
12
|
-
* continues without a gap. `AutoRenew = false` means it does not renew, full stop —
|
|
13
|
-
* skips it and the term simply ends. Reminder-and-approve for the second case is a
|
|
14
|
-
* flow, not a booking one, and does not belong here.
|
|
12
|
+
* continues without a gap. `AutoRenew = false` means it does not renew, full stop — the scheduled
|
|
13
|
+
* pass skips it and the term simply ends. Reminder-and-approve for the second case is a
|
|
14
|
+
* communication flow, not a booking one, and does not belong here.
|
|
15
|
+
*
|
|
16
|
+
* TWO WAYS IN. The scheduled pass selects for itself: every subscription whose latest term expires
|
|
17
|
+
* inside its lead window and whose holder consented. The Renewals page instead names the
|
|
18
|
+
* subscriptions a person ticked (`SubscriptionIDs`), and for those the lead window and the consent
|
|
19
|
+
* switch are the person's call, not the selection's: a subscription with auto-renew OFF is placed as
|
|
20
|
+
* a DRAFT, an ordinary order somebody confirms once the customer agrees, while one with auto-renew
|
|
21
|
+
* ON is confirmed and invoiced exactly as the pass would have done it, only earlier. `PlaceAs`
|
|
22
|
+
* overrides that default either way. Everything else — eligibility, pricing, the term, the
|
|
23
|
+
* idempotency guards, the booking path — is the same code, so a renewal placed from the page is
|
|
24
|
+
* indistinguishable from one the pass placed.
|
|
15
25
|
*
|
|
16
26
|
* The order is placed at LEAD TIME, not on the expiry date, which is how subscription billing
|
|
17
27
|
* actually works: the invoice goes out before the period it covers. The order carries a one-row
|
|
@@ -29,22 +39,19 @@
|
|
|
29
39
|
* 2. an explicit check for a live renewal line that has not yet produced a term — one drafted or
|
|
30
40
|
* quoted by hand for this cycle. Earlier cycles' renewals each booked a term, so they do not
|
|
31
41
|
* count, and a subscription keeps renewing cycle after cycle.
|
|
32
|
-
* Running the operation twice in a row is a no-op, and that is asserted by the check suite.
|
|
42
|
+
* Running the operation twice in a row is a no-op, and that is asserted by the check suite. A draft
|
|
43
|
+
* this operation places from the page is held by the second guard like any other draft: the pass
|
|
44
|
+
* will not place a confirmed order beside it.
|
|
33
45
|
*
|
|
34
46
|
* WHAT IT RENEWS AT (golive #304)
|
|
35
47
|
* Not what the customer last paid. A first-term discount lapses, a product with a successor renews
|
|
36
48
|
* as the successor at its own list price, and an annual increase applies when the new term crosses
|
|
37
|
-
* an anniversary of the subscription's start: `PriceRenewal` in orders-entities decides, and
|
|
38
|
-
*
|
|
39
|
-
* product's, else the nearest category's, else the company's
|
|
40
|
-
* it was reached are reported on every candidate, preview
|
|
41
|
-
* and logged on the renewal event, so the figure can be
|
|
42
|
-
*
|
|
43
|
-
* A line that bought several terms at once (golive #338: 24 months stated on a 12-month type) at a
|
|
44
|
-
* typed price (`PriceOverridden`) has a price covering all of them, while the renewal buys one term.
|
|
45
|
-
* That price is cut to one term's share of it (`PriorTermShare`) before the rules above apply. An
|
|
46
|
-
* engine-priced line already carries one term's price, whatever period it states, and is not cut. Every candidate also reports the
|
|
47
|
-
* renewal term's start and end, decided by the same subscription behaviour the confirm runs.
|
|
49
|
+
* an anniversary of the subscription's start: `PriceRenewal` in orders-entities decides, and
|
|
50
|
+
* `RenewalPricer` (./RenewalPricing.ts) gathers its inputs. The increase is the subscription's
|
|
51
|
+
* `RenewalIncreasePercent`, else the product's, else the nearest category's, else the company's
|
|
52
|
+
* `OrderCompanyPolicy`. The price and how it was reached are reported on every candidate, preview
|
|
53
|
+
* included, written into the order's notes and logged on the renewal event, so the figure can be
|
|
54
|
+
* checked before a live pass books it.
|
|
48
55
|
*
|
|
49
56
|
* PROMOTIONS THAT CARRY INTO RENEWALS (#289)
|
|
50
57
|
* A promotion with `AppliesToRenewals` set is presented again on each automatic renewal of a
|
|
@@ -63,19 +70,37 @@
|
|
|
63
70
|
* so extension, term creation, GL resolution and recognition are all the SAME code
|
|
64
71
|
* POLICY: SubscriptionBehavior (IsRenewal bypasses ConcurrencyMode — a renewal is not a second
|
|
65
72
|
* concurrent subscription, it is this one continuing)
|
|
66
|
-
* PRICING: orders-entities PriceRenewal / ResolveRenewalIncrease / RenewalCrossesAnniversary
|
|
73
|
+
* PRICING: ./RenewalPricing.ts, over orders-entities PriceRenewal / ResolveRenewalIncrease / RenewalCrossesAnniversary
|
|
67
74
|
* PROMOS: ./RenewalPromotions.ts (which codes, and what became of them); OrderPricingService for the preview
|
|
75
|
+
* PAGE: ./GetRenewalWorklistOperation.ts reads the same subjects for the Renewals page, which calls this with SubscriptionIDs
|
|
68
76
|
* TABLES: __mj_BizAppsOrders.{Subscription,SubscriptionTerm,SubscriptionType,OrderHeader,OrderLine,OrderHeaderPaymentSchedule,
|
|
69
77
|
* Product,ProductCategory,OrderCompanyPolicy,OrderAdjustment,PromotionCode,Promotion}
|
|
70
78
|
*/
|
|
71
79
|
import { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
72
80
|
import { OrdersSpawnRenewalsOperation as OrdersSpawnRenewalsOperationBase } from '@mj-biz-apps/orders-entities';
|
|
73
81
|
import { type UnusableRenewalPromotionCode } from './RenewalPromotions.js';
|
|
82
|
+
import { NonSubscriptionSuccessorRefusal, type RenewalSubjectRow } from './RenewalPricing.js';
|
|
83
|
+
export { NonSubscriptionSuccessorRefusal };
|
|
84
|
+
/** How a placed renewal order is left. */
|
|
85
|
+
export type RenewalPlacement = 'Confirmed' | 'Draft';
|
|
74
86
|
export interface SpawnRenewalsInput {
|
|
75
87
|
/** Treat this as "today". Defaults to now. */
|
|
76
88
|
AsOfDate?: Date | string;
|
|
77
89
|
/** Restrict to one subscription — for a targeted retry, or for a test. */
|
|
78
90
|
SubscriptionID?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Place renewals for exactly these subscriptions, chosen by a person (the Renewals page). The lead
|
|
93
|
+
* window and the auto-renew switch do not select here; eligibility still does (Active or Trialing,
|
|
94
|
+
* latest term Scheduled or Active, not billed by a gateway, no renewal already pending), and each
|
|
95
|
+
* ineligible id is reported as a skipped candidate rather than silently dropped.
|
|
96
|
+
*/
|
|
97
|
+
SubscriptionIDs?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* How to leave each order: `Confirmed` books and invoices it; `Draft` saves it for a person to
|
|
100
|
+
* confirm. Defaults to `Confirmed` for the scheduled selection, and for `SubscriptionIDs` to
|
|
101
|
+
* `Confirmed` where the subscription has auto-renew on and `Draft` where it does not.
|
|
102
|
+
*/
|
|
103
|
+
PlaceAs?: RenewalPlacement;
|
|
79
104
|
/** Report what WOULD be placed, without placing anything. */
|
|
80
105
|
Preview?: boolean;
|
|
81
106
|
/**
|
|
@@ -92,9 +117,15 @@ export interface RenewalCandidate {
|
|
|
92
117
|
CurrentTermEnd: string;
|
|
93
118
|
/** Lead days actually applied, after the subscription's override of the type's default. */
|
|
94
119
|
LeadDays: number;
|
|
120
|
+
/** `Subscription.AutoRenew`. */
|
|
121
|
+
AutoRenew?: boolean;
|
|
122
|
+
/** How the order was, or would be, left. */
|
|
123
|
+
OrderStatus?: RenewalPlacement;
|
|
95
124
|
/** Set when the renewal was placed (absent on a preview, or when placing failed). */
|
|
96
125
|
OrderID?: string;
|
|
97
126
|
OrderNumber?: string;
|
|
127
|
+
/** Which renewal order of this pass the subscription renews on (1-based). Members with the same number share one order. */
|
|
128
|
+
OrderGroup?: number;
|
|
98
129
|
/** Set when this candidate was skipped, with the reason. */
|
|
99
130
|
SkippedReason?: string;
|
|
100
131
|
/** The product the renewal is placed on: the subscription's own, or its successor. */
|
|
@@ -114,6 +145,8 @@ export interface RenewalCandidate {
|
|
|
114
145
|
UnitPrice?: number;
|
|
115
146
|
/** The renewal line's discount, as a fraction: 0 unless the subscription carries its discount into renewals. */
|
|
116
147
|
DiscountPct?: number;
|
|
148
|
+
/** Seats the renewal buys. */
|
|
149
|
+
Quantity?: number;
|
|
117
150
|
/** First day of the term the renewal buys, `YYYY-MM-DD`, as the confirm will set it. */
|
|
118
151
|
RenewalTermStart?: string;
|
|
119
152
|
/** Last day of the term the renewal buys, `YYYY-MM-DD`, as the confirm will set it. */
|
|
@@ -137,27 +170,13 @@ export interface SpawnRenewalsOutput {
|
|
|
137
170
|
Placed: number;
|
|
138
171
|
Skipped: number;
|
|
139
172
|
}
|
|
140
|
-
/** A product on the subscription's successor chain, the subscription's own product first. */
|
|
141
|
-
interface ChainProductRow {
|
|
142
|
-
ID: string;
|
|
143
|
-
Name: string;
|
|
144
|
-
Status: string;
|
|
145
|
-
ProductCategoryID: string;
|
|
146
|
-
RenewalIncreasePercent: number | null;
|
|
147
|
-
SuccessorProductID: string | null;
|
|
148
|
-
/** The product's subscription type, else its product type's default; null when it sells no subscription. */
|
|
149
|
-
SubscriptionTypeID: string | null;
|
|
150
|
-
ProductTypeID: string | null;
|
|
151
|
-
}
|
|
152
173
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* is skipped with this reason instead. The subscription's own product (the first entry) is not
|
|
158
|
-
* checked: it already holds the subscription.
|
|
174
|
+
* Which renewal order a subscription renews on: one per selling company, customer (holder
|
|
175
|
+
* organization and beneficiary person), expiring term end date, placement and renewal card. Two
|
|
176
|
+
* subscriptions with the same key renew on ONE order with a line each. Exported so the rule can
|
|
177
|
+
* be read and tested on its own.
|
|
159
178
|
*/
|
|
160
|
-
export declare function
|
|
179
|
+
export declare function RenewalGroupKey(due: Pick<RenewalSubjectRow, 'CompanyID' | 'HolderOrganizationID' | 'BeneficiaryPersonID' | 'TermEndDate' | 'DefaultCustomerPaymentMethodID'>, placeAs: RenewalPlacement): string;
|
|
161
180
|
export declare class SpawnRenewalsOperation extends OrdersSpawnRenewalsOperationBase {
|
|
162
181
|
protected InternalExecute(input: SpawnRenewalsInput, provider: IMetadataProvider, user: UserInfo): Promise<SpawnRenewalsOutput>;
|
|
163
182
|
/**
|
|
@@ -170,6 +189,13 @@ export declare class SpawnRenewalsOperation extends OrdersSpawnRenewalsOperation
|
|
|
170
189
|
* (`ProviderSubscriptionID` set) is never due here: the gateway renews it (./ProviderBilledSubscriptions.ts).
|
|
171
190
|
*/
|
|
172
191
|
private findDue;
|
|
192
|
+
/**
|
|
193
|
+
* The subscriptions a person named, each with its latest term, whatever the switch or the window
|
|
194
|
+
* say. The rules the scheduled selection puts in its WHERE are applied here instead, so an
|
|
195
|
+
* ineligible choice comes back as a skipped candidate with its reason: a person who ticked a
|
|
196
|
+
* cancelled subscription is told so, where the pass would simply not have seen it.
|
|
197
|
+
*/
|
|
198
|
+
private findSelected;
|
|
173
199
|
/**
|
|
174
200
|
* True when a renewal order for this cycle already exists.
|
|
175
201
|
*
|
|
@@ -182,52 +208,19 @@ export declare class SpawnRenewalsOperation extends OrdersSpawnRenewalsOperation
|
|
|
182
208
|
*/
|
|
183
209
|
private alreadyRenewed;
|
|
184
210
|
/**
|
|
185
|
-
* Place
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* extension, the new term, GL resolution, the recognition schedule and the all-or-none
|
|
189
|
-
* guarantee are the same code that handles a customer purchase. A bespoke renewal writer would
|
|
190
|
-
* be a second implementation of booking, drifting from the first.
|
|
191
|
-
*
|
|
192
|
-
* `invoiceDay` is the pass's as-of day, `YYYY-MM-DD`: the renewal invoice date. The one-row
|
|
193
|
-
* schedule the order carries is due that day plus the customer's terms, capped at the order date (#305).
|
|
194
|
-
*/
|
|
195
|
-
private placeRenewal;
|
|
196
|
-
/** Write the renewal's one-row schedule, from the order's company, due on `dueDate`. */
|
|
197
|
-
private addRenewalSchedule;
|
|
198
|
-
/**
|
|
199
|
-
* What the renewal line is written with: product, quantity and price (golive #304).
|
|
200
|
-
*
|
|
201
|
-
* Read-only, so a preview runs it too. Throws with a reason a person can act on when the
|
|
202
|
-
* renewal cannot be priced; the caller skips that candidate.
|
|
203
|
-
*/
|
|
204
|
-
private priceRenewal;
|
|
205
|
-
/**
|
|
206
|
-
* The months the source line's price covers when that line bought earlier terms too, or null
|
|
207
|
-
* (golive #338). Read from the line's service period, which the confirm sets to the whole coverage.
|
|
211
|
+
* Place a group's order and report it on every member; on failure, record the reason on every
|
|
212
|
+
* member and say so. Counts the order in `out.Placed`; the caller decides what a failure counts
|
|
213
|
+
* as, since a failed group is retried a member at a time.
|
|
208
214
|
*/
|
|
209
|
-
private
|
|
215
|
+
private tryPlaceGroup;
|
|
210
216
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* the
|
|
217
|
+
* Place ONE renewal order for a group of subscriptions that renew together (one line each), as a
|
|
218
|
+
* draft or confirmed, inside one transaction: all of it or none of it. The header comes from the
|
|
219
|
+
* first member; the group key guarantees every member agrees on it.
|
|
214
220
|
*/
|
|
215
|
-
private
|
|
216
|
-
/**
|
|
217
|
-
|
|
218
|
-
* subscription type and behaviour, continuing the subscription from the day after its latest term.
|
|
219
|
-
* Null when that cannot be decided here (no type, an unregistered driver, a rejection); the
|
|
220
|
-
* confirm then reports the reason itself.
|
|
221
|
-
*/
|
|
222
|
-
private renewalTerm;
|
|
223
|
-
/** A subscription type's rules from the engine cache, or null when the type is not there. */
|
|
224
|
-
private rulesFor;
|
|
225
|
-
/**
|
|
226
|
-
* The codes the renewal presents: those recorded on the line that bought the expiring term whose
|
|
227
|
-
* promotion carries into renewals (#289). A promotion's adjustment rows always name a line; an
|
|
228
|
-
* order-level promotion writes one per line, so the source line's own rows are complete.
|
|
229
|
-
*/
|
|
230
|
-
private loadRenewalPromotionCodes;
|
|
221
|
+
private placeRenewalGroup;
|
|
222
|
+
/** Write the renewal's one-row schedule, from the order's company, due on `dueDate`. */
|
|
223
|
+
private addRenewalSchedule;
|
|
231
224
|
/** The presented codes the engine wrote a discount for on this order, read from its adjustment rows. */
|
|
232
225
|
private appliedCodes;
|
|
233
226
|
/** The presented codes whose PromotionCode ID is among `codeIDs`. */
|
|
@@ -239,38 +232,23 @@ export declare class SpawnRenewalsOperation extends OrdersSpawnRenewalsOperation
|
|
|
239
232
|
private previewPromotions;
|
|
240
233
|
/** Copy a promotion outcome onto the candidate. */
|
|
241
234
|
private reportPromotions;
|
|
242
|
-
/**
|
|
243
|
-
* The subscription's product followed along `SuccessorProductID` while the next product is
|
|
244
|
-
* Active: a successor that is still a draft, or already retired, is not one to renew onto.
|
|
245
|
-
* The subscription's own product comes first; the last entry is what the renewal is placed on.
|
|
246
|
-
*/
|
|
247
|
-
private loadSuccessorChain;
|
|
248
|
-
/** `RenewalIncreasePercent` of a category and each ancestor, the category itself first. */
|
|
249
|
-
private loadCategoryIncreases;
|
|
250
|
-
/** The selling company's `OrderCompanyPolicy.RenewalIncreasePercent`; null when it has no policy row. */
|
|
251
|
-
private loadCompanyIncrease;
|
|
252
|
-
/**
|
|
253
|
-
* What the pricing engine charges for `line`'s product, for the customer on `line`'s order. As of
|
|
254
|
-
* that order's date, or as of `asOf` when given. Null when no rule prices the product.
|
|
255
|
-
*/
|
|
256
|
-
private listPrice;
|
|
257
|
-
/** The renewal order's notes: what it renews, how its price was reached, and what its promotions did. */
|
|
235
|
+
/** The renewal order's notes: one line per subscription it renews (what, who asked, how its price was reached), then what the promotions did. */
|
|
258
236
|
private renewalNotes;
|
|
259
|
-
/**
|
|
260
|
-
* Quantity for the renewal: the seats the expiring term covers (#589).
|
|
261
|
-
*
|
|
262
|
-
* Not the source line's quantity. A PRORATED source line carries a scaled quantity — the short
|
|
263
|
-
* first period into a calendar anchor (D54) — so 10 seats over half a period read 5, and the
|
|
264
|
-
* renewal billed and granted 5 seats for a full period. The term records the seats as bought.
|
|
265
|
-
*/
|
|
266
|
-
private renewalQuantity;
|
|
267
|
-
private dayAfter;
|
|
268
|
-
private loadSourceLine;
|
|
269
237
|
/** The choices recorded on the line that bought the expiring term, in group and option order. */
|
|
270
238
|
private loadSourceChoices;
|
|
271
239
|
private logEvent;
|
|
272
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Why a subscription a person named cannot have a renewal placed, or null when it can: the same
|
|
243
|
+
* rules the scheduled selection applies in SQL, minus the lead window and the auto-renew switch,
|
|
244
|
+
* which are the person's call. Exported so the Renewals page and its tests read one rule.
|
|
245
|
+
*/
|
|
246
|
+
export declare function SelectedRenewalRefusal(row: {
|
|
247
|
+
SubscriptionStatus: string;
|
|
248
|
+
TermID?: string | null;
|
|
249
|
+
TermStatus?: string | null;
|
|
250
|
+
ProviderSubscriptionID?: string | null;
|
|
251
|
+
}): string | null;
|
|
273
252
|
/** Tree-shaking anchor — called from the server bootstrap so the registration is retained. */
|
|
274
253
|
export declare function LoadSpawnRenewalsOperation(): void;
|
|
275
|
-
export {};
|
|
276
254
|
//# sourceMappingURL=SpawnRenewalsOperation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpawnRenewalsOperation.d.ts","sourceRoot":"","sources":["../src/SpawnRenewalsOperation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SpawnRenewalsOperation.d.ts","sourceRoot":"","sources":["../src/SpawnRenewalsOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,OAAO,EAGH,iBAAiB,EAIjB,QAAQ,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,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