@salesforce/b2c-cli 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev.js +8 -8
- package/bin/run.js +5 -7
- package/content/guidance/b2c/b2c-business-manager-extensions/SKILL.md +361 -0
- package/content/guidance/b2c/b2c-business-manager-extensions/references/EXTENSIONS-XML.md +458 -0
- package/content/guidance/b2c/b2c-controllers/SKILL.md +301 -0
- package/content/guidance/b2c/b2c-controllers/references/CLASSIC-PATTERNS.md +335 -0
- package/content/guidance/b2c/b2c-controllers/references/SFRA-PATTERNS.md +400 -0
- package/content/guidance/b2c/b2c-custom-api-development/SKILL.md +281 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/CONTRACT.md +142 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/IMPLEMENTATION.md +153 -0
- package/content/guidance/b2c/b2c-custom-api-development/references/TESTING.md +118 -0
- package/content/guidance/b2c/b2c-custom-caches/SKILL.md +279 -0
- package/content/guidance/b2c/b2c-custom-job-steps/SKILL.md +520 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/CHUNK-ORIENTED.md +377 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/JOBS-XML.md +212 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/STEPTYPES-JSON.md +373 -0
- package/content/guidance/b2c/b2c-custom-job-steps/references/TASK-ORIENTED.md +344 -0
- package/content/guidance/b2c/b2c-custom-objects/SKILL.md +327 -0
- package/content/guidance/b2c/b2c-custom-objects/references/OCAPI-SEARCH.md +298 -0
- package/content/guidance/b2c/b2c-forms/SKILL.md +242 -0
- package/content/guidance/b2c/b2c-forms/references/FORM-XML.md +409 -0
- package/content/guidance/b2c/b2c-hooks/SKILL.md +500 -0
- package/content/guidance/b2c/b2c-hooks/references/OCAPI-SCAPI-HOOKS.md +403 -0
- package/content/guidance/b2c/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +169 -0
- package/content/guidance/b2c/b2c-hooks/references/SYSTEM-HOOKS.md +433 -0
- package/content/guidance/b2c/b2c-isml/SKILL.md +320 -0
- package/content/guidance/b2c/b2c-isml/references/EXPRESSIONS.md +366 -0
- package/content/guidance/b2c/b2c-isml/references/TAGS.md +443 -0
- package/content/guidance/b2c/b2c-localization/SKILL.md +344 -0
- package/content/guidance/b2c/b2c-localization/references/PATTERNS.md +407 -0
- package/content/guidance/b2c/b2c-logging/SKILL.md +352 -0
- package/content/guidance/b2c/b2c-logging/references/LOG-FILES.md +282 -0
- package/content/guidance/b2c/b2c-metadata/SKILL.md +406 -0
- package/content/guidance/b2c/b2c-metadata/references/SYSTEM-OBJECTS.md +320 -0
- package/content/guidance/b2c/b2c-metadata/references/XML-EXAMPLES.md +366 -0
- package/content/guidance/b2c/b2c-onboarding/SKILL.md +154 -0
- package/content/guidance/b2c/b2c-ordering/SKILL.md +391 -0
- package/content/guidance/b2c/b2c-page-designer/SKILL.md +410 -0
- package/content/guidance/b2c/b2c-page-designer/references/ATTRIBUTE-TYPES.md +436 -0
- package/content/guidance/b2c/b2c-page-designer/references/META-DEFINITIONS.md +340 -0
- package/content/guidance/b2c/b2c-querying-data/SKILL.md +289 -0
- package/content/guidance/b2c/b2c-querying-data/references/PERFORMANCE-APIS.md +74 -0
- package/content/guidance/b2c/b2c-scapi-admin/SKILL.md +53 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +440 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/INTEGRATION-PATTERNS.md +518 -0
- package/content/guidance/b2c/b2c-scapi-admin/references/OAUTH-SCOPES.md +337 -0
- package/content/guidance/b2c/b2c-scapi-shopper/SKILL.md +56 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CHECKOUT-FLOW.md +466 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +351 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/COMMON-PATTERNS.md +390 -0
- package/content/guidance/b2c/b2c-scapi-shopper/references/SCOPES.md +290 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/SKILL.md +420 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/PASSKEYS.md +126 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/SESSION-BRIDGE.md +267 -0
- package/content/guidance/b2c/b2c-slas-auth-patterns/references/TOKEN-LIFECYCLE.md +367 -0
- package/content/guidance/b2c/b2c-webservices/SKILL.md +318 -0
- package/content/guidance/b2c/b2c-webservices/references/FTP-SERVICES.md +524 -0
- package/content/guidance/b2c/b2c-webservices/references/HTTP-SERVICES.md +578 -0
- package/content/guidance/b2c/b2c-webservices/references/SERVICES-XML.md +351 -0
- package/content/guidance/b2c/b2c-webservices/references/SOAP-SERVICES.md +587 -0
- package/content/guidance/b2c-cli/b2c-am/SKILL.md +277 -0
- package/content/guidance/b2c-cli/b2c-bm-users-roles/SKILL.md +210 -0
- package/content/guidance/b2c-cli/b2c-cap/SKILL.md +131 -0
- package/content/guidance/b2c-cli/b2c-cip/SKILL.md +116 -0
- package/content/guidance/b2c-cli/b2c-cip/references/KNOWN_TABLES.md +105 -0
- package/content/guidance/b2c-cli/b2c-cip/references/SALES_ANALYSIS.md +50 -0
- package/content/guidance/b2c-cli/b2c-cip/references/STARTER_QUERIES.md +147 -0
- package/content/guidance/b2c-cli/b2c-code/SKILL.md +146 -0
- package/content/guidance/b2c-cli/b2c-config/SKILL.md +462 -0
- package/content/guidance/b2c-cli/b2c-content/SKILL.md +176 -0
- package/content/guidance/b2c-cli/b2c-debug/SKILL.md +138 -0
- package/content/guidance/b2c-cli/b2c-docs/SKILL.md +301 -0
- package/content/guidance/b2c-cli/b2c-ecdn/SKILL.md +135 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/ADVANCED.md +97 -0
- package/content/guidance/b2c-cli/b2c-ecdn/references/SECURITY.md +75 -0
- package/content/guidance/b2c-cli/b2c-import-set-migrations/SKILL.md +265 -0
- package/content/guidance/b2c-cli/b2c-job/SKILL.md +64 -0
- package/content/guidance/b2c-cli/b2c-job/references/EXPORT.md +121 -0
- package/content/guidance/b2c-cli/b2c-job/references/IMPORT.md +55 -0
- package/content/guidance/b2c-cli/b2c-job/references/RUN-AND-MONITOR.md +119 -0
- package/content/guidance/b2c-cli/b2c-logs/SKILL.md +249 -0
- package/content/guidance/b2c-cli/b2c-metrics/SKILL.md +315 -0
- package/content/guidance/b2c-cli/b2c-mrt/SKILL.md +207 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/BUNDLE-COMMANDS.md +203 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/ENVIRONMENT-COMMANDS.md +218 -0
- package/content/guidance/b2c-cli/b2c-mrt/references/PROJECT-COMMANDS.md +154 -0
- package/content/guidance/b2c-cli/b2c-sandbox/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-scapi-custom/SKILL.md +126 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/SKILL.md +66 -0
- package/content/guidance/b2c-cli/b2c-scapi-schemas/references/CLI-EXAMPLES.md +108 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/SKILL.md +57 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/IMPORT-OPTIONS.md +118 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/METADATA-XML.md +381 -0
- package/content/guidance/b2c-cli/b2c-site-import-export/references/WORKFLOWS.md +182 -0
- package/content/guidance/b2c-cli/b2c-sites/SKILL.md +112 -0
- package/content/guidance/b2c-cli/b2c-slas/SKILL.md +182 -0
- package/content/guidance/b2c-cli/b2c-webdav/SKILL.md +186 -0
- package/content/guidance/b2c-ops/b2c-checkout-triage/SKILL.md +68 -0
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +75 -0
- package/content/guidance/b2c-ops/b2c-job-health/references/job-logs.md +21 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/SKILL.md +66 -0
- package/content/guidance/b2c-ops/b2c-order-failure-triage/references/order-evidence.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/SKILL.md +87 -0
- package/content/guidance/b2c-ops/b2c-production-triage/references/escalation.md +57 -0
- package/content/guidance/index.json +1949 -0
- package/content/guidance/storefront-next/sfnext-accessibility/SKILL.md +103 -0
- package/content/guidance/storefront-next/sfnext-accessibility/references/checklist.md +64 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/SKILL.md +91 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
- package/content/guidance/storefront-next/sfnext-authentication/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/COOKIES.md +39 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/SKILL.md +67 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
- package/content/guidance/storefront-next/sfnext-components/SKILL.md +153 -0
- package/content/guidance/storefront-next/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
- package/content/guidance/storefront-next/sfnext-components/references/SHAPE-TOKENS.md +51 -0
- package/content/guidance/storefront-next/sfnext-components/references/STORYBOOK.md +54 -0
- package/content/guidance/storefront-next/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
- package/content/guidance/storefront-next/sfnext-components/references/TROUBLESHOOTING.md +19 -0
- package/content/guidance/storefront-next/sfnext-configuration/SKILL.md +163 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/SKILL.md +140 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/ACTIONS.md +53 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADERS.md +73 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/SCAPI-FETCHER.md +39 -0
- package/content/guidance/storefront-next/sfnext-deployment/SKILL.md +127 -0
- package/content/guidance/storefront-next/sfnext-deployment/references/MRT-DEPLOYMENT.md +59 -0
- package/content/guidance/storefront-next/sfnext-extensions/SKILL.md +118 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/BASE-AUDIT.md +68 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/EXTENSION-EXAMPLES.md +79 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/SKILL.md +93 -0
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +86 -0
- package/content/guidance/storefront-next/sfnext-i18n/SKILL.md +152 -0
- package/content/guidance/storefront-next/sfnext-i18n/references/locale-config.md +35 -0
- package/content/guidance/storefront-next/sfnext-overview/SKILL.md +101 -0
- package/content/guidance/storefront-next/sfnext-page-designer/SKILL.md +202 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/COMPONENT-REGISTRY.md +111 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/DECORATOR-PATTERNS.md +168 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
- package/content/guidance/storefront-next/sfnext-performance/SKILL.md +102 -0
- package/content/guidance/storefront-next/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
- package/content/guidance/storefront-next/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
- package/content/guidance/storefront-next/sfnext-project-setup/SKILL.md +147 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SCRIPTS.md +47 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/SKILL.md +70 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
- package/content/guidance/storefront-next/sfnext-revalidation/SKILL.md +121 -0
- package/content/guidance/storefront-next/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
- package/content/guidance/storefront-next/sfnext-routing/SKILL.md +123 -0
- package/content/guidance/storefront-next/sfnext-routing/references/ROUTE-CONVENTIONS.md +65 -0
- package/content/guidance/storefront-next/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
- package/content/guidance/storefront-next/sfnext-scapi/SKILL.md +126 -0
- package/content/guidance/storefront-next/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/SKILL.md +129 -0
- package/content/guidance/storefront-next/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/references/TURNSTILE.md +43 -0
- package/content/guidance/storefront-next/sfnext-seo/SKILL.md +95 -0
- package/content/guidance/storefront-next/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
- package/content/guidance/storefront-next/sfnext-seo/references/SEO-ROUTES.md +31 -0
- package/content/guidance/storefront-next/sfnext-state-management/SKILL.md +114 -0
- package/content/guidance/storefront-next/sfnext-state-management/references/PATTERNS.md +45 -0
- package/content/guidance/storefront-next/sfnext-testing/SKILL.md +151 -0
- package/content/guidance/storefront-next/sfnext-testing/references/E2E.md +38 -0
- package/content/guidance/storefront-next/sfnext-testing/references/STORYBOOK-PATTERNS.md +97 -0
- package/content/guidance/storefront-next/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
- package/content/guidance/storefront-next/sfnext-theming/SKILL.md +104 -0
- package/content/guidance/storefront-next/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
- package/dist/commands/cap/install.d.ts +1 -0
- package/dist/commands/cap/list.d.ts +1 -0
- package/dist/commands/cap/pull.d.ts +1 -0
- package/dist/commands/cap/tasks.d.ts +1 -0
- package/dist/commands/cap/uninstall.d.ts +1 -0
- package/dist/commands/cip/describe.d.ts +1 -0
- package/dist/commands/cip/query.d.ts +1 -0
- package/dist/commands/cip/report/bot-traffic-share.d.ts +1 -0
- package/dist/commands/cip/report/checkout-funnel-dropoff.d.ts +1 -0
- package/dist/commands/cip/report/controller-error-rate-trend.d.ts +1 -0
- package/dist/commands/cip/report/controller-health-scorecard.d.ts +1 -0
- package/dist/commands/cip/report/customer-registration-trends.d.ts +1 -0
- package/dist/commands/cip/report/discount-depth-breakdown.d.ts +1 -0
- package/dist/commands/cip/report/inventory-stockout-by-location.d.ts +1 -0
- package/dist/commands/cip/report/new-vs-returning-buyer-revenue.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-client-usage.d.ts +1 -0
- package/dist/commands/cip/report/ocapi-requests.d.ts +1 -0
- package/dist/commands/cip/report/payment-method-performance.d.ts +1 -0
- package/dist/commands/cip/report/product-co-purchase-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-discount-analysis.d.ts +1 -0
- package/dist/commands/cip/report/promotion-roi-leaderboard.d.ts +1 -0
- package/dist/commands/cip/report/recommender-effectiveness.d.ts +1 -0
- package/dist/commands/cip/report/remote-include-performance.d.ts +1 -0
- package/dist/commands/cip/report/revenue-by-channel.d.ts +1 -0
- package/dist/commands/cip/report/sales-analytics.d.ts +1 -0
- package/dist/commands/cip/report/sales-summary.d.ts +1 -0
- package/dist/commands/cip/report/scapi-cache-hit-ratio.d.ts +1 -0
- package/dist/commands/cip/report/scapi-error-rate-by-status.d.ts +1 -0
- package/dist/commands/cip/report/scapi-latency-distribution.d.ts +1 -0
- package/dist/commands/cip/report/scapi-traffic-latency.d.ts +1 -0
- package/dist/commands/cip/report/search-query-performance.d.ts +1 -0
- package/dist/commands/cip/report/top-referrers.d.ts +1 -0
- package/dist/commands/cip/report/top-selling-products.d.ts +1 -0
- package/dist/commands/cip/report/zero-result-searches.d.ts +1 -0
- package/dist/commands/cip/tables.d.ts +1 -0
- package/dist/commands/code/activate.d.ts +1 -0
- package/dist/commands/code/delete.d.ts +1 -0
- package/dist/commands/code/deploy.d.ts +1 -0
- package/dist/commands/code/download.d.ts +1 -0
- package/dist/commands/code/watch.d.ts +1 -0
- package/dist/commands/commands/search.d.ts +35 -0
- package/dist/commands/commands/search.js +85 -0
- package/dist/commands/commands/search.js.map +1 -0
- package/dist/commands/content/export.d.ts +1 -0
- package/dist/commands/content/list.d.ts +1 -0
- package/dist/commands/content/validate.d.ts +1 -0
- package/dist/commands/debug/cli.d.ts +1 -0
- package/dist/commands/debug/index.d.ts +1 -0
- package/dist/commands/docs/cache.d.ts +1 -0
- package/dist/commands/docs/download.d.ts +1 -0
- package/dist/commands/docs/read.d.ts +1 -0
- package/dist/commands/docs/schema.d.ts +1 -0
- package/dist/commands/docs/search.d.ts +1 -0
- package/dist/commands/docs/skill.d.ts +41 -0
- package/dist/commands/docs/skill.js +183 -0
- package/dist/commands/docs/skill.js.map +1 -0
- package/dist/commands/ecdn/cache/purge.d.ts +1 -0
- package/dist/commands/ecdn/certificates/add.d.ts +1 -0
- package/dist/commands/ecdn/certificates/delete.d.ts +1 -0
- package/dist/commands/ecdn/certificates/list.d.ts +1 -0
- package/dist/commands/ecdn/certificates/update.d.ts +1 -0
- package/dist/commands/ecdn/certificates/validate.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/get.d.ts +1 -0
- package/dist/commands/ecdn/cipher-suites/update.d.ts +1 -0
- package/dist/commands/ecdn/firewall/create.d.ts +1 -0
- package/dist/commands/ecdn/firewall/delete.d.ts +1 -0
- package/dist/commands/ecdn/firewall/get.d.ts +1 -0
- package/dist/commands/ecdn/firewall/list.d.ts +1 -0
- package/dist/commands/ecdn/firewall/reorder.d.ts +1 -0
- package/dist/commands/ecdn/firewall/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/create.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/delete.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/get.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/list.d.ts +1 -0
- package/dist/commands/ecdn/logpush/jobs/update.d.ts +1 -0
- package/dist/commands/ecdn/logpush/ownership.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/create.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/get.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/delete.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mrt-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/mtls/create.d.ts +1 -0
- package/dist/commands/ecdn/mtls/delete.d.ts +1 -0
- package/dist/commands/ecdn/mtls/get.d.ts +1 -0
- package/dist/commands/ecdn/mtls/issue.d.ts +1 -0
- package/dist/commands/ecdn/mtls/list.d.ts +1 -0
- package/dist/commands/ecdn/mtls/setup.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/delete.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/get.d.ts +1 -0
- package/dist/commands/ecdn/origin-headers/set.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/notifications/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/create.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/delete.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/list.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/policies/update.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/get.d.ts +1 -0
- package/dist/commands/ecdn/page-shield/scripts/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/create.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/delete.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/get.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/list.d.ts +1 -0
- package/dist/commands/ecdn/rate-limit/update.d.ts +1 -0
- package/dist/commands/ecdn/security/get.d.ts +1 -0
- package/dist/commands/ecdn/security/update.d.ts +1 -0
- package/dist/commands/ecdn/speed/get.d.ts +1 -0
- package/dist/commands/ecdn/speed/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/groups/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/managed-rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/migrate.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/owasp/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/get.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rules/update.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/list.d.ts +1 -0
- package/dist/commands/ecdn/waf/rulesets/update.d.ts +1 -0
- package/dist/commands/ecdn/zones/create.d.ts +1 -0
- package/dist/commands/ecdn/zones/list.d.ts +1 -0
- package/dist/commands/job/execution/delete.d.ts +1 -0
- package/dist/commands/job/export.d.ts +1 -0
- package/dist/commands/job/import-set.d.ts +1 -0
- package/dist/commands/job/import.d.ts +1 -0
- package/dist/commands/job/log.d.ts +1 -0
- package/dist/commands/job/run.d.ts +1 -0
- package/dist/commands/job/search.d.ts +1 -0
- package/dist/commands/job/wait.d.ts +1 -0
- package/dist/commands/logs/get.d.ts +1 -0
- package/dist/commands/logs/list.d.ts +1 -0
- package/dist/commands/logs/tail.d.ts +1 -0
- package/dist/commands/metrics/controller.d.ts +1 -0
- package/dist/commands/metrics/ecdn.d.ts +1 -0
- package/dist/commands/metrics/mrt.d.ts +1 -0
- package/dist/commands/metrics/ocapi.d.ts +1 -0
- package/dist/commands/metrics/overall.d.ts +1 -0
- package/dist/commands/metrics/sales.d.ts +1 -0
- package/dist/commands/metrics/scapi-hooks.d.ts +1 -0
- package/dist/commands/metrics/scapi.d.ts +1 -0
- package/dist/commands/metrics/third-party.d.ts +1 -0
- package/dist/commands/mrt/bundle/delete.d.ts +1 -0
- package/dist/commands/mrt/bundle/deploy.d.ts +1 -0
- package/dist/commands/mrt/bundle/download.d.ts +1 -0
- package/dist/commands/mrt/bundle/history.d.ts +1 -0
- package/dist/commands/mrt/bundle/list.d.ts +1 -0
- package/dist/commands/mrt/bundle/save.d.ts +1 -0
- package/dist/commands/mrt/bundle/upload-v2.d.ts +1 -0
- package/dist/commands/mrt/env/access-control/list.d.ts +1 -0
- package/dist/commands/mrt/env/b2c.d.ts +1 -0
- package/dist/commands/mrt/env/clone.d.ts +1 -0
- package/dist/commands/mrt/env/create.d.ts +1 -0
- package/dist/commands/mrt/env/delete.d.ts +1 -0
- package/dist/commands/mrt/env/get.d.ts +1 -0
- package/dist/commands/mrt/env/invalidate.d.ts +1 -0
- package/dist/commands/mrt/env/list.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/clone.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/create.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/delete.d.ts +1 -0
- package/dist/commands/mrt/env/redirect/list.d.ts +1 -0
- package/dist/commands/mrt/env/update.d.ts +1 -0
- package/dist/commands/mrt/env/var/delete.d.ts +1 -0
- package/dist/commands/mrt/env/var/list.d.ts +1 -0
- package/dist/commands/mrt/env/var/push.d.ts +1 -0
- package/dist/commands/mrt/env/var/set.d.ts +1 -0
- package/dist/commands/mrt/org/b2c.d.ts +1 -0
- package/dist/commands/mrt/org/cert/create.d.ts +1 -0
- package/dist/commands/mrt/org/cert/delete.d.ts +1 -0
- package/dist/commands/mrt/org/cert/get.d.ts +1 -0
- package/dist/commands/mrt/org/cert/list.d.ts +1 -0
- package/dist/commands/mrt/org/cert/restart-validation.d.ts +1 -0
- package/dist/commands/mrt/org/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/add.d.ts +1 -0
- package/dist/commands/mrt/org/member/get.d.ts +1 -0
- package/dist/commands/mrt/org/member/list.d.ts +1 -0
- package/dist/commands/mrt/org/member/remove.d.ts +1 -0
- package/dist/commands/mrt/org/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/create.d.ts +1 -0
- package/dist/commands/mrt/project/delete.d.ts +1 -0
- package/dist/commands/mrt/project/get.d.ts +1 -0
- package/dist/commands/mrt/project/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/add.d.ts +1 -0
- package/dist/commands/mrt/project/member/get.d.ts +1 -0
- package/dist/commands/mrt/project/member/list.d.ts +1 -0
- package/dist/commands/mrt/project/member/remove.d.ts +1 -0
- package/dist/commands/mrt/project/member/update.d.ts +1 -0
- package/dist/commands/mrt/project/notification/delete.d.ts +1 -0
- package/dist/commands/mrt/project/notification/get.d.ts +1 -0
- package/dist/commands/mrt/project/update.d.ts +1 -0
- package/dist/commands/mrt/save-credentials.d.ts +1 -0
- package/dist/commands/mrt/tail-logs.d.ts +1 -0
- package/dist/commands/mrt/user/api-key.d.ts +1 -0
- package/dist/commands/mrt/user/email-prefs.d.ts +1 -0
- package/dist/commands/mrt/user/profile.d.ts +1 -0
- package/dist/commands/scaffold/init.js +2 -1
- package/dist/commands/scaffold/init.js.map +1 -1
- package/dist/commands/scapi/custom/status.d.ts +1 -0
- package/dist/commands/scapi/schemas/get.d.ts +1 -0
- package/dist/commands/scapi/schemas/list.d.ts +1 -0
- package/dist/commands/setup/ide/tsserver-plugin.d.ts +1 -0
- package/dist/commands/setup/ide/vscode-types.d.ts +1 -0
- package/dist/commands/setup/index.js +4 -3
- package/dist/commands/setup/index.js.map +1 -1
- package/dist/commands/setup/inspect.d.ts +1 -0
- package/dist/commands/setup/inspect.js +17 -2
- package/dist/commands/setup/inspect.js.map +1 -1
- package/dist/commands/setup/instance/create.d.ts +1 -0
- package/dist/commands/setup/instance/list.d.ts +1 -0
- package/dist/commands/setup/instance/remove.d.ts +1 -0
- package/dist/commands/setup/instance/set-active.d.ts +1 -0
- package/dist/commands/setup/openshell.d.ts +1 -0
- package/dist/commands/setup/skills.d.ts +1 -0
- package/dist/commands/slas/client/create.d.ts +1 -0
- package/dist/commands/slas/client/delete.d.ts +1 -0
- package/dist/commands/slas/client/get.d.ts +1 -0
- package/dist/commands/slas/client/list.d.ts +1 -0
- package/dist/commands/slas/client/open.d.ts +1 -0
- package/dist/commands/slas/client/update.d.ts +1 -0
- package/dist/commands/slas/token.d.ts +1 -0
- package/dist/commands/slas/token.js +2 -1
- package/dist/commands/slas/token.js.map +1 -1
- package/dist/commands/webdav/get.d.ts +1 -0
- package/dist/commands/webdav/rm.d.ts +1 -0
- package/dist/help.d.ts +25 -0
- package/dist/help.js +96 -0
- package/dist/help.js.map +1 -0
- package/dist/lib/scaffold/generate-helper.js +3 -2
- package/dist/lib/scaffold/generate-helper.js.map +1 -1
- package/dist/lib/skills.d.ts +19 -0
- package/dist/lib/skills.js +75 -0
- package/dist/lib/skills.js.map +1 -0
- package/dist/utils/cip/command.d.ts +1 -0
- package/dist/utils/ecdn/zone-command.d.ts +1 -0
- package/dist/utils/slas/client.d.ts +1 -0
- package/oclif.manifest.json +21814 -18473
- package/package.json +11 -5
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# OCAPI/SCAPI Hooks Reference
|
|
2
|
+
|
|
3
|
+
OCAPI and SCAPI share the same hooks. Registering a hook for OCAPI also applies to SCAPI endpoints.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Enable hooks in Business Manager:
|
|
8
|
+
**Administration > Global Preferences > Feature Switches > Enable Salesforce Commerce Cloud API hook execution**
|
|
9
|
+
|
|
10
|
+
## Hook Naming Convention
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
dw.ocapi.shop.<resource>.<sub-resource>.<hookType><METHOD>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Hook types: `before<METHOD>`, `after<METHOD>`, `modify<METHOD>Response`, `validate<Resource>`
|
|
17
|
+
|
|
18
|
+
## Complete Hook Reference
|
|
19
|
+
|
|
20
|
+
### Authentication
|
|
21
|
+
|
|
22
|
+
| Hook | Signature |
|
|
23
|
+
|------|-----------|
|
|
24
|
+
| `dw.ocapi.shop.auth.beforePOST` | `beforePOST(authHeader: String, authType: EnumValue): Status` |
|
|
25
|
+
| `dw.ocapi.shop.auth.afterPOST` | `afterPOST(customer: Customer, authType: EnumValue): Status` |
|
|
26
|
+
| `dw.ocapi.shop.auth.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, authType): Status` |
|
|
27
|
+
|
|
28
|
+
### Basket
|
|
29
|
+
|
|
30
|
+
| Hook | Signature |
|
|
31
|
+
|------|-----------|
|
|
32
|
+
| `dw.ocapi.shop.basket.beforeGET` | `beforeGET(basketId: String): Status` |
|
|
33
|
+
| `dw.ocapi.shop.basket.beforePATCH` | `beforePATCH(basket: Basket, input): Status` |
|
|
34
|
+
| `dw.ocapi.shop.basket.beforePOST_v2` | `beforePOST(basket: Basket): Status` |
|
|
35
|
+
| `dw.ocapi.shop.basket.beforeDELETE` | `beforeDELETE(basket: Basket): Status` |
|
|
36
|
+
| `dw.ocapi.shop.basket.afterPOST` | `afterPOST(basket: Basket): Status` |
|
|
37
|
+
| `dw.ocapi.shop.basket.afterPATCH` | `afterPATCH(basket: Basket, input): Status` |
|
|
38
|
+
| `dw.ocapi.shop.basket.afterDELETE` | `afterDELETE(basketId: String): Status` |
|
|
39
|
+
| `dw.ocapi.shop.basket.modifyGETResponse` | `modifyGETResponse(basket: Basket, response): Status` |
|
|
40
|
+
| `dw.ocapi.shop.basket.modifyPATCHResponse` | `modifyPATCHResponse(basket: Basket, response): Status` |
|
|
41
|
+
| `dw.ocapi.shop.basket.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response): Status` |
|
|
42
|
+
| `dw.ocapi.shop.basket.validateBasket` | `validateBasket(response, duringSubmit: boolean): Status` |
|
|
43
|
+
| `dw.ocapi.baskets.actions.afterMerge` | `afterMerge(basket: Basket): Status` |
|
|
44
|
+
| `dw.ocapi.baskets.actions.afterTransfer` | `afterTransfer(basket: Basket): Status` |
|
|
45
|
+
|
|
46
|
+
### Basket Billing Address
|
|
47
|
+
|
|
48
|
+
| Hook | Signature |
|
|
49
|
+
|------|-----------|
|
|
50
|
+
| `dw.ocapi.shop.basket.billing_address.beforePUT` | `beforePUT(basket: Basket, address): Status` |
|
|
51
|
+
| `dw.ocapi.shop.basket.billing_address.afterPUT` | `afterPUT(basket: Basket, address): Status` |
|
|
52
|
+
| `dw.ocapi.shop.basket.billing_address.modifyPUTResponse` | `modifyPUTResponse(basket: Basket, response, address): Status` |
|
|
53
|
+
|
|
54
|
+
### Basket Customer
|
|
55
|
+
|
|
56
|
+
| Hook | Signature |
|
|
57
|
+
|------|-----------|
|
|
58
|
+
| `dw.ocapi.shop.basket.customer.beforePUT` | `beforePUT(basket: Basket, customerInfo): Status` |
|
|
59
|
+
| `dw.ocapi.shop.basket.customer.afterPUT` | `afterPUT(basket: Basket, customerInfo): Status` |
|
|
60
|
+
| `dw.ocapi.shop.basket.customer.modifyPUTResponse` | `modifyPUTResponse(basket: Basket, response, customerInfo): Status` |
|
|
61
|
+
|
|
62
|
+
### Basket Coupon
|
|
63
|
+
|
|
64
|
+
| Hook | Signature |
|
|
65
|
+
|------|-----------|
|
|
66
|
+
| `dw.ocapi.shop.basket.coupon.beforePOST` | `beforePOST(basket: Basket, couponItem): Status` |
|
|
67
|
+
| `dw.ocapi.shop.basket.coupon.beforeDELETE` | `beforeDELETE(basket: Basket, couponItemId: String): Status` |
|
|
68
|
+
| `dw.ocapi.shop.basket.coupon.afterPOST` | `afterPOST(basket: Basket, couponItem): Status` |
|
|
69
|
+
| `dw.ocapi.shop.basket.coupon.afterDELETE` | `afterDELETE(basket: Basket, couponItemId: String): Status` |
|
|
70
|
+
| `dw.ocapi.shop.basket.coupon.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response, coupon): Status` |
|
|
71
|
+
| `dw.ocapi.shop.basket.coupon.modifyDELETEResponse` | `modifyDELETEResponse(basket: Basket, response, couponItemId): Status` |
|
|
72
|
+
|
|
73
|
+
### Basket Items
|
|
74
|
+
|
|
75
|
+
| Hook | Signature |
|
|
76
|
+
|------|-----------|
|
|
77
|
+
| `dw.ocapi.shop.basket.items.beforePOST` | `beforePOST(basket: Basket, items): Status` |
|
|
78
|
+
| `dw.ocapi.shop.basket.items.afterPOST` | `afterPOST(basket: Basket, items): Status` |
|
|
79
|
+
| `dw.ocapi.shop.basket.items.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response, items): Status` |
|
|
80
|
+
| `dw.ocapi.shop.basket.item.beforePATCH` | `beforePATCH(basket: Basket, item): Status` |
|
|
81
|
+
| `dw.ocapi.shop.basket.item.beforeDELETE` | `beforeDELETE(basket: Basket, itemId: String): Status` |
|
|
82
|
+
| `dw.ocapi.shop.basket.item.afterPATCH` | `afterPATCH(basket: Basket, item): Status` |
|
|
83
|
+
| `dw.ocapi.shop.basket.item.afterDELETE` | `afterDELETE(basket: Basket, itemId: String): Status` |
|
|
84
|
+
| `dw.ocapi.shop.basket.item.modifyPATCHResponse` | `modifyPATCHResponse(basket: Basket, response, itemId): Status` |
|
|
85
|
+
| `dw.ocapi.shop.basket.item.modifyDELETEResponse` | `modifyDELETEResponse(basket: Basket, response, itemId): Status` |
|
|
86
|
+
|
|
87
|
+
### Basket Gift Certificate Item
|
|
88
|
+
|
|
89
|
+
| Hook | Signature |
|
|
90
|
+
|------|-----------|
|
|
91
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.beforePOST` | `beforePOST(basket: Basket, item): Status` |
|
|
92
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.beforePATCH` | `beforePATCH(basket: Basket, itemId: String, item): Status` |
|
|
93
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.beforeDELETE` | `beforeDELETE(basket: Basket, itemId: String): Status` |
|
|
94
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.afterPOST` | `afterPOST(basket: Basket, item): Status` |
|
|
95
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.afterPATCH` | `afterPATCH(basket: Basket, itemId: String, item): Status` |
|
|
96
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.afterDELETE` | `afterDELETE(basket: Basket, itemId: String): Status` |
|
|
97
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response, item): Status` |
|
|
98
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.modifyPATCHResponse` | `modifyPATCHResponse(basket: Basket, response, itemId): Status` |
|
|
99
|
+
| `dw.ocapi.shop.basket.gift_certificate_item.modifyDELETEResponse` | `modifyDELETEResponse(basket: Basket, response, itemId): Status` |
|
|
100
|
+
|
|
101
|
+
### Basket Payment Instrument
|
|
102
|
+
|
|
103
|
+
| Hook | Signature |
|
|
104
|
+
|------|-----------|
|
|
105
|
+
| `dw.ocapi.shop.basket.payment_instrument.beforePOST` | `beforePOST(basket: Basket, instrument): Status` |
|
|
106
|
+
| `dw.ocapi.shop.basket.payment_instrument.beforePATCH` | `beforePATCH(basket: Basket, instrument, newInstrument): Status` |
|
|
107
|
+
| `dw.ocapi.shop.basket.payment_instrument.beforeDELETE` | `beforeDELETE(basket: Basket, instrument): Status` |
|
|
108
|
+
| `dw.ocapi.shop.basket.payment_instrument.afterPOST` | `afterPOST(basket: Basket, instrument): Status` |
|
|
109
|
+
| `dw.ocapi.shop.basket.payment_instrument.afterPATCH` | `afterPATCH(basket: Basket, instrument, request): Status` |
|
|
110
|
+
| `dw.ocapi.shop.basket.payment_instrument.afterDELETE` | `afterDELETE(basket: Basket): Status` |
|
|
111
|
+
| `dw.ocapi.shop.basket.payment_instrument.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response, request): Status` |
|
|
112
|
+
| `dw.ocapi.shop.basket.payment_instrument.modifyPATCHResponse` | `modifyPATCHResponse(basket: Basket, response, instrumentId): Status` |
|
|
113
|
+
| `dw.ocapi.shop.basket.payment_instrument.modifyDELETEResponse` | `modifyDELETEResponse(basket: Basket, response, instrumentId): Status` |
|
|
114
|
+
|
|
115
|
+
### Basket Payment Methods
|
|
116
|
+
|
|
117
|
+
| Hook | Signature |
|
|
118
|
+
|------|-----------|
|
|
119
|
+
| `dw.ocapi.shop.basket.payment_methods.beforeGET` | `beforeGET(basketId: String): Status` |
|
|
120
|
+
| `dw.ocapi.shop.basket.payment_methods.afterGET` | `afterGET(basket: Basket, paymentMethods): Status` |
|
|
121
|
+
| `dw.ocapi.shop.basket.payment_methods.modifyGETResponse_v2` | `modifyGETResponse(basket: Basket, response): Status` |
|
|
122
|
+
|
|
123
|
+
### Basket Shipment
|
|
124
|
+
|
|
125
|
+
| Hook | Signature |
|
|
126
|
+
|------|-----------|
|
|
127
|
+
| `dw.ocapi.shop.basket.shipment.beforePOST` | `beforePOST(basket: Basket, shipment): Status` |
|
|
128
|
+
| `dw.ocapi.shop.basket.shipment.beforePATCH` | `beforePATCH(basket: Basket, shipment: Shipment, shipmentInfo): Status` |
|
|
129
|
+
| `dw.ocapi.shop.basket.shipment.beforeDELETE` | `beforeDELETE(basket: Basket, shipment: Shipment): Status` |
|
|
130
|
+
| `dw.ocapi.shop.basket.shipment.afterPOST` | `afterPOST(basket: Basket, shipment): Status` |
|
|
131
|
+
| `dw.ocapi.shop.basket.shipment.afterPATCH` | `afterPATCH(basket: Basket, shipment: Shipment, shipmentInfo): Status` |
|
|
132
|
+
| `dw.ocapi.shop.basket.shipment.afterDELETE` | `afterDELETE(basket: Basket, shipmentId: String): Status` |
|
|
133
|
+
| `dw.ocapi.shop.basket.shipment.modifyPOSTResponse` | `modifyPOSTResponse(basket: Basket, response, shipment): Status` |
|
|
134
|
+
| `dw.ocapi.shop.basket.shipment.modifyPATCHResponse` | `modifyPATCHResponse(basket: Basket, response, shipmentId): Status` |
|
|
135
|
+
| `dw.ocapi.shop.basket.shipment.modifyDELETEResponse` | `modifyDELETEResponse(basket: Basket, response, shipmentId): Status` |
|
|
136
|
+
|
|
137
|
+
### Basket Shipment Shipping Address
|
|
138
|
+
|
|
139
|
+
| Hook | Signature |
|
|
140
|
+
|------|-----------|
|
|
141
|
+
| `dw.ocapi.shop.basket.shipment.shipping_address.beforePUT` | `beforePUT(basket: Basket, shipment: Shipment, address): Status` |
|
|
142
|
+
| `dw.ocapi.shop.basket.shipment.shipping_address.afterPUT` | `afterPUT(basket: Basket, shipment: Shipment, address): Status` |
|
|
143
|
+
| `dw.ocapi.shop.basket.shipment.shipping_address.modifyPUTResponse` | `modifyPUTResponse(basket: Basket, response, address): Status` |
|
|
144
|
+
|
|
145
|
+
### Basket Shipment Shipping Method
|
|
146
|
+
|
|
147
|
+
| Hook | Signature |
|
|
148
|
+
|------|-----------|
|
|
149
|
+
| `dw.ocapi.shop.basket.shipment.shipping_method.beforePUT` | `beforePUT(basket: Basket, shipment: Shipment, method): Status` |
|
|
150
|
+
| `dw.ocapi.shop.basket.shipment.shipping_method.afterPUT` | `afterPUT(basket: Basket, shipment: Shipment, method): Status` |
|
|
151
|
+
| `dw.ocapi.shop.basket.shipment.shipping_method.modifyPUTResponse` | `modifyPUTResponse(basket: Basket, response, method): Status` |
|
|
152
|
+
|
|
153
|
+
### Basket Shipments Shipping Methods
|
|
154
|
+
|
|
155
|
+
| Hook | Signature |
|
|
156
|
+
|------|-----------|
|
|
157
|
+
| `dw.ocapi.shop.basket.shipments.shipping_methods.beforeGET` | `beforeGET(basketId: String, shipmentId: String): Status` |
|
|
158
|
+
| `dw.ocapi.shop.basket.shipments.shipping_methods.modifyGETResponse_v2` | `modifyGETResponse(basket: Basket, response): Status` |
|
|
159
|
+
|
|
160
|
+
### Category
|
|
161
|
+
|
|
162
|
+
| Hook | Signature |
|
|
163
|
+
|------|-----------|
|
|
164
|
+
| `dw.ocapi.shop.category.beforeGET` | `beforeGET(categoryId: String): Status` |
|
|
165
|
+
| `dw.ocapi.shop.category.modifyGETResponse` | `modifyGETResponse(category: Category, response): Status` |
|
|
166
|
+
|
|
167
|
+
### Customer
|
|
168
|
+
|
|
169
|
+
| Hook | Signature |
|
|
170
|
+
|------|-----------|
|
|
171
|
+
| `dw.ocapi.shop.customer.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
172
|
+
| `dw.ocapi.shop.customer.beforePOST` | `beforePOST(customerInput): Status` |
|
|
173
|
+
| `dw.ocapi.shop.customer.beforePATCH` | `beforePATCH(customer: Customer, customerInput): Status` |
|
|
174
|
+
| `dw.ocapi.shop.customer.afterPOST` | `afterPOST(customer: Customer, customerInput): Status` |
|
|
175
|
+
| `dw.ocapi.shop.customer.afterPATCH` | `afterPATCH(customer: Customer, customerInput): Status` |
|
|
176
|
+
| `dw.ocapi.shop.customer.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
177
|
+
| `dw.ocapi.shop.customer.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response): Status` |
|
|
178
|
+
| `dw.ocapi.shop.customer.modifyPATCHResponse` | `modifyPATCHResponse(customer: Customer, response): Status` |
|
|
179
|
+
|
|
180
|
+
### Customer Auth
|
|
181
|
+
|
|
182
|
+
| Hook | Signature |
|
|
183
|
+
|------|-----------|
|
|
184
|
+
| `dw.ocapi.shop.customer.auth.beforePOST` | `beforePOST(authHeader: String, authType: EnumValue): Status` |
|
|
185
|
+
| `dw.ocapi.shop.customer.auth.afterPOST` | `afterPOST(customer: Customer, authType: EnumValue): Status` |
|
|
186
|
+
| `dw.ocapi.shop.customer.auth.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, authType): Status` |
|
|
187
|
+
|
|
188
|
+
### Customer Address
|
|
189
|
+
|
|
190
|
+
| Hook | Signature |
|
|
191
|
+
|------|-----------|
|
|
192
|
+
| `dw.ocapi.shop.customer.addresses.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
193
|
+
| `dw.ocapi.shop.customer.addresses.beforePOST` | `beforePOST(customer: Customer, address): Status` |
|
|
194
|
+
| `dw.ocapi.shop.customer.addresses.afterPOST` | `afterPOST(customer: Customer, address): Status` |
|
|
195
|
+
| `dw.ocapi.shop.customer.addresses.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
196
|
+
| `dw.ocapi.shop.customer.address.beforeGET` | `beforeGET(customerId: String, addressName: String): Status` |
|
|
197
|
+
| `dw.ocapi.shop.customer.address.beforePATCH` | `beforePATCH(customer: Customer, address, addressInput): Status` |
|
|
198
|
+
| `dw.ocapi.shop.customer.address.beforeDELETE` | `beforeDELETE(customer: Customer, address): Status` |
|
|
199
|
+
| `dw.ocapi.shop.customer.address.afterPATCH` | `afterPATCH(customer: Customer, address, addressInput): Status` |
|
|
200
|
+
| `dw.ocapi.shop.customer.address.afterDELETE` | `afterDELETE(customer: Customer, addressName: String): Status` |
|
|
201
|
+
| `dw.ocapi.shop.customer.address.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
202
|
+
| `dw.ocapi.shop.customer.address.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, address): Status` |
|
|
203
|
+
| `dw.ocapi.shop.customer.address.modifyPATCHResponse` | `modifyPATCHResponse(customer: Customer, response, addressName): Status` |
|
|
204
|
+
|
|
205
|
+
### Customer Baskets
|
|
206
|
+
|
|
207
|
+
| Hook | Signature |
|
|
208
|
+
|------|-----------|
|
|
209
|
+
| `dw.ocapi.shop.customer.baskets.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
210
|
+
| `dw.ocapi.shop.customer.baskets.modifyGETResponse_v2` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
211
|
+
|
|
212
|
+
### Customer Orders
|
|
213
|
+
|
|
214
|
+
| Hook | Signature |
|
|
215
|
+
|------|-----------|
|
|
216
|
+
| `dw.ocapi.shop.customer.orders.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
217
|
+
| `dw.ocapi.shop.customer.orders.modifyGETResponse_v2` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
218
|
+
|
|
219
|
+
### Customer Password
|
|
220
|
+
|
|
221
|
+
| Hook | Signature |
|
|
222
|
+
|------|-----------|
|
|
223
|
+
| `dw.ocapi.shop.customer.password.beforePUT` | `beforePUT(customer: Customer, passwordInput): Status` |
|
|
224
|
+
| `dw.ocapi.shop.customer.password.afterPUT_v2` | `afterPUT(customer: Customer, passwordInput): Status` |
|
|
225
|
+
| `dw.ocapi.shop.customer.password_reset.beforePOST` | `beforePOST(email: String): Status` |
|
|
226
|
+
| `dw.ocapi.shop.customer.password_reset.afterPOST` | `afterPOST(email: String): Status` |
|
|
227
|
+
|
|
228
|
+
### Customer Payment Instrument
|
|
229
|
+
|
|
230
|
+
| Hook | Signature |
|
|
231
|
+
|------|-----------|
|
|
232
|
+
| `dw.ocapi.shop.customer.payment_instruments.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
233
|
+
| `dw.ocapi.shop.customer.payment_instruments.modifyGETResponse_v2` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
234
|
+
| `dw.ocapi.shop.customer.payment_instrument.beforeGET` | `beforeGET(customerId: String, instrumentId: String): Status` |
|
|
235
|
+
| `dw.ocapi.shop.customer.payment_instrument.beforePOST` | `beforePOST(customer: Customer, instrument): Status` |
|
|
236
|
+
| `dw.ocapi.shop.customer.payment_instrument.beforeDELETE` | `beforeDELETE(customer: Customer, instrument): Status` |
|
|
237
|
+
| `dw.ocapi.shop.customer.payment_instrument.afterPOST` | `afterPOST(customer: Customer, instrument): Status` |
|
|
238
|
+
| `dw.ocapi.shop.customer.payment_instrument.afterDELETE` | `afterDELETE(customer: Customer, instrumentId: String): Status` |
|
|
239
|
+
| `dw.ocapi.shop.customer.payment_instrument.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
240
|
+
| `dw.ocapi.shop.customer.payment_instrument.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, instrument): Status` |
|
|
241
|
+
|
|
242
|
+
### Customer Product Lists
|
|
243
|
+
|
|
244
|
+
| Hook | Signature |
|
|
245
|
+
|------|-----------|
|
|
246
|
+
| `dw.ocapi.shop.customer.product_lists.beforeGET` | `beforeGET(customerId: String): Status` |
|
|
247
|
+
| `dw.ocapi.shop.customer.product_lists.beforePOST` | `beforePOST(customer: Customer, productList): Status` |
|
|
248
|
+
| `dw.ocapi.shop.customer.product_lists.afterPOST` | `afterPOST(customer: Customer, productList): Status` |
|
|
249
|
+
| `dw.ocapi.shop.customer.product_lists.modifyGETResponse_v3` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
250
|
+
| `dw.ocapi.shop.customer.product_list.beforeGET` | `beforeGET(customerId: String, listId: String): Status` |
|
|
251
|
+
| `dw.ocapi.shop.customer.product_list.beforePATCH` | `beforePATCH(customer: Customer, productList, listInput): Status` |
|
|
252
|
+
| `dw.ocapi.shop.customer.product_list.beforeDELETE` | `beforeDELETE(customer: Customer, productList): Status` |
|
|
253
|
+
| `dw.ocapi.shop.customer.product_list.afterPATCH` | `afterPATCH(customer: Customer, productList, listInput): Status` |
|
|
254
|
+
| `dw.ocapi.shop.customer.product_list.afterDELETE` | `afterDELETE(customer: Customer, listId: String): Status` |
|
|
255
|
+
| `dw.ocapi.shop.customer.product_list.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
256
|
+
| `dw.ocapi.shop.customer.product_list.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, productList): Status` |
|
|
257
|
+
| `dw.ocapi.shop.customer.product_list.modifyPATCHResponse` | `modifyPATCHResponse(customer: Customer, response, listId): Status` |
|
|
258
|
+
|
|
259
|
+
### Customer Product List Items
|
|
260
|
+
|
|
261
|
+
| Hook | Signature |
|
|
262
|
+
|------|-----------|
|
|
263
|
+
| `dw.ocapi.shop.customer.product_list.items.beforeGET` | `beforeGET(customerId: String, listId: String): Status` |
|
|
264
|
+
| `dw.ocapi.shop.customer.product_list.items.beforePOST` | `beforePOST(customer: Customer, productList, item): Status` |
|
|
265
|
+
| `dw.ocapi.shop.customer.product_list.items.afterPOST` | `afterPOST(customer: Customer, productList, item): Status` |
|
|
266
|
+
| `dw.ocapi.shop.customer.product_list.items.modifyGETResponse_v2` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
267
|
+
| `dw.ocapi.shop.customer.product_list.item.beforeGET` | `beforeGET(customerId: String, listId: String, itemId: String): Status` |
|
|
268
|
+
| `dw.ocapi.shop.customer.product_list.item.beforePATCH` | `beforePATCH(customer: Customer, productList, item, itemInput): Status` |
|
|
269
|
+
| `dw.ocapi.shop.customer.product_list.item.beforeDELETE` | `beforeDELETE(customer: Customer, productList, item): Status` |
|
|
270
|
+
| `dw.ocapi.shop.customer.product_list.item.afterPATCH` | `afterPATCH(customer: Customer, productList, item, itemInput): Status` |
|
|
271
|
+
| `dw.ocapi.shop.customer.product_list.item.afterDELETE` | `afterDELETE(customer: Customer, productList, itemId: String): Status` |
|
|
272
|
+
| `dw.ocapi.shop.customer.product_list.item.modifyGETResponse` | `modifyGETResponse(customer: Customer, response): Status` |
|
|
273
|
+
| `dw.ocapi.shop.customer.product_list.item.modifyPOSTResponse` | `modifyPOSTResponse(customer: Customer, response, item): Status` |
|
|
274
|
+
| `dw.ocapi.shop.customer.product_list.item.modifyPATCHResponse` | `modifyPATCHResponse(customer: Customer, response, itemId): Status` |
|
|
275
|
+
|
|
276
|
+
### Gift Certificate
|
|
277
|
+
|
|
278
|
+
| Hook | Signature |
|
|
279
|
+
|------|-----------|
|
|
280
|
+
| `dw.ocapi.shop.gift_certificate.beforePOST` | `beforePOST(giftCertificateCode: String): Status` |
|
|
281
|
+
| `dw.ocapi.shop.gift_certificate.modifyPOSTResponse` | `modifyPOSTResponse(giftCertificate, response): Status` |
|
|
282
|
+
|
|
283
|
+
### Order
|
|
284
|
+
|
|
285
|
+
| Hook | Signature |
|
|
286
|
+
|------|-----------|
|
|
287
|
+
| `dw.ocapi.shop.order.beforeGET` | `beforeGET(orderId: String): Status` |
|
|
288
|
+
| `dw.ocapi.shop.order.beforePOST` | `beforePOST(basket: Basket): Status` |
|
|
289
|
+
| `dw.ocapi.shop.order.afterPOST` | `afterPOST(order: Order): Status` |
|
|
290
|
+
| `dw.ocapi.shop.order.modifyGETResponse` | `modifyGETResponse(order: Order, response): Status` |
|
|
291
|
+
| `dw.ocapi.shop.order.modifyPOSTResponse` | `modifyPOSTResponse(order: Order, response): Status` |
|
|
292
|
+
| `dw.ocapi.shop.order.validateOrder` | `validateOrder(response, duringPlace: boolean): Status` |
|
|
293
|
+
|
|
294
|
+
> **Prefer the order payment-instrument authorization lifecycle.** SCAPI creates the order in
|
|
295
|
+
> `CREATED` status. Follow it with an order payment-instrument `PATCH`, which invokes
|
|
296
|
+
> `dw.order.payment.authorizeCreditCard` or `dw.order.payment.authorize`. The default order-PI
|
|
297
|
+
> `afterPATCH` implementation places the order after authorized coverage reaches the order total.
|
|
298
|
+
> Use `order.afterPOST` placement as the single-phase Commerce transaction alternative described in
|
|
299
|
+
> [SKILL.md](../SKILL.md#alternative-authorize-and-place-in-orderafterpost).
|
|
300
|
+
|
|
301
|
+
### Order Payment Instrument
|
|
302
|
+
|
|
303
|
+
| Hook | Signature |
|
|
304
|
+
|------|-----------|
|
|
305
|
+
| `dw.ocapi.shop.order.payment_instrument.beforePOST` | `beforePOST(order: Order, instrument): Status` |
|
|
306
|
+
| `dw.ocapi.shop.order.payment_instrument.beforePATCH` | `beforePATCH(order: Order, instrument, newInstrument): Status` |
|
|
307
|
+
| `dw.ocapi.shop.order.payment_instrument.beforeDELETE` | `beforeDELETE(order: Order, instrument): Status` |
|
|
308
|
+
| `dw.ocapi.shop.order.payment_instrument.afterPOST` | `afterPOST(order: Order, instrument: OrderPaymentInstrumentRequest, successfullyAuthorized: boolean): Status` |
|
|
309
|
+
| `dw.ocapi.shop.order.payment_instrument.afterPATCH` | `afterPATCH(order: Order, instrument: OrderPaymentInstrument, newInstrument: OrderPaymentInstrumentRequest, successfullyAuthorized: boolean): Status` |
|
|
310
|
+
| `dw.ocapi.shop.order.payment_instrument.afterDELETE` | `afterDELETE(order: Order, instrumentId: String): Status` |
|
|
311
|
+
| `dw.ocapi.shop.order.payment_instrument.modifyPOSTResponse` | `modifyPOSTResponse(order: Order, response, request): Status` |
|
|
312
|
+
| `dw.ocapi.shop.order.payment_instrument.modifyPATCHResponse` | `modifyPATCHResponse(order: Order, response, instrumentId): Status` |
|
|
313
|
+
| `dw.ocapi.shop.order.payment_instrument.modifyDELETEResponse` | `modifyDELETEResponse(order: Order, response, instrumentId): Status` |
|
|
314
|
+
|
|
315
|
+
The order PI `POST` and `PATCH` authorize the affected instrument before calling their `after*`
|
|
316
|
+
hook. `successfullyAuthorized` reports whether the selected `dw.order.payment.authorize*` hook
|
|
317
|
+
succeeded. A non-null return ends hook execution; return `undefined` on success when the platform's
|
|
318
|
+
default coverage-based placement implementation must still run. For `CREDIT_CARD`, supply
|
|
319
|
+
payment-card data. A customer payment-instrument ID causes Commerce to copy the customer's PI for
|
|
320
|
+
authorization; otherwise the authorization details come from the request. Request amount and card
|
|
321
|
+
security code remain available to `authorizeCreditCard` in either case.
|
|
322
|
+
|
|
323
|
+
### Order Payment Methods
|
|
324
|
+
|
|
325
|
+
| Hook | Signature |
|
|
326
|
+
|------|-----------|
|
|
327
|
+
| `dw.ocapi.shop.order.payment_methods.beforeGET` | `beforeGET(orderId: String): Status` |
|
|
328
|
+
| `dw.ocapi.shop.order.payment_methods.modifyGETResponse_v2` | `modifyGETResponse(order: Order, response): Status` |
|
|
329
|
+
|
|
330
|
+
### Product
|
|
331
|
+
|
|
332
|
+
| Hook | Signature |
|
|
333
|
+
|------|-----------|
|
|
334
|
+
| `dw.ocapi.shop.product.beforeGET` | `beforeGET(productId: String): Status` |
|
|
335
|
+
| `dw.ocapi.shop.product.modifyGETResponse` | `modifyGETResponse(product: Product, response): Status` |
|
|
336
|
+
|
|
337
|
+
### Product Search
|
|
338
|
+
|
|
339
|
+
| Hook | Signature |
|
|
340
|
+
|------|-----------|
|
|
341
|
+
| `dw.ocapi.shop.product_search.beforeGET` | `beforeGET(searchRequest): Status` |
|
|
342
|
+
| `dw.ocapi.shop.product_search.modifyGETResponse` | `modifyGETResponse(searchResult, response): Status` |
|
|
343
|
+
|
|
344
|
+
### Promotion
|
|
345
|
+
|
|
346
|
+
| Hook | Signature |
|
|
347
|
+
|------|-----------|
|
|
348
|
+
| `dw.ocapi.shop.promotion.beforeGET` | `beforeGET(promotionId: String): Status` |
|
|
349
|
+
| `dw.ocapi.shop.promotion.modifyGETResponse` | `modifyGETResponse(promotion: Promotion, response): Status` |
|
|
350
|
+
| `dw.ocapi.shop.promotions.beforeGET` | `beforeGET(promotionIds: String): Status` |
|
|
351
|
+
| `dw.ocapi.shop.promotions.modifyGETResponse` | `modifyGETResponse(promotions, response): Status` |
|
|
352
|
+
|
|
353
|
+
### Search Suggestion
|
|
354
|
+
|
|
355
|
+
| Hook | Signature |
|
|
356
|
+
|------|-----------|
|
|
357
|
+
| `dw.ocapi.shop.search_suggestion.beforeGET` | `beforeGET(query: String): Status` |
|
|
358
|
+
| `dw.ocapi.shop.search_suggestion.modifyGETResponse` | `modifyGETResponse(suggestions, response): Status` |
|
|
359
|
+
|
|
360
|
+
### Store
|
|
361
|
+
|
|
362
|
+
| Hook | Signature |
|
|
363
|
+
|------|-----------|
|
|
364
|
+
| `dw.ocapi.shop.store.beforeGET` | `beforeGET(storeId: String): Status` |
|
|
365
|
+
| `dw.ocapi.shop.store.modifyGETResponse` | `modifyGETResponse(store: Store, response): Status` |
|
|
366
|
+
| `dw.ocapi.shop.stores.beforeGET` | `beforeGET(storeIds: String): Status` |
|
|
367
|
+
| `dw.ocapi.shop.stores.modifyGETResponse` | `modifyGETResponse(stores, response): Status` |
|
|
368
|
+
|
|
369
|
+
## Common Patterns
|
|
370
|
+
|
|
371
|
+
### Validation (return error to reject request)
|
|
372
|
+
|
|
373
|
+
```javascript
|
|
374
|
+
exports.beforePUT = function(basket, address) {
|
|
375
|
+
if (!isValidZipCode(address.postalCode)) {
|
|
376
|
+
var status = new Status(Status.ERROR);
|
|
377
|
+
status.addDetail('field', 'postalCode');
|
|
378
|
+
status.addDetail('message', 'Invalid postal code');
|
|
379
|
+
return status;
|
|
380
|
+
}
|
|
381
|
+
return new Status(Status.OK);
|
|
382
|
+
};
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Modify Response (add custom properties)
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
exports.modifyGETResponse = function(product, response) {
|
|
389
|
+
response.c_customField = 'value';
|
|
390
|
+
response.c_extendedInfo = { source: 'hook' };
|
|
391
|
+
};
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Custom Properties
|
|
395
|
+
|
|
396
|
+
Add `c_` prefixed properties in modifyResponse hooks. Supported types: String, Integer, Double, Boolean, Date, Set of Strings.
|
|
397
|
+
|
|
398
|
+
## Notes
|
|
399
|
+
|
|
400
|
+
- All hooks return `dw.system.Status` - return `Status.OK` to continue, `Status.ERROR` to reject
|
|
401
|
+
- Hooks with `_v2` or `_v3` suffix are newer versions with updated signatures
|
|
402
|
+
- Response objects in `modify*Response` hooks can be modified in place
|
|
403
|
+
- Custom query parameters with `c_` prefix are accessible via `request.httpParameterMap`
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Shopper Order Payment Lifecycle (SCAPI/OCAPI)
|
|
2
|
+
|
|
3
|
+
## Recommended Lifecycle
|
|
4
|
+
|
|
5
|
+
Use the documented Shopper Orders payment-instrument authorization seam:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
POST /orders
|
|
9
|
+
|
|
|
10
|
+
v
|
|
11
|
+
beforePOST(basket) -> platform creates and commits order in CREATED -> afterPOST(order)
|
|
12
|
+
|
|
|
13
|
+
v
|
|
14
|
+
PATCH /orders/{orderNo}/payment-instruments/{paymentInstrumentId}
|
|
15
|
+
|
|
|
16
|
+
+-> order.payment_instrument.beforePATCH(order, persistentPI, requestPI)
|
|
17
|
+
+-> platform updates/resolves the payment instrument
|
|
18
|
+
+-> dw.order.payment.authorizeCreditCard or dw.order.payment.authorize
|
|
19
|
+
+-> order.payment_instrument.afterPATCH(..., successfullyAuthorized)
|
|
20
|
+
+-> default afterPATCH places when authorized coverage >= order total
|
|
21
|
+
+-> order.payment_instrument.modifyPATCHResponse(...)
|
|
22
|
+
|
|
|
23
|
+
v
|
|
24
|
+
NEW = placed; CREATED = not yet placed
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Do not perform a slow gateway call in `order.afterPOST` by default. Let order creation commit first,
|
|
28
|
+
then authorize through the order-PI endpoint. This keeps a durable order number available when the
|
|
29
|
+
gateway declines, times out, or returns an indeterminate result.
|
|
30
|
+
|
|
31
|
+
## Hook Responsibilities
|
|
32
|
+
|
|
33
|
+
| Phase | Responsibility |
|
|
34
|
+
|-------|----------------|
|
|
35
|
+
| `order.beforePOST` | Validate the basket at the final server-owned boundary before order creation |
|
|
36
|
+
| `order.afterPOST` | Add fast order metadata only; do not authorize/place in the recommended flow |
|
|
37
|
+
| `order.payment_instrument.beforePATCH` | Reject untrusted method, amount, processor, ownership, and token-provenance input before the gateway call |
|
|
38
|
+
| `dw.order.payment.authorizeCreditCard` | Authorize credit cards and persist the payment transaction result |
|
|
39
|
+
| `dw.order.payment.authorize` | Authorize non-card instruments and persist the payment transaction result |
|
|
40
|
+
| `order.payment_instrument.afterPATCH` | Use `successfullyAuthorized`, perform final persistent-state checks, and return no value on success |
|
|
41
|
+
| Platform default `afterPATCH` | Place a still-`CREATED` order when authorized payment coverage equals or exceeds the total |
|
|
42
|
+
| `order.payment_instrument.modifyPATCHResponse` | Shape the response or perform post-placement reporting; determine success from persisted order status |
|
|
43
|
+
|
|
44
|
+
The `afterPATCH` signature is:
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
afterPATCH(order, paymentInstrument, newPaymentInstrument, successfullyAuthorized)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- `paymentInstrument` is the updated persistent order PI.
|
|
51
|
+
- `newPaymentInstrument` is request data and remains untrusted.
|
|
52
|
+
- `successfullyAuthorized` is the payment-hook result reduced to a boolean.
|
|
53
|
+
- A non-null `Status` ends hook execution. Return `undefined` after successful validation so the
|
|
54
|
+
platform placement implementation still runs.
|
|
55
|
+
|
|
56
|
+
Use `request.custom` to retain a richer authorization outcome within the request when the boolean is
|
|
57
|
+
insufficient. For example, distinguish a deterministic decline from a gateway timeout or manual
|
|
58
|
+
review. Do not add object metadata solely as inter-hook transport.
|
|
59
|
+
|
|
60
|
+
## Payment-Instrument Resolution
|
|
61
|
+
|
|
62
|
+
The order-PI endpoint invokes:
|
|
63
|
+
|
|
64
|
+
- Require an applicable payment method; include payment-card data when the method is `CREDIT_CARD`.
|
|
65
|
+
- `dw.order.payment.authorizeCreditCard` when the request includes payment-card data or the PI has a
|
|
66
|
+
credit-card type.
|
|
67
|
+
- `dw.order.payment.authorize` otherwise.
|
|
68
|
+
|
|
69
|
+
For a saved payment method, pass the documented customer payment-instrument ID (named
|
|
70
|
+
`customer_payment_instrument_id` in the OCAPI documentation; generated SCAPI clients can expose a
|
|
71
|
+
camel-case property). Commerce resolves the reference from the order customer's instruments and
|
|
72
|
+
copies that customer PI for authorization; an unknown ID throws. Request amount and card security
|
|
73
|
+
code are still propagated to `authorizeCreditCard`.
|
|
74
|
+
|
|
75
|
+
Without that reference, the payment hook input is populated from request data such as payment-card
|
|
76
|
+
or bank-account information. Do not assume this `paymentDetails` argument is the same object instance
|
|
77
|
+
as the persistent PI attached to `order`. Resolve the persistent instrument when the integration
|
|
78
|
+
stored token or approval state on it. Treat reusable payment tokens and all `c_*` request properties
|
|
79
|
+
as untrusted input; possession of a client-supplied token does not prove wallet ownership.
|
|
80
|
+
|
|
81
|
+
## Success and Failure Handling
|
|
82
|
+
|
|
83
|
+
After the final required payment-instrument request:
|
|
84
|
+
|
|
85
|
+
- Treat `NEW` as placement success.
|
|
86
|
+
- Treat `CREATED` as not placed. During a multi-instrument flow this is expected until total
|
|
87
|
+
authorized coverage is sufficient.
|
|
88
|
+
- On a deterministic authorization failure, call the Shopper Orders fail action with
|
|
89
|
+
`reopenBasket=true` to persist the failed order and restore the basket.
|
|
90
|
+
- On timeout or indeterminate provider state, preserve the `CREATED` order for reconciliation. Do not
|
|
91
|
+
automatically retry or reopen the basket when doing so could duplicate an authorization.
|
|
92
|
+
|
|
93
|
+
Current Shopper Orders v1 failure request:
|
|
94
|
+
|
|
95
|
+
```http
|
|
96
|
+
POST /checkout/shopper-orders/v1/organizations/{organizationId}/orders/{orderNo}/actions/fail?siteId={siteId}&reopenBasket=true
|
|
97
|
+
Authorization: Bearer {shopperToken}
|
|
98
|
+
Content-Type: application/json
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
"reasonCode": "payment_auth_failure"
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Supported payment-oriented reason codes are `payment_auth_failure`, `payment_confirm_failure`, and
|
|
106
|
+
`payment_capture_failure`. Confirm the current schema before generating version-specific code.
|
|
107
|
+
|
|
108
|
+
## Alternative: Complete Checkout in `order.afterPOST`
|
|
109
|
+
|
|
110
|
+
Choose this option when checkout should create, authorize, and perform the Commerce-side
|
|
111
|
+
place-or-fail transition in one server-side phase, or when a processor cannot participate in the
|
|
112
|
+
order-PI authorization lifecycle. It reduces storefront orchestration and makes `order.afterPOST`
|
|
113
|
+
own the complete `CREATED -> NEW/FAILED` transition. The external gateway operation is not rolled
|
|
114
|
+
back with the Commerce transaction.
|
|
115
|
+
|
|
116
|
+
Important transaction rules:
|
|
117
|
+
|
|
118
|
+
- `order.afterPOST` runs inside the order-creation transaction. Do not wrap `OrderMgr.placeOrder`,
|
|
119
|
+
`OrderMgr.failOrder`, or PI mutations in another `Transaction.wrap`.
|
|
120
|
+
- `Status.ERROR` rolls back the complete order creation; no order record survives.
|
|
121
|
+
- Returning success after `OrderMgr.failOrder` commits a queryable failed order but does not produce
|
|
122
|
+
an HTTP error by itself.
|
|
123
|
+
- Manually verify every payment instrument and total authorized coverage before placement.
|
|
124
|
+
|
|
125
|
+
These rollback semantics were empirically verified on sandbox zzpq-019 on 2026-06-24: an
|
|
126
|
+
`afterPOST` `Status.ERROR` returned HTTP 400 and left no searchable order.
|
|
127
|
+
|
|
128
|
+
### Two-Hook Variant
|
|
129
|
+
|
|
130
|
+
If this flow must both persist a failed order and return an HTTP error, split the behavior:
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
var OrderMgr = require('dw/order/OrderMgr');
|
|
134
|
+
var Status = require('dw/system/Status');
|
|
135
|
+
|
|
136
|
+
exports.afterPOST = function (order) {
|
|
137
|
+
var result = authorizePayment(order);
|
|
138
|
+
if (result.declined) {
|
|
139
|
+
OrderMgr.failOrder(order, false);
|
|
140
|
+
request.custom.paymentDecline = {
|
|
141
|
+
code: result.code,
|
|
142
|
+
message: result.message
|
|
143
|
+
};
|
|
144
|
+
return new Status(Status.OK); // commit the FAILED order
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var placeStatus = OrderMgr.placeOrder(order);
|
|
148
|
+
if (placeStatus.error) {
|
|
149
|
+
return new Status(Status.ERROR, 'PLACE_FAILED');
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
exports.modifyPOSTResponse = function () {
|
|
154
|
+
var decline = request.custom.paymentDecline;
|
|
155
|
+
if (decline) {
|
|
156
|
+
return new Status(Status.ERROR, decline.code, decline.message);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This remains a valid single-phase checkout option. Prefer the separate order-PI authorization plus
|
|
162
|
+
Shopper Orders fail action when durable intermediate state, shorter order creation, payment-extension
|
|
163
|
+
alignment, or explicit recovery control matters more than atomic one-request orchestration.
|
|
164
|
+
|
|
165
|
+
## Cross-References
|
|
166
|
+
|
|
167
|
+
- [B2C Hooks](../SKILL.md#headless-order-payment-use-the-order-pi-authorization-seam) — primary implementation guidance
|
|
168
|
+
- `b2c-ordering` skill — order statuses and Shopper Orders failure handling
|
|
169
|
+
- [OCAPI/SCAPI Hooks reference](./OCAPI-SCAPI-HOOKS.md) — hook signature list
|