@mj-biz-apps/orders-core-entities-server 5.27.0 → 5.28.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/CheckCoverageOverlapOperation.d.ts +28 -0
- package/dist/CheckCoverageOverlapOperation.d.ts.map +1 -0
- package/dist/CheckCoverageOverlapOperation.js +70 -0
- package/dist/CheckCoverageOverlapOperation.js.map +1 -0
- package/dist/DetectOverlappingSubscriptionsOperation.d.ts +13 -2
- package/dist/DetectOverlappingSubscriptionsOperation.d.ts.map +1 -1
- package/dist/DetectOverlappingSubscriptionsOperation.js +17 -3
- package/dist/DetectOverlappingSubscriptionsOperation.js.map +1 -1
- package/dist/OrderEntityServer.d.ts +71 -3
- package/dist/OrderEntityServer.d.ts.map +1 -1
- package/dist/OrderEntityServer.js +262 -26
- package/dist/OrderEntityServer.js.map +1 -1
- package/dist/SpawnRenewalsOperation.d.ts +50 -1
- package/dist/SpawnRenewalsOperation.d.ts.map +1 -1
- package/dist/SpawnRenewalsOperation.js +210 -19
- package/dist/SpawnRenewalsOperation.js.map +1 -1
- package/dist/SubscriptionBehavior.d.ts +125 -0
- package/dist/SubscriptionBehavior.d.ts.map +1 -1
- package/dist/SubscriptionBehavior.js +147 -5
- package/dist/SubscriptionBehavior.js.map +1 -1
- package/dist/SubscriptionFamilyRules.d.ts +34 -0
- package/dist/SubscriptionFamilyRules.d.ts.map +1 -0
- package/dist/SubscriptionFamilyRules.js +96 -0
- package/dist/SubscriptionFamilyRules.js.map +1 -0
- package/dist/entity-names.d.ts +2 -0
- package/dist/entity-names.d.ts.map +1 -1
- package/dist/entity-names.js +2 -0
- package/dist/entity-names.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `Orders.CheckCoverageOverlap` — would confirming this draft create coverage that
|
|
3
|
+
* overlaps another band the holder already has (golive #276)?
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS IS AN OPERATION AND NOT A CLIENT QUERY. Who a line's subscriber is (ship-to falling back
|
|
6
|
+
* to the header, an organization inferred from the person's affiliation), which axes define a
|
|
7
|
+
* duplicate (the type's BenefitModel), and what the term's dates will be (the type's start and end
|
|
8
|
+
* rules) are all decided on the server at confirm. A notice computed from its own queries would be
|
|
9
|
+
* a second copy of those rules, and it would disagree with the refusal the first time either
|
|
10
|
+
* changed. So the editor asks the same code confirm refuses with.
|
|
11
|
+
*
|
|
12
|
+
* READ-ONLY: it loads the order and runs the confirm-time decision pass in preview, which writes
|
|
13
|
+
* nothing.
|
|
14
|
+
*
|
|
15
|
+
* CONNECTS TO:
|
|
16
|
+
* CODE: OrderEntityServer.PreviewCoverageOverlaps, SubscriptionBehavior.DecideCoverageOverlap
|
|
17
|
+
* UI: the order lines editor's coverage notice
|
|
18
|
+
*
|
|
19
|
+
* @module @mj-biz-apps/orders-core-entities-server
|
|
20
|
+
*/
|
|
21
|
+
import { type IMetadataProvider, type UserInfo } from '@memberjunction/core';
|
|
22
|
+
import { OrdersCheckCoverageOverlapOperation as OrdersCheckCoverageOverlapOperationBase, type CheckCoverageOverlapInput, type CheckCoverageOverlapOutput } from '@mj-biz-apps/orders-entities';
|
|
23
|
+
export declare class CheckCoverageOverlapOperation extends OrdersCheckCoverageOverlapOperationBase {
|
|
24
|
+
protected InternalExecute(input: CheckCoverageOverlapInput, provider: IMetadataProvider, user: UserInfo): Promise<CheckCoverageOverlapOutput>;
|
|
25
|
+
}
|
|
26
|
+
/** Tree-shaking anchor — call from the server bootstrap so @RegisterClass is retained. */
|
|
27
|
+
export declare function LoadCheckCoverageOverlapOperation(): void;
|
|
28
|
+
//# sourceMappingURL=CheckCoverageOverlapOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckCoverageOverlapOperation.d.ts","sourceRoot":"","sources":["../src/CheckCoverageOverlapOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAA0B,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErG,OAAO,EACH,mCAAmC,IAAI,uCAAuC,EAC9E,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAClC,MAAM,8BAA8B,CAAC;AAStC,qBACa,6BAA8B,SAAQ,uCAAuC;cACtE,eAAe,CAC3B,KAAK,EAAE,yBAAyB,EAChC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACf,OAAO,CAAC,0BAA0B,CAAC;CA4BzC;AAED,0FAA0F;AAC1F,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
* @fileoverview `Orders.CheckCoverageOverlap` — would confirming this draft create coverage that
|
|
9
|
+
* overlaps another band the holder already has (golive #276)?
|
|
10
|
+
*
|
|
11
|
+
* WHY THIS IS AN OPERATION AND NOT A CLIENT QUERY. Who a line's subscriber is (ship-to falling back
|
|
12
|
+
* to the header, an organization inferred from the person's affiliation), which axes define a
|
|
13
|
+
* duplicate (the type's BenefitModel), and what the term's dates will be (the type's start and end
|
|
14
|
+
* rules) are all decided on the server at confirm. A notice computed from its own queries would be
|
|
15
|
+
* a second copy of those rules, and it would disagree with the refusal the first time either
|
|
16
|
+
* changed. So the editor asks the same code confirm refuses with.
|
|
17
|
+
*
|
|
18
|
+
* READ-ONLY: it loads the order and runs the confirm-time decision pass in preview, which writes
|
|
19
|
+
* nothing.
|
|
20
|
+
*
|
|
21
|
+
* CONNECTS TO:
|
|
22
|
+
* CODE: OrderEntityServer.PreviewCoverageOverlaps, SubscriptionBehavior.DecideCoverageOverlap
|
|
23
|
+
* UI: the order lines editor's coverage notice
|
|
24
|
+
*
|
|
25
|
+
* @module @mj-biz-apps/orders-core-entities-server
|
|
26
|
+
*/
|
|
27
|
+
import { BaseRemotableOperation } from '@memberjunction/core';
|
|
28
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
29
|
+
import { OrdersCheckCoverageOverlapOperation as OrdersCheckCoverageOverlapOperationBase, } from '@mj-biz-apps/orders-entities';
|
|
30
|
+
import { RequireUUID } from './sql-guards.js';
|
|
31
|
+
const ORDER_ENTITY = 'MJ_BizApps_Orders: Order Headers';
|
|
32
|
+
const day = (d) => d.toISOString().slice(0, 10);
|
|
33
|
+
let CheckCoverageOverlapOperation = class CheckCoverageOverlapOperation extends OrdersCheckCoverageOverlapOperationBase {
|
|
34
|
+
async InternalExecute(input, provider, user) {
|
|
35
|
+
const orderID = RequireUUID(input?.OrderHeaderID, 'OrderHeaderID');
|
|
36
|
+
const order = await provider.GetEntityObject(ORDER_ENTITY, user);
|
|
37
|
+
if (!(await order.Load(orderID))) {
|
|
38
|
+
throw new Error(`Order ${orderID} does not exist, so its coverage cannot be checked.`);
|
|
39
|
+
}
|
|
40
|
+
// A booked order has already created its subscriptions; there is nothing left to warn about.
|
|
41
|
+
if (order.Status !== 'Draft')
|
|
42
|
+
return { Lines: [] };
|
|
43
|
+
const found = await order.PreviewCoverageOverlaps();
|
|
44
|
+
return {
|
|
45
|
+
Lines: found
|
|
46
|
+
.filter((f) => f.Decision.Outcome !== 'None')
|
|
47
|
+
.map((f) => ({
|
|
48
|
+
OrderLineID: f.Line.ID,
|
|
49
|
+
Outcome: f.Decision.Outcome,
|
|
50
|
+
Message: f.Decision.Message ?? '',
|
|
51
|
+
Overlaps: f.Overlaps.map((o) => ({
|
|
52
|
+
SubscriptionID: o.SubscriptionID,
|
|
53
|
+
SubscriptionNumber: o.SubscriptionNumber,
|
|
54
|
+
ProductName: o.ProductName,
|
|
55
|
+
CoverageStart: day(o.CoverageStart),
|
|
56
|
+
CoverageEnd: day(o.CoverageEnd),
|
|
57
|
+
})),
|
|
58
|
+
})),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
CheckCoverageOverlapOperation = __decorate([
|
|
63
|
+
RegisterClass(BaseRemotableOperation, 'Orders.CheckCoverageOverlap')
|
|
64
|
+
], CheckCoverageOverlapOperation);
|
|
65
|
+
export { CheckCoverageOverlapOperation };
|
|
66
|
+
/** Tree-shaking anchor — call from the server bootstrap so @RegisterClass is retained. */
|
|
67
|
+
export function LoadCheckCoverageOverlapOperation() {
|
|
68
|
+
// intentionally empty
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=CheckCoverageOverlapOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckCoverageOverlapOperation.js","sourceRoot":"","sources":["../src/CheckCoverageOverlapOperation.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,sBAAsB,EAAyC,MAAM,sBAAsB,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACH,mCAAmC,IAAI,uCAAuC,GAGjF,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAExD,MAAM,GAAG,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE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;oBAC1B,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC;oBACnC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC;iBAClC,CAAC,CAAC;aACN,CAAC,CAAC;SACV,CAAC;IACN,CAAC;CACJ,CAAA;AAjCY,6BAA6B;IADzC,aAAa,CAAC,sBAAsB,EAAE,6BAA6B,CAAC;GACxD,6BAA6B,CAiCzC;;AAED,0FAA0F;AAC1F,MAAM,UAAU,iCAAiC;IAC7C,sBAAsB;AAC1B,CAAC"}
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
* as unresolved: a booked order's confirmer can never be filled in afterwards, so
|
|
19
19
|
* an unresolved row could never be cleared and its month never close.
|
|
20
20
|
*
|
|
21
|
+
* AN ACKNOWLEDGED BAND OVERLAP IS NOT RAISED. A SameFamily pair whose later line set
|
|
22
|
+
* `AcknowledgesCoverageOverlap` was confirmed by someone told that both would be billed; raising it
|
|
23
|
+
* would put a decision already made back on finance's list. The query still lists it, flagged.
|
|
24
|
+
* SameProduct and SameCategory pairs are raised whatever the flag says: the acknowledgment is offered
|
|
25
|
+
* only for another band of the same family, so on those pairs it acknowledges nothing.
|
|
26
|
+
*
|
|
21
27
|
* SETTINGS COME FROM THE EXCEPTION TYPE and nowhere else. A missing or inactive
|
|
22
28
|
* OVERLAPPING_SUBSCRIPTION type means the check does not run; a configuration without a boolean
|
|
23
29
|
* `IncludeSameCategory` is refused rather than defaulted, because a default here would decide on
|
|
@@ -45,7 +51,7 @@ export declare const OVERLAPPING_SUBSCRIPTIONS_QUERY_CATEGORY = "Orders";
|
|
|
45
51
|
/** One row of the "Overlapping Subscriptions" query — the columns this check reads. */
|
|
46
52
|
export interface OverlappingSubscriptionRow {
|
|
47
53
|
CompanyID: string;
|
|
48
|
-
MatchBasis: 'SameProduct' | 'SameCategory';
|
|
54
|
+
MatchBasis: 'SameProduct' | 'SameFamily' | 'SameCategory';
|
|
49
55
|
OverlapStart: Date | string | null;
|
|
50
56
|
OverlapEnd: Date | string | null;
|
|
51
57
|
EarlierSubscriptionID: string;
|
|
@@ -54,13 +60,18 @@ export interface OverlappingSubscriptionRow {
|
|
|
54
60
|
LaterSubscriptionNumber: string | null;
|
|
55
61
|
LaterOrderHeaderID: string | null;
|
|
56
62
|
LaterOverlappingTermsAmount: number | null;
|
|
63
|
+
/** The later subscription's `OrderLine.AcknowledgesCoverageOverlap`. */
|
|
64
|
+
LaterOverlapAcknowledged?: boolean | null;
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
67
|
* The type's `IncludeSameCategory` setting, or an error message when the configuration does not
|
|
60
68
|
* state it as a boolean. Never defaulted — see the header.
|
|
61
69
|
*/
|
|
62
70
|
export declare function ReadIncludeSameCategory(configuration: Record<string, unknown> | null | undefined): boolean | string;
|
|
63
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* The pairs to raise: every row, less acknowledged SameFamily pairs, and less the SameCategory ones
|
|
73
|
+
* when the type excludes them.
|
|
74
|
+
*/
|
|
64
75
|
export declare function PairsToRaise(rows: OverlappingSubscriptionRow[], includeSameCategory: boolean): OverlappingSubscriptionRow[];
|
|
65
76
|
export declare function OverlapDedupeKey(row: Pick<OverlappingSubscriptionRow, 'EarlierSubscriptionID' | 'LaterSubscriptionID'>): string;
|
|
66
77
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetectOverlappingSubscriptionsOperation.d.ts","sourceRoot":"","sources":["../src/DetectOverlappingSubscriptionsOperation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"DetectOverlappingSubscriptionsOperation.d.ts","sourceRoot":"","sources":["../src/DetectOverlappingSubscriptionsOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EACH,sBAAsB,EACtB,iBAAiB,EAKjB,QAAQ,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEH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AE,0BAA0B,EAC/B,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,EAAE,MAAM,GACtB,uBAAuB,CAyBzB;AAMD,qBACa,uCAAwC,SAAQ,sBAAsB,CAC/E,yCAAyC,EACzC,0CAA0C,CAC7C;IACU,YAAY,SAA2C;cAE9C,eAAe,CAC3B,KAAK,EAAE,yCAAyC,EAChD,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACf,OAAO,CAAC,0CAA0C,CAAC;YA2DxC,eAAe;IAW7B,2FAA2F;YAC7E,cAAc;YA6Bd,UAAU;CAwC3B;AAED,iGAAiG;AACjG,wBAAgB,2CAA2C,IAAI,IAAI,CAElE"}
|
|
@@ -24,6 +24,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
24
24
|
* as unresolved: a booked order's confirmer can never be filled in afterwards, so
|
|
25
25
|
* an unresolved row could never be cleared and its month never close.
|
|
26
26
|
*
|
|
27
|
+
* AN ACKNOWLEDGED BAND OVERLAP IS NOT RAISED. A SameFamily pair whose later line set
|
|
28
|
+
* `AcknowledgesCoverageOverlap` was confirmed by someone told that both would be billed; raising it
|
|
29
|
+
* would put a decision already made back on finance's list. The query still lists it, flagged.
|
|
30
|
+
* SameProduct and SameCategory pairs are raised whatever the flag says: the acknowledgment is offered
|
|
31
|
+
* only for another band of the same family, so on those pairs it acknowledges nothing.
|
|
32
|
+
*
|
|
27
33
|
* SETTINGS COME FROM THE EXCEPTION TYPE and nowhere else. A missing or inactive
|
|
28
34
|
* OVERLAPPING_SUBSCRIPTION type means the check does not run; a configuration without a boolean
|
|
29
35
|
* `IncludeSameCategory` is refused rather than defaulted, because a default here would decide on
|
|
@@ -69,9 +75,13 @@ export function ReadIncludeSameCategory(configuration) {
|
|
|
69
75
|
return (`The ${OVERLAPPING_SUBSCRIPTION_TYPE_CODE} exception type's Configuration must set IncludeSameCategory ` +
|
|
70
76
|
`to true or false; it has ${value === undefined ? 'no such setting' : JSON.stringify(value)}.`);
|
|
71
77
|
}
|
|
72
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* The pairs to raise: every row, less acknowledged SameFamily pairs, and less the SameCategory ones
|
|
80
|
+
* when the type excludes them.
|
|
81
|
+
*/
|
|
73
82
|
export function PairsToRaise(rows, includeSameCategory) {
|
|
74
|
-
return
|
|
83
|
+
return rows.filter((row) => !(row.MatchBasis === 'SameFamily' && row.LaterOverlapAcknowledged) &&
|
|
84
|
+
(includeSameCategory || row.MatchBasis !== 'SameCategory'));
|
|
75
85
|
}
|
|
76
86
|
export function OverlapDedupeKey(row) {
|
|
77
87
|
return `${row.EarlierSubscriptionID}|${row.LaterSubscriptionID}`;
|
|
@@ -87,7 +97,11 @@ export function BuildOverlapException(row, confirmedBy, exceptionDate) {
|
|
|
87
97
|
const creator = row.LaterOrderHeaderID ? confirmedBy.get(row.LaterOrderHeaderID.toUpperCase()) ?? null : null;
|
|
88
98
|
const later = row.LaterSubscriptionNumber ?? row.LaterSubscriptionID;
|
|
89
99
|
const earlier = row.EarlierSubscriptionNumber ?? row.EarlierSubscriptionID;
|
|
90
|
-
const basis = row.MatchBasis === 'SameProduct'
|
|
100
|
+
const basis = row.MatchBasis === 'SameProduct'
|
|
101
|
+
? 'the same product'
|
|
102
|
+
: row.MatchBasis === 'SameFamily'
|
|
103
|
+
? 'another band of the same subscription family'
|
|
104
|
+
: 'a product in the same category with the same subscription type';
|
|
91
105
|
const window = `${ToISODate(row.OverlapStart) ?? '?'} to ${ToISODate(row.OverlapEnd) ?? '?'}`;
|
|
92
106
|
return {
|
|
93
107
|
TypeCode: OVERLAPPING_SUBSCRIPTION_TYPE_CODE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetectOverlappingSubscriptionsOperation.js","sourceRoot":"","sources":["../src/DetectOverlappingSubscriptionsOperation.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"DetectOverlappingSubscriptionsO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/accounting-core-entities-server)
|
|
28
28
|
*/
|
|
29
29
|
import { EntitySaveOptions, ValidationResult } from '@memberjunction/core';
|
|
30
|
-
import { OrderHeaderEntity } from '@mj-biz-apps/orders-entities';
|
|
30
|
+
import { OrderHeaderEntity, mjBizAppsOrdersOrderLineEntity } from '@mj-biz-apps/orders-entities';
|
|
31
31
|
import { type ManualDiscountRequest, type RequestedCharge } from '@mj-biz-apps/orders-entities';
|
|
32
|
+
import { type CoverageOverlap, type CoverageOverlapDecision } from './SubscriptionBehavior.js';
|
|
33
|
+
/** A subscription line whose term overlaps coverage in its family, as a preview reports it. */
|
|
34
|
+
export interface LineCoverageOverlap {
|
|
35
|
+
Line: mjBizAppsOrdersOrderLineEntity;
|
|
36
|
+
Decision: CoverageOverlapDecision;
|
|
37
|
+
Overlaps: CoverageOverlap[];
|
|
38
|
+
}
|
|
32
39
|
export declare class OrderEntityServer extends OrderHeaderEntity {
|
|
33
40
|
/** An approved Terms concession, applied by ./PaymentTermsChange.ts, is the only change to a confirmed order's terms. */
|
|
34
41
|
protected PaymentTermsChangeSanctioned(): boolean;
|
|
35
42
|
/** Price decompositions produced during this save, written once the lines have IDs (D69). */
|
|
36
43
|
private _priceComponents;
|
|
44
|
+
/** Lines the renewal pass priced, with the price it wrote; see {@link MarkRenewalPriced}. */
|
|
45
|
+
private _renewalPricedLines;
|
|
46
|
+
/**
|
|
47
|
+
* Record that the renewal pass priced this line (golive #304).
|
|
48
|
+
*
|
|
49
|
+
* A renewal is priced from the prior term, not today's list: a lapsed discount, a grandfathered
|
|
50
|
+
* price raised by the annual increase. That can sit below the engine's price, and it is the
|
|
51
|
+
* price finance chose, not a concession someone typed. While the line still carries the price
|
|
52
|
+
* the pass wrote, the concession gate and the below-engine review treat it as engine-priced.
|
|
53
|
+
* Change the price and both judge it as usual.
|
|
54
|
+
*/
|
|
55
|
+
MarkRenewalPriced(line: mjBizAppsOrdersOrderLineEntity): void;
|
|
56
|
+
/** True for a line the renewal pass priced whose price is unchanged; matched by entity or saved ID. */
|
|
57
|
+
private isUneditedRenewalPrice;
|
|
37
58
|
/** Why a line owes no tax, by line index — written as a zero-amount component (D73). */
|
|
38
59
|
private _taxReasons;
|
|
39
60
|
private _manualDiscounts;
|
|
@@ -644,12 +665,24 @@ export declare class OrderEntityServer extends OrderHeaderEntity {
|
|
|
644
665
|
* the persistence, inside the caller's transaction.
|
|
645
666
|
*/
|
|
646
667
|
private materializeSubscriptions;
|
|
668
|
+
/**
|
|
669
|
+
* The subscription lines of this draft whose terms overlap coverage in their family, and what
|
|
670
|
+
* confirm will do with each (golive #276). Writes nothing.
|
|
671
|
+
*
|
|
672
|
+
* Runs the same decision pass confirm runs, over the SAVED lines. Lines a bundle would add at
|
|
673
|
+
* confirm are not expanded here, so a band sold inside a bundle is caught at confirm only.
|
|
674
|
+
*/
|
|
675
|
+
PreviewCoverageOverlaps(): Promise<LineCoverageOverlap[]>;
|
|
647
676
|
/**
|
|
648
677
|
* Evaluate the subscription rules for every pending line, BEFORE any of them is inserted.
|
|
649
678
|
*
|
|
650
679
|
* Pure with respect to this app's tables — it reads the catalog and any existing subscription,
|
|
651
680
|
* then asks the behaviour what to do. Nothing is written, so a rules rejection aborts the
|
|
652
681
|
* confirm before a single line exists.
|
|
682
|
+
*
|
|
683
|
+
* `preview` turns refusals into answers: a line the rules reject is skipped, and every line
|
|
684
|
+
* whose term overlaps coverage in its family is collected there instead of throwing. That is
|
|
685
|
+
* how `Orders.CheckCoverageOverlap` asks the same question confirm does without confirming.
|
|
653
686
|
*/
|
|
654
687
|
private decideSubscriptions;
|
|
655
688
|
/**
|
|
@@ -738,7 +771,35 @@ export declare class OrderEntityServer extends OrderHeaderEntity {
|
|
|
738
771
|
* the same product under an `AllowMultiple` type.
|
|
739
772
|
*/
|
|
740
773
|
private findExistingSubscription;
|
|
741
|
-
/**
|
|
774
|
+
/**
|
|
775
|
+
* The subscription filter for a dedupe match, or null when it names nobody.
|
|
776
|
+
*
|
|
777
|
+
* Match on exactly the axes the BenefitModel says define a duplicate (`DedupeMatch`). An
|
|
778
|
+
* org-held type ignores the stored person entirely (one company membership, however many
|
|
779
|
+
* employees, whoever the order named as its contact); a seat type matches BOTH, so two seats
|
|
780
|
+
* for two people never collide.
|
|
781
|
+
*/
|
|
782
|
+
private holderFilter;
|
|
783
|
+
/** Family names by ID, for the overlap message. One read for every family on the order. */
|
|
784
|
+
private loadFamilyNames;
|
|
785
|
+
/**
|
|
786
|
+
* Terms that cover this holder under OTHER bands of the product's family and end on or after
|
|
787
|
+
* `start` (golive #276). Terms after `end` are included so the caller can say when coverage
|
|
788
|
+
* runs out.
|
|
789
|
+
*
|
|
790
|
+
* Bands are the family's other products in the product's own company. A subscription counts
|
|
791
|
+
* unless it is Migrated, and its terms count unless they are Canceled or Lapsed. A Canceled
|
|
792
|
+
* subscription still counts: cancelling stamps one term and leaves the subscription's access
|
|
793
|
+
* running to `Subscription.EndDate`, so its Canceled term counts through that date, and any
|
|
794
|
+
* term it did not stamp counts in full.
|
|
795
|
+
*/
|
|
796
|
+
private loadFamilyCoverage;
|
|
797
|
+
/**
|
|
798
|
+
* Load a subscription plus the end and number of its latest term, by whatever filter.
|
|
799
|
+
*
|
|
800
|
+
* When the filter matches several, the most live one wins: Active or Trialing, then Paused,
|
|
801
|
+
* then Canceled, then the rest; among equals, one stored for `personID`, then the newest.
|
|
802
|
+
*/
|
|
742
803
|
private loadSubscriptionState;
|
|
743
804
|
private createSubscription;
|
|
744
805
|
/**
|
|
@@ -749,7 +810,14 @@ export declare class OrderEntityServer extends OrderHeaderEntity {
|
|
|
749
810
|
* worth having; a `SubscriptionEvent` table nobody writes to is just schema.
|
|
750
811
|
*/
|
|
751
812
|
private logSubscriptionEvent;
|
|
752
|
-
/**
|
|
813
|
+
/**
|
|
814
|
+
* Extension or reactivation — the term is what changes; the subscription just re-activates.
|
|
815
|
+
*
|
|
816
|
+
* `renewedOnto` is the product a renewal line names. When it is not the subscription's product,
|
|
817
|
+
* the subscription moved to a successor at renewal (golive #304), and from this term on it is a
|
|
818
|
+
* subscription to the successor: its product and type follow, so the next renewal, entitlement
|
|
819
|
+
* checks and reports all read the product the customer now holds.
|
|
820
|
+
*/
|
|
753
821
|
private touchExistingSubscription;
|
|
754
822
|
/**
|
|
755
823
|
* Mint the next `SUB-{seq}` from the SubscriptionSequence singleton.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAMH,iBAAiB,EAUjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGH,iBAAiB,
|
|
1
|
+
{"version":3,"file":"OrderEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAMH,iBAAiB,EAUjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGH,iBAAiB,EACjB,8BAA8B,EAUjC,MAAM,8BAA8B,CAAC;AAuCtC,OAAO,EAA4R,KAAK,qBAAqB,EAAgD,KAAK,eAAe,EAAiH,MAAM,8BAA8B,CAAC;AAIvhB,OAAO,EAUH,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;AA4HD,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;;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