@openlup/platform 0.22.0 → 0.23.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/CHANGELOG.md +222 -99
- package/README.md +59 -589
- package/dist/fulfillment/adapterConformance.js +1 -1
- package/dist/fulfillment/bindings.js +1 -1
- package/dist/fulfillment/contracts/conformance.d.ts +3 -1
- package/dist/fulfillment/contracts/dispatch.d.ts +41 -3
- package/dist/fulfillment/contracts/index.d.ts +3 -3
- package/dist/fulfillment/contracts/observation.d.ts +21 -1
- package/dist/fulfillment/contracts/readback.d.ts +21 -0
- package/dist/fulfillment/contracts/store.d.ts +3 -0
- package/dist/fulfillment/contracts/sync.d.ts +58 -2
- package/dist/fulfillment/dispatchProjection.d.ts +20 -1
- package/dist/fulfillment/dispatchProjection.js +95 -6
- package/dist/fulfillment/index.d.ts +3 -2
- package/dist/fulfillment/index.js +2 -2
- package/dist/fulfillment/migrations.d.ts +5 -0
- package/dist/fulfillment/migrations.js +1 -0
- package/dist/fulfillment/observationProjection.d.ts +24 -3
- package/dist/fulfillment/observationProjection.js +65 -12
- package/dist/fulfillment/omnipack/client.d.ts +3 -1
- package/dist/fulfillment/omnipack/client.js +17 -7
- package/dist/fulfillment/omnipack/index.d.ts +4 -1
- package/dist/fulfillment/omnipack/index.js +104 -45
- package/dist/fulfillment/omnipack/mappers.d.ts +7 -1
- package/dist/fulfillment/omnipack/mappers.js +24 -2
- package/dist/fulfillment/omnipack/observation.d.ts +11 -4
- package/dist/fulfillment/omnipack/observation.js +44 -29
- package/dist/fulfillment/omnipack/reconciliation.d.ts +15 -0
- package/dist/fulfillment/omnipack/reconciliation.js +55 -0
- package/dist/fulfillment/postgresDispatchStore.js +1 -1
- package/dist/fulfillment/postgresShipmentSpine.d.ts +8 -1
- package/dist/fulfillment/postgresShipmentSpine.js +17 -3
- package/dist/fulfillment/postgresStockSyncPort.js +6 -3
- package/dist/fulfillment/providerDispatchAcceptance.d.ts +1 -0
- package/dist/fulfillment/providerDispatchAcceptance.js +8 -2
- package/dist/fulfillment/providerDispatchWorker.d.ts +13 -0
- package/dist/fulfillment/providerDispatchWorker.js +47 -20
- package/dist/fulfillment/providerReconciliationWorker.d.ts +27 -19
- package/dist/fulfillment/providerReconciliationWorker.js +75 -19
- package/dist/fulfillment/providerStockSyncWorker.d.ts +5 -1
- package/dist/fulfillment/providerStockSyncWorker.js +229 -120
- package/dist/fulfillment/providerTrackingReferences.d.ts +3 -2
- package/dist/fulfillment/verifiedIngress.d.ts +38 -11
- package/dist/fulfillment/verifiedIngress.js +36 -8
- package/dist/invoicing/capabilities.d.ts +11 -0
- package/dist/invoicing/capabilities.js +10 -0
- package/dist/invoicing/contracts/capabilities.d.ts +40 -0
- package/dist/invoicing/contracts/capabilities.js +1 -0
- package/dist/invoicing/contracts/companyLookup.d.ts +49 -0
- package/dist/invoicing/contracts/companyLookup.js +1 -0
- package/dist/invoicing/contracts/delivery.d.ts +74 -0
- package/dist/invoicing/contracts/delivery.js +1 -0
- package/dist/invoicing/contracts/facts.d.ts +100 -0
- package/dist/invoicing/contracts/facts.js +1 -0
- package/dist/invoicing/contracts/host.d.ts +246 -0
- package/dist/invoicing/contracts/host.js +1 -0
- package/dist/invoicing/contracts/index.d.ts +16 -0
- package/dist/invoicing/contracts/index.js +1 -0
- package/dist/invoicing/contracts/provider.d.ts +126 -0
- package/dist/invoicing/contracts/provider.js +1 -0
- package/dist/invoicing/contracts/settlement.d.ts +66 -0
- package/dist/invoicing/contracts/settlement.js +1 -0
- package/dist/invoicing/contracts/store.d.ts +267 -0
- package/dist/invoicing/contracts/store.js +1 -0
- package/dist/invoicing/index.d.ts +1 -0
- package/dist/invoicing/index.js +1 -0
- package/dist/subscriptions/automaticRenewal.d.ts +44 -0
- package/dist/subscriptions/automaticRenewal.js +81 -0
- package/dist/subscriptions/automaticRenewalExecution.d.ts +21 -0
- package/dist/subscriptions/automaticRenewalExecution.js +44 -0
- package/dist/subscriptions/contracts/commands.d.ts +115 -0
- package/dist/subscriptions/contracts/commands.js +1 -0
- package/dist/subscriptions/contracts/dunning.d.ts +133 -0
- package/dist/subscriptions/contracts/dunning.js +1 -0
- package/dist/subscriptions/contracts/index.d.ts +6 -0
- package/dist/subscriptions/contracts/index.js +1 -0
- package/dist/subscriptions/contracts/messages.d.ts +43 -0
- package/dist/subscriptions/contracts/messages.js +1 -0
- package/dist/subscriptions/contracts/renewal.d.ts +533 -0
- package/dist/subscriptions/contracts/renewal.js +1 -0
- package/dist/subscriptions/contracts/stockWait.d.ts +73 -0
- package/dist/subscriptions/contracts/stockWait.js +1 -0
- package/dist/subscriptions/index.d.ts +39 -0
- package/dist/subscriptions/index.js +17 -0
- package/dist/subscriptions/paymentOutcomes.d.ts +8 -0
- package/dist/subscriptions/paymentOutcomes.js +27 -0
- package/dist/subscriptions/postgresRenewalStore.d.ts +20 -0
- package/dist/subscriptions/postgresRenewalStore.js +61 -0
- package/dist/subscriptions/postgresRetryStore.d.ts +78 -0
- package/dist/subscriptions/postgresRetryStore.js +142 -0
- package/dist/subscriptions/renewalCycleFailureMechanism.d.ts +34 -0
- package/dist/subscriptions/renewalCycleFailureMechanism.js +79 -0
- package/dist/subscriptions/renewalCycleMechanism.d.ts +46 -0
- package/dist/subscriptions/renewalCycleMechanism.js +157 -0
- package/dist/subscriptions/renewalCycleRefusalMechanism.d.ts +41 -0
- package/dist/subscriptions/renewalCycleRefusalMechanism.js +160 -0
- package/dist/subscriptions/renewalIdentity.d.ts +3 -0
- package/dist/subscriptions/renewalIdentity.js +4 -0
- package/package.json +22 -2
- package/release-gates.json +56 -3
- package/sql/20261022160000_subscription_retry_lifecycle.sql +328 -0
- package/sql/20261022165000_fulfillment_stock_evidence_replay_reopen.sql +30 -0
- package/src/fulfillment/adapterConformance.ts +1 -1
- package/src/fulfillment/bindings.ts +1 -1
- package/src/fulfillment/contracts/conformance.ts +3 -1
- package/src/fulfillment/contracts/dispatch.ts +20 -5
- package/src/fulfillment/contracts/index.ts +3 -3
- package/src/fulfillment/contracts/observation.ts +11 -3
- package/src/fulfillment/contracts/readback.ts +13 -0
- package/src/fulfillment/contracts/store.ts +1 -0
- package/src/fulfillment/contracts/sync.ts +13 -2
- package/src/fulfillment/dispatchProjection.ts +92 -7
- package/src/fulfillment/index.ts +3 -2
- package/src/fulfillment/migrations.ts +1 -0
- package/src/fulfillment/observationProjection.ts +64 -13
- package/src/fulfillment/omnipack/client.ts +19 -7
- package/src/fulfillment/omnipack/index.ts +96 -39
- package/src/fulfillment/omnipack/mappers.ts +23 -2
- package/src/fulfillment/omnipack/observation.ts +45 -27
- package/src/fulfillment/omnipack/reconciliation.ts +56 -0
- package/src/fulfillment/postgresDispatchStore.ts +1 -1
- package/src/fulfillment/postgresShipmentSpine.ts +21 -4
- package/src/fulfillment/postgresStockSyncPort.ts +6 -3
- package/src/fulfillment/providerDispatchAcceptance.ts +9 -3
- package/src/fulfillment/providerDispatchWorker.ts +48 -20
- package/src/fulfillment/providerReconciliationWorker.ts +81 -25
- package/src/fulfillment/providerStockSyncWorker.ts +222 -126
- package/src/fulfillment/providerTrackingReferences.ts +3 -2
- package/src/fulfillment/verifiedIngress.ts +44 -11
- package/src/invoicing/capabilities.ts +9 -0
- package/src/invoicing/contracts/capabilities.ts +15 -0
- package/src/invoicing/contracts/companyLookup.ts +13 -0
- package/src/invoicing/contracts/delivery.ts +24 -0
- package/src/invoicing/contracts/facts.ts +60 -0
- package/src/invoicing/contracts/host.ts +85 -0
- package/src/invoicing/contracts/index.ts +16 -0
- package/src/invoicing/contracts/provider.ts +78 -0
- package/src/invoicing/contracts/settlement.ts +39 -0
- package/src/invoicing/contracts/store.ts +98 -0
- package/src/invoicing/index.ts +1 -0
- package/src/subscriptions/automaticRenewal.ts +87 -0
- package/src/subscriptions/automaticRenewalExecution.ts +39 -0
- package/src/subscriptions/contracts/commands.ts +46 -0
- package/src/subscriptions/contracts/dunning.ts +48 -0
- package/src/subscriptions/contracts/index.ts +6 -0
- package/src/subscriptions/contracts/messages.ts +18 -0
- package/src/subscriptions/contracts/renewal.ts +325 -0
- package/src/subscriptions/contracts/stockWait.ts +34 -0
- package/src/subscriptions/index.ts +24 -0
- package/src/subscriptions/paymentOutcomes.ts +23 -0
- package/src/subscriptions/postgresRenewalStore.ts +76 -0
- package/src/subscriptions/postgresRetryStore.ts +174 -0
- package/src/subscriptions/renewalCycleFailureMechanism.ts +119 -0
- package/src/subscriptions/renewalCycleMechanism.ts +225 -0
- package/src/subscriptions/renewalCycleRefusalMechanism.ts +215 -0
- package/src/subscriptions/renewalIdentity.ts +5 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export interface DunningCaseOpenInput {
|
|
2
|
+
idempotencyKey: string;
|
|
3
|
+
subscriptionId: string;
|
|
4
|
+
cycleId: string | null;
|
|
5
|
+
clientId: string;
|
|
6
|
+
retryAttempt: number;
|
|
7
|
+
nextRetryAt: string | null;
|
|
8
|
+
failureClass: string | null;
|
|
9
|
+
failureReason: string | null;
|
|
10
|
+
occurredAt: string;
|
|
11
|
+
amountMinor: number | null;
|
|
12
|
+
currency: string | null;
|
|
13
|
+
templateSlug: string;
|
|
14
|
+
recoveryUrlPath: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface DunningCaseOpened {
|
|
17
|
+
caseId: string;
|
|
18
|
+
caseStatus: string;
|
|
19
|
+
replayed: boolean;
|
|
20
|
+
notificationId: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface DunningCaseAdvanced {
|
|
23
|
+
caseId: string;
|
|
24
|
+
caseStatus: string;
|
|
25
|
+
notificationId: string | null;
|
|
26
|
+
retryAttempt: number | null;
|
|
27
|
+
paused: false;
|
|
28
|
+
pauseWindowId: null;
|
|
29
|
+
terminal: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type DunningRefusalCode = "case_not_open" | "recoverable_order_unavailable";
|
|
32
|
+
export interface DunningCaseLifecyclePort {
|
|
33
|
+
openCase(input: DunningCaseOpenInput): Promise<DunningCaseOpened>;
|
|
34
|
+
recordFailedAttempt(input: {
|
|
35
|
+
caseId: string;
|
|
36
|
+
occurredAt: string;
|
|
37
|
+
failureClass: string | null;
|
|
38
|
+
failureReason: string | null;
|
|
39
|
+
retryAttempt: number;
|
|
40
|
+
nextRetryAt: string | null;
|
|
41
|
+
templateSlug: string;
|
|
42
|
+
recoveryUrlPath: string | null;
|
|
43
|
+
}): Promise<DunningCaseAdvanced>;
|
|
44
|
+
recordRecovery(input: {
|
|
45
|
+
caseId: string;
|
|
46
|
+
recoveredAt: string;
|
|
47
|
+
templateSlug: string;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
outcome: "recovered";
|
|
50
|
+
caseId: string;
|
|
51
|
+
caseStatus: string;
|
|
52
|
+
replayed: boolean;
|
|
53
|
+
notificationId: string | null;
|
|
54
|
+
} | {
|
|
55
|
+
outcome: "refused";
|
|
56
|
+
caseId: string;
|
|
57
|
+
caseStatus: string;
|
|
58
|
+
refusalCode: DunningRefusalCode;
|
|
59
|
+
}>;
|
|
60
|
+
issueRecoveryLink(input: {
|
|
61
|
+
caseId: string;
|
|
62
|
+
tokenHash: string;
|
|
63
|
+
expiresAt: string;
|
|
64
|
+
}): Promise<{
|
|
65
|
+
outcome: "issued";
|
|
66
|
+
orderId: string;
|
|
67
|
+
} | {
|
|
68
|
+
outcome: "refused";
|
|
69
|
+
refusalCode: DunningRefusalCode;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
export interface RenewalRetryState {
|
|
73
|
+
rowPresent: boolean;
|
|
74
|
+
retryAttempt: number | null;
|
|
75
|
+
nextRetryAt: string | null;
|
|
76
|
+
}
|
|
77
|
+
export interface RenewalRetryObligation {
|
|
78
|
+
operationId: string;
|
|
79
|
+
subscriptionId: string;
|
|
80
|
+
cycleId: string;
|
|
81
|
+
orderId: string;
|
|
82
|
+
settlementIntentId: string;
|
|
83
|
+
logicalCycleNumber: number;
|
|
84
|
+
nativeRenewalCounter: number;
|
|
85
|
+
retryAttempt: number;
|
|
86
|
+
externalAttemptSequence: number;
|
|
87
|
+
nextRetryAt: string | null;
|
|
88
|
+
failureClass: string | null;
|
|
89
|
+
failureReason: string | null;
|
|
90
|
+
occurredAt: string;
|
|
91
|
+
identityKey: string;
|
|
92
|
+
requestFingerprint: string;
|
|
93
|
+
disposition: "retry_scheduled" | "payment_failed" | "paid";
|
|
94
|
+
}
|
|
95
|
+
export interface RenewalRecoveryAuthorization {
|
|
96
|
+
tokenId: string;
|
|
97
|
+
tokenHash: string;
|
|
98
|
+
caseId: string;
|
|
99
|
+
clientId: string;
|
|
100
|
+
authUserId: string | null;
|
|
101
|
+
subscriptionId: string;
|
|
102
|
+
cycleId: string;
|
|
103
|
+
orderId: string;
|
|
104
|
+
payerAccountRef: string | null;
|
|
105
|
+
purpose: "repair_payment" | "resume_subscription";
|
|
106
|
+
retryAttempt: number;
|
|
107
|
+
paymentMethodRef: string;
|
|
108
|
+
paymentMethodKind: string;
|
|
109
|
+
expiresAt: string;
|
|
110
|
+
usedAt: string | null;
|
|
111
|
+
revokedAt: string | null;
|
|
112
|
+
requestedAt: string;
|
|
113
|
+
}
|
|
114
|
+
export interface RenewalFailureHandoffPort {
|
|
115
|
+
handoffFailure(input: {
|
|
116
|
+
idempotencyKey: string;
|
|
117
|
+
subscriptionId: string;
|
|
118
|
+
clientId: string;
|
|
119
|
+
cycleId: string;
|
|
120
|
+
orderId: string;
|
|
121
|
+
paymentIntentId: string;
|
|
122
|
+
retryAttempt: number;
|
|
123
|
+
failureClass: string;
|
|
124
|
+
failureReason: string;
|
|
125
|
+
nextRetryAt: string | null;
|
|
126
|
+
occurredAt: string;
|
|
127
|
+
amountMinor: number | null;
|
|
128
|
+
currency: string | null;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
caseId: string | null;
|
|
131
|
+
replayed: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { RenewalSchedule, RenewalIdentity, RenewalAdmission, RenewalLine, RenewalCycleCorrelation, RenewalTemplateSnapshot, RenewalPricingSnapshot, RenewalOrderSnapshot, RenewalFrozenSnapshot, RenewalDue, RenewalOperationState, RenewalReadback, RenewalPaymentEvidence, RenewalTransactionUnits, RenewalReservationResult, RenewalPreparedSettlement, RenewalStorePort, RenewalSettlementPort, RenewalExecutionRequest, RenewalPaymentRail, RenewalResult } from "./renewal.js";
|
|
2
|
+
export type { DunningCaseOpenInput, DunningCaseOpened, DunningCaseAdvanced, DunningRefusalCode, DunningCaseLifecyclePort, RenewalRetryState, RenewalRetryObligation, RenewalRecoveryAuthorization, RenewalFailureHandoffPort } from "./dunning.js";
|
|
3
|
+
export type { StockWaitRecoveryBinding, StockWaitDeficit, StockWaitCase, StockWaitStorePort } from "./stockWait.js";
|
|
4
|
+
export type { SubscriptionCommandContext, SubscriptionCommand, SubscriptionBundleLine, SubscriptionCommandReceipt, SubscriptionUnsupportedCode, SubscriptionUnsupported, SubscriptionCapabilities, SubscriptionCommandPort, SubscriptionActivationPort } from "./commands.js";
|
|
5
|
+
export type { SubscriptionLifecycleFact, SubscriptionLifecycleMessageDescriptor, SubscriptionLifecycleMessagePort } from "./messages.js";
|
|
6
|
+
export type { SubscriptionRenewalOutcome, HostedRenewalDue, SubscriptionRenewalChargeResult, SubscriptionCycleSnapshotResult, SubscriptionCycleOrderInput, SubscriptionCycleOrderResult, SubscriptionReservationPreflightResult, SubscriptionRenewalPersistencePort, FailurePropagationKind, FailurePropagationContext, CycleRetryState, DunningCaseOpenOutcome, CycleChargeFailurePropagationPort, FailurePropagationResult, RenewalPrepareInput, RenewalAttemptResult, RenewalIntentResult, RenewalPaymentPort, RenewalExecutionPort, RenewalDeliveryAdmission, RenewalAllowedAdmission, RenewalDeliveryClient, RenewalFailureDeps, RenewalPreflightDeps, RenewalCycleDeps, RenewalExecutionContext, RenewalOutcomeContext, RenewalReplayContext, RenewalPreparedAttemptPrepareInput, RenewalPreparedAttemptPersistenceResult, RenewalPreparedAttemptFinalizeInput, RenewalPreparedAttemptPersistencePort } from "./renewal.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type SubscriptionLifecycleFact = {
|
|
2
|
+
factId: string;
|
|
3
|
+
idempotencyKey: string;
|
|
4
|
+
subscriptionId: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
cycleId: string | null;
|
|
7
|
+
caseId: string | null;
|
|
8
|
+
orderId: string | null;
|
|
9
|
+
occurredAt: string;
|
|
10
|
+
firstRecordedAt: string;
|
|
11
|
+
} & ({
|
|
12
|
+
kind: "payment_failed" | "payment_expired";
|
|
13
|
+
retryAttempt: number;
|
|
14
|
+
nextRetryAt: string | null;
|
|
15
|
+
failureClass: string | null;
|
|
16
|
+
amountMinor: number | null;
|
|
17
|
+
currency: string | null;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "payment_recovered";
|
|
20
|
+
paymentEvidenceRef: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "stock_wait_started" | "stock_wait_resumed";
|
|
23
|
+
frozenFingerprint: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "winback_eligible";
|
|
26
|
+
cancelledAt: string;
|
|
27
|
+
paymentMethodRef: string;
|
|
28
|
+
});
|
|
29
|
+
/** M04 receives a descriptor; host owns copy, recipient, consent and transport. */
|
|
30
|
+
export interface SubscriptionLifecycleMessageDescriptor {
|
|
31
|
+
fact: SubscriptionLifecycleFact;
|
|
32
|
+
messageKey: string;
|
|
33
|
+
templateSlug: string;
|
|
34
|
+
recipientRef: string;
|
|
35
|
+
locale: string;
|
|
36
|
+
recoveryUrlPath: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface SubscriptionLifecycleMessagePort {
|
|
39
|
+
enqueue(descriptor: SubscriptionLifecycleMessageDescriptor): Promise<{
|
|
40
|
+
notificationId: string;
|
|
41
|
+
replayed: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|