This is page 39 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/TopLevel/Array.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: TopLevel 2 | 3 | # Class Array 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - Array 9 | 10 | ## Description 11 | 12 | An Array of items. 13 | 14 | ## Properties 15 | 16 | ### length 17 | 18 | **Type:** Number 19 | 20 | The length of the Array. 21 | 22 | ## Constructor Summary 23 | 24 | Array() Constructs an Array. 25 | 26 | Array(length : Number) Constructs an Array of the specified length. 27 | 28 | Array(values : Object...) Constructs an Array using the specified values. 29 | 30 | ## Method Summary 31 | 32 | ### concat 33 | 34 | **Signature:** `concat(values : Object...) : Array` 35 | 36 | Constructs an Array by concatenating multiple values. 37 | 38 | ### copyWithin 39 | 40 | **Signature:** `copyWithin(target : Number, start : Number, end : Number) : Array` 41 | 42 | Copies elements within this array. 43 | 44 | ### entries 45 | 46 | **Signature:** `entries() : ES6Iterator` 47 | 48 | Returns an iterator containing all index/value pairs of this array. 49 | 50 | ### every 51 | 52 | **Signature:** `every(callback : Function) : boolean` 53 | 54 | Returns true if every element in this array satisfies the test performed in the callback function. 55 | 56 | ### every 57 | 58 | **Signature:** `every(callback : Function, thisObject : Object) : boolean` 59 | 60 | Returns true if every element in the thisObject argument satisfies the test performed in the callback function, false otherwise. 61 | 62 | ### fill 63 | 64 | **Signature:** `fill(value : Object, start : Number, end : Number) : Array` 65 | 66 | Sets multiple entries of this array to specific value. 67 | 68 | ### filter 69 | 70 | **Signature:** `filter(callback : Function) : Array` 71 | 72 | Returns a new Array with all of the elements that pass the test implemented by the callback function. 73 | 74 | ### filter 75 | 76 | **Signature:** `filter(callback : Function, thisObject : Object) : Array` 77 | 78 | Returns a new Array with all of the elements that pass the test implemented by the callback function that is run against the specified Array, thisObject. 79 | 80 | ### find 81 | 82 | **Signature:** `find(callback : Function, thisObject : Object) : Object` 83 | 84 | Returns the first value within the array that satisfies the test defined in the callback function. 85 | 86 | ### findIndex 87 | 88 | **Signature:** `findIndex(callback : Function, thisObject : Object) : Number` 89 | 90 | Returns the index of the first value within the array that satisfies the test defined in the callback function. 91 | 92 | ### forEach 93 | 94 | **Signature:** `forEach(callback : Function) : void` 95 | 96 | Runs the provided callback function once for each element present in the Array. 97 | 98 | ### forEach 99 | 100 | **Signature:** `forEach(callback : Function, thisObject : Object) : void` 101 | 102 | Runs the provided callback function once for each element present in the specified Array, thisObject. 103 | 104 | ### from 105 | 106 | **Signature:** `static from(arrayLike : Object, mapFn : Function, thisObject : Object) : Array` 107 | 108 | Creates a new array from an array-like object or an Iterable. 109 | 110 | ### includes 111 | 112 | **Signature:** `includes(valueToFind : Object, fromIndex : Number) : boolean` 113 | 114 | Returns if the array contains a specific value. 115 | 116 | ### indexOf 117 | 118 | **Signature:** `indexOf(elementToLocate : Object) : Number` 119 | 120 | Returns the first index at which a given element can be found in the array, or -1 if it is not present. 121 | 122 | ### indexOf 123 | 124 | **Signature:** `indexOf(elementToLocate : Object, fromIndex : Number) : Number` 125 | 126 | Returns the first index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present. 127 | 128 | ### isArray 129 | 130 | **Signature:** `static isArray(object : Object) : boolean` 131 | 132 | Checks if the passed object is an array. 133 | 134 | ### join 135 | 136 | **Signature:** `join() : String` 137 | 138 | Converts all Array elements to Strings and concatenates them. 139 | 140 | ### join 141 | 142 | **Signature:** `join(separator : String) : String` 143 | 144 | Converts all array elements to Strings and concatenates them. 145 | 146 | ### keys 147 | 148 | **Signature:** `keys() : ES6Iterator` 149 | 150 | Returns an iterator containing all indexes of this array. 151 | 152 | ### lastIndexOf 153 | 154 | **Signature:** `lastIndexOf(elementToLocate : Object) : Number` 155 | 156 | Returns the last index at which a given element can be found in the array, or -1 if it is not present. 157 | 158 | ### lastIndexOf 159 | 160 | **Signature:** `lastIndexOf(elementToLocate : Object, fromIndex : Number) : Number` 161 | 162 | Returns the last index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present. 163 | 164 | ### map 165 | 166 | **Signature:** `map(callback : Function) : Array` 167 | 168 | Creates a new Array with the results of calling the specified function on every element in this Array. 169 | 170 | ### map 171 | 172 | **Signature:** `map(callback : Function, thisObject : Object) : Array` 173 | 174 | Creates a new Array with the results of calling the specified function on every element in the specified Array. 175 | 176 | ### of 177 | 178 | **Signature:** `static of(values : Object...) : Array` 179 | 180 | Creates a new array from a variable list of elements. 181 | 182 | ### pop 183 | 184 | **Signature:** `pop() : Object` 185 | 186 | Removes and returns the last element of the Array. 187 | 188 | ### push 189 | 190 | **Signature:** `push(values : Object...) : Number` 191 | 192 | Appends elements to the Array. 193 | 194 | ### reverse 195 | 196 | **Signature:** `reverse() : void` 197 | 198 | Reverses the order of the elements in the Array. 199 | 200 | ### shift 201 | 202 | **Signature:** `shift() : Object` 203 | 204 | Shifts elements down in the Array and returns the former first element. 205 | 206 | ### slice 207 | 208 | **Signature:** `slice(start : Number, end : Number) : Array` 209 | 210 | Returns a new Array containing a portion of the Array using the specified start and end positions. 211 | 212 | ### some 213 | 214 | **Signature:** `some(callback : Function) : boolean` 215 | 216 | Returns true if any of the elements in the Array pass the test defined in the callback function, false otherwise. 217 | 218 | ### some 219 | 220 | **Signature:** `some(callback : Function, thisObject : Object) : boolean` 221 | 222 | Returns true if any of the elements in the specified Array pass the test defined in the callback function, false otherwise. 223 | 224 | ### sort 225 | 226 | **Signature:** `sort() : Array` 227 | 228 | Sorts the elements of the Array in alphabetical order based on character encoding. 229 | 230 | ### sort 231 | 232 | **Signature:** `sort(function : Function) : Array` 233 | 234 | Sorts the elements of the Array in alphabetical order based on character encoding. 235 | 236 | ### splice 237 | 238 | **Signature:** `splice(start : Number, deleteCount : Number, values : Object...) : Array` 239 | 240 | Deletes the specified number of elements from the Array at the specified position, and then inserts values into the Array at that location. 241 | 242 | ### toLocaleString 243 | 244 | **Signature:** `toLocaleString() : String` 245 | 246 | Converts the Array to a localized String. 247 | 248 | ### toString 249 | 250 | **Signature:** `toString() : String` 251 | 252 | Converts the Array to a String. 253 | 254 | ### unshift 255 | 256 | **Signature:** `unshift(values : Object...) : Number` 257 | 258 | Inserts elements at the beginning of the Array. 259 | 260 | ### values 261 | 262 | **Signature:** `values() : ES6Iterator` 263 | 264 | Returns an iterator containing all values of this array. 265 | 266 | ## Constructor Detail 267 | 268 | ## Method Detail 269 | 270 | ## Method Details 271 | 272 | ### concat 273 | 274 | **Signature:** `concat(values : Object...) : Array` 275 | 276 | **Description:** Constructs an Array by concatenating multiple values. 277 | 278 | **Parameters:** 279 | 280 | - `values`: one or more Array values. 281 | 282 | **Returns:** 283 | 284 | a new Array containing the concatenated values. 285 | 286 | --- 287 | 288 | ### copyWithin 289 | 290 | **Signature:** `copyWithin(target : Number, start : Number, end : Number) : Array` 291 | 292 | **Description:** Copies elements within this array. The array length is not changed. 293 | 294 | **API Versioned:** 295 | 296 | From version 21.2. 297 | 298 | **Parameters:** 299 | 300 | - `target`: The target of the first element to copy. 301 | - `start`: Optional. The first index to copy. Default is 0. 302 | - `end`: Optional. The index of the end. This element is not included. Default is copy all to the array end. 303 | 304 | **Returns:** 305 | 306 | This array. 307 | 308 | --- 309 | 310 | ### entries 311 | 312 | **Signature:** `entries() : ES6Iterator` 313 | 314 | **Description:** Returns an iterator containing all index/value pairs of this array. The iterator produces a series of two-element arrays with the first element as the index and the second element as the value. 315 | 316 | **API Versioned:** 317 | 318 | From version 21.2. 319 | 320 | --- 321 | 322 | ### every 323 | 324 | **Signature:** `every(callback : Function) : boolean` 325 | 326 | **Description:** Returns true if every element in this array satisfies the test performed in the callback function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 327 | 328 | **Parameters:** 329 | 330 | - `callback`: the function to call to determine if every element in this array satisfies the test defined by the function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 331 | 332 | **Returns:** 333 | 334 | true if every element in this array satisfies the test performed in the callback function. 335 | 336 | **See Also:** 337 | 338 | Function 339 | 340 | --- 341 | 342 | ### every 343 | 344 | **Signature:** `every(callback : Function, thisObject : Object) : boolean` 345 | 346 | **Description:** Returns true if every element in the thisObject argument satisfies the test performed in the callback function, false otherwise. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 347 | 348 | **Parameters:** 349 | 350 | - `callback`: the function to call to determine if every element in this array satisfies the test defined by the function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 351 | - `thisObject`: the Object to use as 'this' when executing callback. 352 | 353 | **Returns:** 354 | 355 | true if every element in thisObject satisfies the test performed in the callback function, false otherwise. 356 | 357 | **See Also:** 358 | 359 | Function 360 | 361 | --- 362 | 363 | ### fill 364 | 365 | **Signature:** `fill(value : Object, start : Number, end : Number) : Array` 366 | 367 | **Description:** Sets multiple entries of this array to specific value. 368 | 369 | **API Versioned:** 370 | 371 | From version 21.2. 372 | 373 | **Parameters:** 374 | 375 | - `value`: The value to set. 376 | - `start`: Optional. The first index to copy. Default is 0. 377 | - `end`: Optional. The index of the end. This element is not included. Default is copy all to the array end. 378 | 379 | **Returns:** 380 | 381 | This array. 382 | 383 | --- 384 | 385 | ### filter 386 | 387 | **Signature:** `filter(callback : Function) : Array` 388 | 389 | **Description:** Returns a new Array with all of the elements that pass the test implemented by the callback function. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 390 | 391 | **Parameters:** 392 | 393 | - `callback`: the function that is called on this Array and which returns a new Array containing the elements that satisfy the function's test. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 394 | 395 | **Returns:** 396 | 397 | a new Array containing the elements that satisfy the function's test. 398 | 399 | --- 400 | 401 | ### filter 402 | 403 | **Signature:** `filter(callback : Function, thisObject : Object) : Array` 404 | 405 | **Description:** Returns a new Array with all of the elements that pass the test implemented by the callback function that is run against the specified Array, thisObject. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 406 | 407 | **Parameters:** 408 | 409 | - `callback`: the function that is called on the thisObject Array and which returns a new Array containing the elements that satisfy the function's test. The callback function is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 410 | - `thisObject`: the Object to use as 'this' when executing callback. 411 | 412 | **Returns:** 413 | 414 | a new Array containing the elements that satisfy the function's test. 415 | 416 | --- 417 | 418 | ### find 419 | 420 | **Signature:** `find(callback : Function, thisObject : Object) : Object` 421 | 422 | **Description:** Returns the first value within the array that satisfies the test defined in the callback function. 423 | 424 | **API Versioned:** 425 | 426 | From version 21.2. 427 | 428 | **Parameters:** 429 | 430 | - `callback`: The function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 431 | - `thisObject`: The object to use as 'this' when executing callback. 432 | 433 | **Returns:** 434 | 435 | The first value within the array that satisfies the test defined in the callback function, undefined if no matching value was found. 436 | 437 | --- 438 | 439 | ### findIndex 440 | 441 | **Signature:** `findIndex(callback : Function, thisObject : Object) : Number` 442 | 443 | **Description:** Returns the index of the first value within the array that satisfies the test defined in the callback function. 444 | 445 | **API Versioned:** 446 | 447 | From version 21.2. 448 | 449 | **Parameters:** 450 | 451 | - `callback`: The function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 452 | - `thisObject`: The object to use as 'this' when executing callback. 453 | 454 | **Returns:** 455 | 456 | The index of the first value within the array that satisfies the test defined in the callback function, -1 if no matching value was found. 457 | 458 | --- 459 | 460 | ### forEach 461 | 462 | **Signature:** `forEach(callback : Function) : void` 463 | 464 | **Description:** Runs the provided callback function once for each element present in the Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned a value. 465 | 466 | **Parameters:** 467 | 468 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 469 | 470 | --- 471 | 472 | ### forEach 473 | 474 | **Signature:** `forEach(callback : Function, thisObject : Object) : void` 475 | 476 | **Description:** Runs the provided callback function once for each element present in the specified Array, thisObject. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned a value. 477 | 478 | **Parameters:** 479 | 480 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 481 | - `thisObject`: the Object to use as 'this' when executing callback. 482 | 483 | --- 484 | 485 | ### from 486 | 487 | **Signature:** `static from(arrayLike : Object, mapFn : Function, thisObject : Object) : Array` 488 | 489 | **Description:** Creates a new array from an array-like object or an Iterable. 490 | 491 | **API Versioned:** 492 | 493 | From version 21.2. 494 | 495 | **Parameters:** 496 | 497 | - `arrayLike`: An array-like object or an iterable that provides the elements for the new array. 498 | - `mapFn`: Optional. A function that maps the input elements into the value for the new array. 499 | - `thisObject`: Optional. The Object to use as 'this' when executing mapFn. 500 | 501 | **Returns:** 502 | 503 | The newly created array. 504 | 505 | --- 506 | 507 | ### includes 508 | 509 | **Signature:** `includes(valueToFind : Object, fromIndex : Number) : boolean` 510 | 511 | **Description:** Returns if the array contains a specific value. 512 | 513 | **API Versioned:** 514 | 515 | From version 21.2. 516 | 517 | **Parameters:** 518 | 519 | - `valueToFind`: The value to look for. 520 | - `fromIndex`: Optional. The index to start from. 521 | 522 | **Returns:** 523 | 524 | true if the value is found in the array else false. 525 | 526 | --- 527 | 528 | ### indexOf 529 | 530 | **Signature:** `indexOf(elementToLocate : Object) : Number` 531 | 532 | **Description:** Returns the first index at which a given element can be found in the array, or -1 if it is not present. 533 | 534 | **Parameters:** 535 | 536 | - `elementToLocate`: the element to locate in the Array. 537 | 538 | **Returns:** 539 | 540 | the index of the element or -1 if it is no preset. 541 | 542 | --- 543 | 544 | ### indexOf 545 | 546 | **Signature:** `indexOf(elementToLocate : Object, fromIndex : Number) : Number` 547 | 548 | **Description:** Returns the first index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present. 549 | 550 | **Parameters:** 551 | 552 | - `elementToLocate`: the element to locate in the Array. 553 | - `fromIndex`: the index from which to start looking for the element. 554 | 555 | **Returns:** 556 | 557 | the index of the element or -1 if it is no preset. 558 | 559 | --- 560 | 561 | ### isArray 562 | 563 | **Signature:** `static isArray(object : Object) : boolean` 564 | 565 | **Description:** Checks if the passed object is an array. 566 | 567 | **Parameters:** 568 | 569 | - `object`: The object to ckeck. 570 | 571 | **Returns:** 572 | 573 | true if the passed object is an array else false. 574 | 575 | --- 576 | 577 | ### join 578 | 579 | **Signature:** `join() : String` 580 | 581 | **Description:** Converts all Array elements to Strings and concatenates them. 582 | 583 | **Returns:** 584 | 585 | a concatenated list of all Array elements as a String. 586 | 587 | --- 588 | 589 | ### join 590 | 591 | **Signature:** `join(separator : String) : String` 592 | 593 | **Description:** Converts all array elements to Strings and concatenates them. 594 | 595 | **Parameters:** 596 | 597 | - `separator`: an optional character or string used to separate one element of the Array from the next element in the return String. 598 | 599 | **Returns:** 600 | 601 | a concatenated list of all Array elements as a String where the specified delimiter is used to separate elements. 602 | 603 | --- 604 | 605 | ### keys 606 | 607 | **Signature:** `keys() : ES6Iterator` 608 | 609 | **Description:** Returns an iterator containing all indexes of this array. 610 | 611 | **API Versioned:** 612 | 613 | From version 21.2. 614 | 615 | --- 616 | 617 | ### lastIndexOf 618 | 619 | **Signature:** `lastIndexOf(elementToLocate : Object) : Number` 620 | 621 | **Description:** Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards. 622 | 623 | **Parameters:** 624 | 625 | - `elementToLocate`: the element to locate in the Array. 626 | 627 | **Returns:** 628 | 629 | the index of the element or -1 if it is no preset. 630 | 631 | --- 632 | 633 | ### lastIndexOf 634 | 635 | **Signature:** `lastIndexOf(elementToLocate : Object, fromIndex : Number) : Number` 636 | 637 | **Description:** Returns the last index at which a given element can be found in the array starting at fromIndex, or -1 if it is not present. The array is searched backwards. 638 | 639 | **Parameters:** 640 | 641 | - `elementToLocate`: the element to locate in the Array. 642 | - `fromIndex`: the index from which to start looking for the element. The array is searched backwards. 643 | 644 | **Returns:** 645 | 646 | the index of the element or -1 if it is no present. 647 | 648 | --- 649 | 650 | ### map 651 | 652 | **Signature:** `map(callback : Function) : Array` 653 | 654 | **Description:** Creates a new Array with the results of calling the specified function on every element in this Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. 655 | 656 | **Parameters:** 657 | 658 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 659 | 660 | **Returns:** 661 | 662 | a new Array with the results of calling the specified function on every element in this Array. 663 | 664 | --- 665 | 666 | ### map 667 | 668 | **Signature:** `map(callback : Function, thisObject : Object) : Array` 669 | 670 | **Description:** Creates a new Array with the results of calling the specified function on every element in the specified Array. The callback function is invoked only for indexes of the Array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. 671 | 672 | **Parameters:** 673 | 674 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 675 | - `thisObject`: the Object to use as 'this' when executing callback. 676 | 677 | **Returns:** 678 | 679 | a new Array with the results of calling the specified function on every element in this Array. 680 | 681 | --- 682 | 683 | ### of 684 | 685 | **Signature:** `static of(values : Object...) : Array` 686 | 687 | **Description:** Creates a new array from a variable list of elements. 688 | 689 | **API Versioned:** 690 | 691 | From version 21.2. 692 | 693 | **Parameters:** 694 | 695 | - `values`: The array values. 696 | 697 | **Returns:** 698 | 699 | The newly created array. 700 | 701 | --- 702 | 703 | ### pop 704 | 705 | **Signature:** `pop() : Object` 706 | 707 | **Description:** Removes and returns the last element of the Array. 708 | 709 | **Returns:** 710 | 711 | the last element of the Array. 712 | 713 | --- 714 | 715 | ### push 716 | 717 | **Signature:** `push(values : Object...) : Number` 718 | 719 | **Description:** Appends elements to the Array. 720 | 721 | **Parameters:** 722 | 723 | - `values`: one or more values that will be appended to the Array. 724 | 725 | **Returns:** 726 | 727 | the new length of the Array. 728 | 729 | --- 730 | 731 | ### reverse 732 | 733 | **Signature:** `reverse() : void` 734 | 735 | **Description:** Reverses the order of the elements in the Array. 736 | 737 | --- 738 | 739 | ### shift 740 | 741 | **Signature:** `shift() : Object` 742 | 743 | **Description:** Shifts elements down in the Array and returns the former first element. 744 | 745 | **Returns:** 746 | 747 | the former first element. 748 | 749 | --- 750 | 751 | ### slice 752 | 753 | **Signature:** `slice(start : Number, end : Number) : Array` 754 | 755 | **Description:** Returns a new Array containing a portion of the Array using the specified start and end positions. 756 | 757 | **Parameters:** 758 | 759 | - `start`: the location in the Array to start the slice operation. 760 | - `end`: the location in the Array to stop the slice operation. 761 | 762 | **Returns:** 763 | 764 | a new Array containing the members bound by start and end. 765 | 766 | --- 767 | 768 | ### some 769 | 770 | **Signature:** `some(callback : Function) : boolean` 771 | 772 | **Description:** Returns true if any of the elements in the Array pass the test defined in the callback function, false otherwise. 773 | 774 | **Parameters:** 775 | 776 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 777 | 778 | **Returns:** 779 | 780 | true if any of the elements in the Array pass the test defined in the callback function, false otherwise. 781 | 782 | --- 783 | 784 | ### some 785 | 786 | **Signature:** `some(callback : Function, thisObject : Object) : boolean` 787 | 788 | **Description:** Returns true if any of the elements in the specified Array pass the test defined in the callback function, false otherwise. 789 | 790 | **Parameters:** 791 | 792 | - `callback`: the function to call, which is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed. 793 | - `thisObject`: the Object to use as 'this' when executing callback. 794 | 795 | **Returns:** 796 | 797 | true if any of the elements in the Array pass the test defined in the callback function, false otherwise. 798 | 799 | --- 800 | 801 | ### sort 802 | 803 | **Signature:** `sort() : Array` 804 | 805 | **Description:** Sorts the elements of the Array in alphabetical order based on character encoding. This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort. 806 | 807 | **Returns:** 808 | 809 | a reference to the Array. 810 | 811 | --- 812 | 813 | ### sort 814 | 815 | **Signature:** `sort(function : Function) : Array` 816 | 817 | **Description:** Sorts the elements of the Array in alphabetical order based on character encoding. This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort. 818 | 819 | **Parameters:** 820 | 821 | - `function`: a Function used to specify the sorting order. 822 | 823 | **Returns:** 824 | 825 | a reference to the Array. 826 | 827 | **See Also:** 828 | 829 | Function 830 | 831 | --- 832 | 833 | ### splice 834 | 835 | **Signature:** `splice(start : Number, deleteCount : Number, values : Object...) : Array` 836 | 837 | **Description:** Deletes the specified number of elements from the Array at the specified position, and then inserts values into the Array at that location. 838 | 839 | **Parameters:** 840 | 841 | - `start`: the start location. 842 | - `deleteCount`: the number of items to delete. 843 | - `values`: zero or more values to be inserted into the Array. 844 | 845 | --- 846 | 847 | ### toLocaleString 848 | 849 | **Signature:** `toLocaleString() : String` 850 | 851 | **Description:** Converts the Array to a localized String. 852 | 853 | **Returns:** 854 | 855 | a localized String representing the Array. 856 | 857 | --- 858 | 859 | ### toString 860 | 861 | **Signature:** `toString() : String` 862 | 863 | **Description:** Converts the Array to a String. 864 | 865 | **Returns:** 866 | 867 | a String representation of the Array. 868 | 869 | --- 870 | 871 | ### unshift 872 | 873 | **Signature:** `unshift(values : Object...) : Number` 874 | 875 | **Description:** Inserts elements at the beginning of the Array. 876 | 877 | **Parameters:** 878 | 879 | - `values`: one or more vales that will be inserted into the beginning of the Array. 880 | 881 | **Returns:** 882 | 883 | the new length of the Array. 884 | 885 | --- 886 | 887 | ### values 888 | 889 | **Signature:** `values() : ES6Iterator` 890 | 891 | **Description:** Returns an iterator containing all values of this array. 892 | 893 | **API Versioned:** 894 | 895 | From version 21.2. 896 | 897 | --- ``` -------------------------------------------------------------------------------- /docs/dw_catalog/ProductSearchHit.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.catalog 2 | 3 | # Class ProductSearchHit 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.catalog.ProductSearchHit 9 | 10 | ## Description 11 | 12 | ProductSearchHit is the result of a executed search query and wraps the actual product found by the search. The method getRepresentedProducts() returns the actual products that is conforming the query and is represented by the search hit. Depending on the hit typ, getRepresentedProducts() returns: HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation product HIT_TYPE_PRODUCT_SET -> a product part of set HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle HIT_TYPE_VARIATION_GROUP -> a variation product The ProductSearchHit type can be retrieved by method getHitType() and contains the following types: HIT_TYPE_SIMPLE HIT_TYPE_PRODUCT_MASTER HIT_TYPE_PRODUCT_SET HIT_TYPE_PRODUCT_BUNDLE HIT_TYPE_VARIATION_GROUP The method getProduct() returns the presentation product corresponding to the ProductSearchHit type. HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation master product HIT_TYPE_PRODUCT_SET -> a product set HIT_TYPE_PRODUCT_BUNDLE -> a product bundle HIT_TYPE_VARIATION_GROUP ->a variation group Example: Given a product master P1 called "Sweater" with attributes color and size that has the following variants: V1 - color: red, size: small V2 - color: red, size: large V3 - color: blue, size: small V4 - color: blue, size: large V5 - color: yellow, size: small V6 - color: yellow, size: large A search for "red sweater" should hit the first two variants, V1 and V2 that are both red. The ProductSearchHit for this result encompass the master and the red variants but not the other non-relevant variants. The variants hit by the query can be retrieved by getRepresentedProducts(), returning a list that contains the two red sweater variants. The master product "Sweater" is returned by getProduct(). Furthermore, to get the first or last of that list of variants hit by the query we can call getFirstRepresentedProduct() or getLastRepresentedProduct(). The product with the highest sort rank is returned first, and the product with the lowest sort rank is returned last. The product sort rank depends on the sorting conditions used for the search query. 13 | 14 | ## Constants 15 | 16 | ### HIT_TYPE_PRODUCT_BUNDLE 17 | 18 | **Type:** String = "bundle" 19 | 20 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with product bundles. 21 | 22 | ### HIT_TYPE_PRODUCT_MASTER 23 | 24 | **Type:** String = "master" 25 | 26 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with master products. 27 | 28 | ### HIT_TYPE_PRODUCT_SET 29 | 30 | **Type:** String = "set" 31 | 32 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with product sets. 33 | 34 | ### HIT_TYPE_SIMPLE 35 | 36 | **Type:** String = "product" 37 | 38 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with single, non-complex products, including product variants that are assigned to a category and are returned as the presentation product. 39 | 40 | ### HIT_TYPE_SLICING_GROUP 41 | 42 | **Type:** String = "slicing_group" 43 | 44 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with slicing groups. 45 | 46 | ### HIT_TYPE_VARIATION_GROUP 47 | 48 | **Type:** String = "variation_group" 49 | 50 | Constant representing a product search hit type based on the presentation product of a hit. This hit type is used with variation groups. 51 | 52 | ## Properties 53 | 54 | ### allPromotionIDs 55 | 56 | **Type:** List (Read Only) 57 | 58 | Return the IDs of all searchable promotions for which at least one of the represented products of this search hit 59 | relates to the promotion, either as qualifying, discount, or bonus product. This may be used as a better 60 | performing alternative to PromotionPlan.getProductPromotions(Product) in some special cases. 61 | However be warned: this method has no additional checks and currently returns all id's which are known at 62 | indexing time. Custom code should generally filter and sort the promotions returned by this method according to 63 | PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile. 64 | 65 | ### bonusPromotionIDs 66 | 67 | **Type:** List (Read Only) 68 | 69 | Return the IDs of all searchable promotions for which at least one of the represented products of this search hit 70 | is a bonus product. This may be used as a better performing alternative to 71 | PromotionPlan.getProductPromotions(Product) in some special cases. However be warned: this 72 | method has no additional checks and currently returns all id's which are known at indexing time. Custom code 73 | should generally filter and sort the promotions returned by this method according to 74 | PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile. 75 | 76 | ### discountedPromotionIDs 77 | 78 | **Type:** List (Read Only) 79 | 80 | Return the IDs of all searchable promotions for which at least one of the represented products of this search hit 81 | satisfy the discounted product rule. This may be used as a better performing alternative to 82 | PromotionPlan.getProductPromotionsForDiscountedProduct(Product) in some special cases. 83 | However be warned: this method has no additional checks and currently returns all id's which are known at 84 | indexing time. Custom code should generally filter and sort the promotions returned by this method according to 85 | PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile. 86 | 87 | ### firstRepresentedProduct 88 | 89 | **Type:** Product (Read Only) 90 | 91 | The product that is actually hit by the search and has the highest 92 | sort rank according to the sorting conditions used for the search query. 93 | 94 | ### firstRepresentedProductID 95 | 96 | **Type:** String (Read Only) 97 | 98 | The ID of the product that is actually hit by the search and has the highest 99 | sort rank according to the sorting conditions used for the search query. 100 | 101 | ### hitType 102 | 103 | **Type:** String (Read Only) 104 | 105 | The type of the product wrapped by this search hit. The product type returned will be one of the hit types: 106 | 107 | HIT_TYPE_SIMPLE 108 | HIT_TYPE_PRODUCT_MASTER 109 | HIT_TYPE_PRODUCT_BUNDLE 110 | HIT_TYPE_PRODUCT_SET 111 | HIT_TYPE_SLICING_GROUP 112 | HIT_TYPE_VARIATION_GROUP 113 | 114 | ### lastRepresentedProduct 115 | 116 | **Type:** Product (Read Only) 117 | 118 | The product that is actually hit by the search and has the lowest 119 | sort rank according to the sorting conditions used for the search query. 120 | 121 | ### lastRepresentedProductID 122 | 123 | **Type:** String (Read Only) 124 | 125 | The ID of the product that is actually hit by the search and has the lowest 126 | sort rank according to the sorting conditions used for the search query. 127 | 128 | ### maxPrice 129 | 130 | **Type:** Money (Read Only) 131 | 132 | The maximum price of all products represented by the 133 | product hit. See getRepresentedProducts() for details on 134 | the set of products used for finding the maximum. The method returns 135 | N/A in case no price information can be found. 136 | 137 | Note: The method uses price information of the search index and therefore 138 | might return different prices than the ProductPriceModel. 139 | 140 | ### maxPricePerUnit 141 | 142 | **Type:** Money (Read Only) 143 | 144 | The maximum price per unit of all products represented by the 145 | product hit. See getRepresentedProducts() for details on 146 | the set of products used for finding the maximum. The method returns 147 | N/A in case no price information can be found. 148 | 149 | Note: The method uses price information of the search index and therefore 150 | might return different prices than the ProductPriceModel. 151 | 152 | ### minPrice 153 | 154 | **Type:** Money (Read Only) 155 | 156 | The minimum price of all products represented by the 157 | product hit. See getRepresentedProducts() for details on 158 | the set of products used for finding the minimum. The method returns 159 | N/A in case no price information can be found. 160 | 161 | Note: the method uses price information of the search index and therefore 162 | might return different prices than the ProductPriceModel. 163 | 164 | ### minPricePerUnit 165 | 166 | **Type:** Money (Read Only) 167 | 168 | The minimum price per unit of all products represented by the 169 | product hit. See getRepresentedProducts() for details on 170 | the set of products used for finding the minimum. The method returns 171 | N/A in case no price information can be found. 172 | 173 | Note: the method uses price information of the search index and therefore 174 | might return different prices than the ProductPriceModel. 175 | 176 | ### priceRange 177 | 178 | **Type:** getRepresentedProducts() (Read Only) 179 | 180 | Convenience method to check whether this ProductSearchHit represents 181 | multiple products (see getRepresentedProducts()) that have 182 | different prices. 183 | 184 | ### product 185 | 186 | **Type:** Product (Read Only) 187 | 188 | The presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. 189 | 190 | HIT_TYPE_SIMPLE -> a simple product 191 | HIT_TYPE_PRODUCT_MASTER -> a variation master product 192 | HIT_TYPE_PRODUCT_SET -> a product set 193 | HIT_TYPE_PRODUCT_BUNDLE -> a product bundle 194 | HIT_TYPE_VARIATION_GROUP ->a variation group 195 | 196 | 197 | To retrieve the product(s) actually hit by the search use getRepresentedProducts(). 198 | 199 | ### productID 200 | 201 | **Type:** String (Read Only) 202 | 203 | The ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. 204 | 205 | HIT_TYPE_SIMPLE -> a simple product 206 | HIT_TYPE_PRODUCT_MASTER -> a variation master product 207 | HIT_TYPE_PRODUCT_SET -> a product set 208 | HIT_TYPE_PRODUCT_BUNDLE -> a product bundle 209 | HIT_TYPE_VARIATION_GROUP ->a variation group 210 | 211 | 212 | To retrieve the ID of the product actually hit by the search use getFirstRepresentedProductID() or getLastRepresentedProductID(). 213 | 214 | ### qualifyingPromotionIDs 215 | 216 | **Type:** List (Read Only) 217 | 218 | Return the IDs of all searchable promotions for which at least one of the represented products of this search hit 219 | satisfies the qualifying product rule. This may be used as a better performing alternative to 220 | PromotionPlan.getProductPromotionsForQualifyingProduct(Product) in some special cases. 221 | However be warned: this method has no additional checks and currently returns all id's which are known at 222 | indexing time. Custom code should generally filter and sort the promotions returned by this method according to 223 | PromotionMgr.getActiveCustomerPromotions() before messaging the promotions on a product tile. 224 | 225 | ### representedProductIDs 226 | 227 | **Type:** List (Read Only) 228 | 229 | The method returns the actual ID of the product that is conforming the query and is represented by the search hit. 230 | Depending on the hit typ, it returns the ID of: 231 | 232 | HIT_TYPE_SIMPLE -> a simple product 233 | HIT_TYPE_PRODUCT_MASTER -> a variation product 234 | HIT_TYPE_PRODUCT_SET -> a product part of set 235 | HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle 236 | HIT_TYPE_VARIATION_GROUP ->a variation product 237 | 238 | 239 | If the method returns multiple products, the product with the highest 240 | sort rank is returned first, and the product with the lowest sort rank is 241 | returned last. The product sort rank depends on the sorting conditions 242 | used for the search query. 243 | 244 | ### representedProducts 245 | 246 | **Type:** List (Read Only) 247 | 248 | The method returns the actual product that is conforming the query and is represented by the search hit. 249 | Depending on the hit typ, getRepresentedProducts() returns: 250 | 251 | HIT_TYPE_SIMPLE -> a simple product 252 | HIT_TYPE_PRODUCT_MASTER -> a variation product 253 | HIT_TYPE_PRODUCT_SET -> a product part of set 254 | HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle 255 | HIT_TYPE_VARIATION_GROUP ->a variation product 256 | 257 | 258 | If the method returns multiple products, the product with the highest 259 | sort rank is returned first, and the product with the lowest sort rank is 260 | returned last. The product sort rank depends on the sorting conditions 261 | used for the search query. 262 | 263 | ## Constructor Summary 264 | 265 | ## Method Summary 266 | 267 | ### getFirstRepresentedProduct 268 | 269 | **Signature:** `getFirstRepresentedProduct() : Product` 270 | 271 | Returns the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query. 272 | 273 | ### getFirstRepresentedProductID 274 | 275 | **Signature:** `getFirstRepresentedProductID() : String` 276 | 277 | Returns the ID of the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query. 278 | 279 | ### getHitType 280 | 281 | **Signature:** `getHitType() : String` 282 | 283 | Returns the type of the product wrapped by this search hit. 284 | 285 | ### getLastRepresentedProduct 286 | 287 | **Signature:** `getLastRepresentedProduct() : Product` 288 | 289 | Returns the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query. 290 | 291 | ### getLastRepresentedProductID 292 | 293 | **Signature:** `getLastRepresentedProductID() : String` 294 | 295 | Returns the ID of the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query. 296 | 297 | ### getMaxPrice 298 | 299 | **Signature:** `getMaxPrice() : Money` 300 | 301 | Returns the maximum price of all products represented by the product hit. 302 | 303 | ### getMaxPricePerUnit 304 | 305 | **Signature:** `getMaxPricePerUnit() : Money` 306 | 307 | Returns the maximum price per unit of all products represented by the product hit. 308 | 309 | ### getMinPrice 310 | 311 | **Signature:** `getMinPrice() : Money` 312 | 313 | Returns the minimum price of all products represented by the product hit. 314 | 315 | ### getMinPricePerUnit 316 | 317 | **Signature:** `getMinPricePerUnit() : Money` 318 | 319 | Returns the minimum price per unit of all products represented by the product hit. 320 | 321 | ### getProduct 322 | 323 | **Signature:** `getProduct() : Product` 324 | 325 | Returns the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. 326 | 327 | ### getProductID 328 | 329 | **Signature:** `getProductID() : String` 330 | 331 | Returns the ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. 332 | 333 | ### getRepresentedProductIDs 334 | 335 | **Signature:** `getRepresentedProductIDs() : List` 336 | 337 | The method returns the actual ID of the product that is conforming the query and is represented by the search hit. 338 | 339 | ### getRepresentedProducts 340 | 341 | **Signature:** `getRepresentedProducts() : List` 342 | 343 | The method returns the actual product that is conforming the query and is represented by the search hit. 344 | 345 | ### getRepresentedVariationValues 346 | 347 | **Signature:** `getRepresentedVariationValues(va : Object) : List` 348 | 349 | This method is only applicable if this ProductSearchHit represents a product variation (see getRepresentedProducts()). 350 | 351 | ### isPriceRange 352 | 353 | **Signature:** `isPriceRange() : boolean` 354 | 355 | Convenience method to check whether this ProductSearchHit represents multiple products (see getRepresentedProducts()) that have different prices. 356 | 357 | ## Method Detail 358 | 359 | ## Method Details 360 | 361 | ### getFirstRepresentedProduct 362 | 363 | **Signature:** `getFirstRepresentedProduct() : Product` 364 | 365 | **Description:** Returns the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query. 366 | 367 | **Returns:** 368 | 369 | the first product that is actually hit by the search 370 | 371 | **See Also:** 372 | 373 | getRepresentedProducts() 374 | getLastRepresentedProduct() 375 | 376 | --- 377 | 378 | ### getFirstRepresentedProductID 379 | 380 | **Signature:** `getFirstRepresentedProductID() : String` 381 | 382 | **Description:** Returns the ID of the product that is actually hit by the search and has the highest sort rank according to the sorting conditions used for the search query. 383 | 384 | **Returns:** 385 | 386 | the ID of the first product that is actually hit by the search 387 | 388 | **See Also:** 389 | 390 | getRepresentedProducts() 391 | getLastRepresentedProduct() 392 | 393 | --- 394 | 395 | ### getHitType 396 | 397 | **Signature:** `getHitType() : String` 398 | 399 | **Description:** Returns the type of the product wrapped by this search hit. The product type returned will be one of the hit types: HIT_TYPE_SIMPLE HIT_TYPE_PRODUCT_MASTER HIT_TYPE_PRODUCT_BUNDLE HIT_TYPE_PRODUCT_SET HIT_TYPE_SLICING_GROUP HIT_TYPE_VARIATION_GROUP 400 | 401 | **Returns:** 402 | 403 | search hit type 404 | 405 | --- 406 | 407 | ### getLastRepresentedProduct 408 | 409 | **Signature:** `getLastRepresentedProduct() : Product` 410 | 411 | **Description:** Returns the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query. 412 | 413 | **Returns:** 414 | 415 | the last product that is actually hit by the search 416 | 417 | **See Also:** 418 | 419 | getRepresentedProducts() 420 | getLastRepresentedProduct() 421 | 422 | --- 423 | 424 | ### getLastRepresentedProductID 425 | 426 | **Signature:** `getLastRepresentedProductID() : String` 427 | 428 | **Description:** Returns the ID of the product that is actually hit by the search and has the lowest sort rank according to the sorting conditions used for the search query. 429 | 430 | **Returns:** 431 | 432 | the ID of the last product that is actually hit by the search 433 | 434 | **See Also:** 435 | 436 | getRepresentedProducts() 437 | getLastRepresentedProduct() 438 | 439 | --- 440 | 441 | ### getMaxPrice 442 | 443 | **Signature:** `getMaxPrice() : Money` 444 | 445 | **Description:** Returns the maximum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the maximum. The method returns N/A in case no price information can be found. Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel. 446 | 447 | **Returns:** 448 | 449 | the maximum price of all products represented by the product hit. 450 | 451 | --- 452 | 453 | ### getMaxPricePerUnit 454 | 455 | **Signature:** `getMaxPricePerUnit() : Money` 456 | 457 | **Description:** Returns the maximum price per unit of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the maximum. The method returns N/A in case no price information can be found. Note: The method uses price information of the search index and therefore might return different prices than the ProductPriceModel. 458 | 459 | **Returns:** 460 | 461 | the maximum price per unit of all products represented by the product hit. 462 | 463 | --- 464 | 465 | ### getMinPrice 466 | 467 | **Signature:** `getMinPrice() : Money` 468 | 469 | **Description:** Returns the minimum price of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the minimum. The method returns N/A in case no price information can be found. Note: the method uses price information of the search index and therefore might return different prices than the ProductPriceModel. 470 | 471 | **Returns:** 472 | 473 | the minimum price of all products represented by the product hit. 474 | 475 | --- 476 | 477 | ### getMinPricePerUnit 478 | 479 | **Signature:** `getMinPricePerUnit() : Money` 480 | 481 | **Description:** Returns the minimum price per unit of all products represented by the product hit. See getRepresentedProducts() for details on the set of products used for finding the minimum. The method returns N/A in case no price information can be found. Note: the method uses price information of the search index and therefore might return different prices than the ProductPriceModel. 482 | 483 | **Returns:** 484 | 485 | the minimum price per unit of all products represented by the product hit. 486 | 487 | --- 488 | 489 | ### getProduct 490 | 491 | **Signature:** `getProduct() : Product` 492 | 493 | **Description:** Returns the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation master product HIT_TYPE_PRODUCT_SET -> a product set HIT_TYPE_PRODUCT_BUNDLE -> a product bundle HIT_TYPE_VARIATION_GROUP ->a variation group To retrieve the product(s) actually hit by the search use getRepresentedProducts(). 494 | 495 | **Returns:** 496 | 497 | the presentation product of this ProductSearchHit, which is possibly a representative of other related products actually hit by the search. 498 | 499 | **See Also:** 500 | 501 | getRepresentedProducts() 502 | 503 | --- 504 | 505 | ### getProductID 506 | 507 | **Signature:** `getProductID() : String` 508 | 509 | **Description:** Returns the ID of the presentation product of this ProductSearchHit corresponding to the ProductSearchHit type. HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation master product HIT_TYPE_PRODUCT_SET -> a product set HIT_TYPE_PRODUCT_BUNDLE -> a product bundle HIT_TYPE_VARIATION_GROUP ->a variation group To retrieve the ID of the product actually hit by the search use getFirstRepresentedProductID() or getLastRepresentedProductID(). 510 | 511 | **Returns:** 512 | 513 | the ID of the presentation product of this ProductSearchHit, that possibly represents a set of related products actually hit by the search. 514 | 515 | **See Also:** 516 | 517 | getRepresentedProducts() 518 | 519 | --- 520 | 521 | ### getRepresentedProductIDs 522 | 523 | **Signature:** `getRepresentedProductIDs() : List` 524 | 525 | **Description:** The method returns the actual ID of the product that is conforming the query and is represented by the search hit. Depending on the hit typ, it returns the ID of: HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation product HIT_TYPE_PRODUCT_SET -> a product part of set HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle HIT_TYPE_VARIATION_GROUP ->a variation product If the method returns multiple products, the product with the highest sort rank is returned first, and the product with the lowest sort rank is returned last. The product sort rank depends on the sorting conditions used for the search query. 526 | 527 | **Returns:** 528 | 529 | a sorted list of products represented by the wrapped product. 530 | 531 | **See Also:** 532 | 533 | getFirstRepresentedProduct() 534 | getLastRepresentedProduct() 535 | 536 | --- 537 | 538 | ### getRepresentedProducts 539 | 540 | **Signature:** `getRepresentedProducts() : List` 541 | 542 | **Description:** The method returns the actual product that is conforming the query and is represented by the search hit. Depending on the hit typ, getRepresentedProducts() returns: HIT_TYPE_SIMPLE -> a simple product HIT_TYPE_PRODUCT_MASTER -> a variation product HIT_TYPE_PRODUCT_SET -> a product part of set HIT_TYPE_PRODUCT_BUNDLE -> a product part of a bundle HIT_TYPE_VARIATION_GROUP ->a variation product If the method returns multiple products, the product with the highest sort rank is returned first, and the product with the lowest sort rank is returned last. The product sort rank depends on the sorting conditions used for the search query. 543 | 544 | **Returns:** 545 | 546 | a sorted list of products represented by the wrapped product. 547 | 548 | **See Also:** 549 | 550 | getFirstRepresentedProduct() 551 | getLastRepresentedProduct() 552 | 553 | --- 554 | 555 | ### getRepresentedVariationValues 556 | 557 | **Signature:** `getRepresentedVariationValues(va : Object) : List` 558 | 559 | **Description:** This method is only applicable if this ProductSearchHit represents a product variation (see getRepresentedProducts()). It returns the distinct value set for the specified variation attribute for all variants represented by this ProductSearchHit. The values are returned in the same order as they are defined for the variation. This method will accept a ProductVariationAttribute parameter or a String which is the ID of a variation attribute. If any other object type is passed, or null is passed, an exception will be thrown. If this ProductSearchHit does not represent a product variation, or the passed variation attribute is not associated with this product, the method returns an empty list. 560 | 561 | **Parameters:** 562 | 563 | - `va`: the product variation attribute, specified as either a ProductVariationAttribute or a String which is the ID of a variation attribute associated with this product. 564 | 565 | **Returns:** 566 | 567 | a list containing all distinct ProductVariationAttributeValues. 568 | 569 | --- 570 | 571 | ### isPriceRange 572 | 573 | **Signature:** `isPriceRange() : boolean` 574 | 575 | **Description:** Convenience method to check whether this ProductSearchHit represents multiple products (see getRepresentedProducts()) that have different prices. 576 | 577 | **Returns:** 578 | 579 | true if the represented products form a price range false otherwise. 580 | 581 | --- ``` -------------------------------------------------------------------------------- /docs/dw_extensions.payments/SalesforcePaymentsMgr.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.extensions.payments 2 | 3 | # Class SalesforcePaymentsMgr 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.extensions.payments.SalesforcePaymentsMgr 9 | 10 | ## Description 11 | 12 | Contains functionality for use with Salesforce Payments. See Salesforce Payments documentation for how to gain access and configure it for use on your sites. 13 | 14 | ## Constants 15 | 16 | ### CANCELLATION_REASON_ABANDONED 17 | 18 | **Type:** String = "abandoned" 19 | 20 | Cancellation reason indicating customer abandoned payment. 21 | 22 | ### CANCELLATION_REASON_DUPLICATE 23 | 24 | **Type:** String = "duplicate" 25 | 26 | Cancellation reason indicating payment intent was a duplicate. 27 | 28 | ### CANCELLATION_REASON_FRAUDULENT 29 | 30 | **Type:** String = "fraudulent" 31 | 32 | Cancellation reason indicating payment was fraudulent. 33 | 34 | ### CANCELLATION_REASON_REQUESTED_BY_CUSTOMER 35 | 36 | **Type:** String = "requested_by_customer" 37 | 38 | Cancellation reason indicating customer action or request. 39 | 40 | ### REFUND_REASON_DUPLICATE 41 | 42 | **Type:** String = "duplicate" 43 | 44 | Refund reason indicating payment intent was a duplicate. 45 | 46 | ### REFUND_REASON_FRAUDULENT 47 | 48 | **Type:** String = "fraudulent" 49 | 50 | Refund reason indicating payment was fraudulent. 51 | 52 | ### REFUND_REASON_REQUESTED_BY_CUSTOMER 53 | 54 | **Type:** String = "requested_by_customer" 55 | 56 | Refund reason indicating customer action or request. 57 | 58 | ## Properties 59 | 60 | ### paymentsSiteConfig 61 | 62 | **Type:** SalesforcePaymentsSiteConfiguration (Read Only) 63 | 64 | A payments site configuration object for the current site. 65 | 66 | ## Constructor Summary 67 | 68 | ## Method Summary 69 | 70 | ### attachPaymentMethod 71 | 72 | **Signature:** `static attachPaymentMethod(paymentMethod : SalesforcePaymentMethod, customer : Customer) : void` 73 | 74 | Attaches the given payment method to the given customer. 75 | 76 | ### cancelPaymentIntent 77 | 78 | **Signature:** `static cancelPaymentIntent(paymentIntent : SalesforcePaymentIntent, paymentIntentProperties : Object) : Status` 79 | 80 | Cancels the given payment intent. 81 | 82 | ### capturePaymentIntent 83 | 84 | **Signature:** `static capturePaymentIntent(paymentIntent : SalesforcePaymentIntent, amount : Money) : Status` 85 | 86 | Captures funds for the given payment intent. 87 | 88 | ### confirmPaymentIntent 89 | 90 | **Signature:** `static confirmPaymentIntent(order : Order, paymentMethod : SalesforcePaymentMethod, paymentIntentProperties : Object) : Status` 91 | 92 | Confirms a new payment intent using the given payment method, and associates it with the given order. 93 | 94 | ### createPaymentIntent 95 | 96 | **Signature:** `static createPaymentIntent(basket : Basket, shipment : Shipment, zoneId : String, amount : Money, stripeCustomerRequired : boolean, paymentIntentProperties : Object) : Status` 97 | 98 | Creates a payment intent using the given information, and associates it with the given basket. 99 | 100 | ### detachPaymentMethod 101 | 102 | **Signature:** `static detachPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void` 103 | 104 | Detaches the given payment method from its associated customer. 105 | 106 | ### getAttachedPaymentMethods 107 | 108 | **Signature:** `static getAttachedPaymentMethods(customer : Customer) : Collection` 109 | 110 | Returns a collection containing the payment methods attached to the given customer. 111 | 112 | ### getOffSessionPaymentMethods 113 | 114 | **Signature:** `static getOffSessionPaymentMethods(customer : Customer) : Collection` 115 | 116 | Returns a collection containing the payment methods for the given customer set up for future off session reuse. 117 | 118 | ### getPaymentDetails 119 | 120 | **Signature:** `static getPaymentDetails(paymentInstrument : OrderPaymentInstrument) : SalesforcePaymentDetails` 121 | 122 | Returns the details to the Salesforce Payments payment associated with the given payment instrument, or null if the given payment instrument has none. 123 | 124 | ### getPaymentIntent 125 | 126 | **Signature:** `static getPaymentIntent(basket : Basket) : SalesforcePaymentIntent` 127 | 128 | Returns the payment intent for the given basket, or null if the given basket has none. 129 | 130 | ### getPaymentIntent 131 | 132 | **Signature:** `static getPaymentIntent(order : Order) : SalesforcePaymentIntent` 133 | 134 | Returns the payment intent for the given order, or null if the given order has none. 135 | 136 | ### getPaymentsSiteConfig 137 | 138 | **Signature:** `static getPaymentsSiteConfig() : SalesforcePaymentsSiteConfiguration` 139 | 140 | Returns a payments site configuration object for the current site. 141 | 142 | ### getPayPalOrder 143 | 144 | **Signature:** `static getPayPalOrder(basket : Basket) : SalesforcePayPalOrder` 145 | 146 | Returns the PayPal order for the given basket, or null if the given basket has none. 147 | 148 | ### getPayPalOrder 149 | 150 | **Signature:** `static getPayPalOrder(order : Order) : SalesforcePayPalOrder` 151 | 152 | Returns the PayPal order for the given order, or null if the given order has none. 153 | 154 | ### getSavedPaymentMethods 155 | 156 | **Signature:** `static getSavedPaymentMethods(customer : Customer) : Collection` 157 | 158 | Returns a collection containing the payment methods saved to be presented to the given customer for reuse in checkouts. 159 | 160 | ### onCustomerRegistered 161 | 162 | **Signature:** `static onCustomerRegistered(order : Order) : void` 163 | 164 | Handles the account registration of the shopper who placed the given order. 165 | 166 | ### refundPaymentIntent 167 | 168 | **Signature:** `static refundPaymentIntent(paymentIntent : SalesforcePaymentIntent, amount : Money, refundProperties : Object) : Status` 169 | 170 | Refunds previously captured funds for the given payment intent. 171 | 172 | ### removeSavedPaymentMethod 173 | 174 | **Signature:** `static removeSavedPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void` 175 | 176 | Removes the given saved payment method so that it is no longer presented to the given customer for reuse in checkouts. 177 | 178 | ### savePaymentMethod 179 | 180 | **Signature:** `static savePaymentMethod(customer : Customer, paymentMethod : SalesforcePaymentMethod) : void` 181 | 182 | Saves the given payment method to be presented to the given customer for reuse in subsequent checkouts. 183 | 184 | ### setPaymentDetails 185 | 186 | **Signature:** `static setPaymentDetails(paymentInstrument : OrderPaymentInstrument, paymentDetails : SalesforcePaymentDetails) : void` 187 | 188 | Sets the details to the Salesforce Payments payment associated with the given payment instrument. 189 | 190 | ### updatePaymentIntent 191 | 192 | **Signature:** `static updatePaymentIntent(paymentIntent : SalesforcePaymentIntent, shipment : Shipment, amount : Money, orderNo : String, paymentIntentProperties : Object) : Status` 193 | 194 | Updates the provided information in the given payment intent. 195 | 196 | ## Method Detail 197 | 198 | ## Method Details 199 | 200 | ### attachPaymentMethod 201 | 202 | **Signature:** `static attachPaymentMethod(paymentMethod : SalesforcePaymentMethod, customer : Customer) : void` 203 | 204 | **Description:** Attaches the given payment method to the given customer. Use this method to attach a payment method of type SalesforcePaymentMethod.TYPE_CARD to a shopper who registers as a customer after placing an order, and has affirmatively elected to save their card as part of the registration process. This method will throw an error if passed incompatible payment method and/or customer objects. 205 | 206 | **Deprecated:** 207 | 208 | use onCustomerRegistered(Order) and savePaymentMethod(Customer, SalesforcePaymentMethod) 209 | 210 | **Parameters:** 211 | 212 | - `paymentMethod`: payment method to attach to customer 213 | - `customer`: customer whose payment method to attach 214 | 215 | **Throws:** 216 | 217 | Exception - if there was an error attaching the payment method to the customer 218 | 219 | --- 220 | 221 | ### cancelPaymentIntent 222 | 223 | **Signature:** `static cancelPaymentIntent(paymentIntent : SalesforcePaymentIntent, paymentIntentProperties : Object) : Status` 224 | 225 | **Description:** Cancels the given payment intent. If a payment authorization has been made for the payment intent, the authorization is removed. The payment intent must be in a status that supports cancel. See the Stripe documentation for more details. The following Payment Intent property is supported: cancellationReason - optional payment intent cancellation reason 226 | 227 | **Parameters:** 228 | 229 | - `paymentIntent`: payment intent to capture 230 | - `paymentIntentProperties`: additional properties to pass to the create Payment Intent API 231 | 232 | **Returns:** 233 | 234 | Status 'OK' or 'ERROR'. Status detail 'paymentintent' contains the payment intent, if it is available in the Stripe response. Status detail 'error' contains the Stripe error information, if it is available in the response. 235 | 236 | **See Also:** 237 | 238 | CANCELLATION_REASON_ABANDONED 239 | CANCELLATION_REASON_DUPLICATE 240 | CANCELLATION_REASON_FRAUDULENT 241 | CANCELLATION_REASON_REQUESTED_BY_CUSTOMER 242 | 243 | **Throws:** 244 | 245 | Exception - if there was an error canceling the payment intent 246 | 247 | --- 248 | 249 | ### capturePaymentIntent 250 | 251 | **Signature:** `static capturePaymentIntent(paymentIntent : SalesforcePaymentIntent, amount : Money) : Status` 252 | 253 | **Description:** Captures funds for the given payment intent. The payment intent must be in a status that supports capture. See the Stripe documentation for more details. If amount is not specified, the default is the full amount available to capture. If specified, the amount must be less than or equal to the amount available to capture. 254 | 255 | **Parameters:** 256 | 257 | - `paymentIntent`: payment intent to capture 258 | - `amount`: optional amount to capture, defaults to amount available to capture 259 | 260 | **Returns:** 261 | 262 | Status 'OK' or 'ERROR'. Status detail 'error' contains the Stripe error information, if it is available in the response. 263 | 264 | **Throws:** 265 | 266 | Exception - if there was an error capturing the payment intent 267 | 268 | --- 269 | 270 | ### confirmPaymentIntent 271 | 272 | **Signature:** `static confirmPaymentIntent(order : Order, paymentMethod : SalesforcePaymentMethod, paymentIntentProperties : Object) : Status` 273 | 274 | **Description:** Confirms a new payment intent using the given payment method, and associates it with the given order. The order must be prepared to contain products, shipments, and any other necessary data, and must be calculated to reflect the correct total amounts. If the order is not for the same Customer as the given payment method, an error is thrown. The specified payment method must be set up for off session future use or an error is thrown. iDeal and Bancontact implement reuse differently than other payment methods, but they can't be reused themselves. The following Payment Intent properties are supported: statementDescriptor - optional statement descriptor cardCaptureAutomatic - optional true if the credit card payment should be automatically captured at the time of the sale, or false if the credit card payment should be captured later If cardCaptureAutomatic is provided it is used to determine card capture timing, and otherwise the default card capture timing set for the site is used. If statementDescriptor is provided it is used as the complete description that appears on your customers' statements for the payment, and if not a default statement descriptor is used. If a default statement descriptor is set for the site it is used as the default, and otherwise the default statement descriptor for the account will apply. 275 | 276 | **Parameters:** 277 | 278 | - `order`: order to pay using Salesforce Payments 279 | - `paymentMethod`: payment method to use to pay 280 | - `paymentIntentProperties`: additional properties to pass to the create Payment Intent API 281 | 282 | **Returns:** 283 | 284 | Status 'OK' or 'ERROR'. Status detail 'paymentintent' contains the payment intent, if it is available in the Stripe response. Status detail 'error' contains the Stripe error information, if it is available in the response. 285 | 286 | **Throws:** 287 | 288 | Exception - if the parameter validation failed or there's an error confirming the payment intent 289 | 290 | --- 291 | 292 | ### createPaymentIntent 293 | 294 | **Signature:** `static createPaymentIntent(basket : Basket, shipment : Shipment, zoneId : String, amount : Money, stripeCustomerRequired : boolean, paymentIntentProperties : Object) : Status` 295 | 296 | **Description:** Creates a payment intent using the given information, and associates it with the given basket. The following Payment Intent properties are supported: type - required payment method type, such as SalesforcePaymentMethod.TYPE_CARD statementDescriptor - optional statement descriptor cardCaptureAutomatic - optional true if the credit card payment should be automatically captured at the time of the sale, or false if the credit card payment should be captured later The stripeCustomerRequired must be set to true if the payment will be set up for future usage, whether on session or off session. If true then if a Stripe Customer is associated with the shopper then it will be used, and otherwise a new Stripe Customer will be created. The new Stripe Customer will be associated with the shopper if logged into a registered customer account for the site. If cardCaptureAutomatic is provided it is used to determine card capture timing, and otherwise the default card capture timing set for the site is used. If statementDescriptor is provided it is used as the complete description that appears on your customers' statements for the payment, and if not a default statement descriptor is used. If a default statement descriptor is set for the site it is used as the default, and otherwise the default statement descriptor for the account will apply. 297 | 298 | **Parameters:** 299 | 300 | - `basket`: basket to checkout and pay using Salesforce Payments 301 | - `shipment`: shipment to use for shipping information in the payment intent 302 | - `zoneId`: id of the payment zone 303 | - `amount`: payment amount 304 | - `stripeCustomerRequired`: true if a Stripe Customer must be associated with the payment intent, and would be created if it doesn't already exist, or false if a Stripe Customer does not have to be associated with the payment intent 305 | - `paymentIntentProperties`: properties to pass to the create Payment Intent API 306 | 307 | **Returns:** 308 | 309 | Status 'OK' or 'ERROR'. Status detail 'paymentintent' contains the payment intent, if it is available in the Stripe response. Status detail 'error' contains the Stripe error information, if it is available in the response. 310 | 311 | --- 312 | 313 | ### detachPaymentMethod 314 | 315 | **Signature:** `static detachPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void` 316 | 317 | **Description:** Detaches the given payment method from its associated customer. Once detached the payment method remains associated with payment intents in the payment account, but is no longer saved for use by the customer in future orders. 318 | 319 | **Deprecated:** 320 | 321 | use removeSavedPaymentMethod(SalesforcePaymentMethod) 322 | 323 | **Parameters:** 324 | 325 | - `paymentMethod`: payment method to detach from customer 326 | 327 | **Throws:** 328 | 329 | Exception - if there was an error detaching the payment method from its customer 330 | 331 | --- 332 | 333 | ### getAttachedPaymentMethods 334 | 335 | **Signature:** `static getAttachedPaymentMethods(customer : Customer) : Collection` 336 | 337 | **Description:** Returns a collection containing the payment methods attached to the given customer. The collection will be empty if there are no payment methods attached to the customer, or there was an error retrieving the attached payment methods. 338 | 339 | **Deprecated:** 340 | 341 | use getSavedPaymentMethods(Customer) 342 | 343 | **Parameters:** 344 | 345 | - `customer`: customer whose payment methods to get 346 | 347 | **Returns:** 348 | 349 | collection of attached payment methods 350 | 351 | **Throws:** 352 | 353 | Exception - if the given customer is null or undefined 354 | 355 | --- 356 | 357 | ### getOffSessionPaymentMethods 358 | 359 | **Signature:** `static getOffSessionPaymentMethods(customer : Customer) : Collection` 360 | 361 | **Description:** Returns a collection containing the payment methods for the given customer set up for future off session reuse. The collection will be empty if there are no off session payment methods for the customer, or there was an error retrieving the off session payment methods. 362 | 363 | **Parameters:** 364 | 365 | - `customer`: customer whose off session payment methods to get 366 | 367 | **Returns:** 368 | 369 | collection of off session payment methods 370 | 371 | **Throws:** 372 | 373 | Exception - if the given customer is null or undefined, or there is an error getting the off session payment methods 374 | 375 | --- 376 | 377 | ### getPaymentDetails 378 | 379 | **Signature:** `static getPaymentDetails(paymentInstrument : OrderPaymentInstrument) : SalesforcePaymentDetails` 380 | 381 | **Description:** Returns the details to the Salesforce Payments payment associated with the given payment instrument, or null if the given payment instrument has none. 382 | 383 | **Parameters:** 384 | 385 | - `paymentInstrument`: payment instrument 386 | 387 | **Returns:** 388 | 389 | The payment details 390 | 391 | **Throws:** 392 | 393 | Exception - if paymentInstrument is null 394 | 395 | --- 396 | 397 | ### getPaymentIntent 398 | 399 | **Signature:** `static getPaymentIntent(basket : Basket) : SalesforcePaymentIntent` 400 | 401 | **Description:** Returns the payment intent for the given basket, or null if the given basket has none. 402 | 403 | **Parameters:** 404 | 405 | - `basket`: basket to checkout and pay using Salesforce Payments 406 | 407 | **Returns:** 408 | 409 | The payment intent 410 | 411 | **Throws:** 412 | 413 | Exception - if there was an error retrieving the payment intent for the basket 414 | 415 | --- 416 | 417 | ### getPaymentIntent 418 | 419 | **Signature:** `static getPaymentIntent(order : Order) : SalesforcePaymentIntent` 420 | 421 | **Description:** Returns the payment intent for the given order, or null if the given order has none. 422 | 423 | **Parameters:** 424 | 425 | - `order`: order paid using Salesforce Payments 426 | 427 | **Returns:** 428 | 429 | The payment intent 430 | 431 | **Throws:** 432 | 433 | Exception - if there was an error retrieving the payment intent for the order 434 | 435 | --- 436 | 437 | ### getPaymentsSiteConfig 438 | 439 | **Signature:** `static getPaymentsSiteConfig() : SalesforcePaymentsSiteConfiguration` 440 | 441 | **Description:** Returns a payments site configuration object for the current site. 442 | 443 | **Returns:** 444 | 445 | a payments site configuration or null if no payments site configuration found 446 | 447 | **Throws:** 448 | 449 | Exception - if there is no current site 450 | 451 | --- 452 | 453 | ### getPayPalOrder 454 | 455 | **Signature:** `static getPayPalOrder(basket : Basket) : SalesforcePayPalOrder` 456 | 457 | **Description:** Returns the PayPal order for the given basket, or null if the given basket has none. 458 | 459 | **Parameters:** 460 | 461 | - `basket`: basket to checkout and pay using Salesforce Payments 462 | 463 | **Returns:** 464 | 465 | The PayPal order 466 | 467 | **Throws:** 468 | 469 | Exception - if there was an error retrieving the PayPal order for the basket 470 | 471 | --- 472 | 473 | ### getPayPalOrder 474 | 475 | **Signature:** `static getPayPalOrder(order : Order) : SalesforcePayPalOrder` 476 | 477 | **Description:** Returns the PayPal order for the given order, or null if the given order has none. 478 | 479 | **Parameters:** 480 | 481 | - `order`: order paid using Salesforce Payments 482 | 483 | **Returns:** 484 | 485 | The PayPal order 486 | 487 | **Throws:** 488 | 489 | Exception - if there was an error retrieving the PayPal order for the order 490 | 491 | --- 492 | 493 | ### getSavedPaymentMethods 494 | 495 | **Signature:** `static getSavedPaymentMethods(customer : Customer) : Collection` 496 | 497 | **Description:** Returns a collection containing the payment methods saved to be presented to the given customer for reuse in checkouts. The collection will be empty if there are no payment methods saved for the customer, or there was an error retrieving the saved payment methods. 498 | 499 | **Parameters:** 500 | 501 | - `customer`: customer whose saved payment methods to get 502 | 503 | **Returns:** 504 | 505 | collection of saved payment methods 506 | 507 | **Throws:** 508 | 509 | Exception - if the given customer is null or undefined, or there is an error getting the saved payment methods 510 | 511 | --- 512 | 513 | ### onCustomerRegistered 514 | 515 | **Signature:** `static onCustomerRegistered(order : Order) : void` 516 | 517 | **Description:** Handles the account registration of the shopper who placed the given order. Use this method to ensure the registered customer profile is associated with the order in Salesforce Payments. 518 | 519 | **Parameters:** 520 | 521 | - `order`: order paid using Salesforce Payments 522 | 523 | **Throws:** 524 | 525 | Exception - if there was an error attaching the payment method to the customer 526 | 527 | --- 528 | 529 | ### refundPaymentIntent 530 | 531 | **Signature:** `static refundPaymentIntent(paymentIntent : SalesforcePaymentIntent, amount : Money, refundProperties : Object) : Status` 532 | 533 | **Description:** Refunds previously captured funds for the given payment intent. The payment intent must be in a state that supports refund. This includes its status as well as any previous refunds. See the Stripe documentation for more details. The following Payment Intent property is supported: reason - optional payment intent refund reason If amount is not specified, the default is the full amount available to refund. If specified, the amount must be less than or equal to the amount available to refund. 534 | 535 | **Parameters:** 536 | 537 | - `paymentIntent`: payment intent to refund 538 | - `amount`: optional amount to refund, defaults to amount previously captured 539 | - `refundProperties`: additional properties to pass to the refund API 540 | 541 | **Returns:** 542 | 543 | Status 'OK' or 'ERROR'. Status detail 'error' contains the Stripe error information, if it is available in the response. 544 | 545 | **See Also:** 546 | 547 | REFUND_REASON_DUPLICATE 548 | REFUND_REASON_FRAUDULENT 549 | REFUND_REASON_REQUESTED_BY_CUSTOMER 550 | 551 | **Throws:** 552 | 553 | Exception - if there was an error refunding the payment intent 554 | 555 | --- 556 | 557 | ### removeSavedPaymentMethod 558 | 559 | **Signature:** `static removeSavedPaymentMethod(paymentMethod : SalesforcePaymentMethod) : void` 560 | 561 | **Description:** Removes the given saved payment method so that it is no longer presented to the given customer for reuse in checkouts. The payment method remains in the payment account, but is no longer saved for use by the customer. 562 | 563 | **Parameters:** 564 | 565 | - `paymentMethod`: payment method to detach from customer 566 | 567 | **Throws:** 568 | 569 | Exception - if there was an error removing the saved payment method from its customer 570 | 571 | --- 572 | 573 | ### savePaymentMethod 574 | 575 | **Signature:** `static savePaymentMethod(customer : Customer, paymentMethod : SalesforcePaymentMethod) : void` 576 | 577 | **Description:** Saves the given payment method to be presented to the given customer for reuse in subsequent checkouts. This method will throw an error if passed incompatible payment method and/or customer objects. 578 | 579 | **Parameters:** 580 | 581 | - `customer`: customer for which to save the payment method 582 | - `paymentMethod`: payment method to save for the customer 583 | 584 | **Throws:** 585 | 586 | Exception - if there was an error saving the payment method for the customer 587 | 588 | --- 589 | 590 | ### setPaymentDetails 591 | 592 | **Signature:** `static setPaymentDetails(paymentInstrument : OrderPaymentInstrument, paymentDetails : SalesforcePaymentDetails) : void` 593 | 594 | **Description:** Sets the details to the Salesforce Payments payment associated with the given payment instrument. 595 | 596 | **Parameters:** 597 | 598 | - `paymentInstrument`: payment instrument 599 | - `paymentDetails`: payment details 600 | 601 | **See Also:** 602 | 603 | SalesforcePaymentMethod.getPaymentDetails(OrderPaymentInstrument) 604 | SalesforcePayPalOrder.getPaymentDetails(OrderPaymentInstrument) 605 | 606 | **Throws:** 607 | 608 | Exception - if either paymentInstrument or paymentDetails is null 609 | 610 | --- 611 | 612 | ### updatePaymentIntent 613 | 614 | **Signature:** `static updatePaymentIntent(paymentIntent : SalesforcePaymentIntent, shipment : Shipment, amount : Money, orderNo : String, paymentIntentProperties : Object) : Status` 615 | 616 | **Description:** Updates the provided information in the given payment intent. The payment intent must be in a status that supports update. See the Stripe documentation for more details. The following Payment Intent properties are supported: statementDescriptor - optional statement descriptor cardCaptureAutomatic - optional true if the credit card payment should be automatically captured at the time of the sale, or false if the credit card payment should be captured later If cardCaptureAutomatic is provided it is used to determine card capture timing, and otherwise the default card capture timing set for the site is used. If statementDescriptor is provided it is used as the complete description that appears on your customers' statements for the payment, and if not a default statement descriptor is used. If a default statement descriptor is set for the site it is used as the default, and otherwise the default statement descriptor for the account will apply. 617 | 618 | **Parameters:** 619 | 620 | - `paymentIntent`: payment intent to update 621 | - `shipment`: optional shipment to use to update shipping information in the payment intent 622 | - `amount`: optional new payment amount 623 | - `orderNo`: optional order no of Order to associate with the payment intent in metadata 624 | - `paymentIntentProperties`: optional additional properties to pass to the update Payment Intent API 625 | 626 | **Returns:** 627 | 628 | Status 'OK' or 'ERROR'. Status detail 'paymentintent' contains the payment intent, if it is available in the Stripe response. Status detail 'error' contains the Stripe error information, if it is available in the response. 629 | 630 | **Throws:** 631 | 632 | Exception - if the parameter validation failed or there's an error updating the payment intent 633 | 634 | --- ``` -------------------------------------------------------------------------------- /docs/dw_order/Basket.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.order 2 | 3 | # Class Basket 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.object.PersistentObject 9 | - dw.object.ExtensibleObject 10 | - dw.order.LineItemCtnr 11 | - dw.order.Basket 12 | 13 | ## Description 14 | 15 | The Basket class represents a shopping cart. 16 | 17 | ## Properties 18 | 19 | ### agentBasket 20 | 21 | **Type:** BasketMgr.createAgentBasket() (Read Only) 22 | 23 | Returns if the basket was created by an agent. 24 | 25 | An agent basket is created by an agent on behalf of the customer in comparison to a storefront basket which is 26 | created by the customer e.g. in the storefront. An agent basket can be created with 27 | BasketMgr.createAgentBasket(). 28 | 29 | ### inventoryReservationExpiry 30 | 31 | **Type:** Date (Read Only) 32 | 33 | The timestamp when the inventory for this basket expires. 34 | 35 | It will return null for the following reasons: 36 | 37 | No reservation for the basket was done 38 | Reservation is outdated meaning the timestamp is in the past 39 | 40 | 41 | 42 | Please note that the expiry timestamp will not always be valid for the whole basket. It will not be valid for 43 | new items added or items whose quantity has changed after the reservation was done. 44 | 45 | ### orderBeingEdited 46 | 47 | **Type:** Order (Read Only) 48 | 49 | The order that this basket represents if the basket is being used to edit an order, otherwise this method 50 | returns null. Baskets created via BasketMgr.createBasketFromOrder(Order) will create a reference 51 | to the order that was used to create this basket (please check limitations around basket accessibility in 52 | BasketMgr.createBasketFromOrder(Order)). 53 | 54 | ### orderNoBeingEdited 55 | 56 | **Type:** String (Read Only) 57 | 58 | The number of the order that this basket represents if the basket is being used to edit an order, 59 | otherwise this method returns null. Baskets created via BasketMgr.createBasketFromOrder(Order) 60 | will create a reference to the order that was used to create this basket (please check limitations around basket 61 | accessibility in BasketMgr.createBasketFromOrder(Order)). 62 | 63 | ### taxRoundedAtGroup 64 | 65 | **Type:** boolean (Read Only) 66 | 67 | Use this method to check if the Basket was calculated with grouped taxation calculation. 68 | 69 | If the tax is rounded on group level, the tax is applied to the summed-up tax basis for each tax rate. 70 | 71 | ### temporary 72 | 73 | **Type:** BasketMgr.createTemporaryBasket() (Read Only) 74 | 75 | Returns if the basket is temporary. 76 | 77 | Temporary baskets are separate from shopper storefront and agent baskets, and are intended for use to perform 78 | calculations or create an order without disturbing a shopper's open storefront basket. A temporary basket can be 79 | created with BasketMgr.createTemporaryBasket(). 80 | 81 | ## Constructor Summary 82 | 83 | ## Method Summary 84 | 85 | ### getInventoryReservationExpiry 86 | 87 | **Signature:** `getInventoryReservationExpiry() : Date` 88 | 89 | Returns the timestamp when the inventory for this basket expires. 90 | 91 | ### getOrderBeingEdited 92 | 93 | **Signature:** `getOrderBeingEdited() : Order` 94 | 95 | Returns the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. 96 | 97 | ### getOrderNoBeingEdited 98 | 99 | **Signature:** `getOrderNoBeingEdited() : String` 100 | 101 | Returns the number of the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. 102 | 103 | ### isAgentBasket 104 | 105 | **Signature:** `isAgentBasket() : boolean` 106 | 107 | Returns if the basket was created by an agent. 108 | 109 | ### isTaxRoundedAtGroup 110 | 111 | **Signature:** `isTaxRoundedAtGroup() : boolean` 112 | 113 | Use this method to check if the Basket was calculated with grouped taxation calculation. 114 | 115 | ### isTemporary 116 | 117 | **Signature:** `isTemporary() : boolean` 118 | 119 | Returns if the basket is temporary. 120 | 121 | ### releaseInventory 122 | 123 | **Signature:** `releaseInventory() : Status` 124 | 125 | Releases all inventory previously reserved for this basket. 126 | 127 | ### reserveInventory 128 | 129 | **Signature:** `reserveInventory() : Status` 130 | 131 | Reserves inventory for all items in this basket for 10 minutes. 132 | 133 | ### reserveInventory 134 | 135 | **Signature:** `reserveInventory(reservationDurationInMinutes : Number) : Status` 136 | 137 | Reserves inventory for all items in this basket for a specified amount of minutes. 138 | 139 | ### reserveInventory 140 | 141 | **Signature:** `reserveInventory(reservationDurationInMinutes : Number, removeIfNotAvailable : boolean) : Status` 142 | 143 | Reserves inventory for all items in this basket for a specified amount of minutes. 144 | 145 | ### setBusinessType 146 | 147 | **Signature:** `setBusinessType(aType : Number) : void` 148 | 149 | Set the type of the business this order has been placed in. Possible values are LineItemCtnr.BUSINESS_TYPE_B2C or LineItemCtnr.BUSINESS_TYPE_B2B. 150 | 151 | ### setChannelType 152 | 153 | **Signature:** `setChannelType(aType : Number) : void` 154 | 155 | Set the channel type in which sales channel this order has been created. 156 | 157 | ### setCustomerNo 158 | 159 | **Signature:** `setCustomerNo(customerNo : String) : void` 160 | 161 | Sets the customer number of the customer associated with this container. 162 | 163 | ### startCheckout 164 | 165 | **Signature:** `startCheckout() : void` 166 | 167 | Register a "start checkout" event for the current basket. 168 | 169 | ### updateCurrency 170 | 171 | **Signature:** `updateCurrency() : void` 172 | 173 | Updates the basket currency if different to session currency, otherwise does nothing. 174 | 175 | ## Method Detail 176 | 177 | ## Method Details 178 | 179 | ### getInventoryReservationExpiry 180 | 181 | **Signature:** `getInventoryReservationExpiry() : Date` 182 | 183 | **Description:** Returns the timestamp when the inventory for this basket expires. It will return null for the following reasons: No reservation for the basket was done Reservation is outdated meaning the timestamp is in the past Please note that the expiry timestamp will not always be valid for the whole basket. It will not be valid for new items added or items whose quantity has changed after the reservation was done. 184 | 185 | **Returns:** 186 | 187 | the inventory reservation expiry timestamp or null 188 | 189 | --- 190 | 191 | ### getOrderBeingEdited 192 | 193 | **Signature:** `getOrderBeingEdited() : Order` 194 | 195 | **Description:** Returns the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. Baskets created via BasketMgr.createBasketFromOrder(Order) will create a reference to the order that was used to create this basket (please check limitations around basket accessibility in BasketMgr.createBasketFromOrder(Order)). 196 | 197 | **Returns:** 198 | 199 | the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. 200 | 201 | --- 202 | 203 | ### getOrderNoBeingEdited 204 | 205 | **Signature:** `getOrderNoBeingEdited() : String` 206 | 207 | **Description:** Returns the number of the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. Baskets created via BasketMgr.createBasketFromOrder(Order) will create a reference to the order that was used to create this basket (please check limitations around basket accessibility in BasketMgr.createBasketFromOrder(Order)). 208 | 209 | **Returns:** 210 | 211 | the number of the order that this basket represents if the basket is being used to edit an order, otherwise this method returns null. 212 | 213 | --- 214 | 215 | ### isAgentBasket 216 | 217 | **Signature:** `isAgentBasket() : boolean` 218 | 219 | **Description:** Returns if the basket was created by an agent. An agent basket is created by an agent on behalf of the customer in comparison to a storefront basket which is created by the customer e.g. in the storefront. An agent basket can be created with BasketMgr.createAgentBasket(). 220 | 221 | **Returns:** 222 | 223 | true if the basket was created by an agent otherwise false 224 | 225 | --- 226 | 227 | ### isTaxRoundedAtGroup 228 | 229 | **Signature:** `isTaxRoundedAtGroup() : boolean` 230 | 231 | **Description:** Use this method to check if the Basket was calculated with grouped taxation calculation. If the tax is rounded on group level, the tax is applied to the summed-up tax basis for each tax rate. 232 | 233 | **Returns:** 234 | 235 | true if the Basket was calculated with grouped taxation 236 | 237 | --- 238 | 239 | ### isTemporary 240 | 241 | **Signature:** `isTemporary() : boolean` 242 | 243 | **Description:** Returns if the basket is temporary. Temporary baskets are separate from shopper storefront and agent baskets, and are intended for use to perform calculations or create an order without disturbing a shopper's open storefront basket. A temporary basket can be created with BasketMgr.createTemporaryBasket(). 244 | 245 | **Returns:** 246 | 247 | true if the basket is temporary otherwise false 248 | 249 | --- 250 | 251 | ### releaseInventory 252 | 253 | **Signature:** `releaseInventory() : Status` 254 | 255 | **Description:** Releases all inventory previously reserved for this basket. The method implements its own transaction handling. Calling the method from inside a transaction is disallowed and results in an exception being thrown. This behavior differs when calling the method from an OCAPI hook. OCAPI hooks handle transactions themselves, so in this case there is also no need to do any transaction handling, but to ensure the shortest possible locking of the inventory this method should only be called as the last step in the OCAPI hook. 256 | 257 | **Returns:** 258 | 259 | a Status instance with - Status.OK if release inventory was successful, otherwise Status.ERROR. 260 | 261 | --- 262 | 263 | ### reserveInventory 264 | 265 | **Signature:** `reserveInventory() : Status` 266 | 267 | **Description:** Reserves inventory for all items in this basket for 10 minutes. Any reservations created by previous calls of this method will be reset to 10 minutes. The method can be used to reserve basket items before checkout to ensure that inventory is still available at the time an order is created from the basket using OrderMgr.createOrder(Basket). If all or some basket items are not reserved before creating an order, OrderMgr.createOrder(Basket) will validate item availability and will fail if any item is unavailable. Calling this method in the same request as OrderMgr.createOrder(Basket) is unnecessary and discouraged for performance reasons. The maximum quantity that can be reserved at one time is equal to the ATS (Available To Sell) quantity. (See ProductInventoryRecord.getATS().) When using B2C Commerce inventory, reserving basket inventory does not reduce ATS. In this case, converting the basket to an order reduces ATS by the reserved amount. For example, consider a product with an ATS quantity of 5 and no reservations. If a basket reserves a quantity of 3, then other baskets still see an ATS of 5 but can only reserve a quantity of 2. When using Omnichannel Inventory, reserving basket inventory reduces ATS. In this case, converting the basket to an order doesn't reduce ATS. In the previous example, after the first basket reserved a quantity of 3, other baskets would see an ATS of 2. Reservations can only be made for products with an inventory record. The reservation of product bundles is controlled by the Use Bundle Inventory Only setting on the inventory list. The setting allows inventory to be reserved for just the bundle or for the bundle and its bundled products. The following conditions must be met for the method to succeed: an inventory list must be assigned to the current site all products in the basket must exist, and must not be of type Master or ProductSet each product line item must have a valid quantity each product must have an inventory record, or the inventory list must define that products without inventory record are available by default the reservation must succeed for each item as described above. The method implements its own transaction handling. Calling the method from inside a transaction is disallowed and results in an exception being thrown. This behavior differs when calling the method from an OCAPI hook. OCAPI hooks handle transactions themselves, so in this case there is also no need to do any transaction handling, but to ensure the shortest possible locking of the inventory this method should only be called as the last step in the OCAPI hook. If the reservation fails with an ERROR status, existing valid reservations for the basket will remain unchanged but no new reservations will be made. This might lead to a partially reserved basket. Behaves same as reserveInventory( null, false );. This method must not be used with the CreateOrder2 pipelet, or OrderMgr.createOrder(Basket), or OrderMgr.createOrder(Basket, String) in the same request. 268 | 269 | **Returns:** 270 | 271 | a Status instance with - Status.OK if all items could be reserved, otherwise Status.ERROR meaning no items were reserved. 272 | 273 | --- 274 | 275 | ### reserveInventory 276 | 277 | **Signature:** `reserveInventory(reservationDurationInMinutes : Number) : Status` 278 | 279 | **Description:** Reserves inventory for all items in this basket for a specified amount of minutes. Any reservations created by previous calls of this method will be reset to that amount of minutes. The method can be used to reserve basket items before checkout to ensure that inventory is still available at the time an order is created from the basket using OrderMgr.createOrder(Basket). If all or some basket items are not reserved before creating an order, OrderMgr.createOrder(Basket) will validate item availability and will fail if any item is unavailable. Calling this method in the same request as OrderMgr.createOrder(Basket) is unnecessary and discouraged for performance reasons. The maximum quantity that can be reserved at one time is equal to the ATS (Available To Sell) quantity. (See ProductInventoryRecord.getATS().) When using B2C Commerce inventory, reserving basket inventory does not reduce ATS. In this case, converting the basket to an order reduces ATS by the reserved amount. For example, consider a product with an ATS quantity of 5 and no reservations. If a basket reserves a quantity of 3, then other baskets still see an ATS of 5 but can only reserve a quantity of 2. When using Omnichannel Inventory, reserving basket inventory reduces ATS. In this case, converting the basket to an order doesn't reduce ATS. In the previous example, after the first basket reserved a quantity of 3, other baskets would see an ATS of 2. Reservations can only be made for products with an inventory record. The reservation of product bundles is controlled by the Use Bundle Inventory Only setting on the inventory list. The setting allows inventory to be reserved for just the bundle or for the bundle and its bundled products. The following conditions must be met for the method to succeed: an inventory list must be assigned to the current site all products in the basket must exist, and must not be of type Master or ProductSet each product line item must have a valid quantity each product must have an inventory record, or the inventory list must define that products without inventory record are available by default the reservation must succeed for each item as described above. The method implements its own transaction handling. Calling the method from inside a transaction is disallowed and results in an exception being thrown. This behavior differs when calling the method from an OCAPI hook. OCAPI hooks handle transactions themselves, so in this case there is also no need to do any transaction handling, but to ensure the shortest possible locking of the inventory this method should only be called as the last step in the OCAPI hook. getInventoryReservationExpiry() can be used to determine when the expiration will expire. If the reservation fails with an ERROR status, existing valid reservations for the basket will remain unchanged but no new reservations will be made. This might lead to a partially reserved basket. Behaves same as reserveInventory( reservationDurationInMinutes, false );. This method must not be used with the CreateOrder2 pipelet, or OrderMgr.createOrder(Basket), or OrderMgr.createOrder(Basket, String) in the same request. 280 | 281 | **Parameters:** 282 | 283 | - `reservationDurationInMinutes`: reservation duration in minutes, specifying how long the reservation will last. The maximum value for the reservation duration is 240 minutes. 284 | 285 | **Returns:** 286 | 287 | a Status instance with - Status.OK if all items could be reserved, otherwise Status.ERROR meaning no items were reserved. 288 | 289 | --- 290 | 291 | ### reserveInventory 292 | 293 | **Signature:** `reserveInventory(reservationDurationInMinutes : Number, removeIfNotAvailable : boolean) : Status` 294 | 295 | **Description:** Reserves inventory for all items in this basket for a specified amount of minutes. Any reservations created by previous calls of this method will be reset to that amount of minutes. The method can be used to reserve basket items before checkout to ensure that inventory is still available at the time an order is created from the basket using OrderMgr.createOrder(Basket). If all or some basket items are not reserved before creating an order, OrderMgr.createOrder(Basket) will validate item availability and will fail if any item is unavailable. Calling this method in the same request as OrderMgr.createOrder(Basket) is unnecessary and discouraged for performance reasons. The maximum quantity that can be reserved at one time is equal to the ATS (Available To Sell) quantity. (See ProductInventoryRecord.getATS().) When using B2C Commerce inventory, reserving basket inventory does not reduce ATS. In this case, converting the basket to an order reduces ATS by the reserved amount. For example, consider a product with an ATS quantity of 5 and no reservations. If a basket reserves a quantity of 3, then other baskets still see an ATS of 5 but can only reserve a quantity of 2. When using Omnichannel Inventory, reserving basket inventory reduces ATS. In this case, converting the basket to an order doesn't reduce ATS. In the previous example, after the first basket reserved a quantity of 3, other baskets would see an ATS of 2. Reservations can only be made for products with an inventory record. The reservation of product bundles is controlled by the Use Bundle Inventory Only setting on the inventory list. The setting allows inventory to be reserved for just the bundle or for the bundle and its bundled products. The following conditions must be met for the method to succeed: an inventory list must be assigned to the current site all products in the basket must exist, and must not be of type Master or ProductSet each product line item must have a valid quantity each product must have an inventory record, or the inventory list must define that products without inventory record are available by default the reservation must succeed for each item as described above or removeIfNotAvailable is set to true The method implements its own transaction handling. Calling the method from inside a transaction is disallowed and results in an exception being thrown. This behavior differs when calling the method from an OCAPI hook. OCAPI hooks handle transactions themselves, so in this case there is also no need to do any transaction handling, but to ensure the shortest possible locking of the inventory this method should only be called as the last step in the OCAPI hook. getInventoryReservationExpiry() can be used to determine when the expiration will expire. If the reservation fails with an ERROR status, existing valid reservations for the basket will remain unchanged but no new reservations will be made. This might lead to a partially reserved basket. If the reservation succeeds with an OK status and removeIfNotAvailable is true, basket line items quantities might have been changed or line items might have been removed. The returned Status object will contain information about the changes. Possible values for StatusItem.getCode() are: BUNDLE_REMOVED - a bundle item was removed completely ITEM_REMOVED - a product line item was removed completely ITEM_QUANTITY_REDUCED - the quantity of a line item was reduced StatusItem.getDetails() will contain for each item the sku and uuid of the item which was changed/removed. This method must not be used with the CreateOrder2 pipelet, or OrderMgr.createOrder(Basket), or OrderMgr.createOrder(Basket, String) in the same request. 296 | 297 | **Parameters:** 298 | 299 | - `reservationDurationInMinutes`: reservation duration in minutes, specifying how long the reservation will last. The maximum value for the reservation duration is 240 minutes. 300 | - `removeIfNotAvailable`: if true is specified it will not fail if not the full quantity of the items can be reserved. Item quantity will be reduced to the quantity that could be reserved. Item will be removed if not at least quantity 1 for the item could be reserved. Different to that if a bundle line item cannot be reserved completely it will be removed including dependent line item (bundled items). 301 | 302 | **Returns:** 303 | 304 | a Status instance with - Status.OK meaning reservation process was successful. In case of removeIfNotAvailable is true, status might contain status items (Status.getItems()) for each item that needed to be changed or removed. In the worst case this could result in an empty basket and no items reserved. A Status instance with - Status.ERROR will be returned if removeIfNotAvailable is false and not all items could be reserved fully or any unexpected error occurred. 305 | 306 | --- 307 | 308 | ### setBusinessType 309 | 310 | **Signature:** `setBusinessType(aType : Number) : void` 311 | 312 | **Description:** Set the type of the business this order has been placed in. Possible values are LineItemCtnr.BUSINESS_TYPE_B2C or LineItemCtnr.BUSINESS_TYPE_B2B. 313 | 314 | **Parameters:** 315 | 316 | - `aType`: the business type to set for this basket 317 | 318 | --- 319 | 320 | ### setChannelType 321 | 322 | **Signature:** `setChannelType(aType : Number) : void` 323 | 324 | **Description:** Set the channel type in which sales channel this order has been created. This can be used to distinguish order placed through e.g. Storefront, Call Center or Marketplace. Possible values are LineItemCtnr.CHANNEL_TYPE_STOREFRONT, LineItemCtnr.CHANNEL_TYPE_CALLCENTER, LineItemCtnr.CHANNEL_TYPE_MARKETPLACE, LineItemCtnr.CHANNEL_TYPE_DSS, LineItemCtnr.CHANNEL_TYPE_STORE, LineItemCtnr.CHANNEL_TYPE_PINTEREST, LineItemCtnr.CHANNEL_TYPE_TWITTER, LineItemCtnr.CHANNEL_TYPE_FACEBOOKADS, LineItemCtnr.CHANNEL_TYPE_SUBSCRIPTIONS, LineItemCtnr.CHANNEL_TYPE_ONLINERESERVATION, LineItemCtnr.CHANNEL_TYPE_INSTAGRAMCOMMERCE, LineItemCtnr.CHANNEL_TYPE_GOOGLE, LineItemCtnr.CHANNEL_TYPE_YOUTUBE, LineItemCtnr.CHANNEL_TYPE_TIKTOK, LineItemCtnr.CHANNEL_TYPE_SNAPCHAT, LineItemCtnr.CHANNEL_TYPE_WHATSAPP The value for LineItemCtnr.CHANNEL_TYPE_CUSTOMERSERVICECENTER is also available, but it can not be set by the scripting API, it is set only internally. 325 | 326 | **Parameters:** 327 | 328 | - `aType`: the channel type to set for this basket 329 | 330 | --- 331 | 332 | ### setCustomerNo 333 | 334 | **Signature:** `setCustomerNo(customerNo : String) : void` 335 | 336 | **Description:** Sets the customer number of the customer associated with this container. Note this method has little effect as it only sets the customer number and it does not re-link the basket with a customer profile object, nor is the number copied into the Order should one be created from the basket. Use Order.setCustomer(Customer) instead for a registered customer. For a guest customer the customerNo is usually generated during order creation and the attribute is set at order level. 337 | 338 | **Deprecated:** 339 | 340 | The method has been deprecated. Please use Order.setCustomer(Customer) instead for registered customer. For guest customer the customerNo is usually generated during order creation and the attribute is set at order level. 341 | 342 | **Parameters:** 343 | 344 | - `customerNo`: the customer number of the customer associated with this container. 345 | 346 | --- 347 | 348 | ### startCheckout 349 | 350 | **Signature:** `startCheckout() : void` 351 | 352 | **Description:** Register a "start checkout" event for the current basket. This event is tracked for AB test statistics but otherwise has no effect on the basket. The system will register at most one checkout per basket per session. 353 | 354 | --- 355 | 356 | ### updateCurrency 357 | 358 | **Signature:** `updateCurrency() : void` 359 | 360 | **Description:** Updates the basket currency if different to session currency, otherwise does nothing. Use Session.setCurrency(Currency) to set the currency for the session. To reflect the session currency change to the basket you need to update the basket with this method. This ensures that any upcoming basket recalculation, which is based on the session currency, matches the basket currency. ... if (basket.getBillingAddress().getCountryCode() == 'DE'){ var newCurrency : Currency = Currency.getCurrency('EUR'); session.setCurrency( newCurrency ); basket.updateCurrency(); } customBasketRecalculate(); ... 361 | 362 | --- ``` -------------------------------------------------------------------------------- /docs/dw_campaign/Promotion.md: -------------------------------------------------------------------------------- ```markdown 1 | ## Package: dw.campaign 2 | 3 | # Class Promotion 4 | 5 | ## Inheritance Hierarchy 6 | 7 | - Object 8 | - dw.object.PersistentObject 9 | - dw.object.ExtensibleObject 10 | - dw.campaign.Promotion 11 | 12 | ## Description 13 | 14 | This class represents a promotion in Commerce Cloud Digital. Examples of promotions include: "Get 20% off your order" "$15 off a given product" "free shipping for all orders over $50" Get a bonus product with purchase of another product The Promotion class provides access to the basic attributes of the promotion such as name, callout message, and description, but the details of the promotion rules are not available in the API due to their complexity. Commerce Cloud Digital allows merchants to create a single logical "promotion rule" (e.g. "Get 20% off your order") and then assign it to one or more "containers" where the supported container types are campaigns or AB-tests. A Promotion represents a specific instance of a promotion rule assigned to a container. Promotion rules themselves that are not assigned to any container are inaccessible through the API. Each instance (i.e. assignment) can have separate "qualifiers". Qualifiers are the customer groups, source code groups, or coupons that trigger a given promotion for a customer. 15 | 16 | ## Constants 17 | 18 | ### EXCLUSIVITY_CLASS 19 | 20 | **Type:** String = "CLASS" 21 | 22 | Constant representing promotion exclusivity of type class. 23 | 24 | ### EXCLUSIVITY_GLOBAL 25 | 26 | **Type:** String = "GLOBAL" 27 | 28 | Constant representing promotion exclusivity of type global. 29 | 30 | ### EXCLUSIVITY_NO 31 | 32 | **Type:** String = "NO" 33 | 34 | Constant representing promotion exclusivity of type no. 35 | 36 | ### PROMOTION_CLASS_ORDER 37 | 38 | **Type:** String = "ORDER" 39 | 40 | Constant representing promotion class of type order. 41 | 42 | ### PROMOTION_CLASS_PRODUCT 43 | 44 | **Type:** String = "PRODUCT" 45 | 46 | Constant representing promotion class of type product. 47 | 48 | ### PROMOTION_CLASS_SHIPPING 49 | 50 | **Type:** String = "SHIPPING" 51 | 52 | Constant representing promotion class of type shipping. 53 | 54 | ### QUALIFIER_MATCH_MODE_ALL 55 | 56 | **Type:** String = "all" 57 | 58 | Constant indicating that that all qualifier conditions must be met in order for this promotion to apply for a given customer. 59 | 60 | ### QUALIFIER_MATCH_MODE_ANY 61 | 62 | **Type:** String = "any" 63 | 64 | Constant indicating that that at least one qualifier condition must be met in order for this promotion to apply for a given customer. 65 | 66 | ## Properties 67 | 68 | ### active 69 | 70 | **Type:** boolean (Read Only) 71 | 72 | Returns 'true' if promotion is active, otherwise 'false'. 73 | A promotion is active if its campaign is active, and the promotion 74 | is enabled, and it is scheduled for now. 75 | 76 | ### basedOnCoupon 77 | 78 | **Type:** boolean (Read Only) 79 | 80 | Returns 'true' if the promotion is triggered by a coupon, 81 | false otherwise. 82 | 83 | ### basedOnCoupons 84 | 85 | **Type:** boolean (Read Only) 86 | 87 | Returns 'true' if the promotion is triggered by coupons, 88 | false otherwise. 89 | 90 | ### basedOnCustomerGroups 91 | 92 | **Type:** boolean (Read Only) 93 | 94 | Returns 'true' if the promotion is triggered by customer groups, 95 | false otherwise. 96 | 97 | ### basedOnSourceCodes 98 | 99 | **Type:** boolean (Read Only) 100 | 101 | Returns 'true' if the promotion is triggered by source codes, 102 | false otherwise. 103 | 104 | ### calloutMsg 105 | 106 | **Type:** MarkupText (Read Only) 107 | 108 | The callout message of the promotion. 109 | 110 | ### campaign 111 | 112 | **Type:** Campaign (Read Only) 113 | 114 | The campaign this particular instance of the promotion is defined 115 | in. 116 | 117 | Note: If this promotion is defined as part of an AB-test, then a Campaign 118 | object will be returned, but it is a mock implementation, and not a true 119 | Campaign. This behavior is required for backwards compatibility and 120 | should not be relied upon as it may change in future releases. 121 | 122 | ### combinablePromotions 123 | 124 | **Type:** String (Read Only) 125 | 126 | The promotion's combinable promotions. Combinable promotions is a set of promotions or groups this 127 | promotion can be combined with. 128 | 129 | ### conditionalDescription 130 | 131 | **Type:** MarkupText (Read Only) 132 | 133 | A description of the condition that must be met for this 134 | promotion to be applicable. 135 | 136 | The method and the related attribute have been deprecated. Use the 137 | getDetails() method instead. 138 | 139 | ### coupons 140 | 141 | **Type:** Collection (Read Only) 142 | 143 | The coupons directly assigned to the promotion or assigned to the campaign of the promotion. 144 | If the promotion is not based on coupons (see isBasedOnCoupons()), or no coupons is assigned to the 145 | promotion or its campaign, an empty collection is returned. 146 | 147 | ### custom 148 | 149 | **Type:** CustomAttributes (Read Only) 150 | 151 | The custom attributes for this extensible object. 152 | 153 | ### customerGroups 154 | 155 | **Type:** Collection (Read Only) 156 | 157 | The customer groups directly assigned to the promotion or assigned to the campaign of the promotion. 158 | If the promotion is not based on customer groups (see isBasedOnCustomerGroups()), or no customer group is assigned to the 159 | promotion or its campaign, an empty collection is returned. 160 | 161 | ### description 162 | 163 | **Type:** MarkupText (Read Only) 164 | 165 | The description of the promotion. 166 | 167 | Method is deprecated and returns the same value as getCalloutMsg(). 168 | 169 | ### details 170 | 171 | **Type:** MarkupText (Read Only) 172 | 173 | The detailed description of the promotion. 174 | 175 | ### enabled 176 | 177 | **Type:** boolean (Read Only) 178 | 179 | Returns true if promotion is enabled, otherwise false. 180 | 181 | ### endDate 182 | 183 | **Type:** Date (Read Only) 184 | 185 | The effective end date of this instance of the promotion. If no 186 | explicit end date is defined for the promotion, the end date of the 187 | containing Campaign or AB-test is returned. 188 | 189 | ### exclusivity 190 | 191 | **Type:** String (Read Only) 192 | 193 | The promotion's exclusivity specifying how the promotion can be 194 | combined with other promotions. 195 | Possible values are EXCLUSIVITY_NO, EXCLUSIVITY_CLASS 196 | and EXCLUSIVITY_GLOBAL. 197 | 198 | ### ID 199 | 200 | **Type:** String (Read Only) 201 | 202 | The unique ID of the promotion. 203 | 204 | ### image 205 | 206 | **Type:** MediaFile (Read Only) 207 | 208 | The reference to the promotion image. 209 | 210 | ### lastModified 211 | 212 | **Type:** Date (Read Only) 213 | 214 | The date that this object was last modified. 215 | 216 | ### mutuallyExclusivePromotions 217 | 218 | **Type:** String (Read Only) 219 | 220 | The promotion's mutually exclusive Promotions. Mutually exclusive Promotions is a set of promotions or 221 | groups this promotion cannot be combined with. 222 | 223 | ### name 224 | 225 | **Type:** String (Read Only) 226 | 227 | The name of the promotion. 228 | 229 | ### promotionClass 230 | 231 | **Type:** String (Read Only) 232 | 233 | The promotion class indicating the general type of the promotion. 234 | Possible values are PROMOTION_CLASS_PRODUCT, 235 | PROMOTION_CLASS_ORDER, and PROMOTION_CLASS_SHIPPING. 236 | 237 | ### qualifierMatchMode 238 | 239 | **Type:** String (Read Only) 240 | 241 | The qualifier matching mode specified by this promotion. A 242 | promotion may have up to 3 qualifier conditions based on whether it is 243 | customer-group based, coupon based, and/or source-code based. A promotion 244 | may require for example that a customer belong to a certain customer 245 | group and also have a certain coupon in the cart in order for the 246 | promotion to apply. This method returns QUALIFIER_MATCH_MODE_ALL if it is 247 | necessary that all the qualifier conditions are satisfied in order for 248 | this promotion to apply for a given customer. Otherwise, this method 249 | returns QUALIFIER_MATCH_MODE_ANY indicating that at least of the 250 | qualifier conditions must be satisfied. 251 | 252 | Note: currently QUALIFIER_MATCH_MODE_ALL is only supported for promotions 253 | assigned to campaigns, and not those assigned to AB-tests. 254 | 255 | ### rank 256 | 257 | **Type:** Number (Read Only) 258 | 259 | The promotion's rank. Rank is a numeric attribute that you can specify. 260 | Promotions with a defined rank are calculated before promotions without a defined rank. 261 | If two promotions have a rank, the one with the lowest rank is calculated first. 262 | For example, a promotion with rank 10 is calculated before one with rank 30. 263 | 264 | ### refinable 265 | 266 | **Type:** boolean (Read Only) 267 | 268 | Returns true if promotion is refinable, otherwise false. 269 | 270 | ### sourceCodeGroups 271 | 272 | **Type:** Collection (Read Only) 273 | 274 | The source code groups directly assigned to the promotion or assigned to the campaign of the promotion. 275 | If the promotion is not based on source code groups (see isBasedOnSourceCodes()), or no source code group is assigned to the 276 | promotion or its campaign, an empty collection is returned. 277 | 278 | ### startDate 279 | 280 | **Type:** Date (Read Only) 281 | 282 | The effective start date of this instance of the promotion. If no 283 | explicit start date is defined for this instance, the start date of the 284 | containing Campaign or AB-test is returned. 285 | 286 | ### tags 287 | 288 | **Type:** String (Read Only) 289 | 290 | The promotion's tags. Tags are a way of categorizing and organizing promotions. A promotion can have many 291 | tags. Tags will be returned in alphabetical order. 292 | 293 | ## Constructor Summary 294 | 295 | ## Method Summary 296 | 297 | ### getCalloutMsg 298 | 299 | **Signature:** `getCalloutMsg() : MarkupText` 300 | 301 | Returns the callout message of the promotion. 302 | 303 | ### getCampaign 304 | 305 | **Signature:** `getCampaign() : Campaign` 306 | 307 | Returns the campaign this particular instance of the promotion is defined in. 308 | 309 | ### getCombinablePromotions 310 | 311 | **Signature:** `getCombinablePromotions() : String[]` 312 | 313 | Returns the promotion's combinable promotions. 314 | 315 | ### getConditionalDescription 316 | 317 | **Signature:** `getConditionalDescription() : MarkupText` 318 | 319 | Returns a description of the condition that must be met for this promotion to be applicable. 320 | 321 | ### getCoupons 322 | 323 | **Signature:** `getCoupons() : Collection` 324 | 325 | Returns the coupons directly assigned to the promotion or assigned to the campaign of the promotion. 326 | 327 | ### getCustom 328 | 329 | **Signature:** `getCustom() : CustomAttributes` 330 | 331 | Returns the custom attributes for this extensible object. 332 | 333 | ### getCustomerGroups 334 | 335 | **Signature:** `getCustomerGroups() : Collection` 336 | 337 | Returns the customer groups directly assigned to the promotion or assigned to the campaign of the promotion. 338 | 339 | ### getDescription 340 | 341 | **Signature:** `getDescription() : MarkupText` 342 | 343 | Returns the description of the promotion. 344 | 345 | ### getDetails 346 | 347 | **Signature:** `getDetails() : MarkupText` 348 | 349 | Returns the detailed description of the promotion. 350 | 351 | ### getEndDate 352 | 353 | **Signature:** `getEndDate() : Date` 354 | 355 | Returns the effective end date of this instance of the promotion. 356 | 357 | ### getExclusivity 358 | 359 | **Signature:** `getExclusivity() : String` 360 | 361 | Returns the promotion's exclusivity specifying how the promotion can be combined with other promotions. 362 | 363 | ### getID 364 | 365 | **Signature:** `getID() : String` 366 | 367 | Returns the unique ID of the promotion. 368 | 369 | ### getImage 370 | 371 | **Signature:** `getImage() : MediaFile` 372 | 373 | Returns the reference to the promotion image. 374 | 375 | ### getLastModified 376 | 377 | **Signature:** `getLastModified() : Date` 378 | 379 | Returns the date that this object was last modified. 380 | 381 | ### getMutuallyExclusivePromotions 382 | 383 | **Signature:** `getMutuallyExclusivePromotions() : String[]` 384 | 385 | Returns the promotion's mutually exclusive Promotions. 386 | 387 | ### getName 388 | 389 | **Signature:** `getName() : String` 390 | 391 | Returns the name of the promotion. 392 | 393 | ### getPromotionalPrice 394 | 395 | **Signature:** `getPromotionalPrice(product : Product) : Money` 396 | 397 | Returns the promotional price for the specified product. 398 | 399 | ### getPromotionalPrice 400 | 401 | **Signature:** `getPromotionalPrice(product : Product, optionModel : ProductOptionModel) : Money` 402 | 403 | This method follows the same logic as getPromotionalPrice(Product) but prices are calculated based on the option values selected in the specified option model. 404 | 405 | ### getPromotionClass 406 | 407 | **Signature:** `getPromotionClass() : String` 408 | 409 | Returns the promotion class indicating the general type of the promotion. 410 | 411 | ### getQualifierMatchMode 412 | 413 | **Signature:** `getQualifierMatchMode() : String` 414 | 415 | Returns the qualifier matching mode specified by this promotion. 416 | 417 | ### getRank 418 | 419 | **Signature:** `getRank() : Number` 420 | 421 | Returns the promotion's rank. 422 | 423 | ### getSourceCodeGroups 424 | 425 | **Signature:** `getSourceCodeGroups() : Collection` 426 | 427 | Returns the source code groups directly assigned to the promotion or assigned to the campaign of the promotion. 428 | 429 | ### getStartDate 430 | 431 | **Signature:** `getStartDate() : Date` 432 | 433 | Returns the effective start date of this instance of the promotion. 434 | 435 | ### getTags 436 | 437 | **Signature:** `getTags() : String[]` 438 | 439 | Returns the promotion's tags. 440 | 441 | ### isActive 442 | 443 | **Signature:** `isActive() : boolean` 444 | 445 | Returns 'true' if promotion is active, otherwise 'false'. 446 | 447 | ### isBasedOnCoupon 448 | 449 | **Signature:** `isBasedOnCoupon() : boolean` 450 | 451 | Returns 'true' if the promotion is triggered by a coupon, false otherwise. 452 | 453 | ### isBasedOnCoupons 454 | 455 | **Signature:** `isBasedOnCoupons() : boolean` 456 | 457 | Returns 'true' if the promotion is triggered by coupons, false otherwise. 458 | 459 | ### isBasedOnCustomerGroups 460 | 461 | **Signature:** `isBasedOnCustomerGroups() : boolean` 462 | 463 | Returns 'true' if the promotion is triggered by customer groups, false otherwise. 464 | 465 | ### isBasedOnSourceCodes 466 | 467 | **Signature:** `isBasedOnSourceCodes() : boolean` 468 | 469 | Returns 'true' if the promotion is triggered by source codes, false otherwise. 470 | 471 | ### isEnabled 472 | 473 | **Signature:** `isEnabled() : boolean` 474 | 475 | Returns true if promotion is enabled, otherwise false. 476 | 477 | ### isRefinable 478 | 479 | **Signature:** `isRefinable() : boolean` 480 | 481 | Returns true if promotion is refinable, otherwise false. 482 | 483 | ## Method Detail 484 | 485 | ## Method Details 486 | 487 | ### getCalloutMsg 488 | 489 | **Signature:** `getCalloutMsg() : MarkupText` 490 | 491 | **Description:** Returns the callout message of the promotion. 492 | 493 | **Returns:** 494 | 495 | Callout message of the promotion. 496 | 497 | --- 498 | 499 | ### getCampaign 500 | 501 | **Signature:** `getCampaign() : Campaign` 502 | 503 | **Description:** Returns the campaign this particular instance of the promotion is defined in. Note: If this promotion is defined as part of an AB-test, then a Campaign object will be returned, but it is a mock implementation, and not a true Campaign. This behavior is required for backwards compatibility and should not be relied upon as it may change in future releases. 504 | 505 | **Returns:** 506 | 507 | Campaign of the promotion. 508 | 509 | --- 510 | 511 | ### getCombinablePromotions 512 | 513 | **Signature:** `getCombinablePromotions() : String[]` 514 | 515 | **Description:** Returns the promotion's combinable promotions. Combinable promotions is a set of promotions or groups this promotion can be combined with. 516 | 517 | **Returns:** 518 | 519 | The promotion's set of combinable promotions. 520 | 521 | --- 522 | 523 | ### getConditionalDescription 524 | 525 | **Signature:** `getConditionalDescription() : MarkupText` 526 | 527 | **Description:** Returns a description of the condition that must be met for this promotion to be applicable. The method and the related attribute have been deprecated. Use the getDetails() method instead. 528 | 529 | **Deprecated:** 530 | 531 | Use getDetails() 532 | 533 | **Returns:** 534 | 535 | Condition promotion description. 536 | 537 | --- 538 | 539 | ### getCoupons 540 | 541 | **Signature:** `getCoupons() : Collection` 542 | 543 | **Description:** Returns the coupons directly assigned to the promotion or assigned to the campaign of the promotion. If the promotion is not based on coupons (see isBasedOnCoupons()), or no coupons is assigned to the promotion or its campaign, an empty collection is returned. 544 | 545 | **Returns:** 546 | 547 | Coupons assigned to promotion in no particular order. 548 | 549 | --- 550 | 551 | ### getCustom 552 | 553 | **Signature:** `getCustom() : CustomAttributes` 554 | 555 | **Description:** Returns the custom attributes for this extensible object. 556 | 557 | --- 558 | 559 | ### getCustomerGroups 560 | 561 | **Signature:** `getCustomerGroups() : Collection` 562 | 563 | **Description:** Returns the customer groups directly assigned to the promotion or assigned to the campaign of the promotion. If the promotion is not based on customer groups (see isBasedOnCustomerGroups()), or no customer group is assigned to the promotion or its campaign, an empty collection is returned. 564 | 565 | **Returns:** 566 | 567 | Customer groups assigned to promotion in no particular order. 568 | 569 | --- 570 | 571 | ### getDescription 572 | 573 | **Signature:** `getDescription() : MarkupText` 574 | 575 | **Description:** Returns the description of the promotion. Method is deprecated and returns the same value as getCalloutMsg(). 576 | 577 | **Deprecated:** 578 | 579 | Use getCalloutMsg() 580 | 581 | **Returns:** 582 | 583 | Description of the promotion. 584 | 585 | --- 586 | 587 | ### getDetails 588 | 589 | **Signature:** `getDetails() : MarkupText` 590 | 591 | **Description:** Returns the detailed description of the promotion. 592 | 593 | **Returns:** 594 | 595 | Detailed promotion description. 596 | 597 | --- 598 | 599 | ### getEndDate 600 | 601 | **Signature:** `getEndDate() : Date` 602 | 603 | **Description:** Returns the effective end date of this instance of the promotion. If no explicit end date is defined for the promotion, the end date of the containing Campaign or AB-test is returned. 604 | 605 | **Returns:** 606 | 607 | End date of the promotion, or null if no end date is defined. 608 | 609 | --- 610 | 611 | ### getExclusivity 612 | 613 | **Signature:** `getExclusivity() : String` 614 | 615 | **Description:** Returns the promotion's exclusivity specifying how the promotion can be combined with other promotions. Possible values are EXCLUSIVITY_NO, EXCLUSIVITY_CLASS and EXCLUSIVITY_GLOBAL. 616 | 617 | **Returns:** 618 | 619 | Promotion exclusivity 620 | 621 | --- 622 | 623 | ### getID 624 | 625 | **Signature:** `getID() : String` 626 | 627 | **Description:** Returns the unique ID of the promotion. 628 | 629 | **Returns:** 630 | 631 | ID of the promotion. 632 | 633 | --- 634 | 635 | ### getImage 636 | 637 | **Signature:** `getImage() : MediaFile` 638 | 639 | **Description:** Returns the reference to the promotion image. 640 | 641 | **Returns:** 642 | 643 | Image of the promotion. 644 | 645 | --- 646 | 647 | ### getLastModified 648 | 649 | **Signature:** `getLastModified() : Date` 650 | 651 | **Description:** Returns the date that this object was last modified. 652 | 653 | **Returns:** 654 | 655 | the date that this object was last modified. 656 | 657 | --- 658 | 659 | ### getMutuallyExclusivePromotions 660 | 661 | **Signature:** `getMutuallyExclusivePromotions() : String[]` 662 | 663 | **Description:** Returns the promotion's mutually exclusive Promotions. Mutually exclusive Promotions is a set of promotions or groups this promotion cannot be combined with. 664 | 665 | **Returns:** 666 | 667 | The promotion's set of mutually exclusive Promotions. 668 | 669 | --- 670 | 671 | ### getName 672 | 673 | **Signature:** `getName() : String` 674 | 675 | **Description:** Returns the name of the promotion. 676 | 677 | **Returns:** 678 | 679 | Name of the promotion. 680 | 681 | --- 682 | 683 | ### getPromotionalPrice 684 | 685 | **Signature:** `getPromotionalPrice(product : Product) : Money` 686 | 687 | **Description:** Returns the promotional price for the specified product. The promotional price is only returned if the following conditions are met: this promotion is a product promotion without purchase conditions, i.e. is of type 'Without qualifying products'. this promotion's discount is Discount.TYPE_AMOUNT, Discount.TYPE_PERCENTAGE, Discount.TYPE_FIXED_PRICE, or Discount.TYPE_PRICEBOOK_PRICE. specified product is one of the discounted products of the promotion. the product has a valid sales price for quantity 1.0. In all other cases, the method will return Money.NOT_AVAILABLE. It is not required that this promotion be an active customer promotion. NOTE: the method might be extended in the future to support more promotion types. To calculate the promotional price, the method uses the current sales price of the product for quantity 1.0, and applies the discount associated with the promotion to this price. For example, if the product price is $14.99, and the promotion discount is 10%, the method will return $13.49. If the discount is $2 off, the method will return $12.99. If the discount is $10.00 fixed price, the method will return $10.00. 688 | 689 | **Parameters:** 690 | 691 | - `product`: the product to calculate the discount for 692 | 693 | **Returns:** 694 | 695 | the price of the passed product after promotional discount is applied, or Money.NOT_AVAILABLE if any of the restrictions on product or promotion are not met. 696 | 697 | --- 698 | 699 | ### getPromotionalPrice 700 | 701 | **Signature:** `getPromotionalPrice(product : Product, optionModel : ProductOptionModel) : Money` 702 | 703 | **Description:** This method follows the same logic as getPromotionalPrice(Product) but prices are calculated based on the option values selected in the specified option model. 704 | 705 | **Parameters:** 706 | 707 | - `product`: the product to calculate the discount for 708 | - `optionModel`: the option model to use when calculating 709 | 710 | **Returns:** 711 | 712 | the price of the passed product after promotional discount is applied, or Money.NOT_AVAILABLE if any of the restrictions on product or promotion are not met. 713 | 714 | --- 715 | 716 | ### getPromotionClass 717 | 718 | **Signature:** `getPromotionClass() : String` 719 | 720 | **Description:** Returns the promotion class indicating the general type of the promotion. Possible values are PROMOTION_CLASS_PRODUCT, PROMOTION_CLASS_ORDER, and PROMOTION_CLASS_SHIPPING. 721 | 722 | **Returns:** 723 | 724 | Promotion class or null if the promotion rule has not been configured. 725 | 726 | --- 727 | 728 | ### getQualifierMatchMode 729 | 730 | **Signature:** `getQualifierMatchMode() : String` 731 | 732 | **Description:** Returns the qualifier matching mode specified by this promotion. A promotion may have up to 3 qualifier conditions based on whether it is customer-group based, coupon based, and/or source-code based. A promotion may require for example that a customer belong to a certain customer group and also have a certain coupon in the cart in order for the promotion to apply. This method returns QUALIFIER_MATCH_MODE_ALL if it is necessary that all the qualifier conditions are satisfied in order for this promotion to apply for a given customer. Otherwise, this method returns QUALIFIER_MATCH_MODE_ANY indicating that at least of the qualifier conditions must be satisfied. Note: currently QUALIFIER_MATCH_MODE_ALL is only supported for promotions assigned to campaigns, and not those assigned to AB-tests. 733 | 734 | **Returns:** 735 | 736 | the qualifier matching mode specified by this promotion, either QUALIFIER_MATCH_MODE_ALL or QUALIFIER_MATCH_MODE_ANY. 737 | 738 | --- 739 | 740 | ### getRank 741 | 742 | **Signature:** `getRank() : Number` 743 | 744 | **Description:** Returns the promotion's rank. Rank is a numeric attribute that you can specify. Promotions with a defined rank are calculated before promotions without a defined rank. If two promotions have a rank, the one with the lowest rank is calculated first. For example, a promotion with rank 10 is calculated before one with rank 30. 745 | 746 | **Returns:** 747 | 748 | The promotion's rank. 749 | 750 | --- 751 | 752 | ### getSourceCodeGroups 753 | 754 | **Signature:** `getSourceCodeGroups() : Collection` 755 | 756 | **Description:** Returns the source code groups directly assigned to the promotion or assigned to the campaign of the promotion. If the promotion is not based on source code groups (see isBasedOnSourceCodes()), or no source code group is assigned to the promotion or its campaign, an empty collection is returned. 757 | 758 | **Returns:** 759 | 760 | Source code groups assigned to promotion in no particular order. 761 | 762 | --- 763 | 764 | ### getStartDate 765 | 766 | **Signature:** `getStartDate() : Date` 767 | 768 | **Description:** Returns the effective start date of this instance of the promotion. If no explicit start date is defined for this instance, the start date of the containing Campaign or AB-test is returned. 769 | 770 | **Returns:** 771 | 772 | Start date of the promotion, or null if no start date is defined. 773 | 774 | --- 775 | 776 | ### getTags 777 | 778 | **Signature:** `getTags() : String[]` 779 | 780 | **Description:** Returns the promotion's tags. Tags are a way of categorizing and organizing promotions. A promotion can have many tags. Tags will be returned in alphabetical order. 781 | 782 | **Returns:** 783 | 784 | The promotion's set of tags. 785 | 786 | --- 787 | 788 | ### isActive 789 | 790 | **Signature:** `isActive() : boolean` 791 | 792 | **Description:** Returns 'true' if promotion is active, otherwise 'false'. A promotion is active if its campaign is active, and the promotion is enabled, and it is scheduled for now. 793 | 794 | **Returns:** 795 | 796 | true if promotion is active, otherwise false. 797 | 798 | --- 799 | 800 | ### isBasedOnCoupon 801 | 802 | **Signature:** `isBasedOnCoupon() : boolean` 803 | 804 | **Description:** Returns 'true' if the promotion is triggered by a coupon, false otherwise. 805 | 806 | **Deprecated:** 807 | 808 | Use isBasedOnCoupons() 809 | 810 | **Returns:** 811 | 812 | true if promotion is triggered by coupon, otherwise false. 813 | 814 | --- 815 | 816 | ### isBasedOnCoupons 817 | 818 | **Signature:** `isBasedOnCoupons() : boolean` 819 | 820 | **Description:** Returns 'true' if the promotion is triggered by coupons, false otherwise. 821 | 822 | **Returns:** 823 | 824 | true if promotion is triggered by coupons, otherwise false. 825 | 826 | --- 827 | 828 | ### isBasedOnCustomerGroups 829 | 830 | **Signature:** `isBasedOnCustomerGroups() : boolean` 831 | 832 | **Description:** Returns 'true' if the promotion is triggered by customer groups, false otherwise. 833 | 834 | **Returns:** 835 | 836 | true if promotion is triggered by customer groups, otherwise false. 837 | 838 | --- 839 | 840 | ### isBasedOnSourceCodes 841 | 842 | **Signature:** `isBasedOnSourceCodes() : boolean` 843 | 844 | **Description:** Returns 'true' if the promotion is triggered by source codes, false otherwise. 845 | 846 | **Returns:** 847 | 848 | true if promotion is triggered by source codes, otherwise false. 849 | 850 | --- 851 | 852 | ### isEnabled 853 | 854 | **Signature:** `isEnabled() : boolean` 855 | 856 | **Description:** Returns true if promotion is enabled, otherwise false. 857 | 858 | **Returns:** 859 | 860 | true if promotion is enabled, otherwise false. 861 | 862 | --- 863 | 864 | ### isRefinable 865 | 866 | **Signature:** `isRefinable() : boolean` 867 | 868 | **Description:** Returns true if promotion is refinable, otherwise false. 869 | 870 | **Returns:** 871 | 872 | true if promotion is refinable, otherwise false. 873 | 874 | --- ```