@openlup/core 0.0.0 → 0.7.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 +225 -0
- package/CODE_OF_CONDUCT.md +39 -0
- package/CONTRIBUTING.md +34 -0
- package/LICENSE +204 -0
- package/MAINTAINERS.md +33 -0
- package/README.md +85 -3
- package/SECURITY.md +29 -0
- package/dist/bundle/contracts.d.ts +9 -0
- package/dist/bundle/contracts.js +1 -0
- package/dist/bundle/ports.d.ts +41 -0
- package/dist/bundle/ports.js +1 -0
- package/dist/catalog/identifiers.d.ts +31 -0
- package/dist/catalog/identifiers.js +46 -0
- package/dist/catalog/index.d.ts +2 -0
- package/dist/catalog/index.js +2 -0
- package/dist/checkout/idempotency.d.ts +29 -0
- package/dist/checkout/idempotency.js +37 -0
- package/dist/checkout/index.d.ts +2 -0
- package/dist/checkout/index.js +2 -0
- package/dist/company-identity/contracts.d.ts +220 -0
- package/dist/company-identity/contracts.js +167 -0
- package/dist/company-identity/index.d.ts +6 -0
- package/dist/company-identity/index.js +2 -0
- package/dist/company-identity/ports.d.ts +13 -0
- package/dist/company-identity/ports.js +1 -0
- package/dist/fulfillment/facts.d.ts +103 -0
- package/dist/fulfillment/facts.js +195 -0
- package/dist/fulfillment/index.d.ts +4 -0
- package/dist/fulfillment/index.js +2 -0
- package/dist/inventory/atp.d.ts +172 -0
- package/dist/inventory/atp.js +211 -0
- package/dist/inventory/index.d.ts +2 -0
- package/dist/inventory/index.js +2 -0
- package/dist/marketing/research/contracts.d.ts +75 -0
- package/dist/marketing/research/contracts.js +60 -0
- package/dist/marketing/research/index.d.ts +4 -0
- package/dist/marketing/research/index.js +4 -0
- package/dist/marketing/research/ports.d.ts +15 -0
- package/dist/marketing/research/ports.js +1 -0
- package/dist/partners/index.d.ts +4 -0
- package/dist/partners/index.js +4 -0
- package/dist/partners/ports.d.ts +12 -0
- package/dist/partners/ports.js +1 -0
- package/dist/partners/status.d.ts +48 -0
- package/dist/partners/status.js +35 -0
- package/dist/payment/executionBaseContracts.d.ts +81 -0
- package/dist/payment/executionBaseContracts.js +8 -0
- package/dist/payment/index.d.ts +36 -0
- package/dist/payment/index.js +18 -0
- package/dist/payment/methodLifecycle.d.ts +91 -0
- package/dist/payment/methodLifecycle.js +76 -0
- package/dist/payment/paymentControlTypes.d.ts +135 -0
- package/dist/payment/paymentControlTypes.js +110 -0
- package/dist/payment/paymentFailureTaxonomy.d.ts +80 -0
- package/dist/payment/paymentFailureTaxonomy.js +155 -0
- package/dist/payment/paymentFailureTaxonomyContracts.d.ts +106 -0
- package/dist/payment/paymentFailureTaxonomyContracts.js +177 -0
- package/dist/payment/paymentRecovery.d.ts +26 -0
- package/dist/payment/paymentRecovery.js +73 -0
- package/dist/payment/paymentRecoveryContracts.d.ts +53 -0
- package/dist/payment/paymentRecoveryContracts.js +10 -0
- package/dist/payment/paymentStateMachine.d.ts +28 -0
- package/dist/payment/paymentStateMachine.js +184 -0
- package/dist/payment/providerAttemptIdempotency.d.ts +23 -0
- package/dist/payment/providerAttemptIdempotency.js +31 -0
- package/dist/payment/providerCapability.d.ts +148 -0
- package/dist/payment/providerCapability.js +13 -0
- package/dist/platform-runtime/contracts.d.ts +9 -0
- package/dist/platform-runtime/contracts.js +13 -0
- package/dist/platform-runtime/index.d.ts +10 -0
- package/dist/platform-runtime/index.js +4 -0
- package/dist/platform-runtime/platformKernel.d.ts +44 -0
- package/dist/platform-runtime/platformKernel.js +39 -0
- package/dist/platform-runtime/ports.d.ts +100 -0
- package/dist/platform-runtime/ports.js +1 -0
- package/dist/pricing/index.d.ts +8 -0
- package/dist/pricing/index.js +8 -0
- package/dist/pricing/ports.d.ts +22 -0
- package/dist/pricing/ports.js +7 -0
- package/dist/pricing/pricingBreakdown.d.ts +86 -0
- package/dist/pricing/pricingBreakdown.js +155 -0
- package/dist/pricing/targetPriceAllocation.d.ts +97 -0
- package/dist/pricing/targetPriceAllocation.js +202 -0
- package/dist/pricing/types.d.ts +32 -0
- package/dist/pricing/types.js +4 -0
- package/dist/promo/adjustmentEngine.d.ts +4 -0
- package/dist/promo/adjustmentEngine.js +194 -0
- package/dist/promo/adjustmentTypes.d.ts +103 -0
- package/dist/promo/adjustmentTypes.js +13 -0
- package/dist/promo/index.d.ts +8 -0
- package/dist/promo/index.js +8 -0
- package/dist/promo/promoEvaluator.d.ts +25 -0
- package/dist/promo/promoEvaluator.js +135 -0
- package/dist/promo/types.d.ts +86 -0
- package/dist/promo/types.js +12 -0
- package/dist/risk/core/evaluator.d.ts +3 -0
- package/dist/risk/core/evaluator.js +32 -0
- package/dist/risk/core/rules.d.ts +3 -0
- package/dist/risk/core/rules.js +118 -0
- package/dist/risk/core/types.d.ts +65 -0
- package/dist/risk/core/types.js +1 -0
- package/dist/risk/index.d.ts +8 -0
- package/dist/risk/index.js +8 -0
- package/dist/risk/types.d.ts +32 -0
- package/dist/risk/types.js +43 -0
- package/dist/shipping/index.d.ts +4 -0
- package/dist/shipping/index.js +4 -0
- package/dist/shipping/shippingResolver.d.ts +26 -0
- package/dist/shipping/shippingResolver.js +88 -0
- package/dist/shipping/types.d.ts +45 -0
- package/dist/shipping/types.js +4 -0
- package/dist/subscription/cycleHardening.d.ts +95 -0
- package/dist/subscription/cycleHardening.js +118 -0
- package/dist/subscription/index.d.ts +14 -0
- package/dist/subscription/index.js +14 -0
- package/dist/subscription/subscriptionEngineCore.d.ts +13 -0
- package/dist/subscription/subscriptionEngineCore.js +145 -0
- package/dist/subscription/subscriptionEngineLifecycle.d.ts +150 -0
- package/dist/subscription/subscriptionEngineLifecycle.js +433 -0
- package/dist/subscription/subscriptionEnginePayment.d.ts +25 -0
- package/dist/subscription/subscriptionEnginePayment.js +127 -0
- package/dist/subscription/subscriptionEngineTypes.d.ts +94 -0
- package/dist/subscription/subscriptionEngineTypes.js +4 -0
- package/dist/subscription/subscriptionEngineUtils.d.ts +32 -0
- package/dist/subscription/subscriptionEngineUtils.js +74 -0
- package/dist/subscription/types.d.ts +58 -0
- package/dist/subscription/types.js +47 -0
- package/dist/testing.d.ts +48 -0
- package/dist/testing.js +105 -0
- package/package.json +215 -4
- package/release-gates.json +232 -0
- package/src/bundle/contracts.ts +15 -0
- package/src/bundle/ports.ts +32 -0
- package/src/catalog/identifiers.ts +50 -0
- package/src/catalog/index.ts +2 -0
- package/src/checkout/idempotency.ts +49 -0
- package/src/checkout/index.ts +2 -0
- package/src/company-identity/contracts.ts +208 -0
- package/src/company-identity/index.ts +28 -0
- package/src/company-identity/ports.ts +19 -0
- package/src/fulfillment/facts.ts +300 -0
- package/src/fulfillment/index.ts +34 -0
- package/src/inventory/atp.ts +249 -0
- package/src/inventory/index.ts +2 -0
- package/src/marketing/research/contracts.ts +91 -0
- package/src/marketing/research/index.ts +4 -0
- package/src/marketing/research/ports.ts +26 -0
- package/src/partners/index.ts +4 -0
- package/src/partners/ports.ts +18 -0
- package/src/partners/status.ts +49 -0
- package/src/payment/executionBaseContracts.ts +93 -0
- package/src/payment/index.ts +128 -0
- package/src/payment/methodLifecycle.ts +130 -0
- package/src/payment/paymentControlTypes.ts +197 -0
- package/src/payment/paymentFailureTaxonomy.ts +201 -0
- package/src/payment/paymentFailureTaxonomyContracts.ts +228 -0
- package/src/payment/paymentRecovery.ts +95 -0
- package/src/payment/paymentRecoveryContracts.ts +61 -0
- package/src/payment/paymentStateMachine.ts +263 -0
- package/src/payment/providerAttemptIdempotency.ts +57 -0
- package/src/payment/providerCapability.ts +172 -0
- package/src/platform-runtime/contracts.ts +33 -0
- package/src/platform-runtime/index.ts +36 -0
- package/src/platform-runtime/platformKernel.ts +86 -0
- package/src/platform-runtime/ports.ts +88 -0
- package/src/pricing/index.ts +8 -0
- package/src/pricing/ports.ts +27 -0
- package/src/pricing/pricingBreakdown.ts +243 -0
- package/src/pricing/targetPriceAllocation.ts +293 -0
- package/src/pricing/types.ts +36 -0
- package/src/promo/adjustmentEngine.ts +253 -0
- package/src/promo/adjustmentTypes.ts +94 -0
- package/src/promo/index.ts +8 -0
- package/src/promo/promoEvaluator.ts +137 -0
- package/src/promo/types.ts +97 -0
- package/src/risk/core/evaluator.ts +41 -0
- package/src/risk/core/rules.ts +128 -0
- package/src/risk/core/types.ts +73 -0
- package/src/risk/index.ts +8 -0
- package/src/risk/types.ts +60 -0
- package/src/shipping/index.ts +4 -0
- package/src/shipping/shippingResolver.ts +101 -0
- package/src/shipping/types.ts +49 -0
- package/src/subscription/cycleHardening.ts +174 -0
- package/src/subscription/index.ts +14 -0
- package/src/subscription/subscriptionEngineCore.ts +181 -0
- package/src/subscription/subscriptionEngineLifecycle.ts +574 -0
- package/src/subscription/subscriptionEnginePayment.ts +179 -0
- package/src/subscription/subscriptionEngineTypes.ts +114 -0
- package/src/subscription/subscriptionEngineUtils.ts +110 -0
- package/src/subscription/types.ts +104 -0
- package/src/testing.ts +169 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** @beta */
|
|
3
|
+
export const INVENTORY_CONTRACT_VERSION = "inventory.v0";
|
|
4
|
+
const uuidSchema = z.guid();
|
|
5
|
+
const datetimeSchema = z.string().datetime({ offset: true });
|
|
6
|
+
const quantitySchema = z.number().int().nonnegative();
|
|
7
|
+
const positiveQuantitySchema = z.number().int().positive();
|
|
8
|
+
/** @beta */
|
|
9
|
+
export const inventoryLocationKindSchema = z.enum([
|
|
10
|
+
"internal_warehouse",
|
|
11
|
+
"third_party_logistics",
|
|
12
|
+
"supplier",
|
|
13
|
+
"quarantine",
|
|
14
|
+
"virtual",
|
|
15
|
+
]);
|
|
16
|
+
/** @beta */
|
|
17
|
+
export const inventoryLocationStatusSchema = z.enum(["active", "inactive"]);
|
|
18
|
+
/** @beta */
|
|
19
|
+
export const inventoryLotStatusSchema = z.enum(["available", "quarantined", "expired", "recalled"]);
|
|
20
|
+
/** @beta */
|
|
21
|
+
export const inventoryAtpStatusSchema = z.enum(["fulfillable", "insufficient", "review_required", "unsupported"]);
|
|
22
|
+
/** @beta */
|
|
23
|
+
export const inventoryStockLineSchema = z.object({
|
|
24
|
+
skuId: uuidSchema,
|
|
25
|
+
sku: z.string().trim().min(1),
|
|
26
|
+
locationId: uuidSchema,
|
|
27
|
+
locationCode: z.string().trim().min(1),
|
|
28
|
+
locationKind: inventoryLocationKindSchema,
|
|
29
|
+
locationStatus: inventoryLocationStatusSchema,
|
|
30
|
+
fulfillable: z.boolean(),
|
|
31
|
+
lotId: uuidSchema.nullable(),
|
|
32
|
+
lotCode: z.string().trim().min(1).nullable(),
|
|
33
|
+
lotStatus: inventoryLotStatusSchema.nullable(),
|
|
34
|
+
expiresAt: datetimeSchema.nullable(),
|
|
35
|
+
onHand: quantitySchema,
|
|
36
|
+
reserved: quantitySchema,
|
|
37
|
+
unavailable: quantitySchema,
|
|
38
|
+
incoming: quantitySchema,
|
|
39
|
+
safetyStock: quantitySchema,
|
|
40
|
+
}).strict();
|
|
41
|
+
/** @beta */
|
|
42
|
+
export const inventoryAtpRequestLineSchema = z.object({
|
|
43
|
+
skuId: uuidSchema,
|
|
44
|
+
sku: z.string().trim().min(1),
|
|
45
|
+
quantity: positiveQuantitySchema,
|
|
46
|
+
}).strict();
|
|
47
|
+
/** @beta */
|
|
48
|
+
export const inventoryAtpRequestSchema = z.object({
|
|
49
|
+
contractVersion: z.literal(INVENTORY_CONTRACT_VERSION),
|
|
50
|
+
lines: z.array(inventoryAtpRequestLineSchema).min(1),
|
|
51
|
+
requestedAt: datetimeSchema,
|
|
52
|
+
orderMode: z.enum(["one_time", "subscription_cycle"]),
|
|
53
|
+
region: z.string().trim().min(2).max(32).optional(),
|
|
54
|
+
noSplitShipment: z.boolean().default(true),
|
|
55
|
+
minShelfLifeDays: z.number().int().min(0).max(730).default(0),
|
|
56
|
+
}).strict();
|
|
57
|
+
/** @beta */
|
|
58
|
+
export const inventoryAllocationSchema = z.object({
|
|
59
|
+
skuId: uuidSchema,
|
|
60
|
+
sku: z.string().trim().min(1),
|
|
61
|
+
locationId: uuidSchema,
|
|
62
|
+
locationCode: z.string().trim().min(1),
|
|
63
|
+
lotId: uuidSchema.nullable(),
|
|
64
|
+
lotCode: z.string().trim().min(1).nullable(),
|
|
65
|
+
quantity: positiveQuantitySchema,
|
|
66
|
+
expiresAt: datetimeSchema.nullable(),
|
|
67
|
+
}).strict();
|
|
68
|
+
/** @beta */
|
|
69
|
+
export const inventoryAtpLineResultSchema = z.object({
|
|
70
|
+
skuId: uuidSchema,
|
|
71
|
+
sku: z.string().trim().min(1),
|
|
72
|
+
requestedQuantity: positiveQuantitySchema,
|
|
73
|
+
availableQuantity: quantitySchema,
|
|
74
|
+
missingQuantity: quantitySchema,
|
|
75
|
+
status: inventoryAtpStatusSchema,
|
|
76
|
+
allocations: z.array(inventoryAllocationSchema),
|
|
77
|
+
}).strict();
|
|
78
|
+
/** @beta */
|
|
79
|
+
export const inventoryAtpResultSchema = z.object({
|
|
80
|
+
contractVersion: inventoryAtpRequestSchema.shape.contractVersion,
|
|
81
|
+
status: inventoryAtpStatusSchema,
|
|
82
|
+
reason: z.string().trim().min(1).nullable(),
|
|
83
|
+
locationId: uuidSchema.nullable(),
|
|
84
|
+
locationCode: z.string().trim().min(1).nullable(),
|
|
85
|
+
lines: z.array(inventoryAtpLineResultSchema),
|
|
86
|
+
}).strict();
|
|
87
|
+
/** @beta */
|
|
88
|
+
export function availableNow(line) {
|
|
89
|
+
return Math.max(0, line.onHand - line.reserved - line.unavailable - line.safetyStock);
|
|
90
|
+
}
|
|
91
|
+
/** @beta */
|
|
92
|
+
export function calculateInventoryAtp(input) {
|
|
93
|
+
if (input.request.noSplitShipment === false) {
|
|
94
|
+
return inventoryAtpResultSchema.parse({
|
|
95
|
+
contractVersion: INVENTORY_CONTRACT_VERSION,
|
|
96
|
+
status: "unsupported",
|
|
97
|
+
reason: "split_shipment_unsupported",
|
|
98
|
+
locationId: null,
|
|
99
|
+
locationCode: null,
|
|
100
|
+
lines: input.request.lines.map((line) => ({
|
|
101
|
+
skuId: line.skuId,
|
|
102
|
+
sku: line.sku,
|
|
103
|
+
requestedQuantity: line.quantity,
|
|
104
|
+
availableQuantity: 0,
|
|
105
|
+
missingQuantity: line.quantity,
|
|
106
|
+
status: "unsupported",
|
|
107
|
+
allocations: [],
|
|
108
|
+
})),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const usableStock = input.stock.filter((line) => isUsable(line, input.request.requestedAt, input.request.minShelfLifeDays ?? 0));
|
|
112
|
+
const locationIds = [...new Set(usableStock.map((line) => line.locationId))];
|
|
113
|
+
const preferredLocation = locationIds
|
|
114
|
+
.map((locationId) => allocationForLocation(input.request, usableStock, locationId))
|
|
115
|
+
.find((candidate) => candidate.status === "fulfillable");
|
|
116
|
+
if (preferredLocation) {
|
|
117
|
+
return inventoryAtpResultSchema.parse({
|
|
118
|
+
contractVersion: INVENTORY_CONTRACT_VERSION,
|
|
119
|
+
status: "fulfillable",
|
|
120
|
+
reason: null,
|
|
121
|
+
locationId: preferredLocation.locationId,
|
|
122
|
+
locationCode: preferredLocation.locationCode,
|
|
123
|
+
lines: preferredLocation.lines,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const lines = input.request.lines.map((requestLine) => {
|
|
127
|
+
const matching = usableStock.filter((line) => line.skuId === requestLine.skuId);
|
|
128
|
+
const availableQuantity = matching.reduce((sum, line) => sum + availableNow(line), 0);
|
|
129
|
+
return {
|
|
130
|
+
skuId: requestLine.skuId,
|
|
131
|
+
sku: requestLine.sku,
|
|
132
|
+
requestedQuantity: requestLine.quantity,
|
|
133
|
+
availableQuantity,
|
|
134
|
+
missingQuantity: Math.max(0, requestLine.quantity - availableQuantity),
|
|
135
|
+
status: availableQuantity >= requestLine.quantity ? "review_required" : "insufficient",
|
|
136
|
+
allocations: [],
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
const hasEnoughInAggregate = lines.every((line) => line.missingQuantity === 0);
|
|
140
|
+
return inventoryAtpResultSchema.parse({
|
|
141
|
+
contractVersion: INVENTORY_CONTRACT_VERSION,
|
|
142
|
+
status: hasEnoughInAggregate ? "review_required" : "insufficient",
|
|
143
|
+
reason: hasEnoughInAggregate
|
|
144
|
+
? "stock_available_only_with_split_shipment"
|
|
145
|
+
: "insufficient_available_stock",
|
|
146
|
+
locationId: null,
|
|
147
|
+
locationCode: null,
|
|
148
|
+
lines,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function allocationForLocation(request, stock, locationId) {
|
|
152
|
+
const locationStock = stock.filter((line) => line.locationId === locationId);
|
|
153
|
+
const locationCode = locationStock[0]?.locationCode ?? null;
|
|
154
|
+
const lines = request.lines.map((requestLine) => {
|
|
155
|
+
let remaining = requestLine.quantity;
|
|
156
|
+
const allocations = locationStock
|
|
157
|
+
.filter((line) => line.skuId === requestLine.skuId && availableNow(line) > 0)
|
|
158
|
+
.sort(fefoSort)
|
|
159
|
+
.flatMap((line) => {
|
|
160
|
+
if (remaining <= 0)
|
|
161
|
+
return [];
|
|
162
|
+
const quantity = Math.min(remaining, availableNow(line));
|
|
163
|
+
remaining -= quantity;
|
|
164
|
+
return [{
|
|
165
|
+
skuId: requestLine.skuId,
|
|
166
|
+
sku: requestLine.sku,
|
|
167
|
+
locationId: line.locationId,
|
|
168
|
+
locationCode: line.locationCode,
|
|
169
|
+
lotId: line.lotId,
|
|
170
|
+
lotCode: line.lotCode,
|
|
171
|
+
quantity,
|
|
172
|
+
expiresAt: line.expiresAt,
|
|
173
|
+
}];
|
|
174
|
+
});
|
|
175
|
+
return {
|
|
176
|
+
skuId: requestLine.skuId,
|
|
177
|
+
sku: requestLine.sku,
|
|
178
|
+
requestedQuantity: requestLine.quantity,
|
|
179
|
+
availableQuantity: requestLine.quantity - remaining,
|
|
180
|
+
missingQuantity: remaining,
|
|
181
|
+
status: remaining === 0 ? "fulfillable" : "insufficient",
|
|
182
|
+
allocations,
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
status: lines.every((line) => line.status === "fulfillable") ? "fulfillable" : "insufficient",
|
|
187
|
+
locationId,
|
|
188
|
+
locationCode,
|
|
189
|
+
lines,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function isUsable(line, requestedAt, minShelfLifeDays) {
|
|
193
|
+
if (!line.fulfillable || line.locationStatus !== "active")
|
|
194
|
+
return false;
|
|
195
|
+
if (line.lotStatus && line.lotStatus !== "available")
|
|
196
|
+
return false;
|
|
197
|
+
if (line.expiresAt && Date.parse(line.expiresAt) <= minAcceptableExpiry(requestedAt, minShelfLifeDays)) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return availableNow(line) > 0;
|
|
201
|
+
}
|
|
202
|
+
function minAcceptableExpiry(requestedAt, minShelfLifeDays) {
|
|
203
|
+
return Date.parse(requestedAt) + minShelfLifeDays * 24 * 60 * 60 * 1000;
|
|
204
|
+
}
|
|
205
|
+
function fefoSort(a, b) {
|
|
206
|
+
const aExpiry = a.expiresAt ? Date.parse(a.expiresAt) : Number.POSITIVE_INFINITY;
|
|
207
|
+
const bExpiry = b.expiresAt ? Date.parse(b.expiresAt) : Number.POSITIVE_INFINITY;
|
|
208
|
+
if (aExpiry !== bExpiry)
|
|
209
|
+
return aExpiry - bExpiry;
|
|
210
|
+
return a.locationCode.localeCompare(b.locationCode) || (a.lotCode ?? "").localeCompare(b.lotCode ?? "");
|
|
211
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** @beta */
|
|
3
|
+
export type MarketingResearchJson = string | number | boolean | null | {
|
|
4
|
+
[key: string]: MarketingResearchJson | undefined;
|
|
5
|
+
} | MarketingResearchJson[];
|
|
6
|
+
/** @beta */
|
|
7
|
+
export declare const marketingResearchJsonSchema: z.ZodCustom<MarketingResearchJson, MarketingResearchJson>;
|
|
8
|
+
/** @beta */
|
|
9
|
+
export declare const researchSurveyTypeSchema: z.ZodEnum<{
|
|
10
|
+
producer: "producer";
|
|
11
|
+
consumer: "consumer";
|
|
12
|
+
}>;
|
|
13
|
+
/** @beta */
|
|
14
|
+
export declare const adminSurveyResponsesRequestSchema: z.ZodPipe<z.ZodObject<{
|
|
15
|
+
surveyType: z.ZodEnum<{
|
|
16
|
+
producer: "producer";
|
|
17
|
+
consumer: "consumer";
|
|
18
|
+
}>;
|
|
19
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
20
|
+
pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
21
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
22
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
23
|
+
pageSize: number;
|
|
24
|
+
surveyType: "producer" | "consumer";
|
|
25
|
+
page: number;
|
|
26
|
+
}, {
|
|
27
|
+
surveyType: "producer" | "consumer";
|
|
28
|
+
page: number;
|
|
29
|
+
pageSize?: number | undefined;
|
|
30
|
+
limit?: number | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
/** @beta */
|
|
33
|
+
export declare const adminSurveyResponseRowSchema: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
created_at: z.ZodString;
|
|
36
|
+
response_data: z.ZodCustom<MarketingResearchJson, MarketingResearchJson>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
/** @beta */
|
|
39
|
+
export declare const adminSurveyResponsesResponseSchema: z.ZodObject<{
|
|
40
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
created_at: z.ZodString;
|
|
43
|
+
response_data: z.ZodCustom<MarketingResearchJson, MarketingResearchJson>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
totalCount: z.ZodNumber;
|
|
46
|
+
page: z.ZodNumber;
|
|
47
|
+
pageSize: z.ZodNumber;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/** @beta */
|
|
50
|
+
export declare const researchSurveySubmitRequestSchema: z.ZodObject<{
|
|
51
|
+
surveyType: z.ZodEnum<{
|
|
52
|
+
producer: "producer";
|
|
53
|
+
consumer: "consumer";
|
|
54
|
+
}>;
|
|
55
|
+
responseData: z.ZodRecord<z.ZodString, z.ZodCustom<MarketingResearchJson, MarketingResearchJson>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
/** @beta */
|
|
58
|
+
export declare const researchSurveySubmitResponseSchema: z.ZodObject<{
|
|
59
|
+
ok: z.ZodBoolean;
|
|
60
|
+
id: z.ZodOptional<z.ZodString>;
|
|
61
|
+
error: z.ZodOptional<z.ZodString>;
|
|
62
|
+
email_skipped: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
/** @beta */
|
|
65
|
+
export type ResearchSurveyType = z.infer<typeof researchSurveyTypeSchema>;
|
|
66
|
+
/** @beta */
|
|
67
|
+
export type AdminSurveyResponsesRequest = z.infer<typeof adminSurveyResponsesRequestSchema>;
|
|
68
|
+
/** @beta */
|
|
69
|
+
export type AdminSurveyResponseRow = z.infer<typeof adminSurveyResponseRowSchema>;
|
|
70
|
+
/** @beta */
|
|
71
|
+
export type AdminSurveyResponsesResponse = z.infer<typeof adminSurveyResponsesResponseSchema>;
|
|
72
|
+
/** @beta */
|
|
73
|
+
export type ResearchSurveySubmitRequest = z.infer<typeof researchSurveySubmitRequestSchema>;
|
|
74
|
+
/** @beta */
|
|
75
|
+
export type ResearchSurveySubmitResponse = z.infer<typeof researchSurveySubmitResponseSchema>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** @beta */
|
|
3
|
+
export const marketingResearchJsonSchema = z.custom(isMarketingResearchJson, { message: "Expected JSON value" });
|
|
4
|
+
/** @beta */
|
|
5
|
+
export const researchSurveyTypeSchema = z.enum(["producer", "consumer"]);
|
|
6
|
+
/** @beta */
|
|
7
|
+
export const adminSurveyResponsesRequestSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
surveyType: researchSurveyTypeSchema,
|
|
10
|
+
page: z.coerce.number().int().nonnegative().default(0),
|
|
11
|
+
pageSize: z.coerce.number().int().min(1).max(100).optional(),
|
|
12
|
+
limit: z.coerce.number().int().min(1).max(500).optional(),
|
|
13
|
+
})
|
|
14
|
+
.transform(({ limit, pageSize, ...request }) => ({
|
|
15
|
+
...request,
|
|
16
|
+
pageSize: pageSize ?? Math.min(limit ?? 50, 100),
|
|
17
|
+
}));
|
|
18
|
+
/** @beta */
|
|
19
|
+
export const adminSurveyResponseRowSchema = z.object({
|
|
20
|
+
id: z.string().min(1),
|
|
21
|
+
created_at: z.string().min(1),
|
|
22
|
+
response_data: marketingResearchJsonSchema,
|
|
23
|
+
});
|
|
24
|
+
/** @beta */
|
|
25
|
+
export const adminSurveyResponsesResponseSchema = z.object({
|
|
26
|
+
rows: z.array(adminSurveyResponseRowSchema),
|
|
27
|
+
totalCount: z.number().int().nonnegative(),
|
|
28
|
+
page: z.number().int().nonnegative(),
|
|
29
|
+
pageSize: z.number().int().positive(),
|
|
30
|
+
});
|
|
31
|
+
/** @beta */
|
|
32
|
+
export const researchSurveySubmitRequestSchema = z
|
|
33
|
+
.object({
|
|
34
|
+
surveyType: researchSurveyTypeSchema,
|
|
35
|
+
responseData: z.record(z.string(), marketingResearchJsonSchema),
|
|
36
|
+
})
|
|
37
|
+
.refine((request) => Object.keys(request.responseData).length > 0, {
|
|
38
|
+
message: "responseData must not be empty",
|
|
39
|
+
path: ["responseData"],
|
|
40
|
+
});
|
|
41
|
+
/** @beta */
|
|
42
|
+
export const researchSurveySubmitResponseSchema = z.object({
|
|
43
|
+
ok: z.boolean(),
|
|
44
|
+
id: z.string().min(1).optional(),
|
|
45
|
+
error: z.string().optional(),
|
|
46
|
+
email_skipped: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
function isMarketingResearchJson(value) {
|
|
49
|
+
if (value === null)
|
|
50
|
+
return true;
|
|
51
|
+
if (typeof value === "string" || typeof value === "boolean")
|
|
52
|
+
return true;
|
|
53
|
+
if (typeof value === "number")
|
|
54
|
+
return Number.isFinite(value);
|
|
55
|
+
if (Array.isArray(value))
|
|
56
|
+
return value.every(isMarketingResearchJson);
|
|
57
|
+
if (typeof value !== "object")
|
|
58
|
+
return false;
|
|
59
|
+
return Object.values(value).every((entry) => entry === undefined || isMarketingResearchJson(entry));
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AdminSurveyResponsesRequest, AdminSurveyResponsesResponse, ResearchSurveySubmitRequest, ResearchSurveySubmitResponse } from "./contracts.js";
|
|
2
|
+
/** @beta */
|
|
3
|
+
export interface MarketingResearchSurveyResponsesReadPort {
|
|
4
|
+
getAdminSurveyResponses(request: AdminSurveyResponsesRequest): Promise<AdminSurveyResponsesResponse>;
|
|
5
|
+
}
|
|
6
|
+
/** @beta */
|
|
7
|
+
export interface MarketingResearchSurveyRequestHeaders {
|
|
8
|
+
forEach(callbackfn: (value: string, key: string) => void): void;
|
|
9
|
+
}
|
|
10
|
+
/** @beta */
|
|
11
|
+
export interface MarketingResearchSurveySubmitPort {
|
|
12
|
+
submitSurveyResponse(request: ResearchSurveySubmitRequest, context?: {
|
|
13
|
+
headers?: MarketingResearchSurveyRequestHeaders;
|
|
14
|
+
}): Promise<ResearchSurveySubmitResponse>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PartnersB2BInquiryStatusUpdateRequest, PartnersB2BInquiryStatusUpdateResponse } from "./status.js";
|
|
2
|
+
/**
|
|
3
|
+
* Persistence seam for advancing a B2B inquiry's pipeline status. The host
|
|
4
|
+
* application supplies the adapter (e.g. a DB-backed store, a CRM bridge); the
|
|
5
|
+
* core only owns this contract, not where inquiries are stored. Implementations
|
|
6
|
+
* should reject (throw) when the inquiry does not exist or the transition is
|
|
7
|
+
* not allowed, rather than resolving with a non-updated result.
|
|
8
|
+
*/
|
|
9
|
+
/** @beta */
|
|
10
|
+
export interface PartnersB2BInquiryStatusUpdatePort {
|
|
11
|
+
updateB2BInquiryStatus(request: PartnersB2BInquiryStatusUpdateRequest): Promise<PartnersB2BInquiryStatusUpdateResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle stage of a B2B / partner inquiry as it moves through a sales
|
|
4
|
+
* pipeline. Neutral, provider-agnostic vocabulary:
|
|
5
|
+
* - `new` — just received, not yet triaged;
|
|
6
|
+
* - `contacted` — outreach made, awaiting response;
|
|
7
|
+
* - `qualified` — a real, in-scope opportunity;
|
|
8
|
+
* - `disqualified` — not a fit (out of scope / spam / no intent);
|
|
9
|
+
* - `closed_won` — converted;
|
|
10
|
+
* - `closed_lost` — did not convert.
|
|
11
|
+
* The inquiry payload itself (contact details, CRM ids, PII) is NOT part of the
|
|
12
|
+
* core contract; it lives in the host application's downstream adapter.
|
|
13
|
+
*/
|
|
14
|
+
/** @beta */
|
|
15
|
+
export declare const partnersB2BInquiryStatusSchema: z.ZodEnum<{
|
|
16
|
+
new: "new";
|
|
17
|
+
contacted: "contacted";
|
|
18
|
+
qualified: "qualified";
|
|
19
|
+
disqualified: "disqualified";
|
|
20
|
+
closed_won: "closed_won";
|
|
21
|
+
closed_lost: "closed_lost";
|
|
22
|
+
}>;
|
|
23
|
+
/** Request to move one inquiry (`id`) to a new pipeline `status`. */
|
|
24
|
+
/** @beta */
|
|
25
|
+
export declare const partnersB2BInquiryStatusUpdateRequestSchema: z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
status: z.ZodEnum<{
|
|
28
|
+
new: "new";
|
|
29
|
+
contacted: "contacted";
|
|
30
|
+
qualified: "qualified";
|
|
31
|
+
disqualified: "disqualified";
|
|
32
|
+
closed_won: "closed_won";
|
|
33
|
+
closed_lost: "closed_lost";
|
|
34
|
+
}>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/** Successful status-update acknowledgement. `updated` is always `true`; a
|
|
37
|
+
* failed update is surfaced as a rejected promise / error by the port, not as
|
|
38
|
+
* `{ updated: false }`. */
|
|
39
|
+
/** @beta */
|
|
40
|
+
export declare const partnersB2BInquiryStatusUpdateResponseSchema: z.ZodObject<{
|
|
41
|
+
updated: z.ZodLiteral<true>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
/** @beta */
|
|
44
|
+
export type PartnersB2BInquiryStatus = z.infer<typeof partnersB2BInquiryStatusSchema>;
|
|
45
|
+
/** @beta */
|
|
46
|
+
export type PartnersB2BInquiryStatusUpdateRequest = z.infer<typeof partnersB2BInquiryStatusUpdateRequestSchema>;
|
|
47
|
+
/** @beta */
|
|
48
|
+
export type PartnersB2BInquiryStatusUpdateResponse = z.infer<typeof partnersB2BInquiryStatusUpdateResponseSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle stage of a B2B / partner inquiry as it moves through a sales
|
|
4
|
+
* pipeline. Neutral, provider-agnostic vocabulary:
|
|
5
|
+
* - `new` — just received, not yet triaged;
|
|
6
|
+
* - `contacted` — outreach made, awaiting response;
|
|
7
|
+
* - `qualified` — a real, in-scope opportunity;
|
|
8
|
+
* - `disqualified` — not a fit (out of scope / spam / no intent);
|
|
9
|
+
* - `closed_won` — converted;
|
|
10
|
+
* - `closed_lost` — did not convert.
|
|
11
|
+
* The inquiry payload itself (contact details, CRM ids, PII) is NOT part of the
|
|
12
|
+
* core contract; it lives in the host application's downstream adapter.
|
|
13
|
+
*/
|
|
14
|
+
/** @beta */
|
|
15
|
+
export const partnersB2BInquiryStatusSchema = z.enum([
|
|
16
|
+
"new",
|
|
17
|
+
"contacted",
|
|
18
|
+
"qualified",
|
|
19
|
+
"disqualified",
|
|
20
|
+
"closed_won",
|
|
21
|
+
"closed_lost",
|
|
22
|
+
]);
|
|
23
|
+
/** Request to move one inquiry (`id`) to a new pipeline `status`. */
|
|
24
|
+
/** @beta */
|
|
25
|
+
export const partnersB2BInquiryStatusUpdateRequestSchema = z.object({
|
|
26
|
+
id: z.string().min(1),
|
|
27
|
+
status: partnersB2BInquiryStatusSchema,
|
|
28
|
+
});
|
|
29
|
+
/** Successful status-update acknowledgement. `updated` is always `true`; a
|
|
30
|
+
* failed update is surfaced as a rejected promise / error by the port, not as
|
|
31
|
+
* `{ updated: false }`. */
|
|
32
|
+
/** @beta */
|
|
33
|
+
export const partnersB2BInquiryStatusUpdateResponseSchema = z.object({
|
|
34
|
+
updated: z.literal(true),
|
|
35
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PaymentAttemptStatus } from "./paymentControlTypes.js";
|
|
2
|
+
import type { PaymentFailureHint } from "./paymentFailureTaxonomyContracts.js";
|
|
3
|
+
/** @beta */
|
|
4
|
+
export declare const PAYMENT_EXECUTION_MODES: readonly ["one_time", "subscription_cycle"];
|
|
5
|
+
/** @beta */
|
|
6
|
+
export type PaymentExecutionMode = (typeof PAYMENT_EXECUTION_MODES)[number];
|
|
7
|
+
/** @beta */
|
|
8
|
+
export declare const PAYMENT_EXECUTION_ATTEMPT_STATUSES: readonly ["sent_to_provider", "requires_action", "processing"];
|
|
9
|
+
/** @beta */
|
|
10
|
+
export type PaymentExecutionAttemptStatus = Extract<PaymentAttemptStatus, (typeof PAYMENT_EXECUTION_ATTEMPT_STATUSES)[number]>;
|
|
11
|
+
/** @beta */
|
|
12
|
+
export interface PaymentExecutionBaseInput {
|
|
13
|
+
idempotencyKey: string;
|
|
14
|
+
providerIdempotencyKey: string;
|
|
15
|
+
providerRequestFingerprint: string;
|
|
16
|
+
paymentIntentId: string;
|
|
17
|
+
amountMinor: number;
|
|
18
|
+
currency: string;
|
|
19
|
+
mode: PaymentExecutionMode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A provider that refused the attempt inside the execution call itself, rather
|
|
23
|
+
* than through a later callback.
|
|
24
|
+
*
|
|
25
|
+
* Execution adapters cannot express this as an attempt status: only the control
|
|
26
|
+
* plane performs terminal transitions, so {@link PaymentExecutionAttemptStatus}
|
|
27
|
+
* is deliberately non-terminal. The adapter therefore reports the refusal as a
|
|
28
|
+
* fact and lets the caller finalize the attempt.
|
|
29
|
+
*
|
|
30
|
+
* Reporting it matters because some providers offer no second chance to learn of
|
|
31
|
+
* the failure: where a provider's callback fires only for successful payments, a
|
|
32
|
+
* synchronous decline that is not surfaced here is never reported at all, and
|
|
33
|
+
* the attempt hangs until it expires.
|
|
34
|
+
*/
|
|
35
|
+
/** @beta */
|
|
36
|
+
export interface PaymentExecutionProviderDecline {
|
|
37
|
+
/** Provider-native code, for correlation. Low-cardinality; never a free-form message. */
|
|
38
|
+
code: string;
|
|
39
|
+
/** True when the provider states the payer's bank cannot register a reusable mandate. */
|
|
40
|
+
mandateUnsupported: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The finer refusal reason the payer's bank returned, when the provider passes
|
|
43
|
+
* one through beside {@link code}. Optional because most providers report a
|
|
44
|
+
* single code; still a code, never a message.
|
|
45
|
+
*/
|
|
46
|
+
declineCode?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The provider's machine-readable recommendation for what a retry should do
|
|
49
|
+
* (for example: do not retry this instrument again). Optional and advisory —
|
|
50
|
+
* nothing in the decline path branches on it yet; it is carried so a later
|
|
51
|
+
* retry policy is not forced to re-query the provider for evidence that only
|
|
52
|
+
* existed at refusal time.
|
|
53
|
+
*/
|
|
54
|
+
adviceCode?: string;
|
|
55
|
+
/**
|
|
56
|
+
* What the adapter is willing to ASSERT about this refusal, already translated
|
|
57
|
+
* out of its own code vocabulary into {@link PaymentFailureHint}.
|
|
58
|
+
*
|
|
59
|
+
* Carried on the decline so a classifier can read a refusal without learning
|
|
60
|
+
* which adapter produced it: the acquirer's codes stop at the adapter that
|
|
61
|
+
* owns them, and only the neutral reading crosses into the control plane.
|
|
62
|
+
* Absent when the adapter has no opinion, which classifies as `indeterminate`
|
|
63
|
+
* rather than as a guess.
|
|
64
|
+
*/
|
|
65
|
+
neutralReasonHints?: readonly PaymentFailureHint[];
|
|
66
|
+
}
|
|
67
|
+
/** @beta */
|
|
68
|
+
export interface PaymentExecutionBaseResult {
|
|
69
|
+
provider: string;
|
|
70
|
+
providerAttemptId: string | null;
|
|
71
|
+
providerSessionId: string | null;
|
|
72
|
+
attemptStatus: PaymentExecutionAttemptStatus;
|
|
73
|
+
nextActionKind: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Set when the provider refused synchronously. `null` for the normal path,
|
|
76
|
+
* where the outcome arrives later via callback or polling.
|
|
77
|
+
*/
|
|
78
|
+
providerDecline?: PaymentExecutionProviderDecline | null;
|
|
79
|
+
requestPayload: Record<string, unknown>;
|
|
80
|
+
responsePayload: Record<string, unknown>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @beta */
|
|
2
|
+
export { LIVE_ATTEMPT_STATUSES, PAYMENT_ATTEMPT_STATUSES, PAYMENT_CONTROL_EVENT_TYPES, PAYMENT_INTENT_STATUSES, PAYMENT_TARGET_KINDS, RETRYABLE_ATTEMPT_STATUSES, isLiveAttemptStatus, isRetryableAttemptStatus, providerAckedButNeverConfirmed, } from "./paymentControlTypes.js";
|
|
3
|
+
/** @beta */
|
|
4
|
+
export { PAYMENT_EXECUTION_ATTEMPT_STATUSES, PAYMENT_EXECUTION_MODES, } from "./executionBaseContracts.js";
|
|
5
|
+
/** @beta */
|
|
6
|
+
export type { CanonicalPaymentControlEvent, PaymentAttemptAggregate, PaymentAttemptStatus, PaymentControlDecision, PaymentControlDecisionKind, PaymentControlEventType, PaymentControlFailureReason, PaymentControlResult, PaymentIntentAggregate, PaymentIntentStatus, PaymentTargetKind, } from "./paymentControlTypes.js";
|
|
7
|
+
/** @beta */
|
|
8
|
+
export type { PaymentExecutionAttemptStatus, PaymentExecutionBaseInput, PaymentExecutionBaseResult, PaymentExecutionProviderDecline, PaymentExecutionMode, } from "./executionBaseContracts.js";
|
|
9
|
+
/** @beta */
|
|
10
|
+
export { PAYMENT_FAILURE_CLASSES, PAYMENT_FAILURE_CUSTOMER_CAUSES, PAYMENT_FAILURE_HINTS, PAYMENT_RETRY_ADVICE_CODES, customerCauseForFailureClass, failureClassDecision, } from "./paymentFailureTaxonomyContracts.js";
|
|
11
|
+
/** @beta */
|
|
12
|
+
export type { PaymentFailureClass, PaymentFailureCustomerCause, PaymentFailureDecision, PaymentFailureEvidence, PaymentFailureHint, PaymentRetryAdviceCode, PaymentRetryProfile, } from "./paymentFailureTaxonomyContracts.js";
|
|
13
|
+
/** @beta */
|
|
14
|
+
export { PAYMENT_FAILURE_CLASSIFICATION_SOURCES, SCHEME_RETRY_ATTEMPT_CEILING, SCHEME_RETRY_WINDOW_DAYS, classifyPaymentFailure, isPaymentRetryAdviceCode, withinSchemeRetryCeiling, } from "./paymentFailureTaxonomy.js";
|
|
15
|
+
/** @beta */
|
|
16
|
+
export type { PaymentFailureClassification, PaymentFailureClassificationOptions, PaymentFailureClassificationSource, } from "./paymentFailureTaxonomy.js";
|
|
17
|
+
/** @beta */
|
|
18
|
+
export { applyProviderPaymentEvent, canTransitionPaymentAttempt, canTransitionPaymentIntent, transitionPaymentAttempt, transitionPaymentIntent, } from "./paymentStateMachine.js";
|
|
19
|
+
/** @beta */
|
|
20
|
+
export { buildProviderAttemptIdentity, isProviderAttemptReplaySafe, } from "./providerAttemptIdempotency.js";
|
|
21
|
+
/** @beta */
|
|
22
|
+
export type { ProviderAttemptIdentity, ProviderAttemptIdentityInput, } from "./providerAttemptIdempotency.js";
|
|
23
|
+
/** @beta */
|
|
24
|
+
export { PAYMENT_METHOD_LIFECYCLE_EVENT_KINDS, endsStoredMethodUsability, expiryInstantFromMonthYear, isPaymentMethodLifecycleEventKind, } from "./methodLifecycle.js";
|
|
25
|
+
/** @beta */
|
|
26
|
+
export type { PaymentMethodLifecycleEvent, PaymentMethodLifecycleEventKind, PaymentMethodReplacementFacts, } from "./methodLifecycle.js";
|
|
27
|
+
/** @beta */
|
|
28
|
+
export type { PayerContextRequirements, PaymentMethodCaptureFlow, PaymentMethodCaptureHandoff, PaymentMethodHealthExpectations, PaymentProviderCapabilityDescriptor, PaymentProviderCapabilityRegistry, StoredMandateSnapshot, UnattendedChargeBlockReason, UnattendedMandateAssessment, } from "./providerCapability.js";
|
|
29
|
+
/** @beta */
|
|
30
|
+
export { PAYMENT_RECOVERY_CAUSES, PAYMENT_RECOVERY_ACTIONS } from "./paymentRecoveryContracts.js";
|
|
31
|
+
/** @beta */
|
|
32
|
+
export type { PaymentRecoveryCause, PaymentRecoveryAction, PaymentRecoveryOperation, PaymentRecoveryMethod, PaymentRecoveryAdvice, PaymentRecoveryEvidence, PaymentRecoveryCandidate, PaymentRecoveryNormalizer, } from "./paymentRecoveryContracts.js";
|
|
33
|
+
/** @beta */
|
|
34
|
+
export { derivePaymentRecoveryGuidance, availablePaymentRecoveryActions } from "./paymentRecovery.js";
|
|
35
|
+
/** @beta */
|
|
36
|
+
export type { PaymentRecoveryAttempt, PaymentRecoveryGuidance } from "./paymentRecovery.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @beta */
|
|
2
|
+
export { LIVE_ATTEMPT_STATUSES, PAYMENT_ATTEMPT_STATUSES, PAYMENT_CONTROL_EVENT_TYPES, PAYMENT_INTENT_STATUSES, PAYMENT_TARGET_KINDS, RETRYABLE_ATTEMPT_STATUSES, isLiveAttemptStatus, isRetryableAttemptStatus, providerAckedButNeverConfirmed, } from "./paymentControlTypes.js";
|
|
3
|
+
/** @beta */
|
|
4
|
+
export { PAYMENT_EXECUTION_ATTEMPT_STATUSES, PAYMENT_EXECUTION_MODES, } from "./executionBaseContracts.js";
|
|
5
|
+
/** @beta */
|
|
6
|
+
export { PAYMENT_FAILURE_CLASSES, PAYMENT_FAILURE_CUSTOMER_CAUSES, PAYMENT_FAILURE_HINTS, PAYMENT_RETRY_ADVICE_CODES, customerCauseForFailureClass, failureClassDecision, } from "./paymentFailureTaxonomyContracts.js";
|
|
7
|
+
/** @beta */
|
|
8
|
+
export { PAYMENT_FAILURE_CLASSIFICATION_SOURCES, SCHEME_RETRY_ATTEMPT_CEILING, SCHEME_RETRY_WINDOW_DAYS, classifyPaymentFailure, isPaymentRetryAdviceCode, withinSchemeRetryCeiling, } from "./paymentFailureTaxonomy.js";
|
|
9
|
+
/** @beta */
|
|
10
|
+
export { applyProviderPaymentEvent, canTransitionPaymentAttempt, canTransitionPaymentIntent, transitionPaymentAttempt, transitionPaymentIntent, } from "./paymentStateMachine.js";
|
|
11
|
+
/** @beta */
|
|
12
|
+
export { buildProviderAttemptIdentity, isProviderAttemptReplaySafe, } from "./providerAttemptIdempotency.js";
|
|
13
|
+
/** @beta */
|
|
14
|
+
export { PAYMENT_METHOD_LIFECYCLE_EVENT_KINDS, endsStoredMethodUsability, expiryInstantFromMonthYear, isPaymentMethodLifecycleEventKind, } from "./methodLifecycle.js";
|
|
15
|
+
/** @beta */
|
|
16
|
+
export { PAYMENT_RECOVERY_CAUSES, PAYMENT_RECOVERY_ACTIONS } from "./paymentRecoveryContracts.js";
|
|
17
|
+
/** @beta */
|
|
18
|
+
export { derivePaymentRecoveryGuidance, availablePaymentRecoveryActions } from "./paymentRecovery.js";
|