This is page 13 of 61. Use http://codebase.md/taurgis/sfcc-dev-mcp?lines=true&page={x} to view the full context. # Directory Structure ``` ├── .DS_Store ├── .github │ ├── dependabot.yml │ ├── instructions │ │ ├── mcp-node-tests.instructions.md │ │ └── mcp-yml-tests.instructions.md │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.yml │ │ ├── config.yml │ │ ├── documentation.yml │ │ ├── feature_request.yml │ │ └── question.yml │ ├── PULL_REQUEST_TEMPLATE │ │ ├── bug_fix.md │ │ ├── documentation.md │ │ └── new_tool.md │ ├── pull_request_template.md │ └── workflows │ ├── ci.yml │ ├── deploy-pages.yml │ ├── publish.yml │ └── update-docs.yml ├── .gitignore ├── .husky │ └── pre-commit ├── aegis.config.docs-only.json ├── aegis.config.json ├── aegis.config.with-dw.json ├── AGENTS.md ├── ai-instructions │ ├── claude-desktop │ │ └── claude_custom_instructions.md │ ├── cursor │ │ └── .cursor │ │ └── rules │ │ ├── debugging-workflows.mdc │ │ ├── hooks-development.mdc │ │ ├── isml-templates.mdc │ │ ├── job-framework.mdc │ │ ├── performance-optimization.mdc │ │ ├── scapi-endpoints.mdc │ │ ├── security-patterns.mdc │ │ ├── sfcc-development.mdc │ │ ├── sfra-controllers.mdc │ │ ├── sfra-models.mdc │ │ ├── system-objects.mdc │ │ └── testing-patterns.mdc │ └── github-copilot │ └── copilot-instructions.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── docs │ ├── best-practices │ │ ├── cartridge_creation.md │ │ ├── isml_templates.md │ │ ├── job_framework.md │ │ ├── localserviceregistry.md │ │ ├── ocapi_hooks.md │ │ ├── performance.md │ │ ├── scapi_custom_endpoint.md │ │ ├── scapi_hooks.md │ │ ├── security.md │ │ ├── sfra_client_side_js.md │ │ ├── sfra_controllers.md │ │ ├── sfra_models.md │ │ └── sfra_scss.md │ ├── dw_campaign │ │ ├── ABTest.md │ │ ├── ABTestMgr.md │ │ ├── ABTestSegment.md │ │ ├── AmountDiscount.md │ │ ├── ApproachingDiscount.md │ │ ├── BonusChoiceDiscount.md │ │ ├── BonusDiscount.md │ │ ├── Campaign.md │ │ ├── CampaignMgr.md │ │ ├── CampaignStatusCodes.md │ │ ├── Coupon.md │ │ ├── CouponMgr.md │ │ ├── CouponRedemption.md │ │ ├── CouponStatusCodes.md │ │ ├── Discount.md │ │ ├── DiscountPlan.md │ │ ├── FixedPriceDiscount.md │ │ ├── FixedPriceShippingDiscount.md │ │ ├── FreeDiscount.md │ │ ├── FreeShippingDiscount.md │ │ ├── PercentageDiscount.md │ │ ├── PercentageOptionDiscount.md │ │ ├── PriceBookPriceDiscount.md │ │ ├── Promotion.md │ │ ├── PromotionMgr.md │ │ ├── PromotionPlan.md │ │ ├── SlotContent.md │ │ ├── SourceCodeGroup.md │ │ ├── SourceCodeInfo.md │ │ ├── SourceCodeStatusCodes.md │ │ └── TotalFixedPriceDiscount.md │ ├── dw_catalog │ │ ├── Catalog.md │ │ ├── CatalogMgr.md │ │ ├── Category.md │ │ ├── CategoryAssignment.md │ │ ├── CategoryLink.md │ │ ├── PriceBook.md │ │ ├── PriceBookMgr.md │ │ ├── Product.md │ │ ├── ProductActiveData.md │ │ ├── ProductAttributeModel.md │ │ ├── ProductAvailabilityLevels.md │ │ ├── ProductAvailabilityModel.md │ │ ├── ProductInventoryList.md │ │ ├── ProductInventoryMgr.md │ │ ├── ProductInventoryRecord.md │ │ ├── ProductLink.md │ │ ├── ProductMgr.md │ │ ├── ProductOption.md │ │ ├── ProductOptionModel.md │ │ ├── ProductOptionValue.md │ │ ├── ProductPriceInfo.md │ │ ├── ProductPriceModel.md │ │ ├── ProductPriceTable.md │ │ ├── ProductSearchHit.md │ │ ├── ProductSearchModel.md │ │ ├── ProductSearchRefinementDefinition.md │ │ ├── ProductSearchRefinements.md │ │ ├── ProductSearchRefinementValue.md │ │ ├── ProductVariationAttribute.md │ │ ├── ProductVariationAttributeValue.md │ │ ├── ProductVariationModel.md │ │ ├── Recommendation.md │ │ ├── SearchModel.md │ │ ├── SearchRefinementDefinition.md │ │ ├── SearchRefinements.md │ │ ├── SearchRefinementValue.md │ │ ├── SortingOption.md │ │ ├── SortingRule.md │ │ ├── Store.md │ │ ├── StoreGroup.md │ │ ├── StoreInventoryFilter.md │ │ ├── StoreInventoryFilterValue.md │ │ ├── StoreMgr.md │ │ ├── Variant.md │ │ └── VariationGroup.md │ ├── dw_content │ │ ├── Content.md │ │ ├── ContentMgr.md │ │ ├── ContentSearchModel.md │ │ ├── ContentSearchRefinementDefinition.md │ │ ├── ContentSearchRefinements.md │ │ ├── ContentSearchRefinementValue.md │ │ ├── Folder.md │ │ ├── Library.md │ │ ├── MarkupText.md │ │ └── MediaFile.md │ ├── dw_crypto │ │ ├── CertificateRef.md │ │ ├── CertificateUtils.md │ │ ├── Cipher.md │ │ ├── Encoding.md │ │ ├── JWE.md │ │ ├── JWEHeader.md │ │ ├── JWS.md │ │ ├── JWSHeader.md │ │ ├── KeyRef.md │ │ ├── Mac.md │ │ ├── MessageDigest.md │ │ ├── SecureRandom.md │ │ ├── Signature.md │ │ ├── WeakCipher.md │ │ ├── WeakMac.md │ │ ├── WeakMessageDigest.md │ │ ├── WeakSignature.md │ │ └── X509Certificate.md │ ├── dw_customer │ │ ├── AddressBook.md │ │ ├── AgentUserMgr.md │ │ ├── AgentUserStatusCodes.md │ │ ├── AuthenticationStatus.md │ │ ├── Credentials.md │ │ ├── Customer.md │ │ ├── CustomerActiveData.md │ │ ├── CustomerAddress.md │ │ ├── CustomerCDPData.md │ │ ├── CustomerContextMgr.md │ │ ├── CustomerGroup.md │ │ ├── CustomerList.md │ │ ├── CustomerMgr.md │ │ ├── CustomerPasswordConstraints.md │ │ ├── CustomerPaymentInstrument.md │ │ ├── CustomerStatusCodes.md │ │ ├── EncryptedObject.md │ │ ├── ExternalProfile.md │ │ ├── OrderHistory.md │ │ ├── ProductList.md │ │ ├── ProductListItem.md │ │ ├── ProductListItemPurchase.md │ │ ├── ProductListMgr.md │ │ ├── ProductListRegistrant.md │ │ ├── Profile.md │ │ └── Wallet.md │ ├── dw_extensions.applepay │ │ ├── ApplePayHookResult.md │ │ └── ApplePayHooks.md │ ├── dw_extensions.facebook │ │ ├── FacebookFeedHooks.md │ │ └── FacebookProduct.md │ ├── dw_extensions.paymentrequest │ │ ├── PaymentRequestHookResult.md │ │ └── PaymentRequestHooks.md │ ├── dw_extensions.payments │ │ ├── SalesforceBancontactPaymentDetails.md │ │ ├── SalesforceCardPaymentDetails.md │ │ ├── SalesforceEpsPaymentDetails.md │ │ ├── SalesforceIdealPaymentDetails.md │ │ ├── SalesforceKlarnaPaymentDetails.md │ │ ├── SalesforcePaymentDetails.md │ │ ├── SalesforcePaymentIntent.md │ │ ├── SalesforcePaymentMethod.md │ │ ├── SalesforcePaymentRequest.md │ │ ├── SalesforcePaymentsHooks.md │ │ ├── SalesforcePaymentsMgr.md │ │ ├── SalesforcePaymentsSiteConfiguration.md │ │ ├── SalesforcePayPalOrder.md │ │ ├── SalesforcePayPalOrderAddress.md │ │ ├── SalesforcePayPalOrderPayer.md │ │ ├── SalesforcePayPalPaymentDetails.md │ │ ├── SalesforceSepaDebitPaymentDetails.md │ │ └── SalesforceVenmoPaymentDetails.md │ ├── dw_extensions.pinterest │ │ ├── PinterestAvailability.md │ │ ├── PinterestFeedHooks.md │ │ ├── PinterestOrder.md │ │ ├── PinterestOrderHooks.md │ │ └── PinterestProduct.md │ ├── dw_io │ │ ├── CSVStreamReader.md │ │ ├── CSVStreamWriter.md │ │ ├── File.md │ │ ├── FileReader.md │ │ ├── FileWriter.md │ │ ├── InputStream.md │ │ ├── OutputStream.md │ │ ├── PrintWriter.md │ │ ├── RandomAccessFileReader.md │ │ ├── Reader.md │ │ ├── StringWriter.md │ │ ├── Writer.md │ │ ├── XMLIndentingStreamWriter.md │ │ ├── XMLStreamConstants.md │ │ ├── XMLStreamReader.md │ │ └── XMLStreamWriter.md │ ├── dw_job │ │ ├── JobExecution.md │ │ └── JobStepExecution.md │ ├── dw_net │ │ ├── FTPClient.md │ │ ├── FTPFileInfo.md │ │ ├── HTTPClient.md │ │ ├── HTTPRequestPart.md │ │ ├── Mail.md │ │ ├── SFTPClient.md │ │ ├── SFTPFileInfo.md │ │ ├── WebDAVClient.md │ │ └── WebDAVFileInfo.md │ ├── dw_object │ │ ├── ActiveData.md │ │ ├── CustomAttributes.md │ │ ├── CustomObject.md │ │ ├── CustomObjectMgr.md │ │ ├── Extensible.md │ │ ├── ExtensibleObject.md │ │ ├── Note.md │ │ ├── ObjectAttributeDefinition.md │ │ ├── ObjectAttributeGroup.md │ │ ├── ObjectAttributeValueDefinition.md │ │ ├── ObjectTypeDefinition.md │ │ ├── PersistentObject.md │ │ ├── SimpleExtensible.md │ │ └── SystemObjectMgr.md │ ├── dw_order │ │ ├── AbstractItem.md │ │ ├── AbstractItemCtnr.md │ │ ├── Appeasement.md │ │ ├── AppeasementItem.md │ │ ├── Basket.md │ │ ├── BasketMgr.md │ │ ├── BonusDiscountLineItem.md │ │ ├── CouponLineItem.md │ │ ├── CreateAgentBasketLimitExceededException.md │ │ ├── CreateBasketFromOrderException.md │ │ ├── CreateCouponLineItemException.md │ │ ├── CreateOrderException.md │ │ ├── CreateTemporaryBasketLimitExceededException.md │ │ ├── GiftCertificate.md │ │ ├── GiftCertificateLineItem.md │ │ ├── GiftCertificateMgr.md │ │ ├── GiftCertificateStatusCodes.md │ │ ├── Invoice.md │ │ ├── InvoiceItem.md │ │ ├── LineItem.md │ │ ├── LineItemCtnr.md │ │ ├── Order.md │ │ ├── OrderAddress.md │ │ ├── OrderItem.md │ │ ├── OrderMgr.md │ │ ├── OrderPaymentInstrument.md │ │ ├── OrderProcessStatusCodes.md │ │ ├── PaymentCard.md │ │ ├── PaymentInstrument.md │ │ ├── PaymentMethod.md │ │ ├── PaymentMgr.md │ │ ├── PaymentProcessor.md │ │ ├── PaymentStatusCodes.md │ │ ├── PaymentTransaction.md │ │ ├── PriceAdjustment.md │ │ ├── PriceAdjustmentLimitTypes.md │ │ ├── ProductLineItem.md │ │ ├── ProductShippingCost.md │ │ ├── ProductShippingLineItem.md │ │ ├── ProductShippingModel.md │ │ ├── Return.md │ │ ├── ReturnCase.md │ │ ├── ReturnCaseItem.md │ │ ├── ReturnItem.md │ │ ├── Shipment.md │ │ ├── ShipmentShippingCost.md │ │ ├── ShipmentShippingModel.md │ │ ├── ShippingLineItem.md │ │ ├── ShippingLocation.md │ │ ├── ShippingMethod.md │ │ ├── ShippingMgr.md │ │ ├── ShippingOrder.md │ │ ├── ShippingOrderItem.md │ │ ├── SumItem.md │ │ ├── TaxGroup.md │ │ ├── TaxItem.md │ │ ├── TaxMgr.md │ │ ├── TrackingInfo.md │ │ └── TrackingRef.md │ ├── dw_order.hooks │ │ ├── CalculateHooks.md │ │ ├── OrderHooks.md │ │ ├── PaymentHooks.md │ │ ├── ReturnHooks.md │ │ └── ShippingOrderHooks.md │ ├── dw_rpc │ │ ├── SOAPUtil.md │ │ ├── Stub.md │ │ └── WebReference.md │ ├── dw_suggest │ │ ├── BrandSuggestions.md │ │ ├── CategorySuggestions.md │ │ ├── ContentSuggestions.md │ │ ├── CustomSuggestions.md │ │ ├── ProductSuggestions.md │ │ ├── SearchPhraseSuggestions.md │ │ ├── SuggestedCategory.md │ │ ├── SuggestedContent.md │ │ ├── SuggestedPhrase.md │ │ ├── SuggestedProduct.md │ │ ├── SuggestedTerm.md │ │ ├── SuggestedTerms.md │ │ ├── Suggestions.md │ │ └── SuggestModel.md │ ├── dw_svc │ │ ├── FTPService.md │ │ ├── FTPServiceDefinition.md │ │ ├── HTTPFormService.md │ │ ├── HTTPFormServiceDefinition.md │ │ ├── HTTPService.md │ │ ├── HTTPServiceDefinition.md │ │ ├── LocalServiceRegistry.md │ │ ├── Result.md │ │ ├── Service.md │ │ ├── ServiceCallback.md │ │ ├── ServiceConfig.md │ │ ├── ServiceCredential.md │ │ ├── ServiceDefinition.md │ │ ├── ServiceProfile.md │ │ ├── ServiceRegistry.md │ │ ├── SOAPService.md │ │ └── SOAPServiceDefinition.md │ ├── dw_system │ │ ├── AgentUserStatusCodes.md │ │ ├── Cache.md │ │ ├── CacheMgr.md │ │ ├── HookMgr.md │ │ ├── InternalObject.md │ │ ├── JobProcessMonitor.md │ │ ├── Log.md │ │ ├── Logger.md │ │ ├── LogNDC.md │ │ ├── OrganizationPreferences.md │ │ ├── Pipeline.md │ │ ├── PipelineDictionary.md │ │ ├── RemoteInclude.md │ │ ├── Request.md │ │ ├── RequestHooks.md │ │ ├── Response.md │ │ ├── RESTErrorResponse.md │ │ ├── RESTResponseMgr.md │ │ ├── RESTSuccessResponse.md │ │ ├── SearchStatus.md │ │ ├── Session.md │ │ ├── Site.md │ │ ├── SitePreferences.md │ │ ├── Status.md │ │ ├── StatusItem.md │ │ ├── System.md │ │ └── Transaction.md │ ├── dw_util │ │ ├── ArrayList.md │ │ ├── Assert.md │ │ ├── BigInteger.md │ │ ├── Bytes.md │ │ ├── Calendar.md │ │ ├── Collection.md │ │ ├── Currency.md │ │ ├── DateUtils.md │ │ ├── Decimal.md │ │ ├── FilteringCollection.md │ │ ├── Geolocation.md │ │ ├── HashMap.md │ │ ├── HashSet.md │ │ ├── Iterator.md │ │ ├── LinkedHashMap.md │ │ ├── LinkedHashSet.md │ │ ├── List.md │ │ ├── Locale.md │ │ ├── Map.md │ │ ├── MapEntry.md │ │ ├── MappingKey.md │ │ ├── MappingMgr.md │ │ ├── PropertyComparator.md │ │ ├── SecureEncoder.md │ │ ├── SecureFilter.md │ │ ├── SeekableIterator.md │ │ ├── Set.md │ │ ├── SortedMap.md │ │ ├── SortedSet.md │ │ ├── StringUtils.md │ │ ├── Template.md │ │ └── UUIDUtils.md │ ├── dw_value │ │ ├── EnumValue.md │ │ ├── MimeEncodedText.md │ │ ├── Money.md │ │ └── Quantity.md │ ├── dw_web │ │ ├── ClickStream.md │ │ ├── ClickStreamEntry.md │ │ ├── Cookie.md │ │ ├── Cookies.md │ │ ├── CSRFProtection.md │ │ ├── Form.md │ │ ├── FormAction.md │ │ ├── FormElement.md │ │ ├── FormElementValidationResult.md │ │ ├── FormField.md │ │ ├── FormFieldOption.md │ │ ├── FormFieldOptions.md │ │ ├── FormGroup.md │ │ ├── FormList.md │ │ ├── FormListItem.md │ │ ├── Forms.md │ │ ├── HttpParameter.md │ │ ├── HttpParameterMap.md │ │ ├── LoopIterator.md │ │ ├── PageMetaData.md │ │ ├── PageMetaTag.md │ │ ├── PagingModel.md │ │ ├── Resource.md │ │ ├── URL.md │ │ ├── URLAction.md │ │ ├── URLParameter.md │ │ ├── URLRedirect.md │ │ ├── URLRedirectMgr.md │ │ └── URLUtils.md │ ├── sfra │ │ ├── account.md │ │ ├── address.md │ │ ├── billing.md │ │ ├── cart.md │ │ ├── categories.md │ │ ├── content.md │ │ ├── locale.md │ │ ├── order.md │ │ ├── payment.md │ │ ├── price-default.md │ │ ├── price-range.md │ │ ├── price-tiered.md │ │ ├── product-bundle.md │ │ ├── product-full.md │ │ ├── product-line-items.md │ │ ├── product-search.md │ │ ├── product-tile.md │ │ ├── querystring.md │ │ ├── render.md │ │ ├── request.md │ │ ├── response.md │ │ ├── server.md │ │ ├── shipping.md │ │ ├── store.md │ │ ├── stores.md │ │ └── totals.md │ └── TopLevel │ ├── APIException.md │ ├── arguments.md │ ├── Array.md │ ├── ArrayBuffer.md │ ├── BigInt.md │ ├── Boolean.md │ ├── ConversionError.md │ ├── DataView.md │ ├── Date.md │ ├── Error.md │ ├── ES6Iterator.md │ ├── EvalError.md │ ├── Fault.md │ ├── Float32Array.md │ ├── Float64Array.md │ ├── Function.md │ ├── Generator.md │ ├── global.md │ ├── Int16Array.md │ ├── Int32Array.md │ ├── Int8Array.md │ ├── InternalError.md │ ├── IOError.md │ ├── Iterable.md │ ├── Iterator.md │ ├── JSON.md │ ├── Map.md │ ├── Math.md │ ├── Module.md │ ├── Namespace.md │ ├── Number.md │ ├── Object.md │ ├── QName.md │ ├── RangeError.md │ ├── ReferenceError.md │ ├── RegExp.md │ ├── Set.md │ ├── StopIteration.md │ ├── String.md │ ├── Symbol.md │ ├── SyntaxError.md │ ├── SystemError.md │ ├── TypeError.md │ ├── Uint16Array.md │ ├── Uint32Array.md │ ├── Uint8Array.md │ ├── Uint8ClampedArray.md │ ├── URIError.md │ ├── WeakMap.md │ ├── WeakSet.md │ ├── XML.md │ ├── XMLList.md │ └── XMLStreamError.md ├── docs-site │ ├── .gitignore │ ├── App.tsx │ ├── components │ │ ├── Badge.tsx │ │ ├── BreadcrumbSchema.tsx │ │ ├── CodeBlock.tsx │ │ ├── Collapsible.tsx │ │ ├── ConfigBuilder.tsx │ │ ├── ConfigHero.tsx │ │ ├── ConfigModeTabs.tsx │ │ ├── icons.tsx │ │ ├── Layout.tsx │ │ ├── LightCodeContainer.tsx │ │ ├── NewcomerCTA.tsx │ │ ├── NextStepsStrip.tsx │ │ ├── OnThisPage.tsx │ │ ├── Search.tsx │ │ ├── SEO.tsx │ │ ├── Sidebar.tsx │ │ ├── StructuredData.tsx │ │ ├── ToolCard.tsx │ │ ├── ToolFilters.tsx │ │ ├── Typography.tsx │ │ └── VersionBadge.tsx │ ├── constants.tsx │ ├── index.html │ ├── main.tsx │ ├── metadata.json │ ├── package-lock.json │ ├── package.json │ ├── pages │ │ ├── AIInterfacesPage.tsx │ │ ├── ConfigurationPage.tsx │ │ ├── DevelopmentPage.tsx │ │ ├── ExamplesPage.tsx │ │ ├── FeaturesPage.tsx │ │ ├── HomePage.tsx │ │ ├── SecurityPage.tsx │ │ ├── ToolsPage.tsx │ │ └── TroubleshootingPage.tsx │ ├── postcss.config.js │ ├── public │ │ ├── .well-known │ │ │ └── security.txt │ │ ├── 404.html │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── explain-product-pricing-methods-no-mcp.png │ │ ├── explain-product-pricing-methods.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── llms.txt │ │ ├── robots.txt │ │ ├── site.webmanifest │ │ └── sitemap.xml │ ├── README.md │ ├── scripts │ │ ├── generate-search-index.js │ │ ├── generate-sitemap.js │ │ └── search-dev.js │ ├── src │ │ └── styles │ │ ├── input.css │ │ └── prism-theme.css │ ├── tailwind.config.js │ ├── tsconfig.json │ ├── types.ts │ ├── utils │ │ ├── search.ts │ │ └── toolsData.ts │ └── vite.config.ts ├── eslint.config.js ├── jest.config.js ├── LICENSE ├── package-lock.json ├── package.json ├── README.md ├── scripts │ └── convert-docs.js ├── SECURITY.md ├── server.json ├── src │ ├── clients │ │ ├── base │ │ │ ├── http-client.ts │ │ │ ├── oauth-token.ts │ │ │ └── ocapi-auth-client.ts │ │ ├── best-practices-client.ts │ │ ├── cartridge-generation-client.ts │ │ ├── docs │ │ │ ├── class-content-parser.ts │ │ │ ├── class-name-resolver.ts │ │ │ ├── documentation-scanner.ts │ │ │ ├── index.ts │ │ │ └── referenced-types-extractor.ts │ │ ├── docs-client.ts │ │ ├── log-client.ts │ │ ├── logs │ │ │ ├── index.ts │ │ │ ├── log-analyzer.ts │ │ │ ├── log-client.ts │ │ │ ├── log-constants.ts │ │ │ ├── log-file-discovery.ts │ │ │ ├── log-file-reader.ts │ │ │ ├── log-formatter.ts │ │ │ ├── log-processor.ts │ │ │ ├── log-types.ts │ │ │ └── webdav-client-manager.ts │ │ ├── ocapi │ │ │ ├── code-versions-client.ts │ │ │ ├── site-preferences-client.ts │ │ │ └── system-objects-client.ts │ │ ├── ocapi-client.ts │ │ └── sfra-client.ts │ ├── config │ │ ├── configuration-factory.ts │ │ └── dw-json-loader.ts │ ├── core │ │ ├── handlers │ │ │ ├── abstract-log-tool-handler.ts │ │ │ ├── base-handler.ts │ │ │ ├── best-practices-handler.ts │ │ │ ├── cartridge-handler.ts │ │ │ ├── client-factory.ts │ │ │ ├── code-version-handler.ts │ │ │ ├── docs-handler.ts │ │ │ ├── job-log-handler.ts │ │ │ ├── job-log-tool-config.ts │ │ │ ├── log-handler.ts │ │ │ ├── log-tool-config.ts │ │ │ ├── sfra-handler.ts │ │ │ ├── system-object-handler.ts │ │ │ └── validation-helpers.ts │ │ ├── server.ts │ │ └── tool-definitions.ts │ ├── index.ts │ ├── main.ts │ ├── services │ │ ├── file-system-service.ts │ │ ├── index.ts │ │ └── path-service.ts │ ├── tool-configs │ │ ├── best-practices-tool-config.ts │ │ ├── cartridge-tool-config.ts │ │ ├── code-version-tool-config.ts │ │ ├── docs-tool-config.ts │ │ ├── job-log-tool-config.ts │ │ ├── log-tool-config.ts │ │ ├── sfra-tool-config.ts │ │ └── system-object-tool-config.ts │ ├── types │ │ └── types.ts │ └── utils │ ├── cache.ts │ ├── job-log-tool-config.ts │ ├── job-log-utils.ts │ ├── log-cache.ts │ ├── log-tool-config.ts │ ├── log-tool-constants.ts │ ├── log-tool-utils.ts │ ├── logger.ts │ ├── ocapi-url-builder.ts │ ├── path-resolver.ts │ ├── query-builder.ts │ ├── utils.ts │ └── validator.ts ├── tests │ ├── __mocks__ │ │ ├── docs-client.ts │ │ ├── src │ │ │ └── clients │ │ │ └── base │ │ │ └── http-client.js │ │ └── webdav.js │ ├── base-handler.test.ts │ ├── base-http-client.test.ts │ ├── best-practices-handler.test.ts │ ├── cache.test.ts │ ├── cartridge-handler.test.ts │ ├── class-content-parser.test.ts │ ├── class-name-resolver.test.ts │ ├── client-factory.test.ts │ ├── code-version-handler.test.ts │ ├── code-versions-client.test.ts │ ├── config.test.ts │ ├── configuration-factory.test.ts │ ├── docs-handler.test.ts │ ├── documentation-scanner.test.ts │ ├── file-system-service.test.ts │ ├── job-log-handler.test.ts │ ├── job-log-utils.test.ts │ ├── log-client.test.ts │ ├── log-handler.test.ts │ ├── log-processor.test.ts │ ├── logger.test.ts │ ├── mcp │ │ ├── AGENTS.md │ │ ├── node │ │ │ ├── activate-code-version-advanced.full-mode.programmatic.test.js │ │ │ ├── code-versions.full-mode.programmatic.test.js │ │ │ ├── generate-cartridge-structure.docs-only.programmatic.test.js │ │ │ ├── get-available-best-practice-guides.docs-only.programmatic.test.js │ │ │ ├── get-available-sfra-documents.programmatic.test.js │ │ │ ├── get-best-practice-guide.docs-only.programmatic.test.js │ │ │ ├── get-hook-reference.docs-only.programmatic.test.js │ │ │ ├── get-job-execution-summary.full-mode.programmatic.test.js │ │ │ ├── get-job-log-entries.full-mode.programmatic.test.js │ │ │ ├── get-latest-debug.full-mode.programmatic.test.js │ │ │ ├── get-latest-error.full-mode.programmatic.test.js │ │ │ ├── get-latest-info.full-mode.programmatic.test.js │ │ │ ├── get-latest-job-log-files.full-mode.programmatic.test.js │ │ │ ├── get-latest-warn.full-mode.programmatic.test.js │ │ │ ├── get-log-file-contents.full-mode.programmatic.test.js │ │ │ ├── get-sfcc-class-documentation.docs-only.programmatic.test.js │ │ │ ├── get-sfcc-class-info.docs-only.programmatic.test.js │ │ │ ├── get-sfra-categories.docs-only.programmatic.test.js │ │ │ ├── get-sfra-document.programmatic.test.js │ │ │ ├── get-sfra-documents-by-category.docs-only.programmatic.test.js │ │ │ ├── get-system-object-definition.full-mode.programmatic.test.js │ │ │ ├── get-system-object-definitions.docs-only.programmatic.test.js │ │ │ ├── get-system-object-definitions.full-mode.programmatic.test.js │ │ │ ├── list-log-files.full-mode.programmatic.test.js │ │ │ ├── list-sfcc-classes.docs-only.programmatic.test.js │ │ │ ├── search-best-practices.docs-only.programmatic.test.js │ │ │ ├── search-custom-object-attribute-definitions.full-mode.programmatic.test.js │ │ │ ├── search-job-logs-by-name.full-mode.programmatic.test.js │ │ │ ├── search-job-logs.full-mode.programmatic.test.js │ │ │ ├── search-logs.full-mode.programmatic.test.js │ │ │ ├── search-sfcc-classes.docs-only.programmatic.test.js │ │ │ ├── search-sfcc-methods.docs-only.programmatic.test.js │ │ │ ├── search-sfra-documentation.docs-only.programmatic.test.js │ │ │ ├── search-site-preferences.full-mode.programmatic.test.js │ │ │ ├── search-system-object-attribute-definitions.full-mode.programmatic.test.js │ │ │ ├── search-system-object-attribute-groups.full-mode.programmatic.test.js │ │ │ ├── summarize-logs.full-mode.programmatic.test.js │ │ │ ├── tools.docs-only.programmatic.test.js │ │ │ └── tools.full-mode.programmatic.test.js │ │ ├── README.md │ │ ├── test-fixtures │ │ │ └── dw.json │ │ └── yaml │ │ ├── activate-code-version.docs-only.test.mcp.yml │ │ ├── activate-code-version.full-mode.test.mcp.yml │ │ ├── get_latest_error.test.mcp.yml │ │ ├── get-available-best-practice-guides.docs-only.test.mcp.yml │ │ ├── get-available-best-practice-guides.full-mode.test.mcp.yml │ │ ├── get-available-sfra-documents.docs-only.test.mcp.yml │ │ ├── get-available-sfra-documents.full-mode.test.mcp.yml │ │ ├── get-best-practice-guide.docs-only.test.mcp.yml │ │ ├── get-best-practice-guide.full-mode.test.mcp.yml │ │ ├── get-code-versions.docs-only.test.mcp.yml │ │ ├── get-code-versions.full-mode.test.mcp.yml │ │ ├── get-hook-reference.docs-only.test.mcp.yml │ │ ├── get-hook-reference.full-mode.test.mcp.yml │ │ ├── get-job-execution-summary.full-mode.test.mcp.yml │ │ ├── get-job-log-entries.full-mode.test.mcp.yml │ │ ├── get-latest-debug.full-mode.test.mcp.yml │ │ ├── get-latest-error.full-mode.test.mcp.yml │ │ ├── get-latest-info.full-mode.test.mcp.yml │ │ ├── get-latest-job-log-files.full-mode.test.mcp.yml │ │ ├── get-latest-warn.full-mode.test.mcp.yml │ │ ├── get-log-file-contents.full-mode.test.mcp.yml │ │ ├── get-sfcc-class-documentation.docs-only.test.mcp.yml │ │ ├── get-sfcc-class-documentation.full-mode.test.mcp.yml │ │ ├── get-sfcc-class-info.docs-only.test.mcp.yml │ │ ├── get-sfcc-class-info.full-mode.test.mcp.yml │ │ ├── get-sfra-categories.docs-only.test.mcp.yml │ │ ├── get-sfra-categories.full-mode.test.mcp.yml │ │ ├── get-sfra-document.docs-only.test.mcp.yml │ │ ├── get-sfra-document.full-mode.test.mcp.yml │ │ ├── get-sfra-documents-by-category.docs-only.test.mcp.yml │ │ ├── get-sfra-documents-by-category.full-mode.test.mcp.yml │ │ ├── get-system-object-definition.docs-only.test.mcp.yml │ │ ├── get-system-object-definition.full-mode.test.mcp.yml │ │ ├── get-system-object-definitions.docs-only.test.mcp.yml │ │ ├── get-system-object-definitions.full-mode.test.mcp.yml │ │ ├── list-log-files.full-mode.test.mcp.yml │ │ ├── list-sfcc-classes.docs-only.test.mcp.yml │ │ ├── list-sfcc-classes.full-mode.test.mcp.yml │ │ ├── search-best-practices.docs-only.test.mcp.yml │ │ ├── search-best-practices.full-mode.test.mcp.yml │ │ ├── search-custom-object-attribute-definitions.docs-only.test.mcp.yml │ │ ├── search-custom-object-attribute-definitions.test.mcp.yml │ │ ├── search-job-logs-by-name.full-mode.test.mcp.yml │ │ ├── search-job-logs.full-mode.test.mcp.yml │ │ ├── search-logs.full-mode.test.mcp.yml │ │ ├── search-sfcc-classes.docs-only.test.mcp.yml │ │ ├── search-sfcc-classes.full-mode.test.mcp.yml │ │ ├── search-sfcc-methods.docs-only.test.mcp.yml │ │ ├── search-sfcc-methods.full-mode.test.mcp.yml │ │ ├── search-sfra-documentation.docs-only.test.mcp.yml │ │ ├── search-sfra-documentation.full-mode.test.mcp.yml │ │ ├── search-site-preferences.docs-only.test.mcp.yml │ │ ├── search-site-preferences.full-mode.test.mcp.yml │ │ ├── search-system-object-attribute-definitions.docs-only.test.mcp.yml │ │ ├── search-system-object-attribute-definitions.full-mode.test.mcp.yml │ │ ├── search-system-object-attribute-groups.docs-only.test.mcp.yml │ │ ├── search-system-object-attribute-groups.full-mode.test.mcp.yml │ │ ├── summarize-logs.full-mode.test.mcp.yml │ │ ├── tools.docs-only.test.mcp.yml │ │ └── tools.full-mode.test.mcp.yml │ ├── oauth-token.test.ts │ ├── ocapi-auth-client.test.ts │ ├── ocapi-client.test.ts │ ├── path-service.test.ts │ ├── query-builder.test.ts │ ├── referenced-types-extractor.test.ts │ ├── servers │ │ ├── sfcc-mock-server │ │ │ ├── mock-data │ │ │ │ └── ocapi │ │ │ │ ├── code-versions.json │ │ │ │ ├── custom-object-attributes-customapi.json │ │ │ │ ├── custom-object-attributes-globalsettings.json │ │ │ │ ├── custom-object-attributes-versionhistory.json │ │ │ │ ├── site-preferences-ccv.json │ │ │ │ ├── site-preferences-fastforward.json │ │ │ │ ├── site-preferences-sfra.json │ │ │ │ ├── site-preferences-storefront.json │ │ │ │ ├── site-preferences-system.json │ │ │ │ ├── system-object-attribute-groups-campaign.json │ │ │ │ ├── system-object-attribute-groups-category.json │ │ │ │ ├── system-object-attribute-groups-order.json │ │ │ │ ├── system-object-attribute-groups-product.json │ │ │ │ ├── system-object-attribute-groups-sitepreferences.json │ │ │ │ ├── system-object-attributes-customeraddress.json │ │ │ │ ├── system-object-attributes-product-expanded.json │ │ │ │ ├── system-object-attributes-product.json │ │ │ │ ├── system-object-definition-category.json │ │ │ │ ├── system-object-definition-customer.json │ │ │ │ ├── system-object-definition-customeraddress.json │ │ │ │ ├── system-object-definition-order.json │ │ │ │ ├── system-object-definition-product.json │ │ │ │ ├── system-object-definitions-old.json │ │ │ │ └── system-object-definitions.json │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── README.md │ │ │ ├── scripts │ │ │ │ └── setup-logs.js │ │ │ ├── server.js │ │ │ └── src │ │ │ ├── app.js │ │ │ ├── config │ │ │ │ └── server-config.js │ │ │ ├── middleware │ │ │ │ ├── auth.js │ │ │ │ ├── cors.js │ │ │ │ └── logging.js │ │ │ ├── routes │ │ │ │ ├── ocapi │ │ │ │ │ ├── code-versions-handler.js │ │ │ │ │ ├── oauth-handler.js │ │ │ │ │ ├── ocapi-error-utils.js │ │ │ │ │ ├── ocapi-utils.js │ │ │ │ │ ├── site-preferences-handler.js │ │ │ │ │ └── system-objects-handler.js │ │ │ │ ├── ocapi.js │ │ │ │ └── webdav.js │ │ │ └── utils │ │ │ ├── mock-data-loader.js │ │ │ └── webdav-xml.js │ │ └── sfcc-mock-server-manager.ts │ ├── sfcc-mock-server.test.ts │ ├── site-preferences-client.test.ts │ ├── system-objects-client.test.ts │ ├── utils.test.ts │ ├── validation-helpers.test.ts │ └── validator.test.ts ├── tsconfig.json └── tsconfig.test.json ``` # Files -------------------------------------------------------------------------------- /docs/dw_io/Reader.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.io 2 | 3 | # Class Reader 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.io.Reader 9 | 10 | ## Description 11 | 12 | The class supports reading characters from a stream. 13 | 14 | ## Properties 15 | 16 | ### lines 17 | 18 | **Type:** List (Read Only) 19 | 20 | The method reads the whole input stream, parses it and returns a list of strings. 21 | 22 | Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use 23 | method readLine() and process one line at a time. 24 | 25 | ### string 26 | 27 | **Type:** String (Read Only) 28 | 29 | The method reads the whole input stream as one string and returns it. 30 | 31 | Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory 32 | condition. Instead use method readN(Number). 33 | 34 | ## Constructor Summary 35 | 36 | Reader(source : String) Creates a reader from a string. 37 | 38 | Reader(stream : InputStream) Create a reader from a stream using UTF-8 character encoding. 39 | 40 | Reader(stream : InputStream, encoding : String) Create a reader from a stream using the specified character encoding. 41 | 42 | ## Method Summary 43 | 44 | ### close 45 | 46 | **Signature:** `close() : void` 47 | 48 | Closes the reader. 49 | 50 | ### getLines 51 | 52 | **Signature:** `getLines() : List` 53 | 54 | The method reads the whole input stream, parses it and returns a list of strings. 55 | 56 | ### getString 57 | 58 | **Signature:** `getString() : String` 59 | 60 | The method reads the whole input stream as one string and returns it. 61 | 62 | ### read 63 | 64 | **Signature:** `read() : String` 65 | 66 | Reads a single character from the stream. 67 | 68 | ### read 69 | 70 | **Signature:** `read(length : Number) : String` 71 | 72 | Reads multiple characters from the stream as string. 73 | 74 | ### readLine 75 | 76 | **Signature:** `readLine() : String` 77 | 78 | Reads the next line. 79 | 80 | ### readLines 81 | 82 | **Signature:** `readLines() : List` 83 | 84 | The method reads the whole input stream, parses it and returns a list of strings. 85 | 86 | ### readN 87 | 88 | **Signature:** `readN(n : Number) : String` 89 | 90 | Reads n characters from the stream as string. 91 | 92 | ### readString 93 | 94 | **Signature:** `readString() : String` 95 | 96 | The method reads the whole input stream as one string and returns it. 97 | 98 | ### ready 99 | 100 | **Signature:** `ready() : boolean` 101 | 102 | Identifies if this stream is ready to be read. 103 | 104 | ### skip 105 | 106 | **Signature:** `skip(n : Number) : void` 107 | 108 | Skips the specified number of characters in the stream. 109 | 110 | ## Constructor Detail 111 | 112 | ## Method Detail 113 | 114 | ## Method Details 115 | 116 | ### close 117 | 118 | **Signature:** `close() : void` 119 | 120 | **Description:** Closes the reader. 121 | 122 | --- 123 | 124 | ### getLines 125 | 126 | **Signature:** `getLines() : List` 127 | 128 | **Description:** The method reads the whole input stream, parses it and returns a list of strings. Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use method readLine() and process one line at a time. 129 | 130 | **Deprecated:** 131 | 132 | Use readLines() 133 | 134 | **Returns:** 135 | 136 | a list of strings 137 | 138 | --- 139 | 140 | ### getString 141 | 142 | **Signature:** `getString() : String` 143 | 144 | **Description:** The method reads the whole input stream as one string and returns it. Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory condition. Instead use method readN(Number). 145 | 146 | **Deprecated:** 147 | 148 | Use readString() 149 | 150 | **Returns:** 151 | 152 | a string, which represents the whole content of the InputStream 153 | 154 | **Throws:** 155 | 156 | IOException - if something went wrong while reading from the underlying stream 157 | 158 | --- 159 | 160 | ### read 161 | 162 | **Signature:** `read() : String` 163 | 164 | **Description:** Reads a single character from the stream. The method returns null if the end of the stream is reached. 165 | 166 | **Returns:** 167 | 168 | a single character in a string, or null if the end of the stream is reached 169 | 170 | --- 171 | 172 | ### read 173 | 174 | **Signature:** `read(length : Number) : String` 175 | 176 | **Description:** Reads multiple characters from the stream as string. The actual number of characters that were read can be determined from the length of the returned string. If the end of the stream is reached and no more characters can be read, the method exits with an exception. 177 | 178 | **Deprecated:** 179 | 180 | use readN(Number) instead which does not throw an exception if the stream is exhausted 181 | 182 | **Parameters:** 183 | 184 | - `length`: the number of characters to read. 185 | 186 | **Returns:** 187 | 188 | a string whose length is controlled by the length parameter. The actual number of characters that were read can be determined from the length of the returned string. 189 | 190 | **Throws:** 191 | 192 | an - exception if the stream is exhausted 193 | 194 | --- 195 | 196 | ### readLine 197 | 198 | **Signature:** `readLine() : String` 199 | 200 | **Description:** Reads the next line. 201 | 202 | **Returns:** 203 | 204 | A String containing the contents of the line, not including any line termination characters, or null if the end of the stream has been reached. 205 | 206 | --- 207 | 208 | ### readLines 209 | 210 | **Signature:** `readLines() : List` 211 | 212 | **Description:** The method reads the whole input stream, parses it and returns a list of strings. Using this method on large feeds is inherently unsafe and may lead to an out-of-memory condition. Instead use method readLine() and process one line at a time. 213 | 214 | **Returns:** 215 | 216 | a list of strings 217 | 218 | --- 219 | 220 | ### readN 221 | 222 | **Signature:** `readN(n : Number) : String` 223 | 224 | **Description:** Reads n characters from the stream as string. The actual number of characters that were read can be determined from the length of the returned string. If the end of the stream is reached and no more characters can be read, the method returns null. 225 | 226 | **Parameters:** 227 | 228 | - `n`: the number of characters to read 229 | 230 | **Returns:** 231 | 232 | a string whose maximum length is controlled by the n parameter, or null if the end of the stream is reached and no more characters can be read 233 | 234 | --- 235 | 236 | ### readString 237 | 238 | **Signature:** `readString() : String` 239 | 240 | **Description:** The method reads the whole input stream as one string and returns it. Using this method is unsafe if the length of the input stream is not known and may lead to an out-of-memory condition. Instead use method readN(Number). 241 | 242 | **Returns:** 243 | 244 | a string, which represents the whole content of the InputStream 245 | 246 | **Throws:** 247 | 248 | IOException - if something went wrong while reading from the underlying stream 249 | 250 | --- 251 | 252 | ### ready 253 | 254 | **Signature:** `ready() : boolean` 255 | 256 | **Description:** Identifies if this stream is ready to be read. 257 | 258 | **Returns:** 259 | 260 | true guarantees that the stream is ready to read without waiting for input. A false response means that the stream may or may not block to wait for input. Note that returning false does not guarantee that the next read() will block. 261 | 262 | --- 263 | 264 | ### skip 265 | 266 | **Signature:** `skip(n : Number) : void` 267 | 268 | **Description:** Skips the specified number of characters in the stream. 269 | 270 | **Parameters:** 271 | 272 | - `n`: the number of characters to skip. 273 | 274 | --- ``` -------------------------------------------------------------------------------- /docs/dw_order/ShipmentShippingModel.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.order 2 | 3 | # Class ShipmentShippingModel 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.order.ShipmentShippingModel 9 | 10 | ## Description 11 | 12 | Instances of ShipmentShippingModel provide access to shipment-level shipping information, such as applicable and inapplicable shipping methods and shipping cost. Use ShippingMgr.getShipmentShippingModel(Shipment) to get the shipping model for a specific shipment. 13 | 14 | ## Properties 15 | 16 | ### applicableShippingMethods 17 | 18 | **Type:** Collection (Read Only) 19 | 20 | The active applicable shipping methods for the shipment related 21 | to this shipping model. A shipping method is applicable for a shipment 22 | if it does not exclude any of the products in the shipment, and does 23 | not exclude the shipment's shipping address, if this is set. Also checks 24 | that the the shipment customer belongs to an assigned customer group of the shipment 25 | (if any are assigned). 26 | 27 | ### inapplicableShippingMethods 28 | 29 | **Type:** Collection (Read Only) 30 | 31 | The active inapplicable shipping methods for the shipment related 32 | to this shipping model. A shipping method is inapplicable for a shipment 33 | if it is inapplicable for at least one product contained in the 34 | shipment, or the shipping address is excluded by the shipping method, or the 35 | shipping method is restricted to customer groups that the shipment customer 36 | is not a part of. 37 | 38 | ## Constructor Summary 39 | 40 | ## Method Summary 41 | 42 | ### getApplicableShippingMethods 43 | 44 | **Signature:** `getApplicableShippingMethods() : Collection` 45 | 46 | Returns the active applicable shipping methods for the shipment related to this shipping model. 47 | 48 | ### getApplicableShippingMethods 49 | 50 | **Signature:** `getApplicableShippingMethods(shippingAddressObj : Object) : Collection` 51 | 52 | Returns the active applicable shipping methods for the shipment related to this shipping model and the specified shipping address. 53 | 54 | ### getInapplicableShippingMethods 55 | 56 | **Signature:** `getInapplicableShippingMethods() : Collection` 57 | 58 | Returns the active inapplicable shipping methods for the shipment related to this shipping model. 59 | 60 | ### getInapplicableShippingMethods 61 | 62 | **Signature:** `getInapplicableShippingMethods(shippingAddressObj : Object) : Collection` 63 | 64 | Returns the active inapplicable shipping methods for the shipment related to this shipping model and the specified shipping address. 65 | 66 | ### getShippingCost 67 | 68 | **Signature:** `getShippingCost(shippingMethod : ShippingMethod) : ShipmentShippingCost` 69 | 70 | Returns the shipping cost object for the related shipment and the specified shipping method. 71 | 72 | ## Method Detail 73 | 74 | ## Method Details 75 | 76 | ### getApplicableShippingMethods 77 | 78 | **Signature:** `getApplicableShippingMethods() : Collection` 79 | 80 | **Description:** Returns the active applicable shipping methods for the shipment related to this shipping model. A shipping method is applicable for a shipment if it does not exclude any of the products in the shipment, and does not exclude the shipment's shipping address, if this is set. Also checks that the the shipment customer belongs to an assigned customer group of the shipment (if any are assigned). 81 | 82 | **Returns:** 83 | 84 | Applicable shipping methods for the shipment 85 | 86 | --- 87 | 88 | ### getApplicableShippingMethods 89 | 90 | **Signature:** `getApplicableShippingMethods(shippingAddressObj : Object) : Collection` 91 | 92 | **Description:** Returns the active applicable shipping methods for the shipment related to this shipping model and the specified shipping address. A shipping method is applicable if it does not exclude any of the products in the shipment, it does not exclude the specified shipping address, and the shipment customer belongs to an assigned customer group for the shipment (if any are assigned). The parameter shippingAddressObj must be a JavaScript literal with the same properties as an OrderAddress object, or alternatively a Map. For example: model.getApplicableShippingMethods ( { countryCode: "US", stateCode: "MA, custom { POBox : true } } ) This method is useful when it is needed to retrieve the list of applicable shipping methods for an address before the address is saved to the shipment. 93 | 94 | **Parameters:** 95 | 96 | - `shippingAddressObj`: A JavaScript object representing an order address, must not be null. 97 | 98 | **Returns:** 99 | 100 | Applicable shipping methods for the shipment 101 | 102 | --- 103 | 104 | ### getInapplicableShippingMethods 105 | 106 | **Signature:** `getInapplicableShippingMethods() : Collection` 107 | 108 | **Description:** Returns the active inapplicable shipping methods for the shipment related to this shipping model. A shipping method is inapplicable for a shipment if it is inapplicable for at least one product contained in the shipment, or the shipping address is excluded by the shipping method, or the shipping method is restricted to customer groups that the shipment customer is not a part of. 109 | 110 | **Returns:** 111 | 112 | Inapplicable shipping methods for the shipment 113 | 114 | --- 115 | 116 | ### getInapplicableShippingMethods 117 | 118 | **Signature:** `getInapplicableShippingMethods(shippingAddressObj : Object) : Collection` 119 | 120 | **Description:** Returns the active inapplicable shipping methods for the shipment related to this shipping model and the specified shipping address. A shipping method is inapplicable if it is inapplicable for at least one product contained in the shipment, or the specified shipping address is excluded by the shipping method, or the shipping method is restricted to customer groups that the shipment customer is not a part of. The parameter shippingAddressObj must be a JavaScript literal with the same properties as an OrderAddress object, or alternatively a Map. For example: model.getApplicableShippingMethods ( { countryCode: "US", stateCode: "MA, custom { POBox : true } } ) This method is useful when it is needed to retrieve the list of applicable shipping methods for an address before the address is saved to the shipment. 121 | 122 | **Parameters:** 123 | 124 | - `shippingAddressObj`: A JavaScript object representing an order address. 125 | 126 | **Returns:** 127 | 128 | Inapplicable shipping methods for the shipment 129 | 130 | --- 131 | 132 | ### getShippingCost 133 | 134 | **Signature:** `getShippingCost(shippingMethod : ShippingMethod) : ShipmentShippingCost` 135 | 136 | **Description:** Returns the shipping cost object for the related shipment and the specified shipping method. Shipping cost for shipments depended on the merchandise total of the shipment. The method uses the adjusted merchandise total after product and order discounts, and excluding products with product-level fixed-price shipping cost. 137 | 138 | **Parameters:** 139 | 140 | - `shippingMethod`: the shipping method to use. 141 | 142 | **Returns:** 143 | 144 | Product shipping cost 145 | 146 | --- ``` -------------------------------------------------------------------------------- /docs/dw_order/PaymentTransaction.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.order 2 | 3 | # Class PaymentTransaction 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.object.PersistentObject 9 | - dw.object.ExtensibleObject 10 | - dw.order.PaymentTransaction 11 | 12 | ## Description 13 | 14 | The PaymentTransaction class represents a payment transaction. 15 | 16 | ## Constants 17 | 18 | ### TYPE_AUTH 19 | 20 | **Type:** String = "AUTH" 21 | 22 | Constant representing the authorization type of payment transaction. 23 | 24 | ### TYPE_AUTH_REVERSAL 25 | 26 | **Type:** String = "AUTH_REVERSAL" 27 | 28 | Constant representing the authorization reversal type of payment transaction. 29 | 30 | ### TYPE_CAPTURE 31 | 32 | **Type:** String = "CAPTURE" 33 | 34 | Constant representing the capture type of payment transaction. 35 | 36 | ### TYPE_CREDIT 37 | 38 | **Type:** String = "CREDIT" 39 | 40 | Constant representing the credit type of payment transaction. 41 | 42 | ## Properties 43 | 44 | ### accountID 45 | 46 | **Type:** String 47 | 48 | The payment service-specific account id. 49 | 50 | ### accountType 51 | 52 | **Type:** String 53 | 54 | The payment service-specific account type. 55 | 56 | ### amount 57 | 58 | **Type:** Money 59 | 60 | The amount of the transaction. 61 | 62 | ### paymentInstrument 63 | 64 | **Type:** OrderPaymentInstrument (Read Only) 65 | 66 | The payment instrument related to this payment transaction. 67 | 68 | ### paymentProcessor 69 | 70 | **Type:** PaymentProcessor 71 | 72 | The payment processor related to this payment transaction. 73 | 74 | ### transactionID 75 | 76 | **Type:** String 77 | 78 | The payment service-specific transaction id. 79 | 80 | ### type 81 | 82 | **Type:** EnumValue 83 | 84 | The value of the transaction type where the 85 | value is one of TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE 86 | or TYPE_CREDIT. 87 | 88 | ## Constructor Summary 89 | 90 | ## Method Summary 91 | 92 | ### getAccountID 93 | 94 | **Signature:** `getAccountID() : String` 95 | 96 | Returns the payment service-specific account id. 97 | 98 | ### getAccountType 99 | 100 | **Signature:** `getAccountType() : String` 101 | 102 | Returns the payment service-specific account type. 103 | 104 | ### getAmount 105 | 106 | **Signature:** `getAmount() : Money` 107 | 108 | Returns the amount of the transaction. 109 | 110 | ### getPaymentInstrument 111 | 112 | **Signature:** `getPaymentInstrument() : OrderPaymentInstrument` 113 | 114 | Returns the payment instrument related to this payment transaction. 115 | 116 | ### getPaymentProcessor 117 | 118 | **Signature:** `getPaymentProcessor() : PaymentProcessor` 119 | 120 | Returns the payment processor related to this payment transaction. 121 | 122 | ### getTransactionID 123 | 124 | **Signature:** `getTransactionID() : String` 125 | 126 | Returns the payment service-specific transaction id. 127 | 128 | ### getType 129 | 130 | **Signature:** `getType() : EnumValue` 131 | 132 | Returns the value of the transaction type where the value is one of TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 133 | 134 | ### setAccountID 135 | 136 | **Signature:** `setAccountID(accountID : String) : void` 137 | 138 | Sets the payment service-specific account id. 139 | 140 | ### setAccountType 141 | 142 | **Signature:** `setAccountType(accountType : String) : void` 143 | 144 | Sets the payment service-specific account type. 145 | 146 | ### setAmount 147 | 148 | **Signature:** `setAmount(amount : Money) : void` 149 | 150 | Sets the amount of the transaction. 151 | 152 | ### setPaymentProcessor 153 | 154 | **Signature:** `setPaymentProcessor(paymentProcessor : PaymentProcessor) : void` 155 | 156 | Sets the payment processor related to this payment transaction. 157 | 158 | ### setTransactionID 159 | 160 | **Signature:** `setTransactionID(transactionID : String) : void` 161 | 162 | Sets the payment service-specific transaction id. 163 | 164 | ### setType 165 | 166 | **Signature:** `setType(type : String) : void` 167 | 168 | Sets the value of the transaction type where permissible values are TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 169 | 170 | ## Method Detail 171 | 172 | ## Method Details 173 | 174 | ### getAccountID 175 | 176 | **Signature:** `getAccountID() : String` 177 | 178 | **Description:** Returns the payment service-specific account id. 179 | 180 | **Returns:** 181 | 182 | the payment service-specific account id. 183 | 184 | --- 185 | 186 | ### getAccountType 187 | 188 | **Signature:** `getAccountType() : String` 189 | 190 | **Description:** Returns the payment service-specific account type. 191 | 192 | **Returns:** 193 | 194 | the payment service-specific account type. 195 | 196 | --- 197 | 198 | ### getAmount 199 | 200 | **Signature:** `getAmount() : Money` 201 | 202 | **Description:** Returns the amount of the transaction. 203 | 204 | **Returns:** 205 | 206 | the amount of the transaction. 207 | 208 | --- 209 | 210 | ### getPaymentInstrument 211 | 212 | **Signature:** `getPaymentInstrument() : OrderPaymentInstrument` 213 | 214 | **Description:** Returns the payment instrument related to this payment transaction. 215 | 216 | **Returns:** 217 | 218 | the order payment instrument related to this payment transaction. 219 | 220 | --- 221 | 222 | ### getPaymentProcessor 223 | 224 | **Signature:** `getPaymentProcessor() : PaymentProcessor` 225 | 226 | **Description:** Returns the payment processor related to this payment transaction. 227 | 228 | **Returns:** 229 | 230 | the payment processor related to this payment transaction. 231 | 232 | --- 233 | 234 | ### getTransactionID 235 | 236 | **Signature:** `getTransactionID() : String` 237 | 238 | **Description:** Returns the payment service-specific transaction id. 239 | 240 | **Returns:** 241 | 242 | the payment service-specific transaction id. 243 | 244 | --- 245 | 246 | ### getType 247 | 248 | **Signature:** `getType() : EnumValue` 249 | 250 | **Description:** Returns the value of the transaction type where the value is one of TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 251 | 252 | **Returns:** 253 | 254 | the value of the transaction type where the value is one of TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 255 | 256 | --- 257 | 258 | ### setAccountID 259 | 260 | **Signature:** `setAccountID(accountID : String) : void` 261 | 262 | **Description:** Sets the payment service-specific account id. 263 | 264 | **Parameters:** 265 | 266 | - `accountID`: the payment service-specific account id. 267 | 268 | --- 269 | 270 | ### setAccountType 271 | 272 | **Signature:** `setAccountType(accountType : String) : void` 273 | 274 | **Description:** Sets the payment service-specific account type. 275 | 276 | **Parameters:** 277 | 278 | - `accountType`: the payment service-specific account type. 279 | 280 | --- 281 | 282 | ### setAmount 283 | 284 | **Signature:** `setAmount(amount : Money) : void` 285 | 286 | **Description:** Sets the amount of the transaction. 287 | 288 | **Parameters:** 289 | 290 | - `amount`: the amount of the transaction. 291 | 292 | --- 293 | 294 | ### setPaymentProcessor 295 | 296 | **Signature:** `setPaymentProcessor(paymentProcessor : PaymentProcessor) : void` 297 | 298 | **Description:** Sets the payment processor related to this payment transaction. 299 | 300 | **Parameters:** 301 | 302 | - `paymentProcessor`: the payment processor related to this payment transaction. 303 | 304 | --- 305 | 306 | ### setTransactionID 307 | 308 | **Signature:** `setTransactionID(transactionID : String) : void` 309 | 310 | **Description:** Sets the payment service-specific transaction id. 311 | 312 | **Parameters:** 313 | 314 | - `transactionID`: the payment service-specific transaction id. 315 | 316 | --- 317 | 318 | ### setType 319 | 320 | **Signature:** `setType(type : String) : void` 321 | 322 | **Description:** Sets the value of the transaction type where permissible values are TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 323 | 324 | **Parameters:** 325 | 326 | - `type`: the value of the transaction type where the value is one of TYPE_AUTH, TYPE_AUTH_REVERSAL, TYPE_CAPTURE or TYPE_CREDIT. 327 | 328 | --- ``` -------------------------------------------------------------------------------- /docs/TopLevel/JSON.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: TopLevel 2 | 3 | # Class JSON 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - JSON 9 | 10 | ## Description 11 | 12 | The JSON object is a single object that contains two functions, parse and stringify, that are used to parse and construct JSON texts. The JSON Data Interchange Format is described in RFC 4627. 13 | 14 | ## Constructor Summary 15 | 16 | JSON() 17 | 18 | ## Method Summary 19 | 20 | ### parse 21 | 22 | **Signature:** `static parse(json : String) : Object` 23 | 24 | The parse function parses a JSON text (a JSON formatted string) and produces an ECMAScript value. 25 | 26 | ### parse 27 | 28 | **Signature:** `static parse(json : String, reviver : Function) : Object` 29 | 30 | The parse function parses a JSON text (a JSON formatted string) and produces an ECMAScript value. 31 | 32 | ### stringify 33 | 34 | **Signature:** `static stringify(value : Object) : String` 35 | 36 | The stringify function produces a JSON formatted string that captures information from a JavaScript value. 37 | 38 | ### stringify 39 | 40 | **Signature:** `static stringify(value : Object, replacer : Object) : String` 41 | 42 | The stringify function produces a JSON formatted string that captures information from a JavaScript value. 43 | 44 | ### stringify 45 | 46 | **Signature:** `static stringify(value : Object, replacer : Object, space : Number) : String` 47 | 48 | The stringify function produces a JSON formatted string that captures information from a JavaScript value. 49 | 50 | ### stringify 51 | 52 | **Signature:** `static stringify(value : Object, replacer : Object, space : String) : String` 53 | 54 | The stringify function produces a JSON formatted string that captures information from a JavaScript value. 55 | 56 | ## Constructor Detail 57 | 58 | ## Method Detail 59 | 60 | ## Method Details 61 | 62 | ### parse 63 | 64 | **Signature:** `static parse(json : String) : Object` 65 | 66 | **Description:** The parse function parses a JSON text (a JSON formatted string) and produces an ECMAScript value. The JSON format is a restricted form of ECMAScript literal. JSON objects are realized as ECMAScript objects. JSON Arrays are realized as ECMAScript arrays. JSON strings, numbers, booleans, and null are realized as ECMAScript strings, numbers, booleans, and null. 67 | 68 | **Parameters:** 69 | 70 | - `json`: a JSON formatted string 71 | 72 | **Returns:** 73 | 74 | the object produced from the JSON string 75 | 76 | --- 77 | 78 | ### parse 79 | 80 | **Signature:** `static parse(json : String, reviver : Function) : Object` 81 | 82 | **Description:** The parse function parses a JSON text (a JSON formatted string) and produces an ECMAScript value. The JSON format is a restricted form of ECMAScript literal. JSON objects are realized as ECMAScript objects. JSON Arrays are realized as ECMAScript arrays. JSON strings, numbers, booleans, and null are realized as ECMAScript strings, numbers, booleans, and null. The optional reviver parameter is a function that takes two parameters, (key, value). It can filter and transform the results. It is called with each of the key/value pairs produced by the parse, and its return value is used instead of the original value. If it returns what it received, the structure is not modified. If it returns undefined then the member is deleted from the result. 83 | 84 | **Parameters:** 85 | 86 | - `json`: a JSON formatted string 87 | - `reviver`: a function, which is called with each key, value pair during parsing 88 | 89 | **Returns:** 90 | 91 | the object produced from the JSON string 92 | 93 | --- 94 | 95 | ### stringify 96 | 97 | **Signature:** `static stringify(value : Object) : String` 98 | 99 | **Description:** The stringify function produces a JSON formatted string that captures information from a JavaScript value. The value parameter is a JavaScript value is usually an object or array, although it can also be a string, boolean, number or null. Note: Stringifying API objects is not supported. 100 | 101 | **Parameters:** 102 | 103 | - `value`: the value which is stringified 104 | 105 | **Returns:** 106 | 107 | the JSON string 108 | 109 | --- 110 | 111 | ### stringify 112 | 113 | **Signature:** `static stringify(value : Object, replacer : Object) : String` 114 | 115 | **Description:** The stringify function produces a JSON formatted string that captures information from a JavaScript value. The value parameter is a JavaScript value is usually an object or array, although it can also be a string, boolean, number or null. The optional replacer parameter is either a function that alters the way objects and arrays are stringified, or an array of strings that acts as an allowlist for selecting the keys that will be stringified. Note: Stringifying API objects is not supported. 116 | 117 | **Parameters:** 118 | 119 | - `value`: the value which is stringified 120 | - `replacer`: either a function, which is called with a key and value as parameter, or an array with an allowlist 121 | 122 | **Returns:** 123 | 124 | the JSON string 125 | 126 | --- 127 | 128 | ### stringify 129 | 130 | **Signature:** `static stringify(value : Object, replacer : Object, space : Number) : String` 131 | 132 | **Description:** The stringify function produces a JSON formatted string that captures information from a JavaScript value. The value parameter is a JavaScript value is usually an object or array, although it can also be a string, boolean, number or null. The optional replacer parameter is either a function that alters the way objects and arrays are stringified, or an array of strings that acts as an allowlist for selecting the keys that will be stringified. The optional space parameter is a string or number that allows the result to have white space injected into it to improve human readability. Note: Stringifying API objects is not supported. 133 | 134 | **Parameters:** 135 | 136 | - `value`: the value which is stringified 137 | - `replacer`: either a function, which is called with a key and value as parameter, or an array with an allowlist 138 | - `space`: the number of space for indenting 139 | 140 | **Returns:** 141 | 142 | the JSON string 143 | 144 | --- 145 | 146 | ### stringify 147 | 148 | **Signature:** `static stringify(value : Object, replacer : Object, space : String) : String` 149 | 150 | **Description:** The stringify function produces a JSON formatted string that captures information from a JavaScript value. The value parameter is a JavaScript value is usually an object or array, although it can also be a string, boolean, number or null. The optional replacer parameter is either a function that alters the way objects and arrays are stringified, or an array of strings that acts as an allowlist for selecting the keys that will be stringified. The optional space parameter is a string or number that allows the result to have white space injected into it to improve human readability. Note: Stringifying API objects is not supported. 151 | 152 | **Parameters:** 153 | 154 | - `value`: the value which is stringified 155 | - `replacer`: either a function, which is called with a key and value as parameter, or an array with an allowlist 156 | - `space`: a string for indentation 157 | 158 | **Returns:** 159 | 160 | the JSON string 161 | 162 | --- ``` -------------------------------------------------------------------------------- /docs/dw_order/PaymentCard.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.order 2 | 3 | # Class PaymentCard 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.object.PersistentObject 9 | - dw.object.ExtensibleObject 10 | - dw.order.PaymentCard 11 | 12 | ## Description 13 | 14 | Represents payment cards and provides methods to access the payment card attributes and status. Note: this class handles sensitive financial and card holder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. 15 | 16 | ## Properties 17 | 18 | ### active 19 | 20 | **Type:** boolean (Read Only) 21 | 22 | Returns 'true' if payment card is active (enabled), otherwise 'false' is returned. 23 | 24 | ### cardType 25 | 26 | **Type:** String (Read Only) 27 | 28 | The unique card type of the payment card. 29 | 30 | ### description 31 | 32 | **Type:** MarkupText (Read Only) 33 | 34 | The description of the payment card. 35 | 36 | ### image 37 | 38 | **Type:** MediaFile (Read Only) 39 | 40 | The reference to the payment card image. 41 | 42 | ### name 43 | 44 | **Type:** String (Read Only) 45 | 46 | The name of the payment card. 47 | 48 | ## Constructor Summary 49 | 50 | ## Method Summary 51 | 52 | ### getCardType 53 | 54 | **Signature:** `getCardType() : String` 55 | 56 | Returns the unique card type of the payment card. 57 | 58 | ### getDescription 59 | 60 | **Signature:** `getDescription() : MarkupText` 61 | 62 | Returns the description of the payment card. 63 | 64 | ### getImage 65 | 66 | **Signature:** `getImage() : MediaFile` 67 | 68 | Returns the reference to the payment card image. 69 | 70 | ### getName 71 | 72 | **Signature:** `getName() : String` 73 | 74 | Returns the name of the payment card. 75 | 76 | ### isActive 77 | 78 | **Signature:** `isActive() : boolean` 79 | 80 | Returns 'true' if payment card is active (enabled), otherwise 'false' is returned. 81 | 82 | ### isApplicable 83 | 84 | **Signature:** `isApplicable(customer : Customer, countryCode : String, paymentAmount : Number) : boolean` 85 | 86 | Returns 'true' if this payment card is applicable for the specified customer, country and payment amount and the session currency. 87 | 88 | ### verify 89 | 90 | **Signature:** `verify(expiresMonth : Number, expiresYear : Number, cardNumber : String) : Status` 91 | 92 | Verify the card against the provided values. 93 | 94 | ### verify 95 | 96 | **Signature:** `verify(expiresMonth : Number, expiresYear : Number, cardNumber : String, csc : String) : Status` 97 | 98 | Verify the card against the provided values. 99 | 100 | ## Method Detail 101 | 102 | ## Method Details 103 | 104 | ### getCardType 105 | 106 | **Signature:** `getCardType() : String` 107 | 108 | **Description:** Returns the unique card type of the payment card. 109 | 110 | **Returns:** 111 | 112 | cardType of the payment card. 113 | 114 | --- 115 | 116 | ### getDescription 117 | 118 | **Signature:** `getDescription() : MarkupText` 119 | 120 | **Description:** Returns the description of the payment card. 121 | 122 | **Returns:** 123 | 124 | Description of the payment card. 125 | 126 | --- 127 | 128 | ### getImage 129 | 130 | **Signature:** `getImage() : MediaFile` 131 | 132 | **Description:** Returns the reference to the payment card image. 133 | 134 | **Returns:** 135 | 136 | Image of the payment card. 137 | 138 | --- 139 | 140 | ### getName 141 | 142 | **Signature:** `getName() : String` 143 | 144 | **Description:** Returns the name of the payment card. 145 | 146 | **Returns:** 147 | 148 | Name of the payment card. 149 | 150 | --- 151 | 152 | ### isActive 153 | 154 | **Signature:** `isActive() : boolean` 155 | 156 | **Description:** Returns 'true' if payment card is active (enabled), otherwise 'false' is returned. 157 | 158 | **Returns:** 159 | 160 | true if payment card is active, otherwise false. 161 | 162 | --- 163 | 164 | ### isApplicable 165 | 166 | **Signature:** `isApplicable(customer : Customer, countryCode : String, paymentAmount : Number) : boolean` 167 | 168 | **Description:** Returns 'true' if this payment card is applicable for the specified customer, country and payment amount and the session currency. The payment card is applicable if the card is restricted by customer group, and at least one of the groups of the specified customer is assigned to the card the card is restricted by billing country, and the specified country code is assigned to the card the method is restricted by payment amount for the session currency, and the specified payment amount is within the limits of the min/max payment amount defined for the method and the session currency the method is restricted by session currency, and the session currency code is assigned to the method All parameters are optional, and if not specified, the respective restriction won't be validated. For example, if a card is restricted by billing country, but no country code is specified, this card will be returned, unless it is filtered out by customer group or payment amount. 169 | 170 | **Parameters:** 171 | 172 | - `customer`: Customer or null 173 | - `countryCode`: Billing country code or null 174 | - `paymentAmount`: Payment amount or null 175 | 176 | **Returns:** 177 | 178 | true if payment card is applicable, false otherwise 179 | 180 | --- 181 | 182 | ### verify 183 | 184 | **Signature:** `verify(expiresMonth : Number, expiresYear : Number, cardNumber : String) : Status` 185 | 186 | **Description:** Verify the card against the provided values. This method is equivalent to verify(Number, Number, String, String) but omits verification of the card security code. If the verification fails the resulting Status will hold up to 2 error items each with a code: PaymentStatusCodes.CREDITCARD_INVALID_EXPIRATION_DATE - the expiresMonth and expiresYear do not describe a month in the future, or describe an invalid month outside the range 1-12. PaymentStatusCodes.CREDITCARD_INVALID_CARD_NUMBER - the cardNumber does not verify against one or more configured checks, which may include the Luhn checksum, accepted number lengths, or accepted number prefixes. 187 | 188 | **Parameters:** 189 | 190 | - `expiresMonth`: expiration month as integer, 1 (January) to 12 (December) 191 | - `expiresYear`: expiration year as integer, e.g. 2025 192 | - `cardNumber`: card number, a string containing digital characters 193 | 194 | **Returns:** 195 | 196 | status indicating result 197 | 198 | --- 199 | 200 | ### verify 201 | 202 | **Signature:** `verify(expiresMonth : Number, expiresYear : Number, cardNumber : String, csc : String) : Status` 203 | 204 | **Description:** Verify the card against the provided values. If the verification fails the resulting Status will hold up to 3 error items with these codes: PaymentStatusCodes.CREDITCARD_INVALID_EXPIRATION_DATE - the expiresMonth and expiresYear do not describe a month in the future, or describe an invalid month outside the range 1-12. PaymentStatusCodes.CREDITCARD_INVALID_CARD_NUMBER - the cardNumber does not verify against one or more configured checks, which may include the Luhn checksum, accepted number lengths, or accepted number prefixes. PaymentStatusCodes.CREDITCARD_INVALID_SECURITY_CODE - the card security code does not verify against the configured accepted length. 205 | 206 | **Parameters:** 207 | 208 | - `expiresMonth`: expiration month as integer, 1 (January) to 12 (December) 209 | - `expiresYear`: expiration year as integer, e.g. 2025 210 | - `cardNumber`: card number, a string containing digital characters 211 | - `csc`: card security code, a string containing digital characters 212 | 213 | **Returns:** 214 | 215 | status indicating result 216 | 217 | --- ``` -------------------------------------------------------------------------------- /src/config/configuration-factory.ts: -------------------------------------------------------------------------------- ```typescript 1 | /** 2 | * Configuration factory for SFCC MCP Server 3 | * 4 | * Centralized configuration management with validation and defaults. 5 | * This factory creates SFCCConfig objects from various sources while 6 | * leveraging secure file loading from the config module. 7 | */ 8 | 9 | import { existsSync } from 'fs'; 10 | import { resolve } from 'path'; 11 | import { SFCCConfig, DwJsonConfig } from '../types/types.js'; 12 | import { loadSecureDwJson } from './dw-json-loader.js'; 13 | 14 | export class ConfigurationFactory { 15 | /** 16 | * Create configuration from various sources with proper validation 17 | */ 18 | static create(options: { 19 | dwJsonPath?: string; 20 | hostname?: string; 21 | username?: string; 22 | password?: string; 23 | clientId?: string; 24 | clientSecret?: string; 25 | siteId?: string; 26 | }): SFCCConfig { 27 | let config: SFCCConfig; 28 | 29 | // Load from dw.json if path provided 30 | if (options.dwJsonPath) { 31 | const dwConfig = this.loadFromDwJson(options.dwJsonPath); 32 | config = this.mapDwJsonToConfig(dwConfig); 33 | } else { 34 | // Create from provided options 35 | config = { 36 | hostname: options.hostname ?? '', 37 | username: options.username, 38 | password: options.password, 39 | clientId: options.clientId, 40 | clientSecret: options.clientSecret, 41 | siteId: options.siteId, 42 | }; 43 | } 44 | 45 | // Override with any provided options (command-line args take precedence) 46 | if (options.hostname) {config.hostname = options.hostname;} 47 | if (options.username) {config.username = options.username;} 48 | if (options.password) {config.password = options.password;} 49 | if (options.clientId) {config.clientId = options.clientId;} 50 | if (options.clientSecret) {config.clientSecret = options.clientSecret;} 51 | if (options.siteId) {config.siteId = options.siteId;} 52 | 53 | this.validate(config); 54 | return config; 55 | } 56 | 57 | /** 58 | * Load configuration from dw.json file using secure file loading 59 | * 60 | * @param dwJsonPath - Path to the dw.json file 61 | * @returns Parsed dw.json configuration 62 | * @throws Error if file cannot be loaded or is invalid 63 | */ 64 | private static loadFromDwJson(dwJsonPath: string): DwJsonConfig { 65 | const resolvedPath = resolve(dwJsonPath); 66 | 67 | if (!existsSync(resolvedPath)) { 68 | throw new Error(`dw.json file not found at: ${resolvedPath}`); 69 | } 70 | 71 | // Use the secure loading function from dw-json-loader.ts 72 | // This ensures all security validations are applied consistently 73 | return loadSecureDwJson(dwJsonPath); 74 | } 75 | 76 | /** 77 | * Map dw.json structure to SFCCConfig 78 | * 79 | * Transforms the dw.json format (with kebab-case properties) to the 80 | * internal SFCCConfig format (with camelCase properties). 81 | * 82 | * @param dwConfig - The parsed dw.json configuration 83 | * @returns Mapped SFCCConfig object 84 | */ 85 | static mapDwJsonToConfig(dwConfig: DwJsonConfig): SFCCConfig { 86 | const config: SFCCConfig = { 87 | hostname: dwConfig.hostname, 88 | username: dwConfig.username, 89 | password: dwConfig.password, 90 | }; 91 | 92 | // Map OAuth credentials if present 93 | if (dwConfig['client-id'] && dwConfig['client-secret']) { 94 | config.clientId = dwConfig['client-id']; 95 | config.clientSecret = dwConfig['client-secret']; 96 | } 97 | 98 | // Map site ID if present 99 | if (dwConfig['site-id']) { 100 | config.siteId = dwConfig['site-id']; 101 | } 102 | 103 | return config; 104 | } 105 | 106 | /** 107 | * Validate configuration for different operating modes 108 | * 109 | * This validation supports both documentation-only mode (no credentials required) 110 | * and full mode (credentials required for API access). 111 | * 112 | * @param config - The configuration to validate 113 | * @throws Error if configuration is invalid for any supported mode 114 | */ 115 | private static validate(config: SFCCConfig): void { 116 | const hasBasicAuth = config.username && config.password; 117 | const hasOAuth = config.clientId && config.clientSecret; 118 | const hasHostname = config.hostname && config.hostname.trim() !== ''; 119 | 120 | // Allow local mode if no credentials or hostname are provided 121 | if (!hasBasicAuth && !hasOAuth && !hasHostname) { 122 | // Local mode - only class documentation available 123 | return; 124 | } 125 | 126 | // If hostname is provided, require credentials 127 | if (hasHostname && !hasBasicAuth && !hasOAuth) { 128 | throw new Error( 129 | 'When hostname is provided, either username/password or OAuth credentials (clientId/clientSecret) must be provided', 130 | ); 131 | } 132 | 133 | // Additional hostname validation if provided 134 | if (hasHostname) { 135 | const trimmedHostname = config.hostname!.trim(); 136 | if (!trimmedHostname.match(/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/)) { 137 | throw new Error('Invalid hostname format in configuration'); 138 | } 139 | } 140 | } 141 | 142 | /** 143 | * Check if configuration supports specific features 144 | * 145 | * This method analyzes the provided configuration to determine what 146 | * capabilities are available based on the credentials and hostname provided. 147 | * 148 | * @param config - The configuration to analyze 149 | * @returns Object describing available capabilities 150 | */ 151 | static getCapabilities(config: SFCCConfig): { 152 | canAccessLogs: boolean; 153 | canAccessOCAPI: boolean; 154 | canAccessWebDAV: boolean; 155 | canGenerateCartridges: boolean; 156 | isLocalMode: boolean; 157 | } { 158 | // WebDAV/Logs can work with either basic auth OR OAuth credentials 159 | const hasWebDAVCredentials = !!(config.username && config.password) || 160 | !!(config.clientId && config.clientSecret); 161 | 162 | // OCAPI specifically requires OAuth credentials 163 | const hasOAuthCredentials = !!(config.clientId && config.clientSecret); 164 | 165 | // Local mode when no hostname or credentials are provided 166 | const hasHostname = !!(config.hostname && config.hostname.trim() !== ''); 167 | const isLocalMode = !hasHostname && !hasWebDAVCredentials; 168 | 169 | return { 170 | canAccessLogs: hasWebDAVCredentials && hasHostname, 171 | canAccessOCAPI: hasOAuthCredentials && hasHostname, 172 | canAccessWebDAV: hasWebDAVCredentials && hasHostname, 173 | canGenerateCartridges: true, // Always available since it's a local file operation 174 | isLocalMode, 175 | }; 176 | } 177 | 178 | /** 179 | * Create a configuration for local development mode 180 | * 181 | * This creates a minimal configuration that only provides access to 182 | * documentation and best practices without requiring any SFCC credentials. 183 | * 184 | * @returns Configuration for local/documentation-only mode 185 | */ 186 | static createLocalMode(): SFCCConfig { 187 | return { 188 | hostname: '', 189 | username: undefined, 190 | password: undefined, 191 | clientId: undefined, 192 | clientSecret: undefined, 193 | siteId: undefined, 194 | }; 195 | } 196 | } 197 | ``` -------------------------------------------------------------------------------- /docs/sfra/querystring.md: -------------------------------------------------------------------------------- ```markdown 1 | # Class QueryString 2 | 3 | ## Inheritance Hierarchy 4 | 5 | - Object 6 | - sfra.models.QueryString 7 | 8 | ## Description 9 | 10 | The SFRA QueryString class is a specialized utility for parsing and managing URL query string parameters in SFCC applications. This class provides enhanced functionality beyond basic query string parsing by handling SFCC-specific parameter formats including product variants (`dwvar_`), product options (`dwopt_`), and search preferences (`pref`). The QueryString class automatically organizes these parameters into structured objects, handles URL encoding/decoding, manages duplicate parameters as arrays, and provides serialization back to query string format. It serves as the primary interface for working with URL parameters in SFRA controllers and templates. 11 | 12 | ## Properties 13 | 14 | ### variables 15 | 16 | **Type:** Object 17 | 18 | Object containing product variant information parsed from `dwvar_` parameters. 19 | 20 | ### options 21 | 22 | **Type:** Array 23 | 24 | Array of product option objects parsed from `dwopt_` parameters. 25 | 26 | ### preferences 27 | 28 | **Type:** Object 29 | 30 | Object containing search preference filters parsed from `pref` parameters. 31 | 32 | ### [parameterName] 33 | 34 | **Type:** String | Array 35 | 36 | Dynamic properties containing standard query parameters. Duplicate parameters are automatically converted to arrays. 37 | 38 | ## Constructor Summary 39 | 40 | ### QueryString 41 | 42 | **Signature:** `QueryString(raw)` 43 | 44 | Creates a new QueryString object by parsing the provided raw query string. 45 | 46 | **Parameters:** 47 | - `raw` (String) - Raw query string to parse 48 | 49 | ## Method Summary 50 | 51 | ### toString 52 | 53 | **Signature:** `toString() : String` 54 | 55 | Serializes the QueryString object back to a URL-encoded query string format. 56 | 57 | ## Constructor Detail 58 | 59 | ### QueryString 60 | 61 | **Signature:** `QueryString(raw)` 62 | 63 | **Description:** Parses a raw query string and organizes parameters into structured objects. Handles SFCC-specific parameter formats and automatically processes URL encoding. 64 | 65 | **Parameters:** 66 | - `raw` (String) - The raw query string to parse, may include the leading `?` 67 | 68 | **Processing Logic:** 69 | - Extracts and parses `dwvar_` parameters into the `variables` object 70 | - Extracts and parses `dwopt_` parameters into the `options` array 71 | - Extracts and parses `pref` parameters into the `preferences` object 72 | - Handles duplicate parameters by converting them to arrays 73 | - Performs URL decoding on all parameter values 74 | 75 | ## Method Detail 76 | 77 | ### toString 78 | 79 | **Signature:** `toString() : String` 80 | 81 | **Description:** Converts the QueryString object back to a properly formatted and URL-encoded query string. Maintains the original SFCC parameter format conventions. 82 | 83 | **Returns:** 84 | String containing the URL-encoded query string without the leading `?`. 85 | 86 | **Output Format:** 87 | - `dwvar_` parameters for product variants 88 | - `dwopt_` parameters for product options 89 | - `prefn`/`prefv`/`prefmin`/`prefmax` parameters for search preferences 90 | - Standard parameters for all other values 91 | - Results are sorted alphabetically 92 | 93 | ## Property Details 94 | 95 | ### variables 96 | 97 | **Type:** Object 98 | 99 | **Description:** Contains product variant information parsed from `dwvar_` prefixed parameters. Each variant is represented as: 100 | 101 | ```javascript 102 | { 103 | "variantAttributeName": { 104 | id: "productId", 105 | value: "selectedVariantValue" 106 | } 107 | } 108 | ``` 109 | 110 | **Example:** 111 | ```javascript 112 | // From: dwvar_123456_color=Red&dwvar_123456_size=Large 113 | variables: { 114 | "color": { id: "123456", value: "Red" }, 115 | "size": { id: "123456", value: "Large" } 116 | } 117 | ``` 118 | 119 | ### options 120 | 121 | **Type:** Array 122 | 123 | **Description:** Contains product option selections parsed from `dwopt_` prefixed parameters. Each option is represented as: 124 | 125 | ```javascript 126 | { 127 | optionId: "optionIdentifier", 128 | selectedValueId: "selectedOptionValue", 129 | productId: "associatedProductId" 130 | } 131 | ``` 132 | 133 | **Example:** 134 | ```javascript 135 | // From: dwopt_123456_warranty=extended&dwopt_123456_installation=yes 136 | options: [ 137 | { optionId: "warranty", selectedValueId: "extended", productId: "123456" }, 138 | { optionId: "installation", selectedValueId: "yes", productId: "123456" } 139 | ] 140 | ``` 141 | 142 | ### preferences 143 | 144 | **Type:** Object 145 | 146 | **Description:** Contains search refinement preferences parsed from `pref` prefixed parameters. Supports both single values and min/max ranges: 147 | 148 | **Single Value Format:** 149 | ```javascript 150 | { 151 | "attributeName": "value" 152 | } 153 | ``` 154 | 155 | **Range Value Format:** 156 | ```javascript 157 | { 158 | "attributeName": { 159 | min: "minimumValue", 160 | max: "maximumValue" 161 | } 162 | } 163 | ``` 164 | 165 | **Example:** 166 | ```javascript 167 | // From: prefn1=color&prefv1=Blue&prefn2=price&prefmin2=10&prefmax2=50 168 | preferences: { 169 | "color": "Blue", 170 | "price": { min: "10", max: "50" } 171 | } 172 | ``` 173 | 174 | ## Parameter Handling Details 175 | 176 | ### SFCC-Specific Parameters 177 | 178 | **Product Variants (`dwvar_`):** 179 | - Format: `dwvar_{productId}_{variantAttribute}={value}` 180 | - Underscores in product IDs are encoded as double underscores (`__`) 181 | - Parsed into the `variables` object with product ID and attribute mappings 182 | 183 | **Product Options (`dwopt_`):** 184 | - Format: `dwopt_{productId}_{optionId}={selectedValueId}` 185 | - Underscores in product IDs are encoded as double underscores (`__`) 186 | - Parsed into the `options` array with structured option data 187 | 188 | **Search Preferences (`pref`):** 189 | - Single values: `prefn{index}={name}&prefv{index}={value}` 190 | - Range values: `prefn{index}={name}&prefmin{index}={min}&prefmax{index}={max}` 191 | - Parsed into the `preferences` object with appropriate structure 192 | 193 | ### Standard Parameters 194 | 195 | **Regular Query Parameters:** 196 | - Standard URL parameters are stored as properties on the QueryString object 197 | - Duplicate parameters are automatically converted to arrays 198 | - All values are URL decoded 199 | 200 | ### URL Encoding Handling 201 | 202 | **Automatic Processing:** 203 | - Input parameters are automatically URL decoded during parsing 204 | - Output via `toString()` is automatically URL encoded 205 | - Spaces are handled correctly (+ symbols converted to %20) 206 | - Special characters are properly encoded/decoded 207 | 208 | ## Usage Examples 209 | 210 | ### Basic Parsing 211 | ```javascript 212 | var qs = new QueryString('?color=red&size=large&category=shoes'); 213 | // qs.color === 'red' 214 | // qs.size === 'large' 215 | // qs.category === 'shoes' 216 | ``` 217 | 218 | ### Product Variants 219 | ```javascript 220 | var qs = new QueryString('?dwvar_123456_color=Blue&dwvar_123456_size=Medium'); 221 | // qs.variables.color.id === '123456' 222 | // qs.variables.color.value === 'Blue' 223 | ``` 224 | 225 | ### Search Preferences 226 | ```javascript 227 | var qs = new QueryString('?prefn1=color&prefv1=Red&prefn2=price&prefmin2=10&prefmax2=100'); 228 | // qs.preferences.color === 'Red' 229 | // qs.preferences.price.min === '10' 230 | // qs.preferences.price.max === '100' 231 | ``` 232 | 233 | ### Serialization 234 | ```javascript 235 | var qs = new QueryString('?color=red&size=large'); 236 | qs.brand = 'nike'; 237 | var newQuery = qs.toString(); // 'brand=nike&color=red&size=large' 238 | ``` 239 | 240 | --- 241 | ``` -------------------------------------------------------------------------------- /docs/dw_order/TaxMgr.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.order 2 | 3 | # Class TaxMgr 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.order.TaxMgr 9 | 10 | ## Description 11 | 12 | Provides methods to access the tax table. 13 | 14 | ## Constants 15 | 16 | ### TAX_POLICY_GROSS 17 | 18 | **Type:** Number = 0 19 | 20 | Constant representing the gross taxation policy. 21 | 22 | ### TAX_POLICY_NET 23 | 24 | **Type:** Number = 1 25 | 26 | Constant representing the net taxation policy. 27 | 28 | ## Properties 29 | 30 | ### customRateTaxClassID 31 | 32 | **Type:** String (Read Only) 33 | 34 | The ID of the tax class that represents items with a custom tax rate. The standard order calculation 35 | process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate 36 | lookup sequence of the calculation process. 37 | 38 | Note that this tax class does not appear in the Business Manager tax module. 39 | 40 | ### defaultTaxClassID 41 | 42 | **Type:** String (Read Only) 43 | 44 | The ID of the default tax class defined for the site. This class might be used in case a product or 45 | service does not define a tax class. 46 | If no default tax class is defined, the method returns null. 47 | 48 | ### defaultTaxJurisdictionID 49 | 50 | **Type:** String (Read Only) 51 | 52 | The ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no 53 | jurisdiction is defined for a specific address. 54 | If no default tax jurisdiction is defined, this method returns null. 55 | 56 | ### taxationPolicy 57 | 58 | **Type:** Number (Read Only) 59 | 60 | The taxation policy (net/gross) configured for the current site. 61 | 62 | ### taxExemptTaxClassID 63 | 64 | **Type:** String (Read Only) 65 | 66 | The ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0 67 | for this tax class. 68 | 69 | Note that this tax class does not appear in the Business Manager tax module. 70 | 71 | ## Constructor Summary 72 | 73 | ## Method Summary 74 | 75 | ### applyExternalTax 76 | 77 | **Signature:** `static applyExternalTax(basket : Basket) : void` 78 | 79 | Applies externally set tax rates to the given Basket. 80 | 81 | ### getCustomRateTaxClassID 82 | 83 | **Signature:** `static getCustomRateTaxClassID() : String` 84 | 85 | Returns the ID of the tax class that represents items with a custom tax rate. 86 | 87 | ### getDefaultTaxClassID 88 | 89 | **Signature:** `static getDefaultTaxClassID() : String` 90 | 91 | Returns the ID of the default tax class defined for the site. 92 | 93 | ### getDefaultTaxJurisdictionID 94 | 95 | **Signature:** `static getDefaultTaxJurisdictionID() : String` 96 | 97 | Returns the ID of the default tax jurisdiction defined for the site. 98 | 99 | ### getTaxationPolicy 100 | 101 | **Signature:** `static getTaxationPolicy() : Number` 102 | 103 | Returns the taxation policy (net/gross) configured for the current site. 104 | 105 | ### getTaxExemptTaxClassID 106 | 107 | **Signature:** `static getTaxExemptTaxClassID() : String` 108 | 109 | Returns the ID of the tax class that represents tax exempt items. 110 | 111 | ### getTaxJurisdictionID 112 | 113 | **Signature:** `static getTaxJurisdictionID(location : ShippingLocation) : String` 114 | 115 | Returns the ID of the tax jurisdiction for the specified address. 116 | 117 | ### getTaxRate 118 | 119 | **Signature:** `static getTaxRate(taxClassID : String, taxJurisdictionID : String) : Number` 120 | 121 | Returns the tax rate defined for the specified combination of tax class and tax jurisdiction. 122 | 123 | ## Method Detail 124 | 125 | ## Method Details 126 | 127 | ### applyExternalTax 128 | 129 | **Signature:** `static applyExternalTax(basket : Basket) : void` 130 | 131 | **Description:** Applies externally set tax rates to the given Basket. Only use when LineItemCtnr.isExternallyTaxed() returns true. Note: a basket can only be created in EXTERNAL tax mode using SCAPI. Typical usage in tax calculation: var TaxMgr = require('dw/order/TaxMgr'); calculateTaxes: function () { Basket basket = BasketMgr.getCurrentBasket(); if ( basket.isExternallyTaxed() ) { TaxMgr.applyExternalTaxation( basket ); } else { // calculation with tax tables or customization } } 132 | 133 | **Parameters:** 134 | 135 | - `basket`: apply external taxation to this basket 136 | 137 | --- 138 | 139 | ### getCustomRateTaxClassID 140 | 141 | **Signature:** `static getCustomRateTaxClassID() : String` 142 | 143 | **Description:** Returns the ID of the tax class that represents items with a custom tax rate. The standard order calculation process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate lookup sequence of the calculation process. Note that this tax class does not appear in the Business Manager tax module. 144 | 145 | --- 146 | 147 | ### getDefaultTaxClassID 148 | 149 | **Signature:** `static getDefaultTaxClassID() : String` 150 | 151 | **Description:** Returns the ID of the default tax class defined for the site. This class might be used in case a product or service does not define a tax class. If no default tax class is defined, the method returns null. 152 | 153 | **Returns:** 154 | 155 | the ID of the default tax class defined for the site or null. 156 | 157 | --- 158 | 159 | ### getDefaultTaxJurisdictionID 160 | 161 | **Signature:** `static getDefaultTaxJurisdictionID() : String` 162 | 163 | **Description:** Returns the ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no jurisdiction is defined for a specific address. If no default tax jurisdiction is defined, this method returns null. 164 | 165 | **Returns:** 166 | 167 | the ID of the default tax jurisdiction defined for the site or null. 168 | 169 | --- 170 | 171 | ### getTaxationPolicy 172 | 173 | **Signature:** `static getTaxationPolicy() : Number` 174 | 175 | **Description:** Returns the taxation policy (net/gross) configured for the current site. 176 | 177 | **Returns:** 178 | 179 | Taxation policy configured for current site 180 | 181 | **See Also:** 182 | 183 | TAX_POLICY_GROSS 184 | TAX_POLICY_NET 185 | 186 | --- 187 | 188 | ### getTaxExemptTaxClassID 189 | 190 | **Signature:** `static getTaxExemptTaxClassID() : String` 191 | 192 | **Description:** Returns the ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0 for this tax class. Note that this tax class does not appear in the Business Manager tax module. 193 | 194 | --- 195 | 196 | ### getTaxJurisdictionID 197 | 198 | **Signature:** `static getTaxJurisdictionID(location : ShippingLocation) : String` 199 | 200 | **Description:** Returns the ID of the tax jurisdiction for the specified address. If no tax jurisdiction defined for the site matches the specified address, this method returns null. 201 | 202 | **Parameters:** 203 | 204 | - `location`: The shipping location 205 | 206 | **Returns:** 207 | 208 | the ID of the tax jurisdiction for the specified address or null. 209 | 210 | --- 211 | 212 | ### getTaxRate 213 | 214 | **Signature:** `static getTaxRate(taxClassID : String, taxJurisdictionID : String) : Number` 215 | 216 | **Description:** Returns the tax rate defined for the specified combination of tax class and tax jurisdiction. Method returns null if no tax rate is defined. Method returns 0.0 of 'nontaxable' tax rate is specified (see method 'getNontaxableTaxClassID'. 217 | 218 | **Parameters:** 219 | 220 | - `taxClassID`: ID of the tax class 221 | - `taxJurisdictionID`: ID of tax jusrisdiction 222 | 223 | **Returns:** 224 | 225 | the tax rate defined for the specified combination of tax class and tax jurisdiction. 226 | 227 | --- ``` -------------------------------------------------------------------------------- /docs/dw_extensions.payments/SalesforcePaymentIntent.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.extensions.payments 2 | 3 | # Class SalesforcePaymentIntent 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.extensions.payments.SalesforcePaymentIntent 9 | 10 | ## Description 11 | 12 | Salesforce Payments representation of a payment intent object. See Salesforce Payments documentation for how to gain access and configure it for use on your sites. A payment intent is automatically created when a shopper is ready to pay for items in their basket. It becomes confirmed when the shopper provides information to the payment provider that is acceptable to authorize payment for a given amount. Once that information has been provided it becomes available as the payment method associated with the payment intent. 13 | 14 | ## Constants 15 | 16 | ### SETUP_FUTURE_USAGE_OFF_SESSION 17 | 18 | **Type:** String = "off_session" 19 | 20 | Represents the payment method setup future usage is off session. 21 | 22 | ### SETUP_FUTURE_USAGE_ON_SESSION 23 | 24 | **Type:** String = "on_session" 25 | 26 | Represents the payment method setup future usage is on session. 27 | 28 | ## Properties 29 | 30 | ### amount 31 | 32 | **Type:** Money (Read Only) 33 | 34 | The amount of this payment intent. 35 | 36 | ### cancelable 37 | 38 | **Type:** boolean (Read Only) 39 | 40 | Returns true if this payment intent has a status which indicates it can be canceled, 41 | or false if its status does not indicate it can be canceled. 42 | 43 | ### clientSecret 44 | 45 | **Type:** String (Read Only) 46 | 47 | The client secret of this payment intent. 48 | 49 | ### confirmed 50 | 51 | **Type:** boolean (Read Only) 52 | 53 | Returns true if this payment intent has been confirmed, or false if not. 54 | 55 | ### ID 56 | 57 | **Type:** String (Read Only) 58 | 59 | The identifier of this payment intent. 60 | 61 | ### paymentMethod 62 | 63 | **Type:** SalesforcePaymentMethod (Read Only) 64 | 65 | The payment method for this payment intent, or null if none has been established. 66 | 67 | ### refundable 68 | 69 | **Type:** boolean (Read Only) 70 | 71 | Returns true if this payment intent has a status and other state which indicate it can be refunded, 72 | or false if it cannot be refunded. 73 | 74 | ### setupFutureUsage 75 | 76 | **Type:** String (Read Only) 77 | 78 | Returns SETUP_FUTURE_USAGE_OFF_SESSION or SETUP_FUTURE_USAGE_ON_SESSION to indicate how the payment 79 | intent can be used in the future or returns null if future usage is not set up. 80 | 81 | ## Constructor Summary 82 | 83 | ## Method Summary 84 | 85 | ### getAmount 86 | 87 | **Signature:** `getAmount() : Money` 88 | 89 | Returns the amount of this payment intent. 90 | 91 | ### getClientSecret 92 | 93 | **Signature:** `getClientSecret() : String` 94 | 95 | Returns the client secret of this payment intent. 96 | 97 | ### getID 98 | 99 | **Signature:** `getID() : String` 100 | 101 | Returns the identifier of this payment intent. 102 | 103 | ### getPaymentInstrument 104 | 105 | **Signature:** `getPaymentInstrument(basket : Basket) : OrderPaymentInstrument` 106 | 107 | Returns the payment instrument for this payment intent in the given basket, or null if the given basket has none. 108 | 109 | ### getPaymentInstrument 110 | 111 | **Signature:** `getPaymentInstrument(order : Order) : OrderPaymentInstrument` 112 | 113 | Returns the payment instrument for this payment intent in the given order, or null if the given order has none. 114 | 115 | ### getPaymentMethod 116 | 117 | **Signature:** `getPaymentMethod() : SalesforcePaymentMethod` 118 | 119 | Returns the payment method for this payment intent, or null if none has been established. 120 | 121 | ### getSetupFutureUsage 122 | 123 | **Signature:** `getSetupFutureUsage() : String` 124 | 125 | Returns SETUP_FUTURE_USAGE_OFF_SESSION or SETUP_FUTURE_USAGE_ON_SESSION to indicate how the payment intent can be used in the future or returns null if future usage is not set up. 126 | 127 | ### isCancelable 128 | 129 | **Signature:** `isCancelable() : boolean` 130 | 131 | Returns true if this payment intent has a status which indicates it can be canceled, or false if its status does not indicate it can be canceled. 132 | 133 | ### isConfirmed 134 | 135 | **Signature:** `isConfirmed() : boolean` 136 | 137 | Returns true if this payment intent has been confirmed, or false if not. 138 | 139 | ### isRefundable 140 | 141 | **Signature:** `isRefundable() : boolean` 142 | 143 | Returns true if this payment intent has a status and other state which indicate it can be refunded, or false if it cannot be refunded. 144 | 145 | ## Method Detail 146 | 147 | ## Method Details 148 | 149 | ### getAmount 150 | 151 | **Signature:** `getAmount() : Money` 152 | 153 | **Description:** Returns the amount of this payment intent. 154 | 155 | **Returns:** 156 | 157 | payment intent amount 158 | 159 | --- 160 | 161 | ### getClientSecret 162 | 163 | **Signature:** `getClientSecret() : String` 164 | 165 | **Description:** Returns the client secret of this payment intent. 166 | 167 | **Returns:** 168 | 169 | payment intent client secret 170 | 171 | --- 172 | 173 | ### getID 174 | 175 | **Signature:** `getID() : String` 176 | 177 | **Description:** Returns the identifier of this payment intent. 178 | 179 | **Returns:** 180 | 181 | payment intent identifier 182 | 183 | --- 184 | 185 | ### getPaymentInstrument 186 | 187 | **Signature:** `getPaymentInstrument(basket : Basket) : OrderPaymentInstrument` 188 | 189 | **Description:** Returns the payment instrument for this payment intent in the given basket, or null if the given basket has none. 190 | 191 | **Parameters:** 192 | 193 | - `basket`: basket 194 | 195 | **Returns:** 196 | 197 | basket payment instrument 198 | 199 | --- 200 | 201 | ### getPaymentInstrument 202 | 203 | **Signature:** `getPaymentInstrument(order : Order) : OrderPaymentInstrument` 204 | 205 | **Description:** Returns the payment instrument for this payment intent in the given order, or null if the given order has none. 206 | 207 | **Parameters:** 208 | 209 | - `order`: order 210 | 211 | **Returns:** 212 | 213 | order payment instrument 214 | 215 | --- 216 | 217 | ### getPaymentMethod 218 | 219 | **Signature:** `getPaymentMethod() : SalesforcePaymentMethod` 220 | 221 | **Description:** Returns the payment method for this payment intent, or null if none has been established. 222 | 223 | **Returns:** 224 | 225 | payment method 226 | 227 | --- 228 | 229 | ### getSetupFutureUsage 230 | 231 | **Signature:** `getSetupFutureUsage() : String` 232 | 233 | **Description:** Returns SETUP_FUTURE_USAGE_OFF_SESSION or SETUP_FUTURE_USAGE_ON_SESSION to indicate how the payment intent can be used in the future or returns null if future usage is not set up. 234 | 235 | **Returns:** 236 | 237 | setup future usage or null if future usage is not set up 238 | 239 | **See Also:** 240 | 241 | SalesforcePaymentRequest.setSetupFutureUsage(Boolean) 242 | SETUP_FUTURE_USAGE_OFF_SESSION 243 | SETUP_FUTURE_USAGE_ON_SESSION 244 | 245 | --- 246 | 247 | ### isCancelable 248 | 249 | **Signature:** `isCancelable() : boolean` 250 | 251 | **Description:** Returns true if this payment intent has a status which indicates it can be canceled, or false if its status does not indicate it can be canceled. 252 | 253 | **Returns:** 254 | 255 | true if this payment intent has a status which indicates it can be canceled 256 | 257 | --- 258 | 259 | ### isConfirmed 260 | 261 | **Signature:** `isConfirmed() : boolean` 262 | 263 | **Description:** Returns true if this payment intent has been confirmed, or false if not. 264 | 265 | **Returns:** 266 | 267 | true if this payment intent has been confirmed 268 | 269 | --- 270 | 271 | ### isRefundable 272 | 273 | **Signature:** `isRefundable() : boolean` 274 | 275 | **Description:** Returns true if this payment intent has a status and other state which indicate it can be refunded, or false if it cannot be refunded. 276 | 277 | **Returns:** 278 | 279 | true if this payment intent has a status and other state which indicate it can be refunded 280 | 281 | --- ``` -------------------------------------------------------------------------------- /docs/dw_catalog/ProductOptionModel.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.catalog 2 | 3 | # Class ProductOptionModel 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.catalog.ProductOptionModel 9 | 10 | ## Description 11 | 12 | This class represents the option model of a specific product and for a specific currency. It provides accessor methods to the configured options and the values of those options. It has also methods to set a specific selection of option values. 13 | 14 | ## Properties 15 | 16 | ### options 17 | 18 | **Type:** Collection (Read Only) 19 | 20 | The collection of product options. 21 | 22 | ## Constructor Summary 23 | 24 | ## Method Summary 25 | 26 | ### getOption 27 | 28 | **Signature:** `getOption(optionID : String) : ProductOption` 29 | 30 | Returns the product option for the specified ID. 31 | 32 | ### getOptions 33 | 34 | **Signature:** `getOptions() : Collection` 35 | 36 | Returns the collection of product options. 37 | 38 | ### getOptionValue 39 | 40 | **Signature:** `getOptionValue(option : ProductOption, valueID : String) : ProductOptionValue` 41 | 42 | Returns the product option value object for the passed value id and in the context of the passed option. 43 | 44 | ### getOptionValues 45 | 46 | **Signature:** `getOptionValues(option : ProductOption) : Collection` 47 | 48 | Returns a collection of product option values for the specified product option. 49 | 50 | ### getPrice 51 | 52 | **Signature:** `getPrice(optionValue : ProductOptionValue) : Money` 53 | 54 | Returns the effective price of the specified option value. 55 | 56 | ### getSelectedOptionValue 57 | 58 | **Signature:** `getSelectedOptionValue(option : ProductOption) : ProductOptionValue` 59 | 60 | Returns the selected value for the specified product option. 61 | 62 | ### isSelectedOptionValue 63 | 64 | **Signature:** `isSelectedOptionValue(option : ProductOption, value : ProductOptionValue) : boolean` 65 | 66 | Returns true if the specified option value is the one currently selected, false otherwise. 67 | 68 | ### setSelectedOptionValue 69 | 70 | **Signature:** `setSelectedOptionValue(option : ProductOption, value : ProductOptionValue) : void` 71 | 72 | Updates the selection of the specified option based on the specified value. 73 | 74 | ### url 75 | 76 | **Signature:** `url(action : String, varOptionAndValues : Object...) : URL` 77 | 78 | Returns a URL that can be used to select one or more option values. 79 | 80 | ### urlSelectOptionValue 81 | 82 | **Signature:** `urlSelectOptionValue(action : String, option : ProductOption, value : ProductOptionValue) : String` 83 | 84 | Returns an URL that can be used to select a specific value of a specific option. 85 | 86 | ## Method Detail 87 | 88 | ## Method Details 89 | 90 | ### getOption 91 | 92 | **Signature:** `getOption(optionID : String) : ProductOption` 93 | 94 | **Description:** Returns the product option for the specified ID. 95 | 96 | **Parameters:** 97 | 98 | - `optionID`: the product option identifier. 99 | 100 | **Returns:** 101 | 102 | the product option for the specified ID. 103 | 104 | --- 105 | 106 | ### getOptions 107 | 108 | **Signature:** `getOptions() : Collection` 109 | 110 | **Description:** Returns the collection of product options. 111 | 112 | **Returns:** 113 | 114 | Collection of Product Options. 115 | 116 | --- 117 | 118 | ### getOptionValue 119 | 120 | **Signature:** `getOptionValue(option : ProductOption, valueID : String) : ProductOptionValue` 121 | 122 | **Description:** Returns the product option value object for the passed value id and in the context of the passed option. 123 | 124 | **Parameters:** 125 | 126 | - `option`: The option to get the specified value for. 127 | - `valueID`: The id of the value to retrieve 128 | 129 | **Returns:** 130 | 131 | a value for the specified product option and value id 132 | 133 | --- 134 | 135 | ### getOptionValues 136 | 137 | **Signature:** `getOptionValues(option : ProductOption) : Collection` 138 | 139 | **Description:** Returns a collection of product option values for the specified product option. 140 | 141 | **Parameters:** 142 | 143 | - `option`: the option for which we want to extract the collection of product option values. 144 | 145 | **Returns:** 146 | 147 | a collection of product option values for the specified product option. 148 | 149 | --- 150 | 151 | ### getPrice 152 | 153 | **Signature:** `getPrice(optionValue : ProductOptionValue) : Money` 154 | 155 | **Description:** Returns the effective price of the specified option value. 156 | 157 | **Parameters:** 158 | 159 | - `optionValue`: the product option value to use. 160 | 161 | **Returns:** 162 | 163 | the effective price of the specified option value. 164 | 165 | --- 166 | 167 | ### getSelectedOptionValue 168 | 169 | **Signature:** `getSelectedOptionValue(option : ProductOption) : ProductOptionValue` 170 | 171 | **Description:** Returns the selected value for the specified product option. If no option values was set as selected option explicitly, the method returns the default option value for this option. 172 | 173 | **Parameters:** 174 | 175 | - `option`: The option to get the selected value for. 176 | 177 | **Returns:** 178 | 179 | a selected value for the specified product option. 180 | 181 | --- 182 | 183 | ### isSelectedOptionValue 184 | 185 | **Signature:** `isSelectedOptionValue(option : ProductOption, value : ProductOptionValue) : boolean` 186 | 187 | **Description:** Returns true if the specified option value is the one currently selected, false otherwise. 188 | 189 | **Parameters:** 190 | 191 | - `option`: the product option. 192 | - `value`: the product option value. 193 | 194 | **Returns:** 195 | 196 | true if the specified option value is the one currently selected, false otherwise. 197 | 198 | --- 199 | 200 | ### setSelectedOptionValue 201 | 202 | **Signature:** `setSelectedOptionValue(option : ProductOption, value : ProductOptionValue) : void` 203 | 204 | **Description:** Updates the selection of the specified option based on the specified value. 205 | 206 | **Parameters:** 207 | 208 | - `option`: the option to update. 209 | - `value`: the value to use when updating the product option. 210 | 211 | --- 212 | 213 | ### url 214 | 215 | **Signature:** `url(action : String, varOptionAndValues : Object...) : URL` 216 | 217 | **Description:** Returns a URL that can be used to select one or more option values. The optional varOptionAndValues argument can be empty, or can contain one or more option / value pairs. This variable list must be even in length, with options and values alternating. If the list is odd in length, the last argument will be ignored. Options can be specified as instances of ProductOption, or String option ID. Values can be specified as instances of ProductOptionValue or as strings representing the value ID. If a parameter is invalid, then the parameter pair is not included in the generated URL. The returned URL will contain options and values already selected in the product option model, as well as options and values specified as method parameters. This includes option values explicitly selected and implicitly selected by default. 218 | 219 | **Parameters:** 220 | 221 | - `action`: The pipeline action, must not be null. 222 | - `varOptionAndValues`: Variable length list of options and values. 223 | 224 | **Returns:** 225 | 226 | The constructed URL. 227 | 228 | --- 229 | 230 | ### urlSelectOptionValue 231 | 232 | **Signature:** `urlSelectOptionValue(action : String, option : ProductOption, value : ProductOptionValue) : String` 233 | 234 | **Description:** Returns an URL that can be used to select a specific value of a specific option. 235 | 236 | **Parameters:** 237 | 238 | - `action`: the action to use. 239 | - `option`: the option to use when constructing the URL. 240 | - `value`: the value to use when constructing the URL. 241 | 242 | **Returns:** 243 | 244 | The constructed URL as string. 245 | 246 | --- ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/get-system-object-definition.full-mode.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml 1 | # ================================================================================== 2 | # SFCC MCP Server - get_system_object_definition Tool YAML Tests (Full Mode) 3 | # Streamlined smoke testing and declarative validation for core functionality 4 | # Complex business logic, edge cases, and workflows are covered in programmatic tests 5 | # 6 | # Quick Test Commands: 7 | # aegis "tests/mcp/yaml/get-system-object-definition.full-mode.test.mcp.yml" --config "aegis.config.with-dw.json" --verbose 8 | # aegis query get_system_object_definition '{"objectType": "Product"}' --config "aegis.config.with-dw.json" 9 | # ================================================================================== 10 | 11 | description: "get_system_object_definition tool smoke tests - Basic functionality validation" 12 | 13 | tests: 14 | # ================================================================================== 15 | # TOOL AVAILABILITY VALIDATION 16 | # ================================================================================== 17 | - it: "should have get_system_object_definition tool available with proper schema" 18 | request: 19 | jsonrpc: "2.0" 20 | id: "tool-available" 21 | method: "tools/list" 22 | params: {} 23 | expect: 24 | response: 25 | jsonrpc: "2.0" 26 | id: "tool-available" 27 | result: 28 | tools: 29 | match:arrayElements: 30 | match:partial: 31 | name: "match:type:string" 32 | description: "match:type:string" 33 | match:extractField: "tools.*.name" 34 | value: "match:arrayContains:get_system_object_definition" 35 | stderr: "toBeEmpty" 36 | 37 | # ================================================================================== 38 | # CORE FUNCTIONALITY VALIDATION 39 | # ================================================================================== 40 | - it: "should successfully retrieve Product object definition with valid structure" 41 | request: 42 | jsonrpc: "2.0" 43 | id: "product-success" 44 | method: "tools/call" 45 | params: 46 | name: "get_system_object_definition" 47 | arguments: 48 | objectType: "Product" 49 | expect: 50 | response: 51 | jsonrpc: "2.0" 52 | id: "product-success" 53 | result: 54 | content: 55 | - type: "text" 56 | text: "match:contains:Product" 57 | isError: false 58 | performance: 59 | maxResponseTime: "800ms" 60 | stderr: "toBeEmpty" 61 | 62 | - it: "should successfully retrieve Customer object definition" 63 | request: 64 | jsonrpc: "2.0" 65 | id: "customer-success" 66 | method: "tools/call" 67 | params: 68 | name: "get_system_object_definition" 69 | arguments: 70 | objectType: "Customer" 71 | expect: 72 | response: 73 | jsonrpc: "2.0" 74 | id: "customer-success" 75 | result: 76 | content: 77 | - type: "text" 78 | text: "match:contains:Customer" 79 | isError: false 80 | stderr: "toBeEmpty" 81 | 82 | - it: "should return valid JSON structure with required SFCC metadata" 83 | request: 84 | jsonrpc: "2.0" 85 | id: "valid-json" 86 | method: "tools/call" 87 | params: 88 | name: "get_system_object_definition" 89 | arguments: 90 | objectType: "Product" 91 | expect: 92 | response: 93 | jsonrpc: "2.0" 94 | id: "valid-json" 95 | result: 96 | content: 97 | - type: "text" 98 | text: "match:regex:^\\{[\\s\\S]*object_type_definition[\\s\\S]*\\}$" 99 | isError: false 100 | stderr: "toBeEmpty" 101 | 102 | # ================================================================================== 103 | # ERROR HANDLING VALIDATION 104 | # ================================================================================== 105 | - it: "should handle missing objectType parameter with clear error" 106 | request: 107 | jsonrpc: "2.0" 108 | id: "missing-param" 109 | method: "tools/call" 110 | params: 111 | name: "get_system_object_definition" 112 | arguments: {} 113 | expect: 114 | response: 115 | jsonrpc: "2.0" 116 | id: "missing-param" 117 | result: 118 | content: 119 | - type: "text" 120 | text: "match:contains:objectType must be a non-empty string" 121 | isError: true 122 | stderr: "toBeEmpty" 123 | 124 | - it: "should handle invalid parameter type gracefully" 125 | request: 126 | jsonrpc: "2.0" 127 | id: "invalid-type" 128 | method: "tools/call" 129 | params: 130 | name: "get_system_object_definition" 131 | arguments: 132 | objectType: 123 133 | expect: 134 | response: 135 | jsonrpc: "2.0" 136 | id: "invalid-type" 137 | result: 138 | content: 139 | - type: "text" 140 | text: "match:contains:objectType must be a non-empty string" 141 | isError: true 142 | stderr: "toBeEmpty" 143 | 144 | # ================================================================================== 145 | # PERFORMANCE SMOKE TEST 146 | # ================================================================================== 147 | - it: "should respond within acceptable timeframe for unknown objects" 148 | request: 149 | jsonrpc: "2.0" 150 | id: "performance-check" 151 | method: "tools/call" 152 | params: 153 | name: "get_system_object_definition" 154 | arguments: 155 | objectType: "UnknownObject" 156 | expect: 157 | response: 158 | jsonrpc: "2.0" 159 | id: "performance-check" 160 | result: 161 | content: 162 | - type: "text" 163 | text: "match:contains:UnknownObject" 164 | isError: false 165 | performance: 166 | maxResponseTime: "600ms" 167 | stderr: "toBeEmpty" 168 | 169 | # ================================================================================== 170 | # OPTIMIZATION NOTES 171 | # ================================================================================== 172 | # This YAML test suite has been optimized to focus on declarative smoke testing. 173 | # 174 | # REMOVED from YAML (handled better in programmatic tests): 175 | # - Detailed JSON structure validation (complex regex patterns) 176 | # - Multiple object-specific tests (9 tests → 2 representative tests) 177 | # - Fallback behavior testing (3 tests → covered in programmatic) 178 | # - Case sensitivity edge cases (2 tests → covered in programmatic) 179 | # - Complex edge case testing (3 tests → covered in programmatic) 180 | # - Multiple tool discovery tests (4 tests → 1 consolidated test) 181 | # - Detailed metadata field validation (brittle regex patterns) 182 | # 183 | # KEPT in YAML (optimal for declarative validation): 184 | # - Basic tool availability (1 consolidated test) 185 | # - Core functionality smoke tests (2 key object types) 186 | # - Basic error handling (2 representative cases) 187 | # - Performance smoke test (1 test) 188 | # 189 | # TOTAL REDUCTION: 30+ tests → 7 focused tests 190 | # COMPLEX LOGIC: Now exclusively in programmatic tests where it belongs 191 | # ================================================================================== ``` -------------------------------------------------------------------------------- /tests/job-log-utils.test.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { JobLogValidators, JobLogFormatters } from '../src/utils/job-log-utils.js'; 2 | 3 | describe('JobLogValidators', () => { 4 | describe('validateJobLogLevel', () => { 5 | it('should accept valid log levels', () => { 6 | const validLevels = ['error', 'warn', 'info', 'debug', 'all']; 7 | 8 | validLevels.forEach(level => { 9 | expect(() => JobLogValidators.validateJobLogLevel(level)).not.toThrow(); 10 | }); 11 | }); 12 | 13 | it('should reject invalid log levels', () => { 14 | const invalidLevels = ['trace', 'fatal', 'verbose', 'invalid', '']; 15 | 16 | invalidLevels.forEach(level => { 17 | expect(() => JobLogValidators.validateJobLogLevel(level)) 18 | .toThrow(`Invalid log level: ${level}. Must be one of: error, warn, info, debug, all`); 19 | }); 20 | }); 21 | 22 | it('should include tool name in error message when provided', () => { 23 | const toolName = 'test_tool'; 24 | const invalidLevel = 'invalid'; 25 | 26 | expect(() => JobLogValidators.validateJobLogLevel(invalidLevel, toolName)) 27 | .toThrow(`${toolName}: Invalid log level: ${invalidLevel}. Must be one of: error, warn, info, debug, all`); 28 | }); 29 | 30 | it('should handle null and undefined gracefully', () => { 31 | expect(() => JobLogValidators.validateJobLogLevel(null as any)).toThrow(); 32 | expect(() => JobLogValidators.validateJobLogLevel(undefined as any)).toThrow(); 33 | }); 34 | 35 | it('should be case sensitive', () => { 36 | expect(() => JobLogValidators.validateJobLogLevel('ERROR')).toThrow(); 37 | expect(() => JobLogValidators.validateJobLogLevel('ALL')).toThrow(); 38 | expect(() => JobLogValidators.validateJobLogLevel('Debug')).toThrow(); 39 | }); 40 | }); 41 | 42 | describe('getDefaultLimit', () => { 43 | it('should return correct default limit for search operations', () => { 44 | expect(JobLogValidators.getDefaultLimit('search')).toBe(20); 45 | }); 46 | 47 | it('should return correct default limit for entries operations', () => { 48 | expect(JobLogValidators.getDefaultLimit('entries')).toBe(10); 49 | }); 50 | 51 | it('should return correct default limit for files operations', () => { 52 | expect(JobLogValidators.getDefaultLimit('files')).toBe(10); 53 | }); 54 | 55 | it('should return default limit for unknown operations', () => { 56 | expect(JobLogValidators.getDefaultLimit('unknown' as any)).toBe(10); 57 | }); 58 | }); 59 | 60 | describe('ALLOWED_LEVELS constant', () => { 61 | it('should contain exactly the expected levels', () => { 62 | expect(JobLogValidators.ALLOWED_LEVELS).toEqual(['error', 'warn', 'info', 'debug', 'all']); 63 | }); 64 | 65 | it('should be readonly array', () => { 66 | const levels = JobLogValidators.ALLOWED_LEVELS; 67 | expect(levels).toEqual(['error', 'warn', 'info', 'debug', 'all']); 68 | // Test that it's a readonly array by checking its type/immutability intent 69 | expect(Array.isArray(levels)).toBe(true); 70 | }); 71 | }); 72 | }); 73 | 74 | describe('JobLogFormatters', () => { 75 | describe('formatJobLogMessage', () => { 76 | it('should format message with operation only', () => { 77 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', {}); 78 | expect(result).toBe('Testing operation'); 79 | }); 80 | 81 | it('should format message with job name', () => { 82 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 83 | jobName: 'TestJob', 84 | }); 85 | expect(result).toBe('Testing operation jobName=TestJob'); 86 | }); 87 | 88 | it('should format message with level', () => { 89 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 90 | level: 'error', 91 | }); 92 | expect(result).toBe('Testing operation level=error'); 93 | }); 94 | 95 | it('should format message with limit', () => { 96 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 97 | limit: 50, 98 | }); 99 | expect(result).toBe('Testing operation limit=50'); 100 | }); 101 | 102 | it('should format message with limit of 0', () => { 103 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 104 | limit: 0, 105 | }); 106 | expect(result).toBe('Testing operation limit=0'); 107 | }); 108 | 109 | it('should format message with pattern', () => { 110 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 111 | pattern: 'error-pattern', 112 | }); 113 | expect(result).toBe('Testing operation pattern="error-pattern"'); 114 | }); 115 | 116 | it('should format message with pattern containing spaces', () => { 117 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 118 | pattern: 'error with spaces', 119 | }); 120 | expect(result).toBe('Testing operation pattern="error with spaces"'); 121 | }); 122 | 123 | it('should format message with all parameters', () => { 124 | const result = JobLogFormatters.formatJobLogMessage('Complex operation', { 125 | jobName: 'ComplexJob', 126 | level: 'debug', 127 | limit: 25, 128 | pattern: 'search-term', 129 | }); 130 | expect(result).toBe('Complex operation jobName=ComplexJob level=debug limit=25 pattern="search-term"'); 131 | }); 132 | 133 | it('should handle empty strings in parameters', () => { 134 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 135 | jobName: '', 136 | level: '', 137 | pattern: '', 138 | }); 139 | expect(result).toBe('Testing operation'); 140 | }); 141 | 142 | it('should handle undefined limit correctly', () => { 143 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 144 | jobName: 'TestJob', 145 | limit: undefined, 146 | }); 147 | expect(result).toBe('Testing operation jobName=TestJob'); 148 | }); 149 | 150 | it('should handle special characters in job name', () => { 151 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 152 | jobName: 'Job-With_Special.Characters', 153 | }); 154 | expect(result).toBe('Testing operation jobName=Job-With_Special.Characters'); 155 | }); 156 | 157 | it('should handle special characters in pattern', () => { 158 | const result = JobLogFormatters.formatJobLogMessage('Testing operation', { 159 | pattern: 'pattern-with_special.chars', 160 | }); 161 | expect(result).toBe('Testing operation pattern="pattern-with_special.chars"'); 162 | }); 163 | 164 | it('should preserve order of parameters', () => { 165 | const result = JobLogFormatters.formatJobLogMessage('Operation', { 166 | pattern: 'last', 167 | jobName: 'first', 168 | level: 'second', 169 | limit: 123, 170 | }); 171 | // Should maintain the order: jobName, level, limit, pattern 172 | expect(result).toBe('Operation jobName=first level=second limit=123 pattern="last"'); 173 | }); 174 | 175 | it('should handle empty operation string', () => { 176 | const result = JobLogFormatters.formatJobLogMessage('', { 177 | jobName: 'TestJob', 178 | }); 179 | expect(result).toBe(' jobName=TestJob'); 180 | }); 181 | }); 182 | }); 183 | ``` -------------------------------------------------------------------------------- /docs/dw_crypto/WeakSignature.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.crypto 2 | 3 | # Class WeakSignature 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.crypto.WeakSignature 9 | 10 | ## Description 11 | 12 | This API provides access to Deprecated algorithms. See Signature for full documentation. WeakSignature is simply a drop-in replacement that only supports deprecated algorithms. This is helpful when you need to deal with weak algorithms for backward compatibility purposes, but Signature should always be used for new development and for anything intended to be secure. This class allows access to signature services offered through the Java Cryptography Architecture (JCA). At this time the signature/verification implementation of the methods is based on the default RSA JCE provider of the JDK - sun.security.rsa.SunRsaSign dw.crypto.WeakSignature is an adapter to the security provider implementation and only covers one digest algorithm: SHA1withRSA Note: this class handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, 12, and other relevant requirements. 13 | 14 | ## Constructor Summary 15 | 16 | WeakSignature() 17 | 18 | ## Method Summary 19 | 20 | ### isDigestAlgorithmSupported 21 | 22 | **Signature:** `isDigestAlgorithmSupported(digestAlgorithm : String) : boolean` 23 | 24 | Checks to see if a digest algorithm is supported 25 | 26 | ### sign 27 | 28 | **Signature:** `sign(contentToSign : String, privateKey : String, digestAlgorithm : String) : String` 29 | 30 | Signs a string and returns a string 31 | 32 | ### sign 33 | 34 | **Signature:** `sign(contentToSign : String, privateKey : KeyRef, digestAlgorithm : String) : String` 35 | 36 | Signs a string and returns a string 37 | 38 | ### signBytes 39 | 40 | **Signature:** `signBytes(contentToSign : Bytes, privateKey : String, digestAlgorithm : String) : Bytes` 41 | 42 | Signs bytes and returns bytes 43 | 44 | ### signBytes 45 | 46 | **Signature:** `signBytes(contentToSign : Bytes, privateKey : KeyRef, digestAlgorithm : String) : Bytes` 47 | 48 | Signs bytes and returns bytes 49 | 50 | ### verifyBytesSignature 51 | 52 | **Signature:** `verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, publicKey : String, digestAlgorithm : String) : boolean` 53 | 54 | Verifies a signature supplied as bytes 55 | 56 | ### verifyBytesSignature 57 | 58 | **Signature:** `verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, certificate : CertificateRef, digestAlgorithm : String) : boolean` 59 | 60 | Verifies a signature supplied as bytes 61 | 62 | ### verifySignature 63 | 64 | **Signature:** `verifySignature(signature : String, contentToVerify : String, publicKey : String, digestAlgorithm : String) : boolean` 65 | 66 | Verifies a signature supplied as string 67 | 68 | ### verifySignature 69 | 70 | **Signature:** `verifySignature(signature : String, contentToVerify : String, certificate : CertificateRef, digestAlgorithm : String) : boolean` 71 | 72 | Verifies a signature supplied as string 73 | 74 | ## Constructor Detail 75 | 76 | ## Method Detail 77 | 78 | ## Method Details 79 | 80 | ### isDigestAlgorithmSupported 81 | 82 | **Signature:** `isDigestAlgorithmSupported(digestAlgorithm : String) : boolean` 83 | 84 | **Description:** Checks to see if a digest algorithm is supported 85 | 86 | **Parameters:** 87 | 88 | - `digestAlgorithm`: the digest algorithm name 89 | 90 | **Returns:** 91 | 92 | a boolean indicating success (true) or failure (false) 93 | 94 | --- 95 | 96 | ### sign 97 | 98 | **Signature:** `sign(contentToSign : String, privateKey : String, digestAlgorithm : String) : String` 99 | 100 | **Description:** Signs a string and returns a string 101 | 102 | **Parameters:** 103 | 104 | - `contentToSign`: base64 encoded content to sign 105 | - `privateKey`: base64 encoded private key 106 | - `digestAlgorithm`: must be one of the currently supported ones 107 | 108 | **Returns:** 109 | 110 | the base64 encoded signature 111 | 112 | --- 113 | 114 | ### sign 115 | 116 | **Signature:** `sign(contentToSign : String, privateKey : KeyRef, digestAlgorithm : String) : String` 117 | 118 | **Description:** Signs a string and returns a string 119 | 120 | **Parameters:** 121 | 122 | - `contentToSign`: base64 encoded content to sign 123 | - `privateKey`: a reference to a private key entry in the keystore 124 | - `digestAlgorithm`: must be one of the currently supported ones 125 | 126 | **Returns:** 127 | 128 | the base64 encoded signature 129 | 130 | --- 131 | 132 | ### signBytes 133 | 134 | **Signature:** `signBytes(contentToSign : Bytes, privateKey : String, digestAlgorithm : String) : Bytes` 135 | 136 | **Description:** Signs bytes and returns bytes 137 | 138 | **Parameters:** 139 | 140 | - `contentToSign`: transformed with UTF-8 encoding into a byte stream 141 | - `privateKey`: base64 encoded private key 142 | - `digestAlgorithm`: must be one of the currently supported ones 143 | 144 | **Returns:** 145 | 146 | signature 147 | 148 | --- 149 | 150 | ### signBytes 151 | 152 | **Signature:** `signBytes(contentToSign : Bytes, privateKey : KeyRef, digestAlgorithm : String) : Bytes` 153 | 154 | **Description:** Signs bytes and returns bytes 155 | 156 | **Parameters:** 157 | 158 | - `contentToSign`: transformed with UTF-8 encoding into a byte stream 159 | - `privateKey`: a reference to a private key entry in the keystore 160 | - `digestAlgorithm`: must be one of the currently supported ones 161 | 162 | **Returns:** 163 | 164 | signature 165 | 166 | --- 167 | 168 | ### verifyBytesSignature 169 | 170 | **Signature:** `verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, publicKey : String, digestAlgorithm : String) : boolean` 171 | 172 | **Description:** Verifies a signature supplied as bytes 173 | 174 | **Parameters:** 175 | 176 | - `signature`: signature to check as bytes 177 | - `contentToVerify`: as bytes 178 | - `publicKey`: base64 encoded public key 179 | - `digestAlgorithm`: must be one of the currently supported ones 180 | 181 | **Returns:** 182 | 183 | a boolean indicating success (true) or failure (false) 184 | 185 | --- 186 | 187 | ### verifyBytesSignature 188 | 189 | **Signature:** `verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, certificate : CertificateRef, digestAlgorithm : String) : boolean` 190 | 191 | **Description:** Verifies a signature supplied as bytes 192 | 193 | **Parameters:** 194 | 195 | - `signature`: signature to check as bytes 196 | - `contentToVerify`: as bytes 197 | - `certificate`: a reference to a trusted certificate 198 | - `digestAlgorithm`: must be one of the currently supported ones 199 | 200 | **Returns:** 201 | 202 | a boolean indicating success (true) or failure (false) 203 | 204 | --- 205 | 206 | ### verifySignature 207 | 208 | **Signature:** `verifySignature(signature : String, contentToVerify : String, publicKey : String, digestAlgorithm : String) : boolean` 209 | 210 | **Description:** Verifies a signature supplied as string 211 | 212 | **Parameters:** 213 | 214 | - `signature`: base64 encoded signature 215 | - `contentToVerify`: base64 encoded content to verify 216 | - `publicKey`: base64 encoded public key 217 | - `digestAlgorithm`: must be one of the currently supported ones 218 | 219 | **Returns:** 220 | 221 | a boolean indicating success (true) or failure (false) 222 | 223 | --- 224 | 225 | ### verifySignature 226 | 227 | **Signature:** `verifySignature(signature : String, contentToVerify : String, certificate : CertificateRef, digestAlgorithm : String) : boolean` 228 | 229 | **Description:** Verifies a signature supplied as string 230 | 231 | **Parameters:** 232 | 233 | - `signature`: base64 encoded signature 234 | - `contentToVerify`: base64 encoded content to verify 235 | - `certificate`: a reference to a trusted certificate 236 | - `digestAlgorithm`: must be one of the currently supported ones 237 | 238 | **Returns:** 239 | 240 | a boolean indicating success (true) or failure (false) 241 | 242 | --- ``` -------------------------------------------------------------------------------- /docs/dw_util/Collection.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.util 2 | 3 | # Class Collection 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.util.Collection 9 | 10 | ## Description 11 | 12 | Represents a collection of objects. 13 | 14 | ## Properties 15 | 16 | ### empty 17 | 18 | **Type:** boolean (Read Only) 19 | 20 | Returns true if the collection is empty. 21 | 22 | ### length 23 | 24 | **Type:** Number (Read Only) 25 | 26 | The length of the collection. This is similar to 27 | to a ECMA array of 'products.length'. 28 | 29 | ## Constructor Summary 30 | 31 | ## Method Summary 32 | 33 | ### add 34 | 35 | **Signature:** `add(values : Object...) : boolean` 36 | 37 | Adds the specified objects to the collection. 38 | 39 | ### add1 40 | 41 | **Signature:** `add1(object : Object) : boolean` 42 | 43 | The method adds a single object to the collection. 44 | 45 | ### addAll 46 | 47 | **Signature:** `addAll(objs : Collection) : boolean` 48 | 49 | Adds the collection of objects to the collection. 50 | 51 | ### clear 52 | 53 | **Signature:** `clear() : void` 54 | 55 | Clears the collection. 56 | 57 | ### contains 58 | 59 | **Signature:** `contains(obj : Object) : boolean` 60 | 61 | Returns true if the collection contains the specified object. 62 | 63 | ### containsAll 64 | 65 | **Signature:** `containsAll(objs : Collection) : boolean` 66 | 67 | Returns true if the collection contains all of the objects in the specified collection. 68 | 69 | ### getLength 70 | 71 | **Signature:** `getLength() : Number` 72 | 73 | Returns the length of the collection. 74 | 75 | ### isEmpty 76 | 77 | **Signature:** `isEmpty() : boolean` 78 | 79 | Returns true if the collection is empty. 80 | 81 | ### iterator 82 | 83 | **Signature:** `iterator() : Iterator` 84 | 85 | Returns an iterator that can be used to access the members of the collection. 86 | 87 | ### remove 88 | 89 | **Signature:** `remove(obj : Object) : boolean` 90 | 91 | Removes the specified object from the collection. 92 | 93 | ### removeAll 94 | 95 | **Signature:** `removeAll(objs : Collection) : boolean` 96 | 97 | Removes all of object in the specified object from the collection. 98 | 99 | ### retainAll 100 | 101 | **Signature:** `retainAll(objs : Collection) : boolean` 102 | 103 | Removes all of object in the collection that are not in the specified collection. 104 | 105 | ### size 106 | 107 | **Signature:** `size() : Number` 108 | 109 | Returns the size of the collection. 110 | 111 | ### toArray 112 | 113 | **Signature:** `toArray() : Array` 114 | 115 | Returns all elements of this collection in a newly created array. 116 | 117 | ### toArray 118 | 119 | **Signature:** `toArray(start : Number, size : Number) : Array` 120 | 121 | Returns a subset of the elements of this collection in a newly created array. 122 | 123 | ## Method Detail 124 | 125 | ## Method Details 126 | 127 | ### add 128 | 129 | **Signature:** `add(values : Object...) : boolean` 130 | 131 | **Description:** Adds the specified objects to the collection. The method can also be called with an ECMA array as argument. If called with a single ECMA array as argument the individual elements of that array are added to the collection. If the array object itself should be added use the method add1(). 132 | 133 | **Parameters:** 134 | 135 | - `values`: the values to add. 136 | 137 | **Returns:** 138 | 139 | true if the values were added, false otherwise. 140 | 141 | --- 142 | 143 | ### add1 144 | 145 | **Signature:** `add1(object : Object) : boolean` 146 | 147 | **Description:** The method adds a single object to the collection. 148 | 149 | **Parameters:** 150 | 151 | - `object`: the object to add. 152 | 153 | **Returns:** 154 | 155 | true if the object was added, false otherwise. 156 | 157 | --- 158 | 159 | ### addAll 160 | 161 | **Signature:** `addAll(objs : Collection) : boolean` 162 | 163 | **Description:** Adds the collection of objects to the collection. 164 | 165 | **Parameters:** 166 | 167 | - `objs`: the objects to add. 168 | 169 | **Returns:** 170 | 171 | true if the objects were added, false otherwise. 172 | 173 | --- 174 | 175 | ### clear 176 | 177 | **Signature:** `clear() : void` 178 | 179 | **Description:** Clears the collection. 180 | 181 | --- 182 | 183 | ### contains 184 | 185 | **Signature:** `contains(obj : Object) : boolean` 186 | 187 | **Description:** Returns true if the collection contains the specified object. 188 | 189 | **Parameters:** 190 | 191 | - `obj`: the object to locate in this collection. 192 | 193 | **Returns:** 194 | 195 | true if the collection contains the specified object, false otherwise. 196 | 197 | --- 198 | 199 | ### containsAll 200 | 201 | **Signature:** `containsAll(objs : Collection) : boolean` 202 | 203 | **Description:** Returns true if the collection contains all of the objects in the specified collection. 204 | 205 | **Parameters:** 206 | 207 | - `objs`: the collection of objects to locate in this collection. 208 | 209 | **Returns:** 210 | 211 | true if the collection contains all of the specified objects, false otherwise. 212 | 213 | --- 214 | 215 | ### getLength 216 | 217 | **Signature:** `getLength() : Number` 218 | 219 | **Description:** Returns the length of the collection. This is similar to to a ECMA array of 'products.length'. 220 | 221 | **Returns:** 222 | 223 | the length of the collection. 224 | 225 | --- 226 | 227 | ### isEmpty 228 | 229 | **Signature:** `isEmpty() : boolean` 230 | 231 | **Description:** Returns true if the collection is empty. 232 | 233 | **Returns:** 234 | 235 | true if the collection is empty, false otherwise 236 | 237 | --- 238 | 239 | ### iterator 240 | 241 | **Signature:** `iterator() : Iterator` 242 | 243 | **Description:** Returns an iterator that can be used to access the members of the collection. 244 | 245 | **Returns:** 246 | 247 | an iterator that can be used to access the members of the collection. 248 | 249 | --- 250 | 251 | ### remove 252 | 253 | **Signature:** `remove(obj : Object) : boolean` 254 | 255 | **Description:** Removes the specified object from the collection. 256 | 257 | **Parameters:** 258 | 259 | - `obj`: the object to remove. 260 | 261 | **Returns:** 262 | 263 | true if the specified object was removed, false otherwise. 264 | 265 | --- 266 | 267 | ### removeAll 268 | 269 | **Signature:** `removeAll(objs : Collection) : boolean` 270 | 271 | **Description:** Removes all of object in the specified object from the collection. 272 | 273 | **Parameters:** 274 | 275 | - `objs`: the collection of objects to remove. 276 | 277 | **Returns:** 278 | 279 | true if the all of the specified objects were removed, false otherwise. 280 | 281 | --- 282 | 283 | ### retainAll 284 | 285 | **Signature:** `retainAll(objs : Collection) : boolean` 286 | 287 | **Description:** Removes all of object in the collection that are not in the specified collection. 288 | 289 | **Parameters:** 290 | 291 | - `objs`: the collection of objects to retain in the collection. 292 | 293 | **Returns:** 294 | 295 | true if the collection retains all of the specified objects, false otherwise. 296 | 297 | --- 298 | 299 | ### size 300 | 301 | **Signature:** `size() : Number` 302 | 303 | **Description:** Returns the size of the collection. 304 | 305 | **Returns:** 306 | 307 | the size of the collection. 308 | 309 | --- 310 | 311 | ### toArray 312 | 313 | **Signature:** `toArray() : Array` 314 | 315 | **Description:** Returns all elements of this collection in a newly created array. The returned array is independent of this collection and can be modified without changing the collection. The elements in the array are in the same order as they are returned when iterating over this collection. 316 | 317 | **Returns:** 318 | 319 | a newly created array. 320 | 321 | --- 322 | 323 | ### toArray 324 | 325 | **Signature:** `toArray(start : Number, size : Number) : Array` 326 | 327 | **Description:** Returns a subset of the elements of this collection in a newly created array. The returned array is independent of this collection and can be modified without changing the collection. The elements in the array are in the same order as they are returned when iterating over this collection. 328 | 329 | **Parameters:** 330 | 331 | - `start`: the number of elements to iterate before adding elements to the array. Negative values are treated as 0. 332 | - `size`: the maximum number of elements to add to the array. Nonpositive values always result in empty array. 333 | 334 | **Returns:** 335 | 336 | a newly created array. 337 | 338 | --- ``` -------------------------------------------------------------------------------- /src/clients/ocapi-client.ts: -------------------------------------------------------------------------------- ```typescript 1 | /** 2 | * OCAPI Client for Salesforce Commerce Cloud 3 | * 4 | * This module provides a unified interface for making authenticated requests to SFCC's Open Commerce API (OCAPI). 5 | * It orchestrates specialized client modules for different domain areas while maintaining backward compatibility. 6 | */ 7 | 8 | import { OCAPIConfig } from '../types/types.js'; 9 | import { OCAPISystemObjectsClient } from './ocapi/system-objects-client.js'; 10 | import { OCAPISitePreferencesClient } from './ocapi/site-preferences-client.js'; 11 | import { OCAPICodeVersionsClient } from './ocapi/code-versions-client.js'; 12 | import { OCAPIAuthClient } from './base/ocapi-auth-client.js'; 13 | import { Logger } from '../utils/logger.js'; 14 | 15 | /** 16 | * Interface for common query parameters used across multiple endpoints 17 | */ 18 | interface BaseQueryParams { 19 | start?: number; 20 | count?: number; 21 | select?: string; 22 | } 23 | 24 | /** 25 | * Interface for search request structure used in multiple search endpoints 26 | */ 27 | interface SearchRequest { 28 | query?: { 29 | text_query?: { 30 | fields: string[]; 31 | search_phrase: string; 32 | }; 33 | term_query?: { 34 | fields: string[]; 35 | operator: string; 36 | values: any[]; 37 | }; 38 | filtered_query?: { 39 | filter: any; 40 | query: any; 41 | }; 42 | bool_query?: { 43 | must?: any[]; 44 | must_not?: any[]; 45 | should?: any[]; 46 | }; 47 | match_all_query?: {}; 48 | }; 49 | sorts?: Array<{ 50 | field: string; 51 | sort_order?: 'asc' | 'desc'; 52 | }>; 53 | start?: number; 54 | count?: number; 55 | select?: string; 56 | } 57 | 58 | /** 59 | * OCAPI Client - Unified interface for SFCC OCAPI operations 60 | * 61 | * This class serves as a facade that orchestrates specialized client modules: 62 | * - SystemObjectsClient: Handles system object definitions and attributes 63 | * - SitePreferencesClient: Manages site preference operations 64 | * - CodeVersionsClient: Manages code version operations 65 | * - AuthClient: Manages OAuth authentication and token lifecycle 66 | */ 67 | export class OCAPIClient { 68 | // Specialized client modules 69 | public readonly systemObjects: OCAPISystemObjectsClient; 70 | public readonly sitePreferences: OCAPISitePreferencesClient; 71 | public readonly codeVersions: OCAPICodeVersionsClient; 72 | private readonly authClient: OCAPIAuthClient; 73 | private logger: Logger; 74 | 75 | constructor(config: OCAPIConfig) { 76 | this.logger = Logger.getChildLogger('OCAPIClient'); 77 | this.logger.debug(`Initializing OCAPI client for hostname: ${config.hostname}`); 78 | 79 | const finalConfig = { 80 | version: 'v21_3', 81 | ...config, 82 | }; 83 | 84 | // Initialize specialized clients 85 | this.systemObjects = new OCAPISystemObjectsClient(finalConfig); 86 | this.sitePreferences = new OCAPISitePreferencesClient(finalConfig); 87 | this.codeVersions = new OCAPICodeVersionsClient(finalConfig); 88 | this.authClient = new OCAPIAuthClient(finalConfig); 89 | 90 | this.logger.debug('OCAPI client initialized with specialized modules'); 91 | } 92 | 93 | // ============================================================================= 94 | // System Objects API - Delegated to SystemObjectsClient 95 | // ============================================================================= 96 | 97 | /** 98 | * Get all system object definitions 99 | */ 100 | async getSystemObjectDefinitions(params?: BaseQueryParams): Promise<any> { 101 | return this.systemObjects.getSystemObjectDefinitions(params); 102 | } 103 | 104 | /** 105 | * Get a specific system object definition by object type 106 | */ 107 | async getSystemObjectDefinition(objectType: string): Promise<any> { 108 | return this.systemObjects.getSystemObjectDefinition(objectType); 109 | } 110 | 111 | /** 112 | * Search for system object definitions using complex queries 113 | */ 114 | async searchSystemObjectDefinitions(searchRequest: SearchRequest): Promise<any> { 115 | return this.systemObjects.searchSystemObjectDefinitions(searchRequest); 116 | } 117 | 118 | /** 119 | * Search attribute definitions for a specific system object type using complex queries 120 | */ 121 | async searchSystemObjectAttributeDefinitions( 122 | objectType: string, 123 | searchRequest: SearchRequest, 124 | ): Promise<any> { 125 | return this.systemObjects.searchSystemObjectAttributeDefinitions(objectType, searchRequest); 126 | } 127 | 128 | /** 129 | * Search attribute groups for a specific system object type 130 | */ 131 | async searchSystemObjectAttributeGroups( 132 | objectType: string, 133 | searchRequest: SearchRequest, 134 | ): Promise<any> { 135 | return this.systemObjects.searchSystemObjectAttributeGroups(objectType, searchRequest); 136 | } 137 | 138 | /** 139 | * Search attribute definitions for a specific custom object type using complex queries 140 | */ 141 | async searchCustomObjectAttributeDefinitions( 142 | objectType: string, 143 | searchRequest: SearchRequest, 144 | ): Promise<any> { 145 | return this.systemObjects.searchCustomObjectAttributeDefinitions(objectType, searchRequest); 146 | } 147 | 148 | // ============================================================================= 149 | // Site Preferences API - Delegated to SitePreferencesClient 150 | // ============================================================================= 151 | 152 | /** 153 | * Search site preferences across sites in the specified preference group and instance 154 | */ 155 | async searchSitePreferences( 156 | groupId: string, 157 | instanceType: string, 158 | searchRequest: SearchRequest, 159 | options?: { 160 | maskPasswords?: boolean; 161 | expand?: string; 162 | }, 163 | ): Promise<any> { 164 | return this.sitePreferences.searchSitePreferences(groupId, instanceType, searchRequest, options); 165 | } 166 | 167 | // ============================================================================= 168 | // Code Versions API - Delegated to CodeVersionsClient 169 | // ============================================================================= 170 | 171 | /** 172 | * Get all code versions from the SFCC instance 173 | * 174 | * @returns {Promise<any>} Code version result with data array containing version information 175 | */ 176 | async getCodeVersions(): Promise<any> { 177 | return this.codeVersions.getCodeVersions(); 178 | } 179 | 180 | /** 181 | * Activate a specific code version on the SFCC instance 182 | * 183 | * @param {string} codeVersionId - The ID of the code version to activate 184 | * @param {string} codeVersionId - The ID of the code version to activate 185 | * @returns {Promise<any>} Updated code version object 186 | */ 187 | async activateCodeVersion(codeVersionId: string): Promise<any> { 188 | return this.codeVersions.activateCodeVersion(codeVersionId); 189 | } 190 | 191 | // ============================================================================= 192 | // Authentication & Token Management - Delegated to AuthClient 193 | // ============================================================================= 194 | 195 | /** 196 | * Get current token expiration for debugging 197 | */ 198 | getTokenExpiration(): Date | null { 199 | return this.authClient.getTokenExpiration(); 200 | } 201 | 202 | /** 203 | * Force refresh the token (useful for testing) 204 | */ 205 | async refreshToken(): Promise<void> { 206 | return this.authClient.refreshToken(); 207 | } 208 | } 209 | ``` -------------------------------------------------------------------------------- /tests/mcp/yaml/get-system-object-definition.docs-only.test.mcp.yml: -------------------------------------------------------------------------------- ```yaml 1 | # ================================================================================== 2 | # SFCC MCP Server - get_system_object_definition Tool YAML Tests (Docs-Only Mode) 3 | # Tests that system object tools are NOT available in docs-only mode 4 | # This tool requires SFCC credentials and should not be available without them 5 | # However, the tool can still be called and should return authentication error 6 | # 7 | # Quick Test Commands: 8 | # aegis "tests/mcp/yaml/get-system-object-definition.docs-only.test.mcp.yml" --config "aegis.config.docs-only.json" --verbose 9 | # aegis "tests/mcp/yaml/get-system-object-definition.docs-only.test.mcp.yml" --config "aegis.config.docs-only.json" --debug --timing 10 | # aegis query --config "aegis.config.docs-only.json" 11 | # aegis query get_system_object_definition '{"objectType": "Product"}' --config "aegis.config.docs-only.json" 12 | # ================================================================================== 13 | 14 | description: "get_system_object_definition tool tests - Docs-only mode tool availability and authentication errors" 15 | 16 | # ================================================================================== 17 | # TOOL UNAVAILABILITY IN DOCS-ONLY MODE 18 | # ================================================================================== 19 | tests: 20 | - it: "should NOT list get_system_object_definition tool in docs-only mode" 21 | request: 22 | jsonrpc: "2.0" 23 | id: "tool-not-available-docs" 24 | method: "tools/list" 25 | params: {} 26 | expect: 27 | response: 28 | jsonrpc: "2.0" 29 | id: "tool-not-available-docs" 30 | result: 31 | match:extractField: "tools.*.name" 32 | value: "match:not:arrayContains:get_system_object_definition" 33 | stderr: "toBeEmpty" 34 | 35 | # ================================================================================== 36 | # AUTHENTICATION ERROR TESTS (Tool Can Be Called But Returns Error) 37 | # ================================================================================== 38 | 39 | - it: "should return authentication error when calling get_system_object_definition in docs-only mode" 40 | request: 41 | jsonrpc: "2.0" 42 | id: "auth-error-product" 43 | method: "tools/call" 44 | params: 45 | name: "get_system_object_definition" 46 | arguments: 47 | objectType: "Product" 48 | expect: 49 | response: 50 | jsonrpc: "2.0" 51 | id: "auth-error-product" 52 | result: 53 | content: 54 | - type: "text" 55 | text: "match:contains:OCAPI client not configured" 56 | isError: true 57 | performance: 58 | maxResponseTime: "500ms" 59 | stderr: "toBeEmpty" 60 | 61 | - it: "should return authentication error for Customer object type" 62 | request: 63 | jsonrpc: "2.0" 64 | id: "auth-error-customer" 65 | method: "tools/call" 66 | params: 67 | name: "get_system_object_definition" 68 | arguments: 69 | objectType: "Customer" 70 | expect: 71 | response: 72 | jsonrpc: "2.0" 73 | id: "auth-error-customer" 74 | result: 75 | content: 76 | - type: "text" 77 | text: "match:contains:credentials are provided" 78 | isError: true 79 | stderr: "toBeEmpty" 80 | 81 | - it: "should return authentication error for any object type" 82 | request: 83 | jsonrpc: "2.0" 84 | id: "auth-error-any" 85 | method: "tools/call" 86 | params: 87 | name: "get_system_object_definition" 88 | arguments: 89 | objectType: "AnyObjectType" 90 | expect: 91 | response: 92 | jsonrpc: "2.0" 93 | id: "auth-error-any" 94 | result: 95 | content: 96 | - type: "text" 97 | text: "match:contains:full mode" 98 | isError: true 99 | stderr: "toBeEmpty" 100 | 101 | - it: "should return consistent authentication error message structure" 102 | request: 103 | jsonrpc: "2.0" 104 | id: "auth-error-structure" 105 | method: "tools/call" 106 | params: 107 | name: "get_system_object_definition" 108 | arguments: 109 | objectType: "Order" 110 | expect: 111 | response: 112 | jsonrpc: "2.0" 113 | id: "auth-error-structure" 114 | result: 115 | content: 116 | - type: "text" 117 | text: "match:startsWith:Error:" 118 | isError: true 119 | stderr: "toBeEmpty" 120 | 121 | # ================================================================================== 122 | # PARAMETER VALIDATION IN DOCS-ONLY MODE 123 | # ================================================================================== 124 | 125 | - it: "should return authentication error even with missing objectType in docs-only mode" 126 | request: 127 | jsonrpc: "2.0" 128 | id: "docs-missing-param" 129 | method: "tools/call" 130 | params: 131 | name: "get_system_object_definition" 132 | arguments: {} 133 | expect: 134 | response: 135 | jsonrpc: "2.0" 136 | id: "docs-missing-param" 137 | result: 138 | content: 139 | - type: "text" 140 | text: "match:contains:OCAPI client not configured" 141 | isError: true 142 | stderr: "toBeEmpty" 143 | 144 | - it: "should return authentication error even with invalid parameter types in docs-only mode" 145 | request: 146 | jsonrpc: "2.0" 147 | id: "docs-invalid-type" 148 | method: "tools/call" 149 | params: 150 | name: "get_system_object_definition" 151 | arguments: 152 | objectType: 123 153 | expect: 154 | response: 155 | jsonrpc: "2.0" 156 | id: "docs-invalid-type" 157 | result: 158 | content: 159 | - type: "text" 160 | text: "match:contains:OCAPI client not configured" 161 | isError: true 162 | stderr: "toBeEmpty" 163 | 164 | - it: "should return auth error for valid parameters in docs-only mode" 165 | request: 166 | jsonrpc: "2.0" 167 | id: "docs-valid-param-auth-error" 168 | method: "tools/call" 169 | params: 170 | name: "get_system_object_definition" 171 | arguments: 172 | objectType: "ValidObjectType" 173 | expect: 174 | response: 175 | jsonrpc: "2.0" 176 | id: "docs-valid-param-auth-error" 177 | result: 178 | content: 179 | - type: "text" 180 | text: "match:regex:Error:[\\s\\S]*OCAPI[\\s\\S]*configured" 181 | isError: true 182 | stderr: "toBeEmpty" 183 | 184 | # ================================================================================== 185 | # PERFORMANCE TESTS FOR ERROR RESPONSES 186 | # ================================================================================== 187 | 188 | - it: "should return authentication errors quickly" 189 | request: 190 | jsonrpc: "2.0" 191 | id: "auth-error-perf" 192 | method: "tools/call" 193 | params: 194 | name: "get_system_object_definition" 195 | arguments: 196 | objectType: "FastErrorTest" 197 | expect: 198 | response: 199 | jsonrpc: "2.0" 200 | id: "auth-error-perf" 201 | result: 202 | content: 203 | - type: "text" 204 | text: "match:contains:Error" 205 | isError: true 206 | performance: 207 | maxResponseTime: "400ms" 208 | stderr: "toBeEmpty" ``` -------------------------------------------------------------------------------- /docs/dw_value/Quantity.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.value 2 | 3 | # Class Quantity 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.value.Quantity 9 | 10 | ## Description 11 | 12 | Represents the quantity of an item. 13 | 14 | ## Properties 15 | 16 | ### available 17 | 18 | **Type:** boolean (Read Only) 19 | 20 | Identifies if the instance contains settings for value and unit. 21 | 22 | ### decimalValue 23 | 24 | **Type:** Decimal (Read Only) 25 | 26 | The quantity as Decimal, null is returned when the quantity is not available. 27 | 28 | ### unit 29 | 30 | **Type:** String (Read Only) 31 | 32 | The value for unit which identifies the 33 | unit of measure for the quantity. Examples of unit 34 | are 'inches' or 'pounds'. 35 | 36 | ### value 37 | 38 | **Type:** Number (Read Only) 39 | 40 | The quantity value. 41 | 42 | ## Constructor Summary 43 | 44 | Quantity(value : Number, unit : String) Creates a new quantity instance with the specified value and unit. 45 | 46 | ## Method Summary 47 | 48 | ### add 49 | 50 | **Signature:** `add(value : Quantity) : Quantity` 51 | 52 | Add Quantity object to the current object. 53 | 54 | ### compareTo 55 | 56 | **Signature:** `compareTo(other : Quantity) : Number` 57 | 58 | Compares two Quantity values. 59 | 60 | ### divide 61 | 62 | **Signature:** `divide(divisor : Number) : Quantity` 63 | 64 | Divide Quantity object by specified divisor. 65 | 66 | ### equals 67 | 68 | **Signature:** `equals(other : Object) : boolean` 69 | 70 | Compares two decimal values whether they are equivalent. 71 | 72 | ### getDecimalValue 73 | 74 | **Signature:** `getDecimalValue() : Decimal` 75 | 76 | Returns the quantity as Decimal, null is returned when the quantity is not available. 77 | 78 | ### getUnit 79 | 80 | **Signature:** `getUnit() : String` 81 | 82 | Returns the value for unit which identifies the unit of measure for the quantity. 83 | 84 | ### getValue 85 | 86 | **Signature:** `getValue() : Number` 87 | 88 | Returns the quantity value. 89 | 90 | ### hashCode 91 | 92 | **Signature:** `hashCode() : Number` 93 | 94 | Calculates the hash code for a decimal. 95 | 96 | ### isAvailable 97 | 98 | **Signature:** `isAvailable() : boolean` 99 | 100 | Identifies if the instance contains settings for value and unit. 101 | 102 | ### isOfSameUnit 103 | 104 | **Signature:** `isOfSameUnit(value : Quantity) : boolean` 105 | 106 | Identifies if two Quantities have the same unit. 107 | 108 | ### multiply 109 | 110 | **Signature:** `multiply(factor : Number) : Quantity` 111 | 112 | Multiply Quantity object by specified factor. 113 | 114 | ### newQuantity 115 | 116 | **Signature:** `newQuantity(value : Decimal) : Quantity` 117 | 118 | Method returns a new instance of Quantity with the same unit but different value. 119 | 120 | ### round 121 | 122 | **Signature:** `round(precision : Number) : Quantity` 123 | 124 | Rounds the Quantity value to the number of specified decimal digits. 125 | 126 | ### subtract 127 | 128 | **Signature:** `subtract(value : Quantity) : Quantity` 129 | 130 | Subtract Quantity object from the current object. 131 | 132 | ### toString 133 | 134 | **Signature:** `toString() : String` 135 | 136 | Returns a string representation of this quantity object. 137 | 138 | ### valueOf 139 | 140 | **Signature:** `valueOf() : Object` 141 | 142 | According to the ECMA spec returns the "natural" primitive value. 143 | 144 | ## Constructor Detail 145 | 146 | ## Method Detail 147 | 148 | ## Method Details 149 | 150 | ### add 151 | 152 | **Signature:** `add(value : Quantity) : Quantity` 153 | 154 | **Description:** Add Quantity object to the current object. Only objects representing the same unit can be added. 155 | 156 | **Parameters:** 157 | 158 | - `value`: Quantity object 159 | 160 | **Returns:** 161 | 162 | Quantity object representing the sum of the operands 163 | 164 | --- 165 | 166 | ### compareTo 167 | 168 | **Signature:** `compareTo(other : Quantity) : Number` 169 | 170 | **Description:** Compares two Quantity values. An exception is thrown if the two Quantities values are of different unit. If one of the Quantity values represents the N/A value it is treated as 0.0. 171 | 172 | **Parameters:** 173 | 174 | - `other`: the other quantity to compare. 175 | 176 | **Returns:** 177 | 178 | the comparison. 179 | 180 | --- 181 | 182 | ### divide 183 | 184 | **Signature:** `divide(divisor : Number) : Quantity` 185 | 186 | **Description:** Divide Quantity object by specified divisor. 187 | 188 | **Parameters:** 189 | 190 | - `divisor`: divisor 191 | 192 | **Returns:** 193 | 194 | Quantity object representing division result 195 | 196 | --- 197 | 198 | ### equals 199 | 200 | **Signature:** `equals(other : Object) : boolean` 201 | 202 | **Description:** Compares two decimal values whether they are equivalent. 203 | 204 | **Parameters:** 205 | 206 | - `other`: the object to compare against this quantity instance. 207 | 208 | **Returns:** 209 | 210 | true if equal, false otherwise. 211 | 212 | --- 213 | 214 | ### getDecimalValue 215 | 216 | **Signature:** `getDecimalValue() : Decimal` 217 | 218 | **Description:** Returns the quantity as Decimal, null is returned when the quantity is not available. 219 | 220 | **Returns:** 221 | 222 | the quantity as Decimal 223 | 224 | --- 225 | 226 | ### getUnit 227 | 228 | **Signature:** `getUnit() : String` 229 | 230 | **Description:** Returns the value for unit which identifies the unit of measure for the quantity. Examples of unit are 'inches' or 'pounds'. 231 | 232 | **Returns:** 233 | 234 | the unit value. 235 | 236 | --- 237 | 238 | ### getValue 239 | 240 | **Signature:** `getValue() : Number` 241 | 242 | **Description:** Returns the quantity value. 243 | 244 | **Returns:** 245 | 246 | the quantity value. 247 | 248 | **See Also:** 249 | 250 | getDecimalValue() 251 | 252 | --- 253 | 254 | ### hashCode 255 | 256 | **Signature:** `hashCode() : Number` 257 | 258 | **Description:** Calculates the hash code for a decimal. 259 | 260 | **Returns:** 261 | 262 | the hash code. 263 | 264 | --- 265 | 266 | ### isAvailable 267 | 268 | **Signature:** `isAvailable() : boolean` 269 | 270 | **Description:** Identifies if the instance contains settings for value and unit. 271 | 272 | **Returns:** 273 | 274 | true if the instance is initialized with value and unit, false if the state is 'not available'. 275 | 276 | --- 277 | 278 | ### isOfSameUnit 279 | 280 | **Signature:** `isOfSameUnit(value : Quantity) : boolean` 281 | 282 | **Description:** Identifies if two Quantities have the same unit. 283 | 284 | **Parameters:** 285 | 286 | - `value`: the second quantity for the comparison. 287 | 288 | **Returns:** 289 | 290 | true if both quantities have the same unit, false otherwise. 291 | 292 | --- 293 | 294 | ### multiply 295 | 296 | **Signature:** `multiply(factor : Number) : Quantity` 297 | 298 | **Description:** Multiply Quantity object by specified factor. 299 | 300 | **Parameters:** 301 | 302 | - `factor`: multiplication factor 303 | 304 | **Returns:** 305 | 306 | Quantity object representing multiplication result 307 | 308 | --- 309 | 310 | ### newQuantity 311 | 312 | **Signature:** `newQuantity(value : Decimal) : Quantity` 313 | 314 | **Description:** Method returns a new instance of Quantity with the same unit but different value. An N/A instance is returned if value is null. 315 | 316 | **Parameters:** 317 | 318 | - `value`: as a decimal 319 | 320 | **Returns:** 321 | 322 | new Quantity instance with same unit 323 | 324 | --- 325 | 326 | ### round 327 | 328 | **Signature:** `round(precision : Number) : Quantity` 329 | 330 | **Description:** Rounds the Quantity value to the number of specified decimal digits. 331 | 332 | **Parameters:** 333 | 334 | - `precision`: number of decimal digits after the decimal point 335 | 336 | **Returns:** 337 | 338 | the new rounded Quantity value 339 | 340 | --- 341 | 342 | ### subtract 343 | 344 | **Signature:** `subtract(value : Quantity) : Quantity` 345 | 346 | **Description:** Subtract Quantity object from the current object. Only objects representing the same unit can be subtracted. 347 | 348 | **Parameters:** 349 | 350 | - `value`: Quantity object to subtract 351 | 352 | **Returns:** 353 | 354 | Quantity object representing the result of subtraction 355 | 356 | --- 357 | 358 | ### toString 359 | 360 | **Signature:** `toString() : String` 361 | 362 | **Description:** Returns a string representation of this quantity object. 363 | 364 | **Returns:** 365 | 366 | a string representation of this quantity object. 367 | 368 | --- 369 | 370 | ### valueOf 371 | 372 | **Signature:** `valueOf() : Object` 373 | 374 | **Description:** According to the ECMA spec returns the "natural" primitive value. Here the value portion of the Quantity is returned. 375 | 376 | --- ``` -------------------------------------------------------------------------------- /docs/sfra/product-full.md: -------------------------------------------------------------------------------- ```markdown 1 | # SFRA Full Product Model 2 | 3 | ## Overview 4 | 5 | The Full Product model represents a complete product with all detailed information, typically used on product detail pages (PDP). It provides comprehensive product data including pricing, images, variations, descriptions, ratings, promotions, and availability. 6 | 7 | ## Module Function 8 | 9 | ```javascript 10 | module.exports = function fullProduct(product, apiProduct, options) 11 | ``` 12 | 13 | Decorates a product object with comprehensive product information using multiple decorators. 14 | 15 | ### Parameters 16 | 17 | - `product` (Object) - Product Model to be decorated 18 | - `apiProduct` (dw.catalog.Product) - Product information returned by the script API 19 | - `options` (Object) - Options object containing: 20 | - `variationModel` (dw.catalog.ProductVariationModel) - Variation model returned by the API 21 | - `options` (Object) - Options provided on the query string 22 | - `optionModel` (dw.catalog.ProductOptionModel) - Options model returned by the API 23 | - `promotions` (dw.util.Collection) - Active promotions for the product 24 | - `quantity` (number) - Current selected quantity 25 | - `variables` (Object) - Variables passed in on the query string 26 | 27 | ### Returns 28 | 29 | Object - Decorated product model with comprehensive product information 30 | 31 | ## Applied Decorators 32 | 33 | The full product model applies the following decorators: 34 | 35 | ### base 36 | Adds fundamental product information including uuid, id, productName, productType, and brand. 37 | 38 | ### price 39 | Adds comprehensive pricing information including promotional prices, with option model integration. Sets `price` and `renderedPrice` properties. 40 | 41 | ### images 42 | Adds product images with full configuration: 43 | - **Types:** ['large', 'small'] - Multiple image sizes for different display contexts 44 | - **Quantity:** 'all' - All available images 45 | 46 | ### quantity 47 | Adds quantity information and constraints: `selectedQuantity`, `minOrderQuantity`, and `maxOrderQuantity`. 48 | 49 | ### variationAttributes 50 | Adds variation attribute information with full configuration: 51 | - **Attributes:** '*' - All variation attributes 52 | - **EndPoint:** 'Variation' - Endpoint for variation handling 53 | 54 | ### description 55 | Adds product description: `longDescription` and `shortDescription` markup properties. 56 | 57 | ### ratings 58 | Adds product rating information: `rating` value calculated from product ID. 59 | 60 | ### promotions 61 | Adds active promotion information: `promotions` array with promotion details. 62 | 63 | ### attributes 64 | Adds product attributes from the attribute model: `attributes` array with grouped attribute data. 65 | 66 | ### availability 67 | Adds availability information: `availability` object with messages and stock status based on quantity and availability model. 68 | 69 | ### options 70 | Adds product option information: `options` array including option model, variables, and quantity. 71 | 72 | ### quantitySelector 73 | Adds quantity selector information: `quantities` array with step quantity and URL options. 74 | 75 | ### sizeChart (conditional) 76 | Adds size chart information: `sizeChartId` property if the product's category has a custom sizeChartID attribute. 77 | 78 | ### currentUrl 79 | Adds current product URL: `selectedProductUrl` property with variation and option parameters. 80 | 81 | ### readyToOrder 82 | Adds order readiness status: `readyToOrder` boolean indicating if product can be ordered. 83 | 84 | ### online 85 | Adds online status: `online` boolean indicating if product is available online. 86 | 87 | ### raw 88 | Adds raw API product: `raw` property (non-enumerable) containing the original dw.catalog.Product object. 89 | 90 | ### pageMetaData 91 | Adds SEO metadata: `pageTitle`, `pageDescription`, `pageKeywords`, and `pageMetaTags` properties. 92 | 93 | ### template 94 | Adds template information: `template` property for rendering purposes. 95 | 96 | ## Usage Example 97 | 98 | ```javascript 99 | var fullProductDecorator = require('*/cartridge/models/product/fullProduct'); 100 | var productFactory = require('*/cartridge/scripts/factories/product'); 101 | 102 | // Prepare options 103 | var options = { 104 | variationModel: variationModel, 105 | optionModel: optionModel, 106 | promotions: activePromotions, 107 | quantity: 1, 108 | variables: req.querystring, 109 | options: req.httpParameterMap 110 | }; 111 | 112 | // Create and decorate product 113 | var product = {}; 114 | var fullProduct = fullProductDecorator(product, apiProduct, options); 115 | 116 | // Access comprehensive product information 117 | console.log(fullProduct.price.sales); 118 | console.log(fullProduct.images.large); 119 | console.log(fullProduct.availability.messages); 120 | console.log(fullProduct.variationAttributes); 121 | ``` 122 | 123 | ## Typical Properties After Decoration 124 | 125 | After applying all decorators, the full product object contains: 126 | 127 | - **uuid** - Product UUID 128 | - **id** - Product ID 129 | - **productName** - Product name and display information 130 | - **productType** - Product type 131 | - **brand** - Product brand 132 | - **price** - Comprehensive pricing with promotions 133 | - **renderedPrice** - HTML-rendered price for display 134 | - **images** - Large and small product images 135 | - **selectedQuantity** - Currently selected quantity 136 | - **minOrderQuantity** - Minimum order quantity 137 | - **maxOrderQuantity** - Maximum order quantity 138 | - **variationAttributes** - Complete variation attribute data 139 | - **longDescription** - Product long description markup 140 | - **shortDescription** - Product short description markup 141 | - **rating** - Product rating value 142 | - **promotions** - Active promotion information 143 | - **attributes** - Product attribute groups and values 144 | - **availability** - Availability status and messages 145 | - **options** - Product option configurations 146 | - **quantities** - Available quantity selection options 147 | - **sizeChartId** - Size chart identifier (if applicable) 148 | - **selectedProductUrl** - Current product URL with selected variations and options 149 | - **readyToOrder** - Boolean indicating if product can be ordered 150 | - **online** - Boolean indicating if product is available online 151 | - **pageTitle** - SEO page title 152 | - **pageDescription** - SEO page description 153 | - **pageKeywords** - SEO page keywords 154 | - **pageMetaTags** - SEO meta tags array 155 | - **template** - Template identifier for rendering 156 | 157 | ## Size Chart Handling 158 | 159 | The model automatically checks for size chart information: 160 | 1. Gets the product's primary category 161 | 2. For variants/variation groups, uses the master product's primary category 162 | 3. If the category has a custom `sizeChartID` attribute, applies the sizeChart decorator 163 | 164 | ## Notes 165 | 166 | - Provides the most comprehensive product information available 167 | - Optimized for product detail pages with full functionality 168 | - Handles all product types including variants, masters, and sets 169 | - Includes promotional pricing and availability calculations 170 | - Supports product options and variations 171 | - Automatically handles size chart integration 172 | - Performance-optimized for single product display 173 | 174 | ## Related Models 175 | 176 | - **Product Tile Model** - Simplified version for listings 177 | - **Product Bundle Model** - For bundled products 178 | - **Product Set Model** - For product sets 179 | - **Product Decorators** - Individual decoration functions 180 | ``` -------------------------------------------------------------------------------- /docs/dw_util/BigInteger.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.util 2 | 3 | # Class BigInteger 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.util.BigInteger 9 | 10 | ## Description 11 | 12 | The BigInteger class is a helper class to represent an arbitrary long integer number. The Demandware framework doesn't use this class, but in some special cases web services that declare an XML element with "xsd:integer", which is by definition an arbitrary long integer number, require the use of this class. The class is designed in a way that it can be used very similar to a desktop calculator. For example: var i = new BigInteger( 10 ); var result = d.add( 2 ).sub( 3 ).get(); The above code will return 9 as result. 13 | 14 | ## Constructor Summary 15 | 16 | BigInteger() Constructs a new BigInteger with the value 0. 17 | 18 | BigInteger(value : Number) Constructs a new BigInteger using the specified Number value. 19 | 20 | BigInteger(value : String) Constructs a new BigInteger using the specified string representation of a number. 21 | 22 | ## Method Summary 23 | 24 | ### abs 25 | 26 | **Signature:** `abs() : BigInteger` 27 | 28 | Returns a new BigInteger with the absolute value of this BigInteger. 29 | 30 | ### add 31 | 32 | **Signature:** `add(value : Number) : BigInteger` 33 | 34 | Adds a Number value to this BigInteger and returns the new BigInteger. 35 | 36 | ### add 37 | 38 | **Signature:** `add(value : BigInteger) : BigInteger` 39 | 40 | Adds an BigInteger value to this BigInteger and returns the new BigInteger. 41 | 42 | ### divide 43 | 44 | **Signature:** `divide(value : Number) : BigInteger` 45 | 46 | Divides this BigInteger by the specified BigInteger and returns the new BigInteger. 47 | 48 | ### divide 49 | 50 | **Signature:** `divide(value : BigInteger) : BigInteger` 51 | 52 | Divides this BigInteger by the specified BigInteger and returns the new BigInteger. 53 | 54 | ### equals 55 | 56 | **Signature:** `equals(other : Object) : boolean` 57 | 58 | Compares two BigInteger values whether they are equivalent. 59 | 60 | ### get 61 | 62 | **Signature:** `get() : Number` 63 | 64 | Returns the value of the BigInteger as a Number. 65 | 66 | ### hashCode 67 | 68 | **Signature:** `hashCode() : Number` 69 | 70 | Calculates the hash code for this BigInteger; 71 | 72 | ### multiply 73 | 74 | **Signature:** `multiply(value : Number) : BigInteger` 75 | 76 | Multiples the specified Number value with this BigInteger and returns the new BigInteger. 77 | 78 | ### multiply 79 | 80 | **Signature:** `multiply(value : BigInteger) : BigInteger` 81 | 82 | Multiples the specified BigInteger value with this BigInteger and returns the new BigInteger. 83 | 84 | ### negate 85 | 86 | **Signature:** `negate() : BigInteger` 87 | 88 | Returns a new BigInteger with the negated value of this BigInteger. 89 | 90 | ### subtract 91 | 92 | **Signature:** `subtract(value : Number) : BigInteger` 93 | 94 | Subtracts the specified Number value from this BigInteger and returns the new BigInteger. 95 | 96 | ### subtract 97 | 98 | **Signature:** `subtract(value : BigInteger) : BigInteger` 99 | 100 | Subtracts the specified BigInteger value from this BigInteger and returns the new BigInteger. 101 | 102 | ### toString 103 | 104 | **Signature:** `toString() : String` 105 | 106 | Returns a string representation of this object. 107 | 108 | ### valueOf 109 | 110 | **Signature:** `valueOf() : Object` 111 | 112 | The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object. 113 | 114 | ## Constructor Detail 115 | 116 | ## Method Detail 117 | 118 | ## Method Details 119 | 120 | ### abs 121 | 122 | **Signature:** `abs() : BigInteger` 123 | 124 | **Description:** Returns a new BigInteger with the absolute value of this BigInteger. 125 | 126 | **Returns:** 127 | 128 | the new BigInteger 129 | 130 | --- 131 | 132 | ### add 133 | 134 | **Signature:** `add(value : Number) : BigInteger` 135 | 136 | **Description:** Adds a Number value to this BigInteger and returns the new BigInteger. 137 | 138 | **Parameters:** 139 | 140 | - `value`: the value to add to this BigInteger. 141 | 142 | **Returns:** 143 | 144 | the new BigInteger with the value added. 145 | 146 | --- 147 | 148 | ### add 149 | 150 | **Signature:** `add(value : BigInteger) : BigInteger` 151 | 152 | **Description:** Adds an BigInteger value to this BigInteger and returns the new BigInteger. 153 | 154 | **Parameters:** 155 | 156 | - `value`: the value to add to this BigInteger. 157 | 158 | **Returns:** 159 | 160 | the new BigInteger with the value added. 161 | 162 | --- 163 | 164 | ### divide 165 | 166 | **Signature:** `divide(value : Number) : BigInteger` 167 | 168 | **Description:** Divides this BigInteger by the specified BigInteger and returns the new BigInteger. 169 | 170 | **Parameters:** 171 | 172 | - `value`: the value to use to divide this BigInteger. 173 | 174 | **Returns:** 175 | 176 | the new BigInteger. 177 | 178 | --- 179 | 180 | ### divide 181 | 182 | **Signature:** `divide(value : BigInteger) : BigInteger` 183 | 184 | **Description:** Divides this BigInteger by the specified BigInteger and returns the new BigInteger. 185 | 186 | **Parameters:** 187 | 188 | - `value`: the value to use to divide this BigInteger. 189 | 190 | **Returns:** 191 | 192 | the new BigInteger. 193 | 194 | --- 195 | 196 | ### equals 197 | 198 | **Signature:** `equals(other : Object) : boolean` 199 | 200 | **Description:** Compares two BigInteger values whether they are equivalent. 201 | 202 | **Parameters:** 203 | 204 | - `other`: the object to compare against this BigInteger. 205 | 206 | --- 207 | 208 | ### get 209 | 210 | **Signature:** `get() : Number` 211 | 212 | **Description:** Returns the value of the BigInteger as a Number. 213 | 214 | **Returns:** 215 | 216 | the value of the BigInteger. 217 | 218 | --- 219 | 220 | ### hashCode 221 | 222 | **Signature:** `hashCode() : Number` 223 | 224 | **Description:** Calculates the hash code for this BigInteger; 225 | 226 | --- 227 | 228 | ### multiply 229 | 230 | **Signature:** `multiply(value : Number) : BigInteger` 231 | 232 | **Description:** Multiples the specified Number value with this BigInteger and returns the new BigInteger. 233 | 234 | **Parameters:** 235 | 236 | - `value`: the value to multiply with this BigInteger. 237 | 238 | **Returns:** 239 | 240 | the new BigInteger. 241 | 242 | --- 243 | 244 | ### multiply 245 | 246 | **Signature:** `multiply(value : BigInteger) : BigInteger` 247 | 248 | **Description:** Multiples the specified BigInteger value with this BigInteger and returns the new BigInteger. 249 | 250 | **Parameters:** 251 | 252 | - `value`: the value to multiply with this BigInteger. 253 | 254 | **Returns:** 255 | 256 | the new BigInteger. 257 | 258 | --- 259 | 260 | ### negate 261 | 262 | **Signature:** `negate() : BigInteger` 263 | 264 | **Description:** Returns a new BigInteger with the negated value of this BigInteger. 265 | 266 | **Returns:** 267 | 268 | the new BigInteger 269 | 270 | --- 271 | 272 | ### subtract 273 | 274 | **Signature:** `subtract(value : Number) : BigInteger` 275 | 276 | **Description:** Subtracts the specified Number value from this BigInteger and returns the new BigInteger. 277 | 278 | **Parameters:** 279 | 280 | - `value`: the value to add to this BigInteger. 281 | 282 | **Returns:** 283 | 284 | the new BigInteger with the value subtracted. 285 | 286 | --- 287 | 288 | ### subtract 289 | 290 | **Signature:** `subtract(value : BigInteger) : BigInteger` 291 | 292 | **Description:** Subtracts the specified BigInteger value from this BigInteger and returns the new BigInteger. 293 | 294 | **Parameters:** 295 | 296 | - `value`: the value to add to this BigInteger. 297 | 298 | **Returns:** 299 | 300 | the new BigInteger with the value subtracted. 301 | 302 | --- 303 | 304 | ### toString 305 | 306 | **Signature:** `toString() : String` 307 | 308 | **Description:** Returns a string representation of this object. 309 | 310 | **Returns:** 311 | 312 | a string representation of this object. 313 | 314 | --- 315 | 316 | ### valueOf 317 | 318 | **Signature:** `valueOf() : Object` 319 | 320 | **Description:** The valueOf() method is called by the ECMAScript interpret to return the "natural" value of an object. The BigInteger object returns its current value as number. With this behavior script snippets can be written like: var i = new BigInteger( 10 ); var x = 1 + d.add( 2 ); where x will be at the end 13. 321 | 322 | **Returns:** 323 | 324 | the value of this object. 325 | 326 | --- ```