@openlup/platform 0.26.0 → 0.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/CHANGELOG.md +305 -327
- package/README.md +332 -16
- package/dist/account-support/accountReadFacade.d.ts +8 -0
- package/dist/account-support/accountReadFacade.js +10 -0
- package/dist/account-support/accountReadModels.d.ts +69 -0
- package/dist/account-support/accountReadModels.js +272 -0
- package/dist/account-support/bindings.d.ts +23 -0
- package/dist/account-support/bindings.js +16 -0
- package/dist/account-support/contracts/account.d.ts +281 -0
- package/dist/account-support/contracts/account.js +1 -0
- package/dist/account-support/contracts/capabilities.d.ts +44 -0
- package/dist/account-support/contracts/capabilities.js +1 -0
- package/dist/account-support/contracts/commands.d.ts +307 -0
- package/dist/account-support/contracts/commands.js +1 -0
- package/dist/account-support/contracts/customer360.d.ts +154 -0
- package/dist/account-support/contracts/customer360.js +1 -0
- package/dist/account-support/contracts/index.d.ts +10 -0
- package/dist/account-support/contracts/index.js +1 -0
- package/dist/account-support/contracts/invoice.d.ts +79 -0
- package/dist/account-support/contracts/invoice.js +1 -0
- package/dist/account-support/contracts/operator.d.ts +289 -0
- package/dist/account-support/contracts/operator.js +1 -0
- package/dist/account-support/contribution.d.ts +24 -0
- package/dist/account-support/contribution.js +22 -0
- package/dist/account-support/customer360.d.ts +106 -0
- package/dist/account-support/customer360.js +163 -0
- package/dist/account-support/customerAccountReadDiagnostics.d.ts +11 -0
- package/dist/account-support/customerAccountReadDiagnostics.js +71 -0
- package/dist/account-support/index.d.ts +26 -0
- package/dist/account-support/index.js +15 -0
- package/dist/account-support/invoiceAccess.d.ts +57 -0
- package/dist/account-support/invoiceAccess.js +40 -0
- package/dist/account-support/migrations.d.ts +14 -0
- package/dist/account-support/migrations.js +7 -0
- package/dist/account-support/operatorAuthority.d.ts +67 -0
- package/dist/account-support/operatorAuthority.js +379 -0
- package/dist/account-support/operatorRecovery.d.ts +66 -0
- package/dist/account-support/operatorRecovery.js +129 -0
- package/dist/account-support/orderHistory.d.ts +50 -0
- package/dist/account-support/orderHistory.js +188 -0
- package/dist/account-support/paymentMethodComposition.d.ts +5 -0
- package/dist/account-support/paymentMethodComposition.js +4 -0
- package/dist/account-support/postgresOperatorAuthority.d.ts +16 -0
- package/dist/account-support/postgresOperatorAuthority.js +93 -0
- package/dist/account-support/selfService.d.ts +6 -0
- package/dist/account-support/selfService.js +81 -0
- package/dist/account-support/subscriptionCommandCodec.d.ts +10 -0
- package/dist/account-support/subscriptionCommandCodec.js +38 -0
- package/dist/catalog/draftSchemas.d.ts +1 -1
- package/dist/catalog/foundationSchemas.d.ts +3 -3
- package/dist/catalog/resolvedSkuProjection.d.ts +2 -2
- package/dist/catalog/sellableSchemas.d.ts +2 -2
- package/dist/commerce/adapters/managed/commerceOmsControlPlane.d.ts +3 -0
- package/dist/commerce/adapters/managed/commerceOmsControlPlane.js +71 -0
- package/dist/commerce/adapters/managed/commerceOmsMutations.d.ts +10 -0
- package/dist/commerce/adapters/managed/commerceOmsMutations.js +119 -0
- package/dist/commerce/adapters/managed/commerceOmsPort.d.ts +28 -0
- package/dist/commerce/adapters/managed/commerceOmsPort.js +101 -0
- package/dist/commerce/adapters/managed/oms/accounting.d.ts +3 -0
- package/dist/commerce/adapters/managed/oms/accounting.js +13 -0
- package/dist/commerce/adapters/managed/oms/fulfillmentReads.d.ts +17 -0
- package/dist/commerce/adapters/managed/oms/fulfillmentReads.js +81 -0
- package/dist/commerce/adapters/managed/oms/inboundEvents.d.ts +9 -0
- package/dist/commerce/adapters/managed/oms/inboundEvents.js +40 -0
- package/dist/commerce/adapters/managed/oms/outboxEvents.d.ts +2 -0
- package/dist/commerce/adapters/managed/oms/outboxEvents.js +23 -0
- package/dist/commerce/adapters/managed/oms/paymentAttempts.d.ts +3 -0
- package/dist/commerce/adapters/managed/oms/paymentAttempts.js +15 -0
- package/dist/commerce/adapters/managed/oms/queueSelection.d.ts +12 -0
- package/dist/commerce/adapters/managed/oms/queueSelection.js +109 -0
- package/dist/commerce/adapters/managed/oms/readProjections.d.ts +18 -0
- package/dist/commerce/adapters/managed/oms/readProjections.js +13 -0
- package/dist/commerce/adapters/managed/oms/readQueries.d.ts +16 -0
- package/dist/commerce/adapters/managed/oms/readQueries.js +276 -0
- package/dist/commerce/adapters/managed/oms/types.d.ts +2 -0
- package/dist/commerce/adapters/managed/oms/types.js +7 -0
- package/dist/commerce/checkoutCommandSchemas.d.ts +89 -0
- package/dist/commerce/checkoutCommandSchemas.js +70 -0
- package/dist/commerce/checkoutHelpers.d.ts +21 -0
- package/dist/commerce/checkoutHelpers.js +29 -0
- package/dist/commerce/checkoutResumeSchemas.d.ts +158 -0
- package/dist/commerce/checkoutResumeSchemas.js +145 -0
- package/dist/commerce/checkoutSchemas.d.ts +158 -0
- package/dist/commerce/checkoutSchemas.js +161 -0
- package/dist/commerce/commerceReturnsPort.d.ts +97 -0
- package/dist/commerce/commerceReturnsPort.js +39 -0
- package/dist/commerce/configuratorIntentPersistenceSchemas.d.ts +20 -0
- package/dist/commerce/configuratorIntentPersistenceSchemas.js +21 -0
- package/dist/commerce/configuratorIntentSchemas.d.ts +63 -0
- package/dist/commerce/configuratorIntentSchemas.js +43 -0
- package/dist/commerce/contractPrimitives.d.ts +50 -0
- package/dist/commerce/contractPrimitives.js +25 -0
- package/dist/commerce/contracts/availability.d.ts +23 -0
- package/dist/commerce/contracts/availability.js +1 -0
- package/dist/commerce/contracts/fulfillmentRecovery.d.ts +25 -0
- package/dist/commerce/contracts/fulfillmentRecovery.js +1 -0
- package/dist/commerce/contracts/index.d.ts +13 -0
- package/dist/commerce/contracts/index.js +1 -0
- package/dist/commerce/contracts/intent.d.ts +86 -0
- package/dist/commerce/contracts/intent.js +1 -0
- package/dist/commerce/contracts/omsTypes.d.ts +1216 -0
- package/dist/commerce/contracts/omsTypes.js +1 -0
- package/dist/commerce/contracts/order.d.ts +39 -0
- package/dist/commerce/contracts/order.js +1 -0
- package/dist/commerce/contracts/orderMoney.d.ts +52 -0
- package/dist/commerce/contracts/orderMoney.js +1 -0
- package/dist/commerce/contracts/ports.d.ts +113 -0
- package/dist/commerce/contracts/ports.js +1 -0
- package/dist/commerce/contracts/recovery.d.ts +11 -0
- package/dist/commerce/contracts/recovery.js +1 -0
- package/dist/commerce/contracts/runtimePorts.d.ts +196 -0
- package/dist/commerce/contracts/runtimePorts.js +1 -0
- package/dist/commerce/contracts/state.d.ts +26 -0
- package/dist/commerce/contracts/state.js +43 -0
- package/dist/commerce/customerDefaultsSnapshotSchemas.d.ts +51 -0
- package/dist/commerce/customerDefaultsSnapshotSchemas.js +106 -0
- package/dist/commerce/errors.d.ts +18 -0
- package/dist/commerce/errors.js +36 -0
- package/dist/commerce/fulfillmentEligibility.d.ts +6 -0
- package/dist/commerce/fulfillmentEligibility.js +31 -0
- package/dist/commerce/index.d.ts +72 -0
- package/dist/commerce/index.js +67 -0
- package/dist/commerce/model/customerFulfillmentRecovery.d.ts +40 -0
- package/dist/commerce/model/customerFulfillmentRecovery.js +144 -0
- package/dist/commerce/model/fulfillmentCancellationEligibility.d.ts +7 -0
- package/dist/commerce/model/fulfillmentCancellationEligibility.js +9 -0
- package/dist/commerce/model/omsAccountingVisibility.d.ts +12 -0
- package/dist/commerce/model/omsAccountingVisibility.js +118 -0
- package/dist/commerce/model/omsBillingInvoiceBuyer.d.ts +2 -0
- package/dist/commerce/model/omsBillingInvoiceBuyer.js +15 -0
- package/dist/commerce/model/omsCurrency.d.ts +4 -0
- package/dist/commerce/model/omsCurrency.js +5 -0
- package/dist/commerce/model/omsFulfillmentDebug.d.ts +20 -0
- package/dist/commerce/model/omsFulfillmentDebug.js +122 -0
- package/dist/commerce/model/omsFulfillmentSummary.d.ts +16 -0
- package/dist/commerce/model/omsFulfillmentSummary.js +189 -0
- package/dist/commerce/model/omsListTotals.d.ts +13 -0
- package/dist/commerce/model/omsListTotals.js +32 -0
- package/dist/commerce/model/omsOperationalLadder.d.ts +51 -0
- package/dist/commerce/model/omsOperationalLadder.js +158 -0
- package/dist/commerce/model/omsOrderLineMoney.d.ts +4 -0
- package/dist/commerce/model/omsOrderLineMoney.js +25 -0
- package/dist/commerce/model/omsPaymentMethodSummary.d.ts +5 -0
- package/dist/commerce/model/omsPaymentMethodSummary.js +11 -0
- package/dist/commerce/model/omsReadModel.d.ts +43 -0
- package/dist/commerce/model/omsReadModel.js +211 -0
- package/dist/commerce/model/omsReadModelCommunication.d.ts +3 -0
- package/dist/commerce/model/omsReadModelCommunication.js +29 -0
- package/dist/commerce/model/omsReadModelHelpers.d.ts +125 -0
- package/dist/commerce/model/omsReadModelHelpers.js +212 -0
- package/dist/commerce/model/omsReadModelList.d.ts +33 -0
- package/dist/commerce/model/omsReadModelList.js +50 -0
- package/dist/commerce/model/omsReadModelListSummary.d.ts +3 -0
- package/dist/commerce/model/omsReadModelListSummary.js +13 -0
- package/dist/commerce/model/omsReadModelPricing.d.ts +5 -0
- package/dist/commerce/model/omsReadModelPricing.js +36 -0
- package/dist/commerce/model/omsReadModelProjections.d.ts +1 -0
- package/dist/commerce/model/omsReadModelProjections.js +1 -0
- package/dist/commerce/model/omsReadModelRowCore.d.ts +79 -0
- package/dist/commerce/model/omsReadModelRowCore.js +149 -0
- package/dist/commerce/model/omsReadModelRows.d.ts +1 -0
- package/dist/commerce/model/omsReadModelRows.js +6 -0
- package/dist/commerce/offerAvailability.d.ts +18 -0
- package/dist/commerce/offerAvailability.js +53 -0
- package/dist/commerce/offerAvailabilitySchemas.d.ts +43 -0
- package/dist/commerce/offerAvailabilitySchemas.js +42 -0
- package/dist/commerce/offerEvidenceSchemas.d.ts +7 -0
- package/dist/commerce/offerEvidenceSchemas.js +13 -0
- package/dist/commerce/oms/omsContractBase.d.ts +130 -0
- package/dist/commerce/oms/omsContractBase.js +86 -0
- package/dist/commerce/oms/omsContractReadAuxSchemas.d.ts +222 -0
- package/dist/commerce/oms/omsContractReadAuxSchemas.js +123 -0
- package/dist/commerce/oms/omsContractReadSchemas.d.ts +2266 -0
- package/dist/commerce/oms/omsContractReadSchemas.js +277 -0
- package/dist/commerce/oms/omsContractRequests.d.ts +196 -0
- package/dist/commerce/oms/omsContractRequests.js +118 -0
- package/dist/commerce/oms/omsContracts.d.ts +5 -0
- package/dist/commerce/oms/omsContracts.js +4 -0
- package/dist/commerce/oms/omsControlPlane.d.ts +275 -0
- package/dist/commerce/oms/omsControlPlane.js +72 -0
- package/dist/commerce/oms/omsFulfillmentContractSchemas.d.ts +203 -0
- package/dist/commerce/oms/omsFulfillmentContractSchemas.js +94 -0
- package/dist/commerce/oms/omsFulfillmentDebugSchemas.d.ts +69 -0
- package/dist/commerce/oms/omsFulfillmentDebugSchemas.js +33 -0
- package/dist/commerce/oms/omsFulfillmentHealthSchemas.d.ts +67 -0
- package/dist/commerce/oms/omsFulfillmentHealthSchemas.js +44 -0
- package/dist/commerce/oms/omsPorts.d.ts +84 -0
- package/dist/commerce/oms/omsPorts.js +148 -0
- package/dist/commerce/oms/omsPrimitives.d.ts +5 -0
- package/dist/commerce/oms/omsPrimitives.js +3 -0
- package/dist/commerce/oms/omsProviderEvidenceSchemas.d.ts +15 -0
- package/dist/commerce/oms/omsProviderEvidenceSchemas.js +12 -0
- package/dist/commerce/orderDraftErrors.d.ts +13 -0
- package/dist/commerce/orderDraftErrors.js +20 -0
- package/dist/commerce/orderEmailEligibility.d.ts +54 -0
- package/dist/commerce/orderEmailEligibility.js +123 -0
- package/dist/commerce/orderEmailLines.d.ts +12 -0
- package/dist/commerce/orderEmailLines.js +8 -0
- package/dist/commerce/orderFeedbackContracts.d.ts +41 -0
- package/dist/commerce/orderFeedbackContracts.js +33 -0
- package/dist/commerce/orderMoney.d.ts +6 -0
- package/dist/commerce/orderMoney.js +168 -0
- package/dist/commerce/orderReviewContracts.d.ts +475 -0
- package/dist/commerce/orderReviewContracts.js +94 -0
- package/dist/commerce/orderReviewPorts.d.ts +140 -0
- package/dist/commerce/orderReviewPorts.js +1 -0
- package/dist/commerce/outboxDispatchContracts.d.ts +30 -0
- package/dist/commerce/outboxDispatchContracts.js +1 -0
- package/dist/commerce/outboxEventSchemas.d.ts +162 -0
- package/dist/commerce/outboxEventSchemas.js +164 -0
- package/dist/commerce/outboxOrderDraftEmailPorts.d.ts +207 -0
- package/dist/commerce/outboxOrderDraftEmailPorts.js +12 -0
- package/dist/commerce/paymentContinuation.d.ts +4 -0
- package/dist/commerce/paymentContinuation.js +4 -0
- package/dist/commerce/ports.d.ts +8 -0
- package/dist/commerce/ports.js +1 -0
- package/dist/commerce/recoveryDestination.d.ts +3 -0
- package/dist/commerce/recoveryDestination.js +17 -0
- package/dist/commerce/runtimeErrors.d.ts +8 -0
- package/dist/commerce/runtimeErrors.js +16 -0
- package/dist/commerce/salesChannelEnvelope.d.ts +20 -0
- package/dist/commerce/salesChannelEnvelope.js +7 -0
- package/dist/commerce/schemas.d.ts +174 -0
- package/dist/commerce/schemas.js +84 -0
- package/dist/commerce/server/checkoutCompensation.d.ts +21 -0
- package/dist/commerce/server/checkoutCompensation.js +32 -0
- package/dist/commerce/server/checkoutConflictClassifiers.d.ts +17 -0
- package/dist/commerce/server/checkoutConflictClassifiers.js +38 -0
- package/dist/commerce/server/checkoutExpiredRecoveryPolicy.d.ts +38 -0
- package/dist/commerce/server/checkoutExpiredRecoveryPolicy.js +85 -0
- package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.d.ts +22 -0
- package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.js +30 -0
- package/dist/commerce/server/checkoutOfferPolicyPort.d.ts +33 -0
- package/dist/commerce/server/checkoutOfferPolicyPort.js +49 -0
- package/dist/commerce/server/checkoutPaymentContinuationCredential.d.ts +58 -0
- package/dist/commerce/server/checkoutPaymentContinuationCredential.js +154 -0
- package/dist/commerce/server/checkoutQuoteTypes.d.ts +19 -0
- package/dist/commerce/server/checkoutQuoteTypes.js +1 -0
- package/dist/commerce/server/checkoutRecoveryOrderPort.d.ts +42 -0
- package/dist/commerce/server/checkoutRecoveryOrderPort.js +1 -0
- package/dist/commerce/server/checkoutRecoveryToken.d.ts +40 -0
- package/dist/commerce/server/checkoutRecoveryToken.js +26 -0
- package/dist/commerce/server/checkoutRefusalContinuation.d.ts +24 -0
- package/dist/commerce/server/checkoutRefusalContinuation.js +18 -0
- package/dist/commerce/server/checkoutRuntimeTypes.d.ts +81 -0
- package/dist/commerce/server/checkoutRuntimeTypes.js +1 -0
- package/dist/commerce/server/commerceCheckoutCommandExecution.d.ts +60 -0
- package/dist/commerce/server/commerceCheckoutCommandExecution.js +136 -0
- package/dist/commerce/server/commerceCheckoutCompensation.d.ts +26 -0
- package/dist/commerce/server/commerceCheckoutCompensation.js +46 -0
- package/dist/commerce/server/commerceCheckoutContinuationTerms.d.ts +50 -0
- package/dist/commerce/server/commerceCheckoutContinuationTerms.js +66 -0
- package/dist/commerce/server/commerceCheckoutCustomerDefaults.d.ts +18 -0
- package/dist/commerce/server/commerceCheckoutCustomerDefaults.js +17 -0
- package/dist/commerce/server/commerceCheckoutFailureHandler.d.ts +51 -0
- package/dist/commerce/server/commerceCheckoutFailureHandler.js +90 -0
- package/dist/commerce/server/commerceCheckoutHandler.d.ts +213 -0
- package/dist/commerce/server/commerceCheckoutHandler.js +196 -0
- package/dist/commerce/server/commerceCheckoutHandlerAdmission.d.ts +58 -0
- package/dist/commerce/server/commerceCheckoutHandlerAdmission.js +94 -0
- package/dist/commerce/server/commerceCheckoutHandlerHelpers.d.ts +67 -0
- package/dist/commerce/server/commerceCheckoutHandlerHelpers.js +155 -0
- package/dist/commerce/server/commerceCheckoutOrchestrationError.d.ts +9 -0
- package/dist/commerce/server/commerceCheckoutOrchestrationError.js +14 -0
- package/dist/commerce/server/commerceCheckoutPromotionPriceChange.d.ts +47 -0
- package/dist/commerce/server/commerceCheckoutPromotionPriceChange.js +43 -0
- package/dist/commerce/server/commerceCheckoutProviderPayment.d.ts +34 -0
- package/dist/commerce/server/commerceCheckoutProviderPayment.js +37 -0
- package/dist/commerce/server/commerceCheckoutQuoteGuard.d.ts +62 -0
- package/dist/commerce/server/commerceCheckoutQuoteGuard.js +106 -0
- package/dist/commerce/server/commerceCheckoutResume.d.ts +29 -0
- package/dist/commerce/server/commerceCheckoutResume.js +81 -0
- package/dist/commerce/server/commerceCheckoutResumeGuard.d.ts +54 -0
- package/dist/commerce/server/commerceCheckoutResumeGuard.js +138 -0
- package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.d.ts +39 -0
- package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.js +44 -0
- package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.d.ts +7 -0
- package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.js +39 -0
- package/dist/commerce/server/commerceCheckoutTiming.d.ts +8 -0
- package/dist/commerce/server/commerceCheckoutTiming.js +31 -0
- package/dist/commerce/server/commerceDiagnostics.d.ts +6 -0
- package/dist/commerce/server/commerceDiagnostics.js +31 -0
- package/dist/commerce/server/commerceOmsCancelOrderHandler.d.ts +7 -0
- package/dist/commerce/server/commerceOmsCancelOrderHandler.js +22 -0
- package/dist/commerce/server/commerceOmsControlPlaneHandlers.d.ts +18 -0
- package/dist/commerce/server/commerceOmsControlPlaneHandlers.js +60 -0
- package/dist/commerce/server/commerceOmsHandlers.d.ts +47 -0
- package/dist/commerce/server/commerceOmsHandlers.js +176 -0
- package/dist/commerce/server/commerceOmsMarkRefundedHandler.d.ts +7 -0
- package/dist/commerce/server/commerceOmsMarkRefundedHandler.js +19 -0
- package/dist/commerce/server/commerceOrderDraft.d.ts +24 -0
- package/dist/commerce/server/commerceOrderDraft.js +92 -0
- package/dist/commerce/server/commercePaidOrderOrchestration.d.ts +131 -0
- package/dist/commerce/server/commercePaidOrderOrchestration.js +140 -0
- package/dist/commerce/server/commerceProviderAttemptFailure.d.ts +133 -0
- package/dist/commerce/server/commerceProviderAttemptFailure.js +175 -0
- package/dist/commerce/server/commerceReturnsHandlers.d.ts +41 -0
- package/dist/commerce/server/commerceReturnsHandlers.js +100 -0
- package/dist/commerce/server/commerceRuntimePort.d.ts +16 -0
- package/dist/commerce/server/commerceRuntimePort.js +57 -0
- package/dist/commerce/server/commerceRuntimeService.d.ts +98 -0
- package/dist/commerce/server/commerceRuntimeService.js +186 -0
- package/dist/commerce/server/commerceRuntimeStartResponse.d.ts +37 -0
- package/dist/commerce/server/commerceRuntimeStartResponse.js +56 -0
- package/dist/commerce/server/commerceStarterOfferGuard.d.ts +55 -0
- package/dist/commerce/server/commerceStarterOfferGuard.js +128 -0
- package/dist/commerce/server/configuratorIntentPersistence.d.ts +47 -0
- package/dist/commerce/server/configuratorIntentPersistence.js +85 -0
- package/dist/commerce/server/configuratorIntentPersistenceHandler.d.ts +14 -0
- package/dist/commerce/server/configuratorIntentPersistenceHandler.js +42 -0
- package/dist/commerce/server/emailRuntime.d.ts +47 -0
- package/dist/commerce/server/emailRuntime.js +1 -0
- package/dist/commerce/server/handlerSupport.d.ts +68 -0
- package/dist/commerce/server/handlerSupport.js +1 -0
- package/dist/commerce/server/index.d.ts +178 -0
- package/dist/commerce/server/index.js +127 -0
- package/dist/commerce/server/offerAvailability.d.ts +21 -0
- package/dist/commerce/server/offerAvailability.js +163 -0
- package/dist/commerce/server/orderDraftRpcPayload.d.ts +20 -0
- package/dist/commerce/server/orderDraftRpcPayload.js +21 -0
- package/dist/commerce/server/orderFeedbackSubmit.d.ts +20 -0
- package/dist/commerce/server/orderFeedbackSubmit.js +16 -0
- package/dist/commerce/server/orderFeedbackTokenCheck.d.ts +17 -0
- package/dist/commerce/server/orderFeedbackTokenCheck.js +14 -0
- package/dist/commerce/server/orderReviewAdminHandlers.d.ts +47 -0
- package/dist/commerce/server/orderReviewAdminHandlers.js +41 -0
- package/dist/commerce/server/orderReviewHandlers.d.ts +114 -0
- package/dist/commerce/server/orderReviewHandlers.js +42 -0
- package/dist/commerce/server/orderReviewLifecycle.d.ts +10 -0
- package/dist/commerce/server/orderReviewLifecycle.js +121 -0
- package/dist/commerce/server/orderReviewMedia.d.ts +11 -0
- package/dist/commerce/server/orderReviewMedia.js +172 -0
- package/dist/commerce/server/orderReviewRawUploadHandler.d.ts +40 -0
- package/dist/commerce/server/orderReviewRawUploadHandler.js +316 -0
- package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.js +57 -0
- package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.js +150 -0
- package/dist/commerce/server/outboxDispatchRegistry.d.ts +46 -0
- package/dist/commerce/server/outboxDispatchRegistry.js +184 -0
- package/dist/commerce/server/outboxDispatchRegistryComposition.d.ts +6 -0
- package/dist/commerce/server/outboxDispatchRegistryComposition.js +23 -0
- package/dist/commerce/server/outboxOrderDraftEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxOrderDraftEmailHandler.js +130 -0
- package/dist/commerce/server/outboxOrderPaidEmailHandler.d.ts +21 -0
- package/dist/commerce/server/outboxOrderPaidEmailHandler.js +93 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.d.ts +3 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.js +1 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.d.ts +3 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.js +1 -0
- package/dist/commerce/server/outboxOrderRefundedEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxOrderRefundedEmailHandler.js +42 -0
- package/dist/commerce/server/outboxPaymentFailedEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxPaymentFailedEmailHandler.js +65 -0
- package/dist/commerce/server/outboxReturnEmailHandlers.d.ts +26 -0
- package/dist/commerce/server/outboxReturnEmailHandlers.js +53 -0
- package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.d.ts +17 -0
- package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.js +52 -0
- package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.js +87 -0
- package/dist/commerce/server/outboxShipmentExceptionEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxShipmentExceptionEmailHandler.js +46 -0
- package/dist/commerce/server/referenceCheckoutHandler.d.ts +48 -0
- package/dist/commerce/server/referenceCheckoutHandler.js +68 -0
- package/dist/commerce/server/reservationSweepPort.d.ts +31 -0
- package/dist/commerce/server/reservationSweepPort.js +45 -0
- package/dist/commerce/server/starterTermsPort.d.ts +22 -0
- package/dist/commerce/server/starterTermsPort.js +1 -0
- package/dist/commerce/server/supabaseCommerceReturnsPort.d.ts +13 -0
- package/dist/commerce/server/supabaseCommerceReturnsPort.js +56 -0
- package/dist/communications/consentPurposeRegistry.d.ts +1 -1
- package/dist/communications/newsletterIntegrationContracts.d.ts +10 -10
- package/dist/composition/accountSupportContribution.d.ts +18 -0
- package/dist/composition/accountSupportContribution.js +21 -0
- package/dist/composition/commerceContribution.d.ts +21 -0
- package/dist/composition/commerceContribution.js +27 -0
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +2 -0
- package/dist/fulfillment/handlerSchemas.d.ts +69 -69
- package/dist/fulfillment/index.d.ts +1 -1
- package/dist/fulfillment/index.js +1 -1
- package/dist/fulfillment/paidHandoff.d.ts +12 -1
- package/dist/fulfillment/paidHandoff.js +2 -2
- package/dist/fulfillment/providerDispatchWorker.d.ts +4 -4
- package/dist/identity/customerContracts.d.ts +4 -4
- package/dist/inventory/bindings.d.ts +3 -0
- package/dist/inventory/bindings.js +10 -4
- package/dist/inventory/index.d.ts +1 -0
- package/dist/inventory/index.js +1 -0
- package/dist/inventory/managedStockAvailability.d.ts +15 -0
- package/dist/inventory/managedStockAvailability.js +16 -0
- package/dist/inventory/postgresStockAvailability.js +2 -25
- package/dist/inventory/schemas.d.ts +1 -1
- package/dist/inventory/stockReadResponse.d.ts +4 -0
- package/dist/inventory/stockReadResponse.js +27 -0
- package/dist/invoicing/snapshot.d.ts +1 -1
- package/dist/pricing/acquisitionQuoteBinding.d.ts +1 -1
- package/dist/pricing/browser/index.d.ts +6 -0
- package/dist/pricing/browser/index.js +6 -0
- package/dist/pricing/catalogFactsSchemas.d.ts +1 -1
- package/dist/pricing/quotePromotionEvidence.d.ts +1 -1
- package/dist/pricing/quoteSchemas.d.ts +56 -56
- package/dist/promotions/adminPromotionCodesContracts.d.ts +30 -30
- package/dist/promotions/adminPromotionsContracts.d.ts +16 -16
- package/dist/subscriptions/index.d.ts +3 -2
- package/dist/subscriptions/index.js +3 -2
- package/package.json +32 -2
- package/release-gates.json +90 -8
- package/sql/20261026120000_account_support_operator_authority.sql +693 -0
- package/src/account-support/accountReadFacade.ts +15 -0
- package/src/account-support/accountReadModels.ts +371 -0
- package/src/account-support/bindings.ts +28 -0
- package/src/account-support/contracts/account.ts +306 -0
- package/src/account-support/contracts/capabilities.ts +30 -0
- package/src/account-support/contracts/commands.ts +243 -0
- package/src/account-support/contracts/customer360.ts +150 -0
- package/src/account-support/contracts/index.ts +141 -0
- package/src/account-support/contracts/invoice.ts +44 -0
- package/src/account-support/contracts/operator.ts +123 -0
- package/src/account-support/contribution.ts +35 -0
- package/src/account-support/customer360.ts +268 -0
- package/src/account-support/customerAccountReadDiagnostics.ts +83 -0
- package/src/account-support/index.ts +72 -0
- package/src/account-support/invoiceAccess.ts +63 -0
- package/src/account-support/migrations.ts +7 -0
- package/src/account-support/operatorAuthority.ts +393 -0
- package/src/account-support/operatorRecovery.ts +136 -0
- package/src/account-support/orderHistory.ts +309 -0
- package/src/account-support/paymentMethodComposition.ts +8 -0
- package/src/account-support/postgresOperatorAuthority.ts +92 -0
- package/src/account-support/selfService.ts +83 -0
- package/src/account-support/subscriptionCommandCodec.ts +48 -0
- package/src/commerce/adapters/managed/commerceOmsControlPlane.ts +80 -0
- package/src/commerce/adapters/managed/commerceOmsMutations.ts +145 -0
- package/src/commerce/adapters/managed/commerceOmsPort.ts +158 -0
- package/src/commerce/adapters/managed/oms/accounting.ts +18 -0
- package/src/commerce/adapters/managed/oms/fulfillmentReads.ts +82 -0
- package/src/commerce/adapters/managed/oms/inboundEvents.ts +45 -0
- package/src/commerce/adapters/managed/oms/outboxEvents.ts +30 -0
- package/src/commerce/adapters/managed/oms/paymentAttempts.ts +19 -0
- package/src/commerce/adapters/managed/oms/queueSelection.ts +132 -0
- package/src/commerce/adapters/managed/oms/readProjections.ts +22 -0
- package/src/commerce/adapters/managed/oms/readQueries.ts +292 -0
- package/src/commerce/adapters/managed/oms/types.ts +9 -0
- package/src/commerce/checkoutCommandSchemas.ts +93 -0
- package/src/commerce/checkoutHelpers.ts +47 -0
- package/src/commerce/checkoutResumeSchemas.ts +164 -0
- package/src/commerce/checkoutSchemas.ts +182 -0
- package/src/commerce/commerceReturnsPort.ts +67 -0
- package/src/commerce/configuratorIntentPersistenceSchemas.ts +26 -0
- package/src/commerce/configuratorIntentSchemas.ts +47 -0
- package/src/commerce/contractPrimitives.ts +30 -0
- package/src/commerce/contracts/availability.ts +21 -0
- package/src/commerce/contracts/fulfillmentRecovery.ts +26 -0
- package/src/commerce/contracts/index.ts +17 -0
- package/src/commerce/contracts/intent.ts +58 -0
- package/src/commerce/contracts/omsTypes.ts +1217 -0
- package/src/commerce/contracts/order.ts +44 -0
- package/src/commerce/contracts/orderMoney.ts +75 -0
- package/src/commerce/contracts/ports.ts +124 -0
- package/src/commerce/contracts/recovery.ts +24 -0
- package/src/commerce/contracts/runtimePorts.ts +201 -0
- package/src/commerce/contracts/state.ts +64 -0
- package/src/commerce/customerDefaultsSnapshotSchemas.ts +117 -0
- package/src/commerce/errors.ts +53 -0
- package/src/commerce/fulfillmentEligibility.ts +32 -0
- package/src/commerce/index.ts +82 -0
- package/src/commerce/model/customerFulfillmentRecovery.ts +185 -0
- package/src/commerce/model/fulfillmentCancellationEligibility.ts +18 -0
- package/src/commerce/model/omsAccountingVisibility.ts +135 -0
- package/src/commerce/model/omsBillingInvoiceBuyer.ts +20 -0
- package/src/commerce/model/omsCurrency.ts +8 -0
- package/src/commerce/model/omsFulfillmentDebug.ts +157 -0
- package/src/commerce/model/omsFulfillmentSummary.ts +225 -0
- package/src/commerce/model/omsListTotals.ts +38 -0
- package/src/commerce/model/omsOperationalLadder.ts +181 -0
- package/src/commerce/model/omsOrderLineMoney.ts +34 -0
- package/src/commerce/model/omsPaymentMethodSummary.ts +19 -0
- package/src/commerce/model/omsReadModel.ts +302 -0
- package/src/commerce/model/omsReadModelCommunication.ts +32 -0
- package/src/commerce/model/omsReadModelHelpers.ts +279 -0
- package/src/commerce/model/omsReadModelList.ts +90 -0
- package/src/commerce/model/omsReadModelListSummary.ts +19 -0
- package/src/commerce/model/omsReadModelPricing.ts +57 -0
- package/src/commerce/model/omsReadModelProjections.ts +1 -0
- package/src/commerce/model/omsReadModelRowCore.ts +193 -0
- package/src/commerce/model/omsReadModelRows.ts +7 -0
- package/src/commerce/offerAvailability.ts +75 -0
- package/src/commerce/offerAvailabilitySchemas.ts +56 -0
- package/src/commerce/offerEvidenceSchemas.ts +17 -0
- package/src/commerce/oms/omsContractBase.ts +92 -0
- package/src/commerce/oms/omsContractReadAuxSchemas.ts +130 -0
- package/src/commerce/oms/omsContractReadSchemas.ts +303 -0
- package/src/commerce/oms/omsContractRequests.ts +143 -0
- package/src/commerce/oms/omsContracts.ts +6 -0
- package/src/commerce/oms/omsControlPlane.ts +85 -0
- package/src/commerce/oms/omsFulfillmentContractSchemas.ts +113 -0
- package/src/commerce/oms/omsFulfillmentDebugSchemas.ts +38 -0
- package/src/commerce/oms/omsFulfillmentHealthSchemas.ts +46 -0
- package/src/commerce/oms/omsPorts.ts +165 -0
- package/src/commerce/oms/omsPrimitives.ts +3 -0
- package/src/commerce/oms/omsProviderEvidenceSchemas.ts +13 -0
- package/src/commerce/orderDraftErrors.ts +28 -0
- package/src/commerce/orderEmailEligibility.ts +131 -0
- package/src/commerce/orderEmailLines.ts +22 -0
- package/src/commerce/orderFeedbackContracts.ts +47 -0
- package/src/commerce/orderMoney.ts +207 -0
- package/src/commerce/orderReviewContracts.ts +124 -0
- package/src/commerce/orderReviewPorts.ts +94 -0
- package/src/commerce/outboxDispatchContracts.ts +30 -0
- package/src/commerce/outboxEventSchemas.ts +230 -0
- package/src/commerce/outboxOrderDraftEmailPorts.ts +241 -0
- package/src/commerce/paymentContinuation.ts +5 -0
- package/src/commerce/ports.ts +7 -0
- package/src/commerce/recoveryDestination.ts +23 -0
- package/src/commerce/runtimeErrors.ts +19 -0
- package/src/commerce/salesChannelEnvelope.ts +28 -0
- package/src/commerce/schemas.ts +104 -0
- package/src/commerce/server/checkoutCompensation.ts +49 -0
- package/src/commerce/server/checkoutConflictClassifiers.ts +53 -0
- package/src/commerce/server/checkoutExpiredRecoveryPolicy.ts +107 -0
- package/src/commerce/server/checkoutInvoiceBuyerSnapshot.ts +36 -0
- package/src/commerce/server/checkoutOfferPolicyPort.ts +60 -0
- package/src/commerce/server/checkoutPaymentContinuationCredential.ts +222 -0
- package/src/commerce/server/checkoutQuoteTypes.ts +9 -0
- package/src/commerce/server/checkoutRecoveryOrderPort.ts +40 -0
- package/src/commerce/server/checkoutRecoveryToken.ts +63 -0
- package/src/commerce/server/checkoutRefusalContinuation.ts +29 -0
- package/src/commerce/server/checkoutRuntimeTypes.ts +26 -0
- package/src/commerce/server/commerceCheckoutCommandExecution.ts +188 -0
- package/src/commerce/server/commerceCheckoutCompensation.ts +66 -0
- package/src/commerce/server/commerceCheckoutContinuationTerms.ts +87 -0
- package/src/commerce/server/commerceCheckoutCustomerDefaults.ts +24 -0
- package/src/commerce/server/commerceCheckoutFailureHandler.ts +144 -0
- package/src/commerce/server/commerceCheckoutHandler.ts +269 -0
- package/src/commerce/server/commerceCheckoutHandlerAdmission.ts +157 -0
- package/src/commerce/server/commerceCheckoutHandlerHelpers.ts +223 -0
- package/src/commerce/server/commerceCheckoutOrchestrationError.ts +15 -0
- package/src/commerce/server/commerceCheckoutPromotionPriceChange.ts +83 -0
- package/src/commerce/server/commerceCheckoutProviderPayment.ts +45 -0
- package/src/commerce/server/commerceCheckoutQuoteGuard.ts +172 -0
- package/src/commerce/server/commerceCheckoutResume.ts +132 -0
- package/src/commerce/server/commerceCheckoutResumeGuard.ts +195 -0
- package/src/commerce/server/commerceCheckoutSavedPaymentMethod.ts +85 -0
- package/src/commerce/server/commerceCheckoutStartRuntimeFailure.ts +59 -0
- package/src/commerce/server/commerceCheckoutTiming.ts +53 -0
- package/src/commerce/server/commerceDiagnostics.ts +37 -0
- package/src/commerce/server/commerceOmsCancelOrderHandler.ts +43 -0
- package/src/commerce/server/commerceOmsControlPlaneHandlers.ts +71 -0
- package/src/commerce/server/commerceOmsHandlers.ts +275 -0
- package/src/commerce/server/commerceOmsMarkRefundedHandler.ts +39 -0
- package/src/commerce/server/commerceOrderDraft.ts +131 -0
- package/src/commerce/server/commercePaidOrderOrchestration.ts +275 -0
- package/src/commerce/server/commerceProviderAttemptFailure.ts +257 -0
- package/src/commerce/server/commerceReturnsHandlers.ts +143 -0
- package/src/commerce/server/commerceRuntimePort.ts +75 -0
- package/src/commerce/server/commerceRuntimeService.ts +229 -0
- package/src/commerce/server/commerceRuntimeStartResponse.ts +76 -0
- package/src/commerce/server/commerceStarterOfferGuard.ts +200 -0
- package/src/commerce/server/configuratorIntentPersistence.ts +161 -0
- package/src/commerce/server/configuratorIntentPersistenceHandler.ts +54 -0
- package/src/commerce/server/emailRuntime.ts +30 -0
- package/src/commerce/server/handlerSupport.ts +22 -0
- package/src/commerce/server/index.ts +181 -0
- package/src/commerce/server/offerAvailability.ts +275 -0
- package/src/commerce/server/orderDraftRpcPayload.ts +39 -0
- package/src/commerce/server/orderFeedbackSubmit.ts +40 -0
- package/src/commerce/server/orderFeedbackTokenCheck.ts +28 -0
- package/src/commerce/server/orderReviewAdminHandlers.ts +43 -0
- package/src/commerce/server/orderReviewHandlers.ts +57 -0
- package/src/commerce/server/orderReviewLifecycle.ts +129 -0
- package/src/commerce/server/orderReviewMedia.ts +170 -0
- package/src/commerce/server/orderReviewRawUploadHandler.ts +300 -0
- package/src/commerce/server/outboxCheckoutExpiredEmailHandler.ts +86 -0
- package/src/commerce/server/outboxCheckoutRecoveryEmailHandler.ts +188 -0
- package/src/commerce/server/outboxDispatchRegistry.ts +269 -0
- package/src/commerce/server/outboxDispatchRegistryComposition.ts +31 -0
- package/src/commerce/server/outboxOrderDraftEmailHandler.ts +162 -0
- package/src/commerce/server/outboxOrderPaidEmailHandler.ts +147 -0
- package/src/commerce/server/outboxOrderPaidFulfillmentHandler.ts +4 -0
- package/src/commerce/server/outboxOrderPaidFulfillmentPorts.ts +3 -0
- package/src/commerce/server/outboxOrderRefundedEmailHandler.ts +58 -0
- package/src/commerce/server/outboxPaymentFailedEmailHandler.ts +99 -0
- package/src/commerce/server/outboxReturnEmailHandlers.ts +92 -0
- package/src/commerce/server/outboxShipmentDeliveredEmailHandler.ts +94 -0
- package/src/commerce/server/outboxShipmentDispatchedEmailHandler.ts +112 -0
- package/src/commerce/server/outboxShipmentExceptionEmailHandler.ts +73 -0
- package/src/commerce/server/referenceCheckoutHandler.ts +87 -0
- package/src/commerce/server/reservationSweepPort.ts +67 -0
- package/src/commerce/server/starterTermsPort.ts +22 -0
- package/src/commerce/server/supabaseCommerceReturnsPort.ts +81 -0
- package/src/composition/accountSupportContribution.ts +28 -0
- package/src/composition/commerceContribution.ts +35 -0
- package/src/composition/index.ts +2 -0
- package/src/fulfillment/index.ts +1 -1
- package/src/fulfillment/paidHandoff.ts +2 -2
- package/src/inventory/bindings.ts +12 -4
- package/src/inventory/index.ts +1 -0
- package/src/inventory/managedStockAvailability.ts +23 -0
- package/src/inventory/postgresStockAvailability.ts +2 -21
- package/src/inventory/stockReadResponse.ts +25 -0
- package/src/pricing/browser/index.ts +6 -0
- package/src/subscriptions/index.ts +3 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skip reason meaning "the payer is inside a live payment session right now".
|
|
3
|
+
* Exported because it is the one skip reason a caller must treat as TRANSIENT;
|
|
4
|
+
* every other reason in this module is a settled fact about the order.
|
|
5
|
+
*/
|
|
6
|
+
export const PAYMENT_SESSION_ACTIVE = "payment_session_active";
|
|
7
|
+
const SUCCESSFUL_PAYMENT_STATUSES = new Set(["succeeded", "paid", "captured"]);
|
|
8
|
+
const ACTIVE_PAYMENT_STATUSES = new Set(["pending", "requires_action", "created", "processing"]);
|
|
9
|
+
const FRESH_PAYMENT_ACTIVITY_MS = 15 * 60 * 1000;
|
|
10
|
+
export function shouldSkipOrderDraftConfirmation(state) {
|
|
11
|
+
if (state === null)
|
|
12
|
+
return "order_unavailable";
|
|
13
|
+
if (state.orderStatus !== "draft")
|
|
14
|
+
return "order_no_longer_draft";
|
|
15
|
+
if (state.hasPayment)
|
|
16
|
+
return "order_no_longer_draft";
|
|
17
|
+
if (state.paymentStatus && state.paymentStatus !== "not_started")
|
|
18
|
+
return "order_no_longer_draft";
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Eligibility for the checkout-recovery NUDGE only.
|
|
23
|
+
*
|
|
24
|
+
* `payment_session_active` below is a politeness rule: do not remind someone to
|
|
25
|
+
* pay while they are paying. It is correct here and wrong for a decline notice
|
|
26
|
+
* — see {@link shouldSkipPaymentFailedNotice}. A caller acting on this reason
|
|
27
|
+
* must defer rather than drop, because the nudge's emit key is once-per-order.
|
|
28
|
+
*/
|
|
29
|
+
export function shouldSkipCheckoutRecovery(state) {
|
|
30
|
+
if (state === null)
|
|
31
|
+
return "order_unavailable";
|
|
32
|
+
if (state.orderStatus !== "pending_payment")
|
|
33
|
+
return "order_not_pending_payment";
|
|
34
|
+
if (state.paymentStatus && SUCCESSFUL_PAYMENT_STATUSES.has(state.paymentStatus)) {
|
|
35
|
+
return "order_already_paid";
|
|
36
|
+
}
|
|
37
|
+
if (state.paymentStatus &&
|
|
38
|
+
ACTIVE_PAYMENT_STATUSES.has(state.paymentStatus) &&
|
|
39
|
+
isFreshPaymentActivity(state.paymentUpdatedAt)) {
|
|
40
|
+
return PAYMENT_SESSION_ACTIVE;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Eligibility for an OPERATOR-ISSUED recovery link.
|
|
46
|
+
*
|
|
47
|
+
* Deliberately not {@link shouldSkipCheckoutRecovery}. That gate is written for
|
|
48
|
+
* the cron nudge, and its first rule — leave `pending_payment` and we go quiet —
|
|
49
|
+
* is exactly wrong here. A human looked at the order and decided to send this
|
|
50
|
+
* link, and the orders they send it for are largely the ones that have ALREADY
|
|
51
|
+
* left `pending_payment`: `expired` is the ordinary case, and the redeem rail
|
|
52
|
+
* recreates such an order from its frozen quote when the customer opens the link.
|
|
53
|
+
* Reusing the cron gate would skip those as `order_not_pending_payment`, the
|
|
54
|
+
* operator would have promised an email that never arrives, and nothing anywhere
|
|
55
|
+
* would report a failure. The mint side has already run the full recovery
|
|
56
|
+
* eligibility for this order, so what is left here is only what can have changed
|
|
57
|
+
* between the mint and the send.
|
|
58
|
+
*
|
|
59
|
+
* What still suppresses: the order is gone, or the money is in. Both make the
|
|
60
|
+
* email actively wrong rather than merely late.
|
|
61
|
+
*
|
|
62
|
+
* `payment_session_active` behaves exactly as it does for the nudge, and for the
|
|
63
|
+
* same reason: do not tell someone to finish paying while they are paying. The
|
|
64
|
+
* caller must DEFER on it rather than drop, because a dropped operator link is
|
|
65
|
+
* the silent no-send this whole path is written to prevent.
|
|
66
|
+
*/
|
|
67
|
+
export function shouldSkipOperatorCheckoutRecovery(state) {
|
|
68
|
+
if (state === null)
|
|
69
|
+
return "order_unavailable";
|
|
70
|
+
if (state.orderStatus === "paid")
|
|
71
|
+
return "order_already_paid";
|
|
72
|
+
if (state.paymentStatus && SUCCESSFUL_PAYMENT_STATUSES.has(state.paymentStatus)) {
|
|
73
|
+
return "order_already_paid";
|
|
74
|
+
}
|
|
75
|
+
if (state.paymentStatus &&
|
|
76
|
+
ACTIVE_PAYMENT_STATUSES.has(state.paymentStatus) &&
|
|
77
|
+
isFreshPaymentActivity(state.paymentUpdatedAt)) {
|
|
78
|
+
return PAYMENT_SESSION_ACTIVE;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Eligibility for a recoverable payment-decline notice.
|
|
84
|
+
*
|
|
85
|
+
* Unlike a checkout reminder, a decline notice must not be suppressed by a live
|
|
86
|
+
* retry. Its producer key is once per order, so a later failed attempt cannot
|
|
87
|
+
* replace a notice that was consumed without sending.
|
|
88
|
+
*
|
|
89
|
+
* Suppress only when the order is unavailable, already paid, or no longer
|
|
90
|
+
* pending payment. The producer's claim delay lets successful retries settle
|
|
91
|
+
* before this lifecycle read; scheduling remains the producer/runtime's duty.
|
|
92
|
+
*/
|
|
93
|
+
export function shouldSkipPaymentFailedNotice(state) {
|
|
94
|
+
if (state === null)
|
|
95
|
+
return "order_unavailable";
|
|
96
|
+
if (state.orderStatus !== "pending_payment")
|
|
97
|
+
return "order_not_pending_payment";
|
|
98
|
+
if (state.paymentStatus && SUCCESSFUL_PAYMENT_STATUSES.has(state.paymentStatus)) {
|
|
99
|
+
return "order_already_paid";
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
export function shouldSkipCheckoutExpired(state) {
|
|
104
|
+
if (state === null)
|
|
105
|
+
return "order_unavailable";
|
|
106
|
+
if (state.orderStatus === "expired")
|
|
107
|
+
return null;
|
|
108
|
+
// ⛔ The activation sweep writes `cancelled`, never `expired`, so a first
|
|
109
|
+
// subscription abandoned at the 24h window would fail an `expired`-only gate
|
|
110
|
+
// and the buyer would hear nothing at all. Accepted ONLY with the sweep's own
|
|
111
|
+
// marker, so an ordinary cancellation still cannot reach this template.
|
|
112
|
+
if (state.orderStatus === "cancelled" && state.subscriptionActivationAbandoned === true)
|
|
113
|
+
return null;
|
|
114
|
+
return "order_not_expired";
|
|
115
|
+
}
|
|
116
|
+
function isFreshPaymentActivity(value) {
|
|
117
|
+
if (!value)
|
|
118
|
+
return false;
|
|
119
|
+
const timestamp = Date.parse(value);
|
|
120
|
+
if (!Number.isFinite(timestamp))
|
|
121
|
+
return false;
|
|
122
|
+
return Date.now() - timestamp < FRESH_PAYMENT_ACTIVITY_MS;
|
|
123
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrderEmailLineItem } from "./outboxOrderDraftEmailPorts.js";
|
|
2
|
+
export interface RawLine {
|
|
3
|
+
label: string | null;
|
|
4
|
+
quantity: number;
|
|
5
|
+
lineSubtotalMinor: number | null;
|
|
6
|
+
currency: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface OrderEmailLinePresentation<Locale extends string = string> {
|
|
9
|
+
formatMoney(amountMinor: number, currency: string): string;
|
|
10
|
+
genericItemLabel(locale: Locale): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildItems<Locale extends string>(lines: RawLine[], locale: Locale, presentation: OrderEmailLinePresentation<Locale>): OrderEmailLineItem[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function buildItems(lines, locale, presentation) {
|
|
2
|
+
return lines.map((line) => {
|
|
3
|
+
const name = line.label ?? presentation.genericItemLabel(locale);
|
|
4
|
+
const lineTotalLabel = line.lineSubtotalMinor !== null && line.currency !== null
|
|
5
|
+
? presentation.formatMoney(line.lineSubtotalMinor, line.currency) : "";
|
|
6
|
+
return { name, quantity: line.quantity, lineTotalLabel };
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ORDER_FEEDBACK_SUBMIT_RPC_NAME = "submit_order_feedback";
|
|
3
|
+
export declare const ORDER_FEEDBACK_CHECK_RPC_NAME = "check_order_feedback_token";
|
|
4
|
+
export declare const orderFeedbackTokenCheckRequestSchema: z.ZodObject<{
|
|
5
|
+
token: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type OrderFeedbackTokenCheckRequest = z.infer<typeof orderFeedbackTokenCheckRequestSchema>;
|
|
8
|
+
export declare const orderFeedbackTokenCheckStatusSchema: z.ZodEnum<{
|
|
9
|
+
ready: "ready";
|
|
10
|
+
already_submitted: "already_submitted";
|
|
11
|
+
not_found: "not_found";
|
|
12
|
+
}>;
|
|
13
|
+
export type OrderFeedbackTokenCheckStatus = z.infer<typeof orderFeedbackTokenCheckStatusSchema>;
|
|
14
|
+
export declare const orderFeedbackTokenCheckResponseSchema: z.ZodObject<{
|
|
15
|
+
status: z.ZodEnum<{
|
|
16
|
+
ready: "ready";
|
|
17
|
+
already_submitted: "already_submitted";
|
|
18
|
+
not_found: "not_found";
|
|
19
|
+
}>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type OrderFeedbackTokenCheckResponse = z.infer<typeof orderFeedbackTokenCheckResponseSchema>;
|
|
22
|
+
export declare const orderFeedbackSubmitRequestSchema: z.ZodObject<{
|
|
23
|
+
token: z.ZodString;
|
|
24
|
+
rating: z.ZodNumber;
|
|
25
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type OrderFeedbackSubmitRequest = z.infer<typeof orderFeedbackSubmitRequestSchema>;
|
|
28
|
+
export declare const orderFeedbackSubmitStatusSchema: z.ZodEnum<{
|
|
29
|
+
already_submitted: "already_submitted";
|
|
30
|
+
not_found: "not_found";
|
|
31
|
+
submitted: "submitted";
|
|
32
|
+
}>;
|
|
33
|
+
export type OrderFeedbackSubmitStatus = z.infer<typeof orderFeedbackSubmitStatusSchema>;
|
|
34
|
+
export declare const orderFeedbackSubmitResponseSchema: z.ZodObject<{
|
|
35
|
+
status: z.ZodEnum<{
|
|
36
|
+
already_submitted: "already_submitted";
|
|
37
|
+
not_found: "not_found";
|
|
38
|
+
submitted: "submitted";
|
|
39
|
+
}>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export type OrderFeedbackSubmitResponse = z.infer<typeof orderFeedbackSubmitResponseSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Contract for the public order-feedback (post-delivery review) submit BFF.
|
|
3
|
+
// No login: the opaque token from the review-email link is the only credential.
|
|
4
|
+
export const ORDER_FEEDBACK_SUBMIT_RPC_NAME = "submit_order_feedback";
|
|
5
|
+
export const ORDER_FEEDBACK_CHECK_RPC_NAME = "check_order_feedback_token";
|
|
6
|
+
export const orderFeedbackTokenCheckRequestSchema = z
|
|
7
|
+
.object({ token: z.string().min(1).max(128) })
|
|
8
|
+
.strict();
|
|
9
|
+
export const orderFeedbackTokenCheckStatusSchema = z.enum([
|
|
10
|
+
"ready",
|
|
11
|
+
"already_submitted",
|
|
12
|
+
"not_found",
|
|
13
|
+
]);
|
|
14
|
+
export const orderFeedbackTokenCheckResponseSchema = z
|
|
15
|
+
.object({ status: orderFeedbackTokenCheckStatusSchema })
|
|
16
|
+
.strict();
|
|
17
|
+
export const orderFeedbackSubmitRequestSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
token: z.string().min(1).max(128),
|
|
20
|
+
rating: z.number().int().min(1).max(5),
|
|
21
|
+
comment: z.string().max(2000).optional(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
// The RPC reports outcome without ever exposing the row, so the form can show
|
|
25
|
+
// the right state (submitted / already submitted / unknown token).
|
|
26
|
+
export const orderFeedbackSubmitStatusSchema = z.enum([
|
|
27
|
+
"submitted",
|
|
28
|
+
"already_submitted",
|
|
29
|
+
"not_found",
|
|
30
|
+
]);
|
|
31
|
+
export const orderFeedbackSubmitResponseSchema = z
|
|
32
|
+
.object({ status: orderFeedbackSubmitStatusSchema })
|
|
33
|
+
.strict();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OrderMoneyHeaderRow, OrderMoneyItemRow, CanonicalOrderMoney, OrderMoneyDiagnostic } from "./contracts/orderMoney.js";
|
|
2
|
+
export type { OrderMoneyIssueCode, OrderMoneyHeaderRow, OrderMoneyItemRow, CanonicalOrderMoneyLine, CanonicalOrderMoney, OrderMoneyDiagnostic } from "./contracts/orderMoney.js";
|
|
3
|
+
export declare const ORDER_HEADER_MONEY_COLUMNS: string;
|
|
4
|
+
export declare const ORDER_ITEM_MONEY_COLUMNS: string;
|
|
5
|
+
export declare function deriveOrderMoney(order: OrderMoneyHeaderRow, items?: readonly OrderMoneyItemRow[], onDiagnostic?: (diagnostic: OrderMoneyDiagnostic) => void): CanonicalOrderMoney;
|
|
6
|
+
export declare function emitOrderMoneyDiagnostic(diagnostic: OrderMoneyDiagnostic): void;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export const ORDER_HEADER_MONEY_COLUMNS = [
|
|
2
|
+
"currency",
|
|
3
|
+
"subtotal_cents",
|
|
4
|
+
"discount_cents",
|
|
5
|
+
"shipping_cents",
|
|
6
|
+
"shipping_discount_cents",
|
|
7
|
+
"tax_cents",
|
|
8
|
+
"total_cents",
|
|
9
|
+
].join(", ");
|
|
10
|
+
export const ORDER_ITEM_MONEY_COLUMNS = [
|
|
11
|
+
"unit_price_cents",
|
|
12
|
+
"total_cents",
|
|
13
|
+
"discount_allocated_cents",
|
|
14
|
+
"effective_total_cents",
|
|
15
|
+
"effective_net_cents",
|
|
16
|
+
"vat_rate_bps",
|
|
17
|
+
].join(", ");
|
|
18
|
+
export function deriveOrderMoney(order, items, onDiagnostic = emitOrderMoneyDiagnostic) {
|
|
19
|
+
const issueCodes = new Set();
|
|
20
|
+
const shippingEffective = order.shipping_cents - order.shipping_discount_cents;
|
|
21
|
+
if (order.shipping_discount_cents < 0
|
|
22
|
+
|| order.shipping_discount_cents > order.shipping_cents) {
|
|
23
|
+
issueCodes.add("shipping_discount_out_of_range");
|
|
24
|
+
}
|
|
25
|
+
if (order.discount_cents < 0 || order.discount_cents > order.subtotal_cents) {
|
|
26
|
+
issueCodes.add("product_discount_out_of_range");
|
|
27
|
+
}
|
|
28
|
+
if (order.subtotal_cents - order.discount_cents + shippingEffective
|
|
29
|
+
!== order.total_cents) {
|
|
30
|
+
issueCodes.add("header_equation_mismatch");
|
|
31
|
+
}
|
|
32
|
+
const lines = items?.map((item) => mapLine(item, issueCodes)) ?? [];
|
|
33
|
+
if (items)
|
|
34
|
+
validateLines(order, lines, issueCodes);
|
|
35
|
+
const result = {
|
|
36
|
+
orderId: order.id ?? null,
|
|
37
|
+
currency: order.currency,
|
|
38
|
+
subtotal: order.subtotal_cents,
|
|
39
|
+
productDiscount: order.discount_cents,
|
|
40
|
+
shippingGross: order.shipping_cents,
|
|
41
|
+
shippingDiscount: order.shipping_discount_cents,
|
|
42
|
+
shippingEffective,
|
|
43
|
+
tax: order.tax_cents,
|
|
44
|
+
total: order.total_cents,
|
|
45
|
+
lines,
|
|
46
|
+
validationScope: items ? "full" : "header",
|
|
47
|
+
reconciled: issueCodes.size === 0,
|
|
48
|
+
issueCodes: [...issueCodes],
|
|
49
|
+
};
|
|
50
|
+
if (!result.reconciled) {
|
|
51
|
+
try {
|
|
52
|
+
onDiagnostic({
|
|
53
|
+
event: "commerce_order_money_unreconciled",
|
|
54
|
+
orderId: result.orderId,
|
|
55
|
+
validationScope: result.validationScope,
|
|
56
|
+
issueCodes: result.issueCodes,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Diagnostics must never turn the rollback-only read fallback into a
|
|
61
|
+
// customer-facing outage.
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
export function emitOrderMoneyDiagnostic(diagnostic) {
|
|
67
|
+
console.warn(diagnostic.event, JSON.stringify({
|
|
68
|
+
orderId: diagnostic.orderId,
|
|
69
|
+
validationScope: diagnostic.validationScope,
|
|
70
|
+
issueCodes: diagnostic.issueCodes,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function mapLine(item, issueCodes) {
|
|
74
|
+
const trioComplete = item.discount_allocated_cents != null
|
|
75
|
+
&& item.effective_total_cents != null
|
|
76
|
+
&& item.effective_net_cents != null;
|
|
77
|
+
if (!trioComplete)
|
|
78
|
+
issueCodes.add("missing_item_canonical_money");
|
|
79
|
+
const discountAllocated = trioComplete ? item.discount_allocated_cents : 0;
|
|
80
|
+
const effectiveGross = trioComplete ? item.effective_total_cents : item.total_cents;
|
|
81
|
+
const effectiveNet = trioComplete
|
|
82
|
+
? item.effective_net_cents
|
|
83
|
+
: netFromGross(item.total_cents, item.vat_rate_bps);
|
|
84
|
+
if (!isPositiveSafeInteger(item.quantity)) {
|
|
85
|
+
issueCodes.add("item_quantity_out_of_range");
|
|
86
|
+
}
|
|
87
|
+
if (!isNonNegativeSafeInteger(item.unit_price_cents)
|
|
88
|
+
|| !isNonNegativeSafeInteger(item.total_cents)) {
|
|
89
|
+
issueCodes.add("item_catalog_money_out_of_range");
|
|
90
|
+
}
|
|
91
|
+
if (!isNonNegativeSafeInteger(item.vat_rate_bps)
|
|
92
|
+
|| item.vat_rate_bps > 10_000) {
|
|
93
|
+
issueCodes.add("item_vat_rate_out_of_range");
|
|
94
|
+
}
|
|
95
|
+
if (trioComplete) {
|
|
96
|
+
if (!isNonNegativeSafeInteger(discountAllocated)
|
|
97
|
+
|| discountAllocated > item.total_cents) {
|
|
98
|
+
issueCodes.add("item_discount_out_of_range");
|
|
99
|
+
}
|
|
100
|
+
if (!isNonNegativeSafeInteger(effectiveGross)
|
|
101
|
+
|| !isNonNegativeSafeInteger(effectiveNet)
|
|
102
|
+
|| effectiveGross > item.total_cents
|
|
103
|
+
|| effectiveNet > effectiveGross) {
|
|
104
|
+
issueCodes.add("item_effective_money_out_of_range");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (effectiveGross + discountAllocated !== item.total_cents) {
|
|
108
|
+
issueCodes.add("item_gross_equation_mismatch");
|
|
109
|
+
}
|
|
110
|
+
if (item.unit_price_cents * item.quantity !== item.total_cents) {
|
|
111
|
+
issueCodes.add("item_catalog_equation_mismatch");
|
|
112
|
+
}
|
|
113
|
+
if (effectiveNet !== netFromGross(effectiveGross, item.vat_rate_bps)) {
|
|
114
|
+
issueCodes.add("item_net_vat_mismatch");
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
id: item.id ?? null,
|
|
118
|
+
quantity: item.quantity,
|
|
119
|
+
catalogUnit: item.unit_price_cents,
|
|
120
|
+
catalogTotal: item.total_cents,
|
|
121
|
+
discountAllocated,
|
|
122
|
+
effectiveGross,
|
|
123
|
+
effectiveNet,
|
|
124
|
+
vatRateBps: item.vat_rate_bps,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function validateLines(order, lines, issueCodes) {
|
|
128
|
+
const catalogTotal = sum(lines, (line) => line.catalogTotal);
|
|
129
|
+
const allocatedDiscount = sum(lines, (line) => line.discountAllocated);
|
|
130
|
+
const effectiveTotal = sum(lines, (line) => line.effectiveGross);
|
|
131
|
+
if (catalogTotal !== order.subtotal_cents)
|
|
132
|
+
issueCodes.add("catalog_subtotal_mismatch");
|
|
133
|
+
if (allocatedDiscount !== order.discount_cents)
|
|
134
|
+
issueCodes.add("allocated_discount_mismatch");
|
|
135
|
+
if (effectiveTotal !== order.subtotal_cents - order.discount_cents) {
|
|
136
|
+
issueCodes.add("effective_subtotal_mismatch");
|
|
137
|
+
}
|
|
138
|
+
if (effectiveTotal + order.shipping_cents - order.shipping_discount_cents
|
|
139
|
+
!== order.total_cents) {
|
|
140
|
+
issueCodes.add("total_positions_mismatch");
|
|
141
|
+
}
|
|
142
|
+
const rates = new Set(lines.map((line) => line.vatRateBps));
|
|
143
|
+
if (lines.length > 0 && rates.size !== 1)
|
|
144
|
+
issueCodes.add("mixed_vat_rates");
|
|
145
|
+
if (lines.length > 0 && rates.size === 1) {
|
|
146
|
+
const vatRateBps = lines[0]?.vatRateBps ?? 0;
|
|
147
|
+
const netTotal = sum(lines, (line) => line.effectiveNet)
|
|
148
|
+
+ netFromGross(order.shipping_cents - order.shipping_discount_cents, vatRateBps);
|
|
149
|
+
if (order.total_cents - netTotal !== order.tax_cents) {
|
|
150
|
+
issueCodes.add("tax_total_mismatch");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else if (lines.length === 0 && order.total_cents !== order.tax_cents) {
|
|
154
|
+
issueCodes.add("tax_total_mismatch");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function netFromGross(gross, vatRateBps) {
|
|
158
|
+
return Math.round(gross * 10_000 / (10_000 + vatRateBps));
|
|
159
|
+
}
|
|
160
|
+
function isNonNegativeSafeInteger(value) {
|
|
161
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
162
|
+
}
|
|
163
|
+
function isPositiveSafeInteger(value) {
|
|
164
|
+
return isNonNegativeSafeInteger(value) && value > 0;
|
|
165
|
+
}
|
|
166
|
+
function sum(items, value) {
|
|
167
|
+
return items.reduce((total, item) => total + value(item), 0);
|
|
168
|
+
}
|