@dainamite/cpq 0.2.2
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 +70 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +236 -0
- package/README.md +108 -0
- package/dist/modules/cpq/acl.js +30 -0
- package/dist/modules/cpq/acl.js.map +7 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js +37 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js.map +7 -0
- package/dist/modules/cpq/api/attribute-options/route.js +47 -0
- package/dist/modules/cpq/api/attribute-options/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-slots/route.js +101 -0
- package/dist/modules/cpq/api/bundle-slots/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-tree/route.js +28 -0
- package/dist/modules/cpq/api/bundle-tree/route.js.map +7 -0
- package/dist/modules/cpq/api/context.js +29 -0
- package/dist/modules/cpq/api/context.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/route.js +113 -0
- package/dist/modules/cpq/api/inventory/assets/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js +30 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js +31 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js +99 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js +57 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js +62 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js +116 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js.map +7 -0
- package/dist/modules/cpq/api/offering-components/route.js +91 -0
- package/dist/modules/cpq/api/offering-components/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js +39 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js +28 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js +38 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/route.js +71 -0
- package/dist/modules/cpq/api/orders/route.js.map +7 -0
- package/dist/modules/cpq/api/price-rules/route.js +180 -0
- package/dist/modules/cpq/api/price-rules/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js +142 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-tables/route.js +179 -0
- package/dist/modules/cpq/api/pricing-tables/route.js.map +7 -0
- package/dist/modules/cpq/api/product-attributes/route.js +160 -0
- package/dist/modules/cpq/api/product-attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/product-charges/route.js +166 -0
- package/dist/modules/cpq/api/product-charges/route.js.map +7 -0
- package/dist/modules/cpq/api/product-offerings/route.js +294 -0
- package/dist/modules/cpq/api/product-offerings/route.js.map +7 -0
- package/dist/modules/cpq/api/product-relationships/route.js +144 -0
- package/dist/modules/cpq/api/product-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/product-specifications/route.js +292 -0
- package/dist/modules/cpq/api/product-specifications/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js +71 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js +29 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +54 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js +72 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +35 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js +102 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js +79 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js +95 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js +52 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js +72 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/price/route.js +69 -0
- package/dist/modules/cpq/api/quotes/price/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/route.js +97 -0
- package/dist/modules/cpq/api/quotes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js +86 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js.map +7 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js +38 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js.map +7 -0
- package/dist/modules/cpq/api/wizards/route.js +111 -0
- package/dist/modules/cpq/api/wizards/route.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js +136 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js +185 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js +343 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js +35 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js +20 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +794 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js +917 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js +405 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +677 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js +134 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js +272 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js +407 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js +211 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js +275 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js +112 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js +492 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js +50 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js +249 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js +87 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js +652 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +1289 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js +283 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js +214 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js +1399 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js +148 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js +204 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js +191 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js +119 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js.map +7 -0
- package/dist/modules/cpq/ce.js +151 -0
- package/dist/modules/cpq/ce.js.map +7 -0
- package/dist/modules/cpq/cli.js +11 -0
- package/dist/modules/cpq/cli.js.map +7 -0
- package/dist/modules/cpq/components/CpqListView.js +265 -0
- package/dist/modules/cpq/components/CpqListView.js.map +7 -0
- package/dist/modules/cpq/components/NumberInput.js +95 -0
- package/dist/modules/cpq/components/NumberInput.js.map +7 -0
- package/dist/modules/cpq/components/StatusPath.js +60 -0
- package/dist/modules/cpq/components/StatusPath.js.map +7 -0
- package/dist/modules/cpq/components/statusMaps.js +66 -0
- package/dist/modules/cpq/components/statusMaps.js.map +7 -0
- package/dist/modules/cpq/components/useCpqRowActions.js +125 -0
- package/dist/modules/cpq/components/useCpqRowActions.js.map +7 -0
- package/dist/modules/cpq/data/entities.js +1556 -0
- package/dist/modules/cpq/data/entities.js.map +7 -0
- package/dist/modules/cpq/data/validators.js +575 -0
- package/dist/modules/cpq/data/validators.js.map +7 -0
- package/dist/modules/cpq/di.js +57 -0
- package/dist/modules/cpq/di.js.map +7 -0
- package/dist/modules/cpq/events.js +50 -0
- package/dist/modules/cpq/events.js.map +7 -0
- package/dist/modules/cpq/index.js +16 -0
- package/dist/modules/cpq/index.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/api.js +32 -0
- package/dist/modules/cpq/lib/seeds/api.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js +158 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js.map +7 -0
- package/dist/modules/cpq/lib/seeds.js +6 -0
- package/dist/modules/cpq/lib/seeds.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js +40 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js +54 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js +15 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js +62 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js +56 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js +26 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js +37 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js +35 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js +21 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js +46 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js +118 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js +63 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js +28 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js +36 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js +58 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js +29 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js.map +7 -0
- package/dist/modules/cpq/services/cpqBundleService.js +447 -0
- package/dist/modules/cpq/services/cpqBundleService.js.map +7 -0
- package/dist/modules/cpq/services/cpqInventoryService.js +1371 -0
- package/dist/modules/cpq/services/cpqInventoryService.js.map +7 -0
- package/dist/modules/cpq/services/cpqOrderService.js +901 -0
- package/dist/modules/cpq/services/cpqOrderService.js.map +7 -0
- package/dist/modules/cpq/services/cpqPricingService.js +289 -0
- package/dist/modules/cpq/services/cpqPricingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqProductService.js +204 -0
- package/dist/modules/cpq/services/cpqProductService.js.map +7 -0
- package/dist/modules/cpq/services/cpqQuotingService.js +1867 -0
- package/dist/modules/cpq/services/cpqQuotingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqValidationService.js +234 -0
- package/dist/modules/cpq/services/cpqValidationService.js.map +7 -0
- package/dist/modules/cpq/services/cpqWizardService.js +137 -0
- package/dist/modules/cpq/services/cpqWizardService.js.map +7 -0
- package/dist/modules/cpq/services/types.js +114 -0
- package/dist/modules/cpq/services/types.js.map +7 -0
- package/dist/modules/cpq/setup.js +49 -0
- package/dist/modules/cpq/setup.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js +19 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js +20 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js +192 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js +79 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js +181 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection-table.js +44 -0
- package/dist/modules/cpq/widgets/injection-table.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardRunner.js +113 -0
- package/dist/modules/cpq/workflows/WizardRunner.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js +116 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js.map +7 -0
- package/dist/modules/cpq/workflows/engine.js +188 -0
- package/dist/modules/cpq/workflows/engine.js.map +7 -0
- package/dist/modules/cpq/workflows/registry.js +16 -0
- package/dist/modules/cpq/workflows/registry.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js +119 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js +24 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js +115 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js +327 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js +231 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js +152 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/index.js +49 -0
- package/dist/modules/cpq/workflows/steps/index.js.map +7 -0
- package/dist/modules/cpq/workflows/types.js +1 -0
- package/dist/modules/cpq/workflows/types.js.map +7 -0
- package/package.json +150 -0
- package/src/modules/cpq/__integration__/TC-CPQ-001.spec.ts +177 -0
- package/src/modules/cpq/__integration__/TC-CPQ-002.spec.ts +123 -0
- package/src/modules/cpq/__integration__/TC-CPQ-003.spec.ts +115 -0
- package/src/modules/cpq/__integration__/TC-CPQ-004.spec.ts +184 -0
- package/src/modules/cpq/__integration__/TC-CPQ-005.spec.ts +43 -0
- package/src/modules/cpq/__integration__/TC-CPQ-006.spec.ts +87 -0
- package/src/modules/cpq/__integration__/TC-CPQ-007.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-008.spec.ts +55 -0
- package/src/modules/cpq/__integration__/TC-CPQ-009.spec.ts +45 -0
- package/src/modules/cpq/__integration__/TC-CPQ-010.spec.ts +54 -0
- package/src/modules/cpq/__integration__/TC-CPQ-011.spec.ts +24 -0
- package/src/modules/cpq/__integration__/TC-CPQ-012.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-001.spec.ts +52 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-002.spec.ts +65 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-003.spec.ts +107 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-004.spec.ts +74 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-005.spec.ts +86 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-006.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-007.spec.ts +63 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-008.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-009.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-010.spec.ts +59 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-011.spec.ts +128 -0
- package/src/modules/cpq/__integration__/_helpers/cpqArcFixtures.ts +208 -0
- package/src/modules/cpq/__tests__/package-isolation.test.ts +232 -0
- package/src/modules/cpq/acl.ts +26 -0
- package/src/modules/cpq/api/_helpers/__tests__/handleArcError.test.ts +117 -0
- package/src/modules/cpq/api/_helpers/handleArcError.ts +81 -0
- package/src/modules/cpq/api/attribute-options/route.ts +55 -0
- package/src/modules/cpq/api/bundle-slots/route.ts +112 -0
- package/src/modules/cpq/api/bundle-tree/route.ts +31 -0
- package/src/modules/cpq/api/context.ts +39 -0
- package/src/modules/cpq/api/inventory/assets/route.ts +123 -0
- package/src/modules/cpq/api/inventory/assets/status/route.ts +34 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.ts +30 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/route.ts +31 -0
- package/src/modules/cpq/api/inventory/subscription-items/route.ts +107 -0
- package/src/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.ts +64 -0
- package/src/modules/cpq/api/inventory/subscriptions/expiring/route.ts +66 -0
- package/src/modules/cpq/api/inventory/subscriptions/route.ts +126 -0
- package/src/modules/cpq/api/inventory/subscriptions/status/route.ts +34 -0
- package/src/modules/cpq/api/offering-components/route.ts +103 -0
- package/src/modules/cpq/api/orders/[orderId]/activate/route.ts +48 -0
- package/src/modules/cpq/api/orders/[orderId]/route.ts +28 -0
- package/src/modules/cpq/api/orders/[orderId]/status/route.ts +38 -0
- package/src/modules/cpq/api/orders/route.ts +77 -0
- package/src/modules/cpq/api/price-rules/route.ts +210 -0
- package/src/modules/cpq/api/pricing-table-entries/route.ts +159 -0
- package/src/modules/cpq/api/pricing-tables/route.ts +202 -0
- package/src/modules/cpq/api/product-attributes/route.ts +175 -0
- package/src/modules/cpq/api/product-charges/route.ts +181 -0
- package/src/modules/cpq/api/product-offerings/route.ts +329 -0
- package/src/modules/cpq/api/product-relationships/route.ts +156 -0
- package/src/modules/cpq/api/product-specifications/route.ts +325 -0
- package/src/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.ts +77 -0
- package/src/modules/cpq/api/quotes/[quoteId]/clone/route.ts +28 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +55 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/merge-meta/route.ts +78 -0
- package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +34 -0
- package/src/modules/cpq/api/quotes/[quoteId]/route.ts +109 -0
- package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.ts +91 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.ts +107 -0
- package/src/modules/cpq/api/quotes/attributes/route.ts +61 -0
- package/src/modules/cpq/api/quotes/from-subscription/route.ts +85 -0
- package/src/modules/cpq/api/quotes/price/route.ts +81 -0
- package/src/modules/cpq/api/quotes/route.ts +114 -0
- package/src/modules/cpq/api/quotes/validate-relationships/route.ts +100 -0
- package/src/modules/cpq/api/resolveQuotingService.ts +11 -0
- package/src/modules/cpq/api/wizards/resolve/route.ts +39 -0
- package/src/modules/cpq/api/wizards/route.ts +127 -0
- package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +166 -0
- package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +251 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.tsx +440 -0
- package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/inventory/page.tsx +49 -0
- package/src/modules/cpq/backend/cpq/inventory/shared.tsx +32 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +1085 -0
- package/src/modules/cpq/backend/cpq/offerings/[id]/page.tsx +1165 -0
- package/src/modules/cpq/backend/cpq/offerings/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/offerings/page.tsx +468 -0
- package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +921 -0
- package/src/modules/cpq/backend/cpq/orders/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/orders/page.tsx +182 -0
- package/src/modules/cpq/backend/cpq/price-rules/PriceRuleForm.tsx +310 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.tsx +472 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.tsx +253 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.tsx +431 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.tsx +122 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/page.tsx +588 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.ts +90 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.ts +338 -0
- package/src/modules/cpq/backend/cpq/pricing/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/pricing/page.tsx +111 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.tsx +737 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +1721 -0
- package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/quotes/page.tsx +370 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.tsx +300 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/page.tsx +1722 -0
- package/src/modules/cpq/backend/cpq/specifications/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/specifications/page.tsx +191 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.tsx +319 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/page.tsx +234 -0
- package/src/modules/cpq/backend/cpq/wizards/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/wizards/page.tsx +141 -0
- package/src/modules/cpq/ce.ts +150 -0
- package/src/modules/cpq/cli.ts +10 -0
- package/src/modules/cpq/components/CpqListView.tsx +431 -0
- package/src/modules/cpq/components/NumberInput.tsx +166 -0
- package/src/modules/cpq/components/StatusPath.tsx +116 -0
- package/src/modules/cpq/components/statusMaps.ts +148 -0
- package/src/modules/cpq/components/useCpqRowActions.tsx +183 -0
- package/src/modules/cpq/data/__tests__/validators.arc.test.ts +271 -0
- package/src/modules/cpq/data/__tests__/validators.test.ts +782 -0
- package/src/modules/cpq/data/entities.ts +1467 -0
- package/src/modules/cpq/data/validators.ts +663 -0
- package/src/modules/cpq/di.ts +70 -0
- package/src/modules/cpq/events.ts +62 -0
- package/src/modules/cpq/index.ts +15 -0
- package/src/modules/cpq/lib/seeds/__tests__/api.test.ts +86 -0
- package/src/modules/cpq/lib/seeds/__tests__/tenant-provisioning.test.ts +349 -0
- package/src/modules/cpq/lib/seeds/api.ts +119 -0
- package/src/modules/cpq/lib/seeds/tenant-provisioning.ts +239 -0
- package/src/modules/cpq/lib/seeds.ts +18 -0
- package/src/modules/cpq/migrations/.snapshot-open-mercato.json +7473 -0
- package/src/modules/cpq/migrations/Migration20260220220000_cpq.ts +51 -0
- package/src/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.ts +70 -0
- package/src/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.ts +15 -0
- package/src/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.ts +73 -0
- package/src/modules/cpq/migrations/Migration20260402000000_cpq_workflows.ts +59 -0
- package/src/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.ts +36 -0
- package/src/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.ts +22 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.ts +56 -0
- package/src/modules/cpq/migrations/Migration20260410100000_cpq_inventory.ts +118 -0
- package/src/modules/cpq/migrations/Migration20260411000000_cpq_orders.ts +62 -0
- package/src/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260504064621_cpq_arc.ts +68 -0
- package/src/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.ts +27 -0
- package/src/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.ts +82 -0
- package/src/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.ts +52 -0
- package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +59 -0
- package/src/modules/cpq/services/__tests__/cpqBundleService.test.ts +661 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.arc.test.ts +357 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.test.ts +718 -0
- package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +1012 -0
- package/src/modules/cpq/services/__tests__/cpqProductService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +143 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +658 -0
- package/src/modules/cpq/services/__tests__/cpqValidationService.test.ts +811 -0
- package/src/modules/cpq/services/__tests__/cpqWizardService.test.ts +389 -0
- package/src/modules/cpq/services/__tests__/types.test.ts +359 -0
- package/src/modules/cpq/services/cpqBundleService.ts +671 -0
- package/src/modules/cpq/services/cpqInventoryService.ts +1929 -0
- package/src/modules/cpq/services/cpqOrderService.ts +1230 -0
- package/src/modules/cpq/services/cpqPricingService.ts +412 -0
- package/src/modules/cpq/services/cpqProductService.ts +311 -0
- package/src/modules/cpq/services/cpqQuotingService.ts +2638 -0
- package/src/modules/cpq/services/cpqValidationService.ts +323 -0
- package/src/modules/cpq/services/cpqWizardService.ts +204 -0
- package/src/modules/cpq/services/types.ts +303 -0
- package/src/modules/cpq/setup.ts +63 -0
- package/src/modules/cpq/subscribers/subscription-amended-log.ts +20 -0
- package/src/modules/cpq/subscribers/subscription-cancelled-log.ts +19 -0
- package/src/modules/cpq/subscribers/subscription-merged-log.ts +22 -0
- package/src/modules/cpq/subscribers/subscription-renewed-log.ts +18 -0
- package/src/modules/cpq/subscribers/subscription-superseded-log.ts +19 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.client.tsx +339 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.client.tsx +96 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.client.tsx +265 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection-table.ts +42 -0
- package/src/modules/cpq/workflows/WizardRunner.tsx +158 -0
- package/src/modules/cpq/workflows/WizardTrigger.tsx +142 -0
- package/src/modules/cpq/workflows/engine.tsx +278 -0
- package/src/modules/cpq/workflows/registry.ts +15 -0
- package/src/modules/cpq/workflows/steps/CustomerSelectStep.tsx +136 -0
- package/src/modules/cpq/workflows/steps/InventorySelectStep.tsx +34 -0
- package/src/modules/cpq/workflows/steps/ItemListStep.tsx +146 -0
- package/src/modules/cpq/workflows/steps/OfferingSelectStep.tsx +438 -0
- package/src/modules/cpq/workflows/steps/ProductConfigureStep.tsx +287 -0
- package/src/modules/cpq/workflows/steps/ReviewStep.tsx +219 -0
- package/src/modules/cpq/workflows/steps/index.ts +51 -0
- package/src/modules/cpq/workflows/types.ts +102 -0
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
import { SalesOrder, SalesOrderLine } from "@open-mercato/core/modules/sales/data/entities";
|
|
2
|
+
import {
|
|
3
|
+
CpqQuoteConfiguration,
|
|
4
|
+
CpqQuoteLineConfiguration,
|
|
5
|
+
CpqQuoteTargetSubscription,
|
|
6
|
+
CpqOrderConfiguration,
|
|
7
|
+
CpqOrderLineConfiguration,
|
|
8
|
+
CpqProductOffering,
|
|
9
|
+
CpqProductSpecification,
|
|
10
|
+
CpqInventorySubscriptionItem
|
|
11
|
+
} from "../data/entities.js";
|
|
12
|
+
import {
|
|
13
|
+
CPQ_ORDER_TRANSITIONS
|
|
14
|
+
} from "./types.js";
|
|
15
|
+
import { emitCpqEvent } from "../events.js";
|
|
16
|
+
const CPQ_TO_SALES_ORDER_STATUS = {
|
|
17
|
+
draft: "draft",
|
|
18
|
+
pending_activation: "pending",
|
|
19
|
+
active: "active",
|
|
20
|
+
cancelled: "cancelled",
|
|
21
|
+
fulfilled: "fulfilled"
|
|
22
|
+
};
|
|
23
|
+
class DefaultCpqOrderService {
|
|
24
|
+
constructor(deps) {
|
|
25
|
+
this.em = deps.em;
|
|
26
|
+
this.inventoryService = deps.cpqInventoryService;
|
|
27
|
+
this.numberGenerator = deps.salesDocumentNumberGenerator;
|
|
28
|
+
}
|
|
29
|
+
// ─── Convert Quote to Order ─────────────────────────────────
|
|
30
|
+
async convertQuoteToOrder(quoteId, scope) {
|
|
31
|
+
const em = this.em;
|
|
32
|
+
const cpqConfig = await em.findOne(CpqQuoteConfiguration, {
|
|
33
|
+
id: quoteId,
|
|
34
|
+
organizationId: scope.organizationId,
|
|
35
|
+
tenantId: scope.tenantId,
|
|
36
|
+
deletedAt: null
|
|
37
|
+
});
|
|
38
|
+
if (!cpqConfig) {
|
|
39
|
+
const byQuoteId = await em.findOne(CpqQuoteConfiguration, {
|
|
40
|
+
quoteId,
|
|
41
|
+
organizationId: scope.organizationId,
|
|
42
|
+
tenantId: scope.tenantId,
|
|
43
|
+
deletedAt: null
|
|
44
|
+
});
|
|
45
|
+
if (!byQuoteId) throw new OrderError(404, "Quote not found");
|
|
46
|
+
return this.convertFromConfig(byQuoteId, scope);
|
|
47
|
+
}
|
|
48
|
+
return this.convertFromConfig(cpqConfig, scope);
|
|
49
|
+
}
|
|
50
|
+
async convertFromConfig(cpqConfig, scope) {
|
|
51
|
+
const em = this.em;
|
|
52
|
+
const blockedStatuses = ["cancelled", "rejected"];
|
|
53
|
+
if (blockedStatuses.includes(cpqConfig.cpqStatus)) {
|
|
54
|
+
throw new OrderError(409, `Cannot convert a quote in '${cpqConfig.cpqStatus}' status`);
|
|
55
|
+
}
|
|
56
|
+
const existingOrder = await em.findOne(CpqOrderConfiguration, {
|
|
57
|
+
sourceQuoteId: cpqConfig.id,
|
|
58
|
+
organizationId: scope.organizationId,
|
|
59
|
+
tenantId: scope.tenantId,
|
|
60
|
+
deletedAt: null
|
|
61
|
+
});
|
|
62
|
+
if (existingOrder) {
|
|
63
|
+
throw new OrderError(
|
|
64
|
+
409,
|
|
65
|
+
`Quote has already been converted to order ${existingOrder.orderId}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const quoteLines = await em.find(CpqQuoteLineConfiguration, {
|
|
69
|
+
quoteConfigurationId: cpqConfig.id,
|
|
70
|
+
organizationId: scope.organizationId,
|
|
71
|
+
tenantId: scope.tenantId,
|
|
72
|
+
deletedAt: null
|
|
73
|
+
});
|
|
74
|
+
if (quoteLines.length === 0) {
|
|
75
|
+
throw new OrderError(422, "Cannot convert a quote with no line items");
|
|
76
|
+
}
|
|
77
|
+
const { number: orderNumber } = await this.numberGenerator.generate({
|
|
78
|
+
kind: "order",
|
|
79
|
+
organizationId: scope.organizationId,
|
|
80
|
+
tenantId: scope.tenantId
|
|
81
|
+
});
|
|
82
|
+
const salesOrderId = crypto.randomUUID();
|
|
83
|
+
const pricingSummary = cpqConfig.pricingSummary;
|
|
84
|
+
const nrcTotal = Number(pricingSummary?.nrcTotal ?? 0);
|
|
85
|
+
const mrcTotal = Number(pricingSummary?.mrcTotal ?? 0);
|
|
86
|
+
const grandTotal = nrcTotal + mrcTotal;
|
|
87
|
+
const salesOrder = em.create(SalesOrder, {
|
|
88
|
+
id: salesOrderId,
|
|
89
|
+
organizationId: scope.organizationId,
|
|
90
|
+
tenantId: scope.tenantId,
|
|
91
|
+
orderNumber,
|
|
92
|
+
customerEntityId: cpqConfig.customerId,
|
|
93
|
+
currencyCode: cpqConfig.currencyCode,
|
|
94
|
+
status: "draft",
|
|
95
|
+
subtotalNetAmount: String(grandTotal),
|
|
96
|
+
subtotalGrossAmount: String(grandTotal),
|
|
97
|
+
discountTotalAmount: "0",
|
|
98
|
+
taxTotalAmount: "0",
|
|
99
|
+
shippingNetAmount: "0",
|
|
100
|
+
shippingGrossAmount: "0",
|
|
101
|
+
surchargeTotalAmount: "0",
|
|
102
|
+
paidTotalAmount: "0",
|
|
103
|
+
grandTotalNetAmount: String(grandTotal),
|
|
104
|
+
grandTotalGrossAmount: String(grandTotal),
|
|
105
|
+
lineItemCount: quoteLines.length,
|
|
106
|
+
metadata: { sourceQuoteId: cpqConfig.id },
|
|
107
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
108
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
109
|
+
});
|
|
110
|
+
em.persist(salesOrder);
|
|
111
|
+
const cpqOrderConfigId = crypto.randomUUID();
|
|
112
|
+
const cpqOrderConfig = em.create(CpqOrderConfiguration, {
|
|
113
|
+
id: cpqOrderConfigId,
|
|
114
|
+
organizationId: scope.organizationId,
|
|
115
|
+
tenantId: scope.tenantId,
|
|
116
|
+
orderId: salesOrderId,
|
|
117
|
+
sourceQuoteId: cpqConfig.id,
|
|
118
|
+
customerId: cpqConfig.customerId,
|
|
119
|
+
cpqStatus: "draft",
|
|
120
|
+
currencyCode: cpqConfig.currencyCode,
|
|
121
|
+
pricingSummary: {
|
|
122
|
+
nrcTotal,
|
|
123
|
+
mrcTotal,
|
|
124
|
+
currencyCode: cpqConfig.currencyCode
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
em.persist(cpqOrderConfig);
|
|
128
|
+
const quoteLineIdToOrderLineId = /* @__PURE__ */ new Map();
|
|
129
|
+
for (let i = 0; i < quoteLines.length; i++) {
|
|
130
|
+
const ql = quoteLines[i];
|
|
131
|
+
const perInstanceNrc = Number(ql.nrcTotal);
|
|
132
|
+
const perInstanceMrc = Number(ql.mrcTotal);
|
|
133
|
+
const unitPriceNet = (perInstanceNrc + perInstanceMrc) / ql.quantity;
|
|
134
|
+
const totalNet = perInstanceNrc + perInstanceMrc;
|
|
135
|
+
const orderLineId = crypto.randomUUID();
|
|
136
|
+
quoteLineIdToOrderLineId.set(ql.quoteLineId, orderLineId);
|
|
137
|
+
const offeringName = await this.resolveOfferingName(
|
|
138
|
+
em,
|
|
139
|
+
ql.offeringId,
|
|
140
|
+
scope,
|
|
141
|
+
ql.configuration
|
|
142
|
+
);
|
|
143
|
+
const orderLine = em.create(SalesOrderLine, {
|
|
144
|
+
id: orderLineId,
|
|
145
|
+
order: salesOrder,
|
|
146
|
+
organizationId: scope.organizationId,
|
|
147
|
+
tenantId: scope.tenantId,
|
|
148
|
+
lineNumber: i + 1,
|
|
149
|
+
kind: "product",
|
|
150
|
+
productId: ql.productId ?? null,
|
|
151
|
+
name: offeringName,
|
|
152
|
+
quantity: String(ql.quantity),
|
|
153
|
+
unitPriceNet: String(unitPriceNet),
|
|
154
|
+
unitPriceGross: String(unitPriceNet),
|
|
155
|
+
totalNetAmount: String(totalNet),
|
|
156
|
+
totalGrossAmount: String(totalNet),
|
|
157
|
+
discountAmount: "0",
|
|
158
|
+
discountPercent: "0",
|
|
159
|
+
taxRate: "0",
|
|
160
|
+
taxAmount: "0",
|
|
161
|
+
currencyCode: cpqConfig.currencyCode,
|
|
162
|
+
configuration: {
|
|
163
|
+
offeringId: ql.offeringId ?? null,
|
|
164
|
+
action: ql.action,
|
|
165
|
+
nrcTotal: perInstanceNrc,
|
|
166
|
+
mrcTotal: perInstanceMrc,
|
|
167
|
+
parentLineId: ql.parentLineId ?? null
|
|
168
|
+
},
|
|
169
|
+
normalizedQuantity: String(ql.quantity),
|
|
170
|
+
reservedQuantity: "0",
|
|
171
|
+
fulfilledQuantity: "0",
|
|
172
|
+
invoicedQuantity: "0",
|
|
173
|
+
returnedQuantity: "0",
|
|
174
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
175
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
176
|
+
});
|
|
177
|
+
em.persist(orderLine);
|
|
178
|
+
const orderLineConfig = em.create(CpqOrderLineConfiguration, {
|
|
179
|
+
organizationId: scope.organizationId,
|
|
180
|
+
tenantId: scope.tenantId,
|
|
181
|
+
orderLineId,
|
|
182
|
+
orderConfigurationId: cpqOrderConfig.id,
|
|
183
|
+
offeringId: ql.offeringId ?? null,
|
|
184
|
+
productId: ql.productId ?? null,
|
|
185
|
+
specId: ql.specId ?? null,
|
|
186
|
+
action: ql.action,
|
|
187
|
+
parentLineId: null,
|
|
188
|
+
startDate: ql.startDate,
|
|
189
|
+
termMonths: ql.termMonths ?? null,
|
|
190
|
+
endDate: ql.endDate,
|
|
191
|
+
configuration: { ...ql.configuration, offeringName },
|
|
192
|
+
quantity: ql.quantity,
|
|
193
|
+
charges: ql.charges ? [...ql.charges] : null,
|
|
194
|
+
nrcTotal: ql.nrcTotal,
|
|
195
|
+
mrcTotal: ql.mrcTotal,
|
|
196
|
+
sourceQuoteLineId: ql.quoteLineId
|
|
197
|
+
});
|
|
198
|
+
em.persist(orderLineConfig);
|
|
199
|
+
}
|
|
200
|
+
await em.flush();
|
|
201
|
+
const orderLineConfigs = await em.find(CpqOrderLineConfiguration, {
|
|
202
|
+
orderConfigurationId: cpqOrderConfig.id,
|
|
203
|
+
organizationId: scope.organizationId,
|
|
204
|
+
tenantId: scope.tenantId
|
|
205
|
+
});
|
|
206
|
+
for (const olc of orderLineConfigs) {
|
|
207
|
+
if (olc.sourceQuoteLineId) {
|
|
208
|
+
const sourceQl = quoteLines.find((ql) => ql.quoteLineId === olc.sourceQuoteLineId);
|
|
209
|
+
if (sourceQl?.parentLineId) {
|
|
210
|
+
const mappedParent = quoteLineIdToOrderLineId.get(sourceQl.parentLineId);
|
|
211
|
+
if (mappedParent) olc.parentLineId = mappedParent;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
await em.flush();
|
|
216
|
+
return this.buildOrderResult(em, cpqOrderConfig, salesOrder, orderLineConfigs, scope);
|
|
217
|
+
}
|
|
218
|
+
// ─── Activate Order ─────────────────────────────────────────
|
|
219
|
+
async activateOrder(orderId, scope) {
|
|
220
|
+
const em = this.em;
|
|
221
|
+
const orderConfig = await this.loadOrderConfig(em, orderId, scope);
|
|
222
|
+
const currentStatus = orderConfig.cpqStatus;
|
|
223
|
+
if (currentStatus !== "draft" && currentStatus !== "pending_activation") {
|
|
224
|
+
throw new OrderError(409, `Cannot activate order in '${currentStatus}' status`);
|
|
225
|
+
}
|
|
226
|
+
const salesOrder = await this.loadSalesOrder(em, orderConfig.orderId, scope);
|
|
227
|
+
const orderLines = await em.find(CpqOrderLineConfiguration, {
|
|
228
|
+
orderConfigurationId: orderConfig.id,
|
|
229
|
+
organizationId: scope.organizationId,
|
|
230
|
+
tenantId: scope.tenantId,
|
|
231
|
+
deletedAt: null
|
|
232
|
+
});
|
|
233
|
+
const sourceQuote = orderConfig.sourceQuoteId ? await em.findOne(CpqQuoteConfiguration, {
|
|
234
|
+
id: orderConfig.sourceQuoteId,
|
|
235
|
+
organizationId: scope.organizationId,
|
|
236
|
+
tenantId: scope.tenantId,
|
|
237
|
+
deletedAt: null
|
|
238
|
+
}) : null;
|
|
239
|
+
const quoteType = sourceQuote?.quoteType ?? "new";
|
|
240
|
+
const arcEvents = [];
|
|
241
|
+
if (quoteType === "new") {
|
|
242
|
+
await this.createInventoryFromOrder(orderConfig, orderLines, scope);
|
|
243
|
+
} else {
|
|
244
|
+
arcEvents.push(
|
|
245
|
+
...await this.applyArcOrder(orderConfig, sourceQuote, orderLines, scope)
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
orderConfig.cpqStatus = "active";
|
|
249
|
+
orderConfig.activatedAt = /* @__PURE__ */ new Date();
|
|
250
|
+
salesOrder.status = "active";
|
|
251
|
+
salesOrder.placedAt = /* @__PURE__ */ new Date();
|
|
252
|
+
await em.flush();
|
|
253
|
+
for (const fire of arcEvents) {
|
|
254
|
+
try {
|
|
255
|
+
await fire();
|
|
256
|
+
} catch (err) {
|
|
257
|
+
console.error("[cpq.arc] event emission failed", err);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return this.buildOrderResult(em, orderConfig, salesOrder, orderLines, scope);
|
|
261
|
+
}
|
|
262
|
+
// ─── ARC activation branch (XD-250) ─────────────────────────
|
|
263
|
+
//
|
|
264
|
+
// Reads the source quote's targets + lines, then dispatches per target to
|
|
265
|
+
// cpqInventoryService.apply* primitives. Returns the list of post-commit
|
|
266
|
+
// event emissions so the caller can fire them outside the activation TX.
|
|
267
|
+
async applyArcOrder(orderConfig, sourceQuote, orderLines, scope) {
|
|
268
|
+
const em = this.em;
|
|
269
|
+
const quoteType = sourceQuote.quoteType;
|
|
270
|
+
const targets = await em.find(CpqQuoteTargetSubscription, {
|
|
271
|
+
quoteId: sourceQuote.id,
|
|
272
|
+
organizationId: scope.organizationId,
|
|
273
|
+
tenantId: scope.tenantId,
|
|
274
|
+
deletedAt: null
|
|
275
|
+
});
|
|
276
|
+
if (targets.length === 0) {
|
|
277
|
+
throw new OrderError(
|
|
278
|
+
409,
|
|
279
|
+
`ARC quote ${sourceQuote.id} has no target subscriptions to activate`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const inventory = this.inventoryService;
|
|
283
|
+
const sourceQuoteLines = await em.find(CpqQuoteLineConfiguration, {
|
|
284
|
+
quoteConfigurationId: sourceQuote.id,
|
|
285
|
+
organizationId: scope.organizationId,
|
|
286
|
+
tenantId: scope.tenantId,
|
|
287
|
+
deletedAt: null
|
|
288
|
+
});
|
|
289
|
+
const linesByTarget = /* @__PURE__ */ new Map();
|
|
290
|
+
for (const line of sourceQuoteLines) {
|
|
291
|
+
const key = line.targetSubscriptionId ?? null;
|
|
292
|
+
const list = linesByTarget.get(key) ?? [];
|
|
293
|
+
list.push(line);
|
|
294
|
+
linesByTarget.set(key, list);
|
|
295
|
+
}
|
|
296
|
+
const specIds = [
|
|
297
|
+
...new Set(sourceQuoteLines.map((l) => l.specId).filter((x) => Boolean(x)))
|
|
298
|
+
];
|
|
299
|
+
const specs = specIds.length > 0 ? await em.find(CpqProductSpecification, {
|
|
300
|
+
id: { $in: specIds },
|
|
301
|
+
organizationId: scope.organizationId,
|
|
302
|
+
tenantId: scope.tenantId,
|
|
303
|
+
deletedAt: null
|
|
304
|
+
}) : [];
|
|
305
|
+
const specMap = new Map(specs.map((s) => [s.id, s]));
|
|
306
|
+
const events = [];
|
|
307
|
+
const eventBaseEnvelope = {
|
|
308
|
+
organizationId: scope.organizationId,
|
|
309
|
+
tenantId: scope.tenantId,
|
|
310
|
+
sourceQuoteId: sourceQuote.id,
|
|
311
|
+
sourceOrderId: orderConfig.id
|
|
312
|
+
};
|
|
313
|
+
if (quoteType === "amend") {
|
|
314
|
+
for (const target of targets) {
|
|
315
|
+
const lines = linesByTarget.get(target.subscriptionId) ?? [];
|
|
316
|
+
const result = await inventory.applyAmendment(
|
|
317
|
+
{
|
|
318
|
+
subscriptionId: target.subscriptionId,
|
|
319
|
+
sourceQuoteId: sourceQuote.id,
|
|
320
|
+
sourceOrderId: orderConfig.id,
|
|
321
|
+
performedByUserId: null,
|
|
322
|
+
lineChanges: lines.map((l) => buildArcLineChange(l, specMap))
|
|
323
|
+
},
|
|
324
|
+
scope
|
|
325
|
+
);
|
|
326
|
+
events.push(
|
|
327
|
+
() => emitArcEvent("cpq.subscription.amended", result, eventBaseEnvelope)
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
} else if (quoteType === "cancel") {
|
|
331
|
+
for (const target of targets) {
|
|
332
|
+
const result = await inventory.applyCancel(
|
|
333
|
+
{
|
|
334
|
+
subscriptionId: target.subscriptionId,
|
|
335
|
+
sourceQuoteId: sourceQuote.id,
|
|
336
|
+
sourceOrderId: orderConfig.id,
|
|
337
|
+
performedByUserId: null,
|
|
338
|
+
etfAmount: sourceQuote.arcEtfAmount ?? null,
|
|
339
|
+
etfCurrency: sourceQuote.arcEtfCurrency ?? null,
|
|
340
|
+
reasonCode: sourceQuote.arcReasonCode ?? null,
|
|
341
|
+
reasonText: sourceQuote.arcReasonText ?? null
|
|
342
|
+
},
|
|
343
|
+
scope
|
|
344
|
+
);
|
|
345
|
+
events.push(
|
|
346
|
+
() => emitArcEvent("cpq.subscription.cancelled", result, {
|
|
347
|
+
...eventBaseEnvelope,
|
|
348
|
+
etfAmount: sourceQuote.arcEtfAmount ?? null,
|
|
349
|
+
etfCurrency: sourceQuote.arcEtfCurrency ?? null,
|
|
350
|
+
reasonCode: sourceQuote.arcReasonCode ?? null,
|
|
351
|
+
reasonText: sourceQuote.arcReasonText ?? null
|
|
352
|
+
})
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
} else if (quoteType === "renew") {
|
|
356
|
+
const standalone = targets.filter((t) => t.mergeAction === "standalone");
|
|
357
|
+
const absorb = targets.filter((t) => t.mergeAction === "absorb");
|
|
358
|
+
if (standalone.length > 0 && absorb.length === 0) {
|
|
359
|
+
for (const target of standalone) {
|
|
360
|
+
if (!target.newTermStart || !target.newTermEnd) {
|
|
361
|
+
throw new OrderError(
|
|
362
|
+
409,
|
|
363
|
+
`Standalone renew target ${target.id} missing newTermStart/newTermEnd`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
const lines = linesByTarget.get(target.subscriptionId) ?? [];
|
|
367
|
+
const result = await inventory.applyRenewal(
|
|
368
|
+
{
|
|
369
|
+
subscriptionId: target.subscriptionId,
|
|
370
|
+
sourceQuoteId: sourceQuote.id,
|
|
371
|
+
sourceOrderId: orderConfig.id,
|
|
372
|
+
performedByUserId: null,
|
|
373
|
+
term: {
|
|
374
|
+
newTermStart: target.newTermStart,
|
|
375
|
+
newTermEnd: target.newTermEnd,
|
|
376
|
+
newTermMonths: target.newTermMonths ?? null
|
|
377
|
+
},
|
|
378
|
+
lineChanges: lines.map((l) => buildArcLineChange(l, specMap))
|
|
379
|
+
},
|
|
380
|
+
scope
|
|
381
|
+
);
|
|
382
|
+
events.push(
|
|
383
|
+
() => emitArcEvent("cpq.subscription.renewed", result, {
|
|
384
|
+
...eventBaseEnvelope,
|
|
385
|
+
term: {
|
|
386
|
+
newTermStart: target.newTermStart.toISOString(),
|
|
387
|
+
newTermEnd: target.newTermEnd.toISOString()
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
} else if (absorb.length >= 2 && standalone.length === 0) {
|
|
393
|
+
if (!sourceQuote.arcMergeNewTermStart || !sourceQuote.arcMergeNewTermEnd) {
|
|
394
|
+
throw new OrderError(
|
|
395
|
+
409,
|
|
396
|
+
`Merge renew quote ${sourceQuote.id} missing arc_merge_new_term_*`
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
const mergeLines = linesByTarget.get(null) ?? [];
|
|
400
|
+
const merge = await inventory.applyMergeRenewal(
|
|
401
|
+
{
|
|
402
|
+
sourceIds: absorb.map((t) => t.subscriptionId),
|
|
403
|
+
sourceQuoteId: sourceQuote.id,
|
|
404
|
+
sourceOrderId: orderConfig.id,
|
|
405
|
+
performedByUserId: null,
|
|
406
|
+
term: {
|
|
407
|
+
newTermStart: sourceQuote.arcMergeNewTermStart,
|
|
408
|
+
newTermEnd: sourceQuote.arcMergeNewTermEnd,
|
|
409
|
+
newTermMonths: sourceQuote.arcMergeNewTermMonths ?? null
|
|
410
|
+
},
|
|
411
|
+
mergeMeta: {
|
|
412
|
+
newSubCode: sourceQuote.arcMergeNewSubCode ?? null,
|
|
413
|
+
newSubName: sourceQuote.arcMergeNewSubName ?? null
|
|
414
|
+
},
|
|
415
|
+
lineChanges: mergeLines.map((l) => buildArcLineChange(l, specMap))
|
|
416
|
+
},
|
|
417
|
+
scope
|
|
418
|
+
);
|
|
419
|
+
const mergedFromSubscriptionIds = absorb.map((t) => t.subscriptionId);
|
|
420
|
+
events.push(
|
|
421
|
+
() => emitMergedEvent(merge, eventBaseEnvelope, mergedFromSubscriptionIds)
|
|
422
|
+
);
|
|
423
|
+
for (const sourceLog of merge.sourceChangeLogs) {
|
|
424
|
+
events.push(
|
|
425
|
+
() => emitSupersededEvent(sourceLog, merge.mergedSubscription.id, eventBaseEnvelope)
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
throw new OrderError(
|
|
430
|
+
409,
|
|
431
|
+
`Inconsistent renew targets \u2014 must be either single standalone or \u22652 absorb`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
throw new OrderError(500, `Unknown quote_type '${quoteType}' for ARC activation`);
|
|
436
|
+
}
|
|
437
|
+
return events;
|
|
438
|
+
}
|
|
439
|
+
// ─── Inventory Creation ─────────────────────────────────────
|
|
440
|
+
async createInventoryFromOrder(orderConfig, orderLines, scope) {
|
|
441
|
+
if (orderLines.length === 0) return;
|
|
442
|
+
const specIds = [...new Set(orderLines.map((l) => l.specId).filter(Boolean))];
|
|
443
|
+
const specs = specIds.length > 0 ? await this.em.find(CpqProductSpecification, {
|
|
444
|
+
id: { $in: specIds },
|
|
445
|
+
organizationId: scope.organizationId,
|
|
446
|
+
tenantId: scope.tenantId,
|
|
447
|
+
deletedAt: null
|
|
448
|
+
}) : [];
|
|
449
|
+
const specMap = new Map(specs.map((s) => [s.id, s]));
|
|
450
|
+
const subscriptionLines = orderLines.filter((l) => {
|
|
451
|
+
const spec = l.specId ? specMap.get(l.specId) : null;
|
|
452
|
+
return !spec?.isAssetizable;
|
|
453
|
+
});
|
|
454
|
+
const assetLines = orderLines.filter((l) => {
|
|
455
|
+
const spec = l.specId ? specMap.get(l.specId) : null;
|
|
456
|
+
return spec?.isAssetizable === true;
|
|
457
|
+
});
|
|
458
|
+
const hasSubscriptionContent = subscriptionLines.some(
|
|
459
|
+
(l) => Number(l.mrcTotal) > 0 || Number(l.nrcTotal) > 0
|
|
460
|
+
);
|
|
461
|
+
if (!hasSubscriptionContent && assetLines.length === 0) return;
|
|
462
|
+
const subscriptionName = await this.buildSubscriptionName(orderConfig, orderLines, scope);
|
|
463
|
+
const lineWithDates = orderLines.find((l) => l.startDate != null) ?? orderLines[0];
|
|
464
|
+
const lineWithTerm = orderLines.find((l) => l.termMonths != null) ?? orderLines[0];
|
|
465
|
+
const subscriptionItems = subscriptionLines.map((line) => ({
|
|
466
|
+
productId: line.productId ?? void 0,
|
|
467
|
+
offeringId: line.offeringId ?? void 0,
|
|
468
|
+
specId: line.specId ?? void 0,
|
|
469
|
+
name: this.getLineName(line),
|
|
470
|
+
configuration: line.configuration ?? {},
|
|
471
|
+
charges: line.charges ?? [],
|
|
472
|
+
mrcAmount: Number(line.mrcTotal),
|
|
473
|
+
nrcAmount: Number(line.nrcTotal),
|
|
474
|
+
currencyCode: orderConfig.currencyCode,
|
|
475
|
+
quantity: line.quantity,
|
|
476
|
+
sourceQuoteLineId: line.sourceQuoteLineId ?? void 0,
|
|
477
|
+
sortOrder: orderLines.indexOf(line)
|
|
478
|
+
}));
|
|
479
|
+
const subscription = await this.inventoryService.createSubscription(
|
|
480
|
+
{
|
|
481
|
+
customerId: orderConfig.customerId,
|
|
482
|
+
name: subscriptionName,
|
|
483
|
+
billingCycle: "monthly",
|
|
484
|
+
currencyCode: orderConfig.currencyCode,
|
|
485
|
+
startDate: lineWithDates?.startDate?.toISOString?.() ?? void 0,
|
|
486
|
+
termMonths: lineWithTerm?.termMonths ?? void 0,
|
|
487
|
+
sourceQuoteId: orderConfig.sourceQuoteId ?? void 0,
|
|
488
|
+
sourceOrderId: orderConfig.id,
|
|
489
|
+
items: subscriptionItems.length > 0 ? subscriptionItems : [{ name: subscriptionName, mrcAmount: 0, nrcAmount: 0 }]
|
|
490
|
+
},
|
|
491
|
+
scope
|
|
492
|
+
);
|
|
493
|
+
const orderLineToSubItem = /* @__PURE__ */ new Map();
|
|
494
|
+
const allSubItems = await this.em.find(CpqInventorySubscriptionItem, {
|
|
495
|
+
subscriptionId: subscription.id,
|
|
496
|
+
organizationId: scope.organizationId,
|
|
497
|
+
tenantId: scope.tenantId,
|
|
498
|
+
deletedAt: null
|
|
499
|
+
}, { orderBy: { sortOrder: "asc" } });
|
|
500
|
+
for (let i = 0; i < subscriptionLines.length && i < allSubItems.length; i++) {
|
|
501
|
+
orderLineToSubItem.set(subscriptionLines[i].orderLineId, allSubItems[i].id);
|
|
502
|
+
}
|
|
503
|
+
for (let i = 0; i < subscriptionLines.length && i < allSubItems.length; i++) {
|
|
504
|
+
const orderLine = subscriptionLines[i];
|
|
505
|
+
if (orderLine.parentLineId) {
|
|
506
|
+
const parentSubItemId = orderLineToSubItem.get(orderLine.parentLineId);
|
|
507
|
+
if (parentSubItemId) {
|
|
508
|
+
allSubItems[i].parentItemId = parentSubItemId;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
await this.em.flush();
|
|
513
|
+
for (const line of assetLines) {
|
|
514
|
+
let subscriptionItemId;
|
|
515
|
+
if (line.parentLineId) {
|
|
516
|
+
subscriptionItemId = orderLineToSubItem.get(line.parentLineId) ?? void 0;
|
|
517
|
+
}
|
|
518
|
+
await this.inventoryService.createAsset(
|
|
519
|
+
{
|
|
520
|
+
customerId: orderConfig.customerId,
|
|
521
|
+
subscriptionId: subscription.id,
|
|
522
|
+
subscriptionItemId,
|
|
523
|
+
productId: line.productId ?? void 0,
|
|
524
|
+
offeringId: line.offeringId ?? void 0,
|
|
525
|
+
specId: line.specId ?? void 0,
|
|
526
|
+
name: this.getLineName(line),
|
|
527
|
+
assetType: "one_time",
|
|
528
|
+
currencyCode: orderConfig.currencyCode,
|
|
529
|
+
purchasePrice: Number(line.nrcTotal),
|
|
530
|
+
quantity: line.quantity,
|
|
531
|
+
purchaseDate: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
532
|
+
configuration: line.configuration ?? {},
|
|
533
|
+
charges: line.charges ?? [],
|
|
534
|
+
sourceOrderId: orderConfig.id,
|
|
535
|
+
sourceQuoteLineId: line.sourceQuoteLineId ?? void 0
|
|
536
|
+
},
|
|
537
|
+
scope
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
// ─── Get / List ─────────────────────────────────────────────
|
|
542
|
+
async getOrder(orderId, scope) {
|
|
543
|
+
const em = this.em;
|
|
544
|
+
const orderConfig = await this.loadOrderConfig(em, orderId, scope);
|
|
545
|
+
const salesOrder = await this.loadSalesOrder(em, orderConfig.orderId, scope);
|
|
546
|
+
const lines = await em.find(CpqOrderLineConfiguration, {
|
|
547
|
+
orderConfigurationId: orderConfig.id,
|
|
548
|
+
organizationId: scope.organizationId,
|
|
549
|
+
tenantId: scope.tenantId,
|
|
550
|
+
deletedAt: null
|
|
551
|
+
});
|
|
552
|
+
return this.buildOrderResult(em, orderConfig, salesOrder, lines, scope);
|
|
553
|
+
}
|
|
554
|
+
async listOrders(filters, scope) {
|
|
555
|
+
const page = Math.max(1, filters.page ?? 1);
|
|
556
|
+
const pageSize = Math.min(100, Math.max(1, filters.pageSize ?? 50));
|
|
557
|
+
const offset = (page - 1) * pageSize;
|
|
558
|
+
const where = {
|
|
559
|
+
organizationId: scope.organizationId,
|
|
560
|
+
tenantId: scope.tenantId,
|
|
561
|
+
deletedAt: null
|
|
562
|
+
};
|
|
563
|
+
if (filters.customerId) where.customerId = filters.customerId;
|
|
564
|
+
if (filters.sourceQuoteId) where.sourceQuoteId = filters.sourceQuoteId;
|
|
565
|
+
if (filters.salesOrderId) where.orderId = filters.salesOrderId;
|
|
566
|
+
if (filters.currencyCode) where.currencyCode = filters.currencyCode;
|
|
567
|
+
if (filters.cpqStatus) {
|
|
568
|
+
where.cpqStatus = Array.isArray(filters.cpqStatus) ? { $in: filters.cpqStatus } : filters.cpqStatus;
|
|
569
|
+
}
|
|
570
|
+
const search = filters.search?.trim();
|
|
571
|
+
if (search) {
|
|
572
|
+
where.$or = [
|
|
573
|
+
{ orderId: { $ilike: `%${search}%` } },
|
|
574
|
+
{ customerId: { $ilike: `%${search}%` } }
|
|
575
|
+
];
|
|
576
|
+
}
|
|
577
|
+
const sortField = filters.sortField ?? "createdAt";
|
|
578
|
+
const sortDir = filters.sortDir === "asc" ? "asc" : "desc";
|
|
579
|
+
const [configs, total] = await this.em.findAndCount(
|
|
580
|
+
CpqOrderConfiguration,
|
|
581
|
+
where,
|
|
582
|
+
{ limit: pageSize, offset, orderBy: { [sortField]: sortDir } }
|
|
583
|
+
);
|
|
584
|
+
const orderIds = configs.map((c) => c.orderId);
|
|
585
|
+
const salesOrders = orderIds.length > 0 ? await this.em.find(SalesOrder, { id: { $in: orderIds } }) : [];
|
|
586
|
+
const salesOrderMap = new Map(salesOrders.map((o) => [o.id, o]));
|
|
587
|
+
const items = configs.map((c) => ({
|
|
588
|
+
...c,
|
|
589
|
+
orderNumber: salesOrderMap.get(c.orderId)?.orderNumber ?? null
|
|
590
|
+
}));
|
|
591
|
+
return { items, total, page, pageSize, totalPages: Math.ceil(total / pageSize) };
|
|
592
|
+
}
|
|
593
|
+
// ─── Status Transition ──────────────────────────────────────
|
|
594
|
+
async transitionOrderStatus(orderId, targetStatus, scope) {
|
|
595
|
+
const em = this.em;
|
|
596
|
+
const orderConfig = await this.loadOrderConfig(em, orderId, scope);
|
|
597
|
+
const salesOrder = await this.loadSalesOrder(em, orderConfig.orderId, scope);
|
|
598
|
+
const currentStatus = orderConfig.cpqStatus;
|
|
599
|
+
const allowed = CPQ_ORDER_TRANSITIONS[currentStatus] ?? [];
|
|
600
|
+
if (!allowed.includes(targetStatus)) {
|
|
601
|
+
throw new OrderError(409, `Cannot transition from '${currentStatus}' to '${targetStatus}'`);
|
|
602
|
+
}
|
|
603
|
+
if (targetStatus === "active") {
|
|
604
|
+
return this.activateOrder(orderId, scope);
|
|
605
|
+
}
|
|
606
|
+
orderConfig.cpqStatus = targetStatus;
|
|
607
|
+
salesOrder.status = CPQ_TO_SALES_ORDER_STATUS[targetStatus] ?? targetStatus;
|
|
608
|
+
await em.flush();
|
|
609
|
+
const lines = await em.find(CpqOrderLineConfiguration, {
|
|
610
|
+
orderConfigurationId: orderConfig.id,
|
|
611
|
+
organizationId: scope.organizationId,
|
|
612
|
+
tenantId: scope.tenantId,
|
|
613
|
+
deletedAt: null
|
|
614
|
+
});
|
|
615
|
+
return this.buildOrderResult(em, orderConfig, salesOrder, lines, scope);
|
|
616
|
+
}
|
|
617
|
+
// ─── Helpers ────────────────────────────────────────────────
|
|
618
|
+
async loadOrderConfig(em, orderId, scope) {
|
|
619
|
+
let config = await em.findOne(CpqOrderConfiguration, {
|
|
620
|
+
id: orderId,
|
|
621
|
+
organizationId: scope.organizationId,
|
|
622
|
+
tenantId: scope.tenantId,
|
|
623
|
+
deletedAt: null
|
|
624
|
+
});
|
|
625
|
+
if (!config) {
|
|
626
|
+
config = await em.findOne(CpqOrderConfiguration, {
|
|
627
|
+
orderId,
|
|
628
|
+
organizationId: scope.organizationId,
|
|
629
|
+
tenantId: scope.tenantId,
|
|
630
|
+
deletedAt: null
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
if (!config) throw new OrderError(404, "Order not found");
|
|
634
|
+
return config;
|
|
635
|
+
}
|
|
636
|
+
async loadSalesOrder(em, orderId, scope) {
|
|
637
|
+
const order = await em.findOne(SalesOrder, {
|
|
638
|
+
id: orderId,
|
|
639
|
+
organizationId: scope.organizationId,
|
|
640
|
+
tenantId: scope.tenantId
|
|
641
|
+
});
|
|
642
|
+
if (!order) throw new OrderError(404, "Sales order not found");
|
|
643
|
+
return order;
|
|
644
|
+
}
|
|
645
|
+
async resolveOfferingInfo(em, offeringId, scope, fallbackConfig) {
|
|
646
|
+
if (offeringId) {
|
|
647
|
+
const offering = await em.findOne(CpqProductOffering, {
|
|
648
|
+
id: offeringId,
|
|
649
|
+
organizationId: scope.organizationId,
|
|
650
|
+
tenantId: scope.tenantId,
|
|
651
|
+
deletedAt: null
|
|
652
|
+
});
|
|
653
|
+
if (offering) return { name: offering.name, type: offering.offeringType ?? "simple" };
|
|
654
|
+
}
|
|
655
|
+
const cfg = fallbackConfig ?? null;
|
|
656
|
+
const fallbackName = cfg?._arcMirroredName ?? cfg?.offeringName ?? "Configured Item";
|
|
657
|
+
return { name: fallbackName, type: null };
|
|
658
|
+
}
|
|
659
|
+
async resolveOfferingName(em, offeringId, scope, fallbackConfig) {
|
|
660
|
+
const info = await this.resolveOfferingInfo(em, offeringId, scope, fallbackConfig);
|
|
661
|
+
return info.name;
|
|
662
|
+
}
|
|
663
|
+
getLineName(line) {
|
|
664
|
+
const config = line.configuration;
|
|
665
|
+
return config?._arcMirroredName ?? config?.offeringName ?? config?.name ?? "Configured Item";
|
|
666
|
+
}
|
|
667
|
+
async buildSubscriptionName(orderConfig, orderLines, scope) {
|
|
668
|
+
if (orderLines.length === 1 && orderLines[0].offeringId) {
|
|
669
|
+
return this.resolveOfferingName(this.em, orderLines[0].offeringId, scope);
|
|
670
|
+
}
|
|
671
|
+
const names = [];
|
|
672
|
+
for (const line of orderLines.slice(0, 3)) {
|
|
673
|
+
if (line.offeringId) {
|
|
674
|
+
names.push(await this.resolveOfferingName(this.em, line.offeringId, scope));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (names.length > 0) {
|
|
678
|
+
const suffix = orderLines.length > 3 ? ` (+${orderLines.length - 3} more)` : "";
|
|
679
|
+
return names.join(", ") + suffix;
|
|
680
|
+
}
|
|
681
|
+
return `Order ${orderConfig.orderId.slice(0, 8)}`;
|
|
682
|
+
}
|
|
683
|
+
async buildOrderResult(em, orderConfig, salesOrder, lineConfigs, scope) {
|
|
684
|
+
const lines = [];
|
|
685
|
+
const arcItemIds = /* @__PURE__ */ new Set();
|
|
686
|
+
for (const lc of lineConfigs) {
|
|
687
|
+
const m = lc.configuration?._arcMirroredFromItemId;
|
|
688
|
+
if (typeof m === "string") arcItemIds.add(m);
|
|
689
|
+
}
|
|
690
|
+
const arcItemMap = /* @__PURE__ */ new Map();
|
|
691
|
+
if (arcItemIds.size > 0) {
|
|
692
|
+
const items = await em.find(CpqInventorySubscriptionItem, {
|
|
693
|
+
id: { $in: Array.from(arcItemIds) },
|
|
694
|
+
organizationId: scope.organizationId,
|
|
695
|
+
tenantId: scope.tenantId,
|
|
696
|
+
deletedAt: null
|
|
697
|
+
});
|
|
698
|
+
for (const it of items) arcItemMap.set(it.id, it);
|
|
699
|
+
}
|
|
700
|
+
for (const lc of lineConfigs) {
|
|
701
|
+
const offeringInfo = await this.resolveOfferingInfo(
|
|
702
|
+
em,
|
|
703
|
+
lc.offeringId,
|
|
704
|
+
scope,
|
|
705
|
+
lc.configuration
|
|
706
|
+
);
|
|
707
|
+
const arcSource = pickArcSourceFromConfig(lc.configuration, arcItemMap);
|
|
708
|
+
lines.push({
|
|
709
|
+
lineId: lc.orderLineId,
|
|
710
|
+
offeringId: lc.offeringId ?? null,
|
|
711
|
+
offeringName: offeringInfo.name,
|
|
712
|
+
offeringType: offeringInfo.type,
|
|
713
|
+
productId: lc.productId ?? null,
|
|
714
|
+
specId: lc.specId ?? null,
|
|
715
|
+
action: lc.action,
|
|
716
|
+
parentLineId: lc.parentLineId ?? null,
|
|
717
|
+
quantity: lc.quantity,
|
|
718
|
+
configuration: lc.configuration ?? {},
|
|
719
|
+
startDate: lc.startDate?.toISOString() ?? null,
|
|
720
|
+
termMonths: lc.termMonths ?? null,
|
|
721
|
+
endDate: lc.endDate?.toISOString() ?? null,
|
|
722
|
+
nrcTotal: Number(lc.nrcTotal),
|
|
723
|
+
mrcTotal: Number(lc.mrcTotal),
|
|
724
|
+
charges: lc.charges ?? [],
|
|
725
|
+
sourceQuoteLineId: lc.sourceQuoteLineId ?? null,
|
|
726
|
+
arcSource
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
let quoteType = "new";
|
|
730
|
+
if (orderConfig.sourceQuoteId) {
|
|
731
|
+
const sourceCfg = await em.findOne(CpqQuoteConfiguration, {
|
|
732
|
+
id: orderConfig.sourceQuoteId,
|
|
733
|
+
organizationId: scope.organizationId,
|
|
734
|
+
tenantId: scope.tenantId
|
|
735
|
+
});
|
|
736
|
+
if (sourceCfg?.quoteType) quoteType = sourceCfg.quoteType;
|
|
737
|
+
}
|
|
738
|
+
const pricing = orderConfig.pricingSummary ?? {};
|
|
739
|
+
return {
|
|
740
|
+
id: orderConfig.id,
|
|
741
|
+
orderId: orderConfig.orderId,
|
|
742
|
+
orderNumber: salesOrder.orderNumber ?? "",
|
|
743
|
+
customerId: orderConfig.customerId,
|
|
744
|
+
cpqStatus: orderConfig.cpqStatus,
|
|
745
|
+
sourceQuoteId: orderConfig.sourceQuoteId ?? null,
|
|
746
|
+
quoteType,
|
|
747
|
+
currencyCode: orderConfig.currencyCode,
|
|
748
|
+
pricingSummary: {
|
|
749
|
+
nrcTotal: Number(pricing.nrcTotal ?? 0),
|
|
750
|
+
mrcTotal: Number(pricing.mrcTotal ?? 0),
|
|
751
|
+
currencyCode: orderConfig.currencyCode
|
|
752
|
+
},
|
|
753
|
+
activatedAt: orderConfig.activatedAt?.toISOString() ?? null,
|
|
754
|
+
createdAt: orderConfig.createdAt.toISOString(),
|
|
755
|
+
lines
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
function pickArcSourceFromConfig(cfg, map) {
|
|
760
|
+
const m = cfg?._arcMirroredFromItemId;
|
|
761
|
+
if (typeof m !== "string") return null;
|
|
762
|
+
const item = map.get(m);
|
|
763
|
+
if (!item) return null;
|
|
764
|
+
return {
|
|
765
|
+
subscriptionItemId: item.id,
|
|
766
|
+
name: item.name,
|
|
767
|
+
mrcAmount: Number(item.mrcAmount),
|
|
768
|
+
nrcAmount: Number(item.nrcAmount),
|
|
769
|
+
quantity: item.quantity
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
class OrderError extends Error {
|
|
773
|
+
constructor(status, message) {
|
|
774
|
+
super(message);
|
|
775
|
+
this.status = status;
|
|
776
|
+
this.name = "OrderError";
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
function buildArcLineChange(line, specMap) {
|
|
780
|
+
const action = line.action;
|
|
781
|
+
if (action === "add") {
|
|
782
|
+
const itemInput = {
|
|
783
|
+
productId: line.productId ?? void 0,
|
|
784
|
+
offeringId: line.offeringId ?? void 0,
|
|
785
|
+
specId: line.specId ?? void 0,
|
|
786
|
+
name: resolveLineName(line, specMap),
|
|
787
|
+
configuration: line.configuration ?? {},
|
|
788
|
+
charges: line.charges ?? null,
|
|
789
|
+
mrcAmount: Number(line.mrcTotal),
|
|
790
|
+
nrcAmount: Number(line.nrcTotal),
|
|
791
|
+
quantity: line.quantity,
|
|
792
|
+
sourceQuoteLineId: line.quoteLineId
|
|
793
|
+
};
|
|
794
|
+
return {
|
|
795
|
+
quoteLineId: line.quoteLineId,
|
|
796
|
+
action,
|
|
797
|
+
itemInput,
|
|
798
|
+
parentQuoteLineId: line.parentLineId ?? null
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
if (action === "cancel") {
|
|
802
|
+
return {
|
|
803
|
+
quoteLineId: line.quoteLineId,
|
|
804
|
+
action,
|
|
805
|
+
sourceSubscriptionItemId: line.sourceSubscriptionItemId ?? null
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
quoteLineId: line.quoteLineId,
|
|
810
|
+
action,
|
|
811
|
+
sourceSubscriptionItemId: line.sourceSubscriptionItemId ?? null,
|
|
812
|
+
modifyPatch: {
|
|
813
|
+
configuration: line.configuration ?? void 0,
|
|
814
|
+
charges: line.charges ?? void 0,
|
|
815
|
+
mrcAmount: Number(line.mrcTotal),
|
|
816
|
+
nrcAmount: Number(line.nrcTotal),
|
|
817
|
+
quantity: line.quantity
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
function resolveLineName(line, specMap) {
|
|
822
|
+
const cfg = line.configuration;
|
|
823
|
+
const cfgName = cfg?._arcMirroredName ?? null;
|
|
824
|
+
if (cfgName) return cfgName;
|
|
825
|
+
if (line.specId) {
|
|
826
|
+
const spec = specMap.get(line.specId);
|
|
827
|
+
if (spec?.name) return spec.name;
|
|
828
|
+
}
|
|
829
|
+
return "Configured Item";
|
|
830
|
+
}
|
|
831
|
+
async function emitArcEvent(eventId, result, envelope) {
|
|
832
|
+
const sub = result.subscription;
|
|
833
|
+
await emitCpqEvent(eventId, {
|
|
834
|
+
subscriptionId: sub.id,
|
|
835
|
+
customerId: sub.customerId,
|
|
836
|
+
organizationId: envelope.organizationId,
|
|
837
|
+
tenantId: envelope.tenantId,
|
|
838
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
839
|
+
sourceQuoteId: envelope.sourceQuoteId,
|
|
840
|
+
sourceOrderId: envelope.sourceOrderId,
|
|
841
|
+
performedByUserId: null,
|
|
842
|
+
changeLogId: result.changeLog.id,
|
|
843
|
+
proration: buildProrationPayload(sub, result.changeLog.beforeSnapshot ?? null),
|
|
844
|
+
...envelope.term ? { term: envelope.term } : {},
|
|
845
|
+
...envelope.etfAmount !== void 0 ? { etfAmount: envelope.etfAmount } : {},
|
|
846
|
+
...envelope.etfCurrency !== void 0 ? { etfCurrency: envelope.etfCurrency } : {},
|
|
847
|
+
...envelope.reasonCode !== void 0 ? { reasonCode: envelope.reasonCode } : {},
|
|
848
|
+
...envelope.reasonText !== void 0 ? { reasonText: envelope.reasonText } : {}
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
async function emitMergedEvent(merge, envelope, mergedFromSubscriptionIds) {
|
|
852
|
+
const m = merge.mergedSubscription;
|
|
853
|
+
await emitCpqEvent("cpq.subscription.merged", {
|
|
854
|
+
subscriptionId: m.id,
|
|
855
|
+
customerId: m.customerId,
|
|
856
|
+
organizationId: envelope.organizationId,
|
|
857
|
+
tenantId: envelope.tenantId,
|
|
858
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
859
|
+
sourceQuoteId: envelope.sourceQuoteId,
|
|
860
|
+
sourceOrderId: envelope.sourceOrderId,
|
|
861
|
+
performedByUserId: null,
|
|
862
|
+
changeLogId: merge.mergeResultChangeLog.id,
|
|
863
|
+
mergedFromSubscriptionIds,
|
|
864
|
+
term: {
|
|
865
|
+
newTermStart: m.currentTermStart?.toISOString() ?? null,
|
|
866
|
+
newTermEnd: m.currentTermEnd?.toISOString() ?? null,
|
|
867
|
+
newTermMonths: m.termMonths ?? null
|
|
868
|
+
},
|
|
869
|
+
proration: buildProrationPayload(m, null)
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
async function emitSupersededEvent(sourceLog, newMergeSubId, envelope) {
|
|
873
|
+
await emitCpqEvent("cpq.subscription.superseded", {
|
|
874
|
+
subscriptionId: sourceLog.subscriptionId,
|
|
875
|
+
organizationId: envelope.organizationId,
|
|
876
|
+
tenantId: envelope.tenantId,
|
|
877
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
878
|
+
sourceQuoteId: envelope.sourceQuoteId,
|
|
879
|
+
sourceOrderId: envelope.sourceOrderId,
|
|
880
|
+
performedByUserId: null,
|
|
881
|
+
changeLogId: sourceLog.id,
|
|
882
|
+
mergedIntoSubscriptionId: newMergeSubId
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
function buildProrationPayload(sub, beforeSnapshot) {
|
|
886
|
+
const oldMrc = beforeSnapshot ? Number(beforeSnapshot.mrcAmount ?? 0) : 0;
|
|
887
|
+
return {
|
|
888
|
+
oldMrcAmount: oldMrc,
|
|
889
|
+
newMrcAmount: Number(sub.mrcAmount),
|
|
890
|
+
currency: sub.currencyCode,
|
|
891
|
+
billingCycleStart: null,
|
|
892
|
+
billingCycleEnd: null,
|
|
893
|
+
daysElapsedInCycle: null,
|
|
894
|
+
daysRemainingInCycle: null
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
export {
|
|
898
|
+
DefaultCpqOrderService,
|
|
899
|
+
OrderError
|
|
900
|
+
};
|
|
901
|
+
//# sourceMappingURL=cpqOrderService.js.map
|