@salesforce/b2c-tooling-sdk 1.15.1 → 1.17.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.
Files changed (168) hide show
  1. package/data/content-schemas/regiondefinition.json +1 -0
  2. package/data/job-steps/CatalogDeltaExport.md +31 -0
  3. package/data/job-steps/CreateSitemap.md +22 -0
  4. package/data/job-steps/CustomerListsDeltaExport.md +30 -0
  5. package/data/job-steps/DownloadActiveDataFromStorage.md +24 -0
  6. package/data/job-steps/ExecuteCategorizationRules.md +25 -0
  7. package/data/job-steps/ExecuteDataReplication.md +24 -0
  8. package/data/job-steps/ExecutePipeline.md +24 -0
  9. package/data/job-steps/ExecutePreconfiguredCodeReplicationProcess.md +24 -0
  10. package/data/job-steps/ExecutePreconfiguredDataReplicationProcess.md +24 -0
  11. package/data/job-steps/ExecuteScriptModule.md +27 -0
  12. package/data/job-steps/ExportABTests.md +30 -0
  13. package/data/job-steps/ExportAssignments.md +30 -0
  14. package/data/job-steps/ExportCatalog.md +37 -0
  15. package/data/job-steps/ExportContent.md +31 -0
  16. package/data/job-steps/ExportContentSlots.md +30 -0
  17. package/data/job-steps/ExportCouponCodes.md +33 -0
  18. package/data/job-steps/ExportCoupons.md +30 -0
  19. package/data/job-steps/ExportCustomObjects.md +31 -0
  20. package/data/job-steps/ExportCustomerGroups.md +30 -0
  21. package/data/job-steps/ExportCustomerList.md +31 -0
  22. package/data/job-steps/ExportCustomers.md +30 -0
  23. package/data/job-steps/ExportFacebookFeed.md +26 -0
  24. package/data/job-steps/ExportGiftCertificates.md +30 -0
  25. package/data/job-steps/ExportInventoryLists.md +31 -0
  26. package/data/job-steps/ExportMetaData.md +32 -0
  27. package/data/job-steps/ExportOrders.md +42 -0
  28. package/data/job-steps/ExportPageLocalization.md +34 -0
  29. package/data/job-steps/ExportPriceBook.md +31 -0
  30. package/data/job-steps/ExportProductLists.md +34 -0
  31. package/data/job-steps/ExportPromotions.md +30 -0
  32. package/data/job-steps/ExportShippingMethods.md +30 -0
  33. package/data/job-steps/ExportSourceCodeGroups.md +30 -0
  34. package/data/job-steps/ExportStores.md +31 -0
  35. package/data/job-steps/ExportTaxTable.md +30 -0
  36. package/data/job-steps/ImportABTests.md +34 -0
  37. package/data/job-steps/ImportActiveData.md +33 -0
  38. package/data/job-steps/ImportAssignments.md +34 -0
  39. package/data/job-steps/ImportCatalog.md +34 -0
  40. package/data/job-steps/ImportContent.md +34 -0
  41. package/data/job-steps/ImportContentSlots.md +34 -0
  42. package/data/job-steps/ImportCouponCodeRedemptions.md +34 -0
  43. package/data/job-steps/ImportCoupons.md +34 -0
  44. package/data/job-steps/ImportCustomObjects.md +34 -0
  45. package/data/job-steps/ImportCustomerGroups.md +34 -0
  46. package/data/job-steps/ImportCustomerList.md +34 -0
  47. package/data/job-steps/ImportCustomerLists.md +34 -0
  48. package/data/job-steps/ImportCustomers.md +34 -0
  49. package/data/job-steps/ImportGiftCertificates.md +34 -0
  50. package/data/job-steps/ImportInventoryLists.md +35 -0
  51. package/data/job-steps/ImportKeyValueMapping.md +35 -0
  52. package/data/job-steps/ImportPageLocalization.md +34 -0
  53. package/data/job-steps/ImportPriceBook.md +34 -0
  54. package/data/job-steps/ImportProductLists.md +34 -0
  55. package/data/job-steps/ImportPromotions.md +34 -0
  56. package/data/job-steps/ImportShippingMethods.md +34 -0
  57. package/data/job-steps/ImportSiteArchive.md +30 -0
  58. package/data/job-steps/ImportSourceCodeGroups.md +34 -0
  59. package/data/job-steps/ImportStores.md +34 -0
  60. package/data/job-steps/ImportTaxTable.md +34 -0
  61. package/data/job-steps/IncludeStepsFromJob.md +24 -0
  62. package/data/job-steps/InvalidateCache.md +26 -0
  63. package/data/job-steps/LibraryDeltaExport.md +30 -0
  64. package/data/job-steps/SearchReindex.md +27 -0
  65. package/data/job-steps/SiteExport.md +32 -0
  66. package/data/job-steps/UndoPreconfiguredCodeReplicationProcess.md +24 -0
  67. package/data/job-steps/UndoPreconfiguredDataReplicationProcess.md +24 -0
  68. package/data/job-steps/UpdateStorefrontURLs.md +22 -0
  69. package/data/job-steps/UploadActiveDataBackupToStorage.md +22 -0
  70. package/data/job-steps/UploadActiveDataToStorage.md +24 -0
  71. package/data/job-steps/index.json +426 -0
  72. package/data/job-steps/job-steps.json +2910 -0
  73. package/data/job-steps/job-steps.md +96 -0
  74. package/data/script-api/TopLevel.APIException.md +1 -1
  75. package/data/script-api/dw.catalog.CatalogMgr.md +8 -2
  76. package/data/script-api/dw.crypto.Cipher.md +5 -1
  77. package/data/script-api/dw.customer.Profile.md +45 -0
  78. package/data/script-api/dw.customer.consent.ConsentStatusEntry.md +92 -0
  79. package/data/script-api/dw.customer.consent.MarketingConsentSubscription.md +247 -0
  80. package/data/script-api/dw.customer.consent.ShopperConsentErrorCodes.md +74 -0
  81. package/data/script-api/dw.customer.consent.ShopperConsentException.md +63 -0
  82. package/data/script-api/dw.customer.consent.ShopperConsentMgr.md +152 -0
  83. package/data/script-api/dw.customer.consent.md +10 -0
  84. package/data/script-api/dw.extensions.payments.SalesforcePaymentsHooks.md +24 -0
  85. package/data/script-api/dw.extensions.payments.SalesforcePaymentsSiteConfiguration.md +76 -0
  86. package/data/script-api/dw.object.CustomAttributes.md +72 -29
  87. package/data/script-api/dw.object.md +1 -1
  88. package/data/script-api/dw.order.Basket.md +3 -2
  89. package/data/script-api/dw.order.GiftCertificateLineItem.md +1 -1
  90. package/data/script-api/dw.order.LineItem.md +88 -0
  91. package/data/script-api/dw.order.LineItemCtnr.md +41 -11
  92. package/data/script-api/dw.order.LineItemTax.md +142 -0
  93. package/data/script-api/dw.order.OrderMgr.md +8 -0
  94. package/data/script-api/dw.order.PriceAdjustment.md +1 -1
  95. package/data/script-api/dw.order.ProductLineItem.md +1 -1
  96. package/data/script-api/dw.order.ProductShippingLineItem.md +1 -1
  97. package/data/script-api/dw.order.Shipment.md +12 -4
  98. package/data/script-api/dw.order.ShippingLineItem.md +1 -1
  99. package/data/script-api/dw.order.TaxMgr.md +54 -0
  100. package/data/script-api/dw.order.hooks.TaxHooks.md +495 -0
  101. package/data/script-api/dw.order.hooks.md +1 -0
  102. package/data/script-api/dw.order.md +1 -0
  103. package/data/script-api/dw.sitemap.SitemapFile.md +1 -1
  104. package/data/script-api/dw.sitemap.SitemapMgr.md +23 -0
  105. package/data/script-api/dw.system.Request.md +0 -1
  106. package/data/script-api/dw.util.Assert.md +29 -0
  107. package/data/script-api/dw.util.Locale.md +5 -2
  108. package/data/script-api/dw.web.Cookie.md +0 -6
  109. package/data/script-api/dw.web.PageMetaTag.md +25 -1
  110. package/data/script-api/dw.ws.WSUtil.md +2 -2
  111. package/data/script-api/index.json +49 -2
  112. package/data/script-api/index.md +2 -1
  113. package/data/xsd/commercefeaturestate.xsd +1 -0
  114. package/data/xsd/customer.xsd +11 -0
  115. package/data/xsd/eventrouting.xsd +257 -0
  116. package/data/xsd/index.json +6 -2
  117. package/data/xsd/order.xsd +53 -0
  118. package/data/xsd/store.xsd +8 -0
  119. package/data/xsd/storefronts.xsd +57 -1
  120. package/dist/esm/auth/dispatch-fetch.js +9 -2
  121. package/dist/esm/auth/dispatch-fetch.js.map +1 -1
  122. package/dist/esm/auth/oauth-jwt.js +9 -1
  123. package/dist/esm/auth/oauth-jwt.js.map +1 -1
  124. package/dist/esm/auth/oauth.js +9 -1
  125. package/dist/esm/auth/oauth.js.map +1 -1
  126. package/dist/esm/auth/stateful-oauth-strategy.js +26 -3
  127. package/dist/esm/auth/stateful-oauth-strategy.js.map +1 -1
  128. package/dist/esm/clients/am-api.js +9 -1
  129. package/dist/esm/clients/am-api.js.map +1 -1
  130. package/dist/esm/clients/middleware.js +9 -1
  131. package/dist/esm/clients/middleware.js.map +1 -1
  132. package/dist/esm/clients/webdav.js +14 -6
  133. package/dist/esm/clients/webdav.js.map +1 -1
  134. package/dist/esm/docs/search.d.ts +6 -3
  135. package/dist/esm/docs/search.js +39 -8
  136. package/dist/esm/docs/search.js.map +1 -1
  137. package/dist/esm/docs/types.d.ts +1 -0
  138. package/dist/esm/docs/types.js +1 -0
  139. package/dist/esm/docs/types.js.map +1 -1
  140. package/dist/esm/errors/index.d.ts +1 -0
  141. package/dist/esm/errors/index.js +1 -0
  142. package/dist/esm/errors/index.js.map +1 -1
  143. package/dist/esm/errors/network-error.d.ts +104 -0
  144. package/dist/esm/errors/network-error.js +301 -0
  145. package/dist/esm/errors/network-error.js.map +1 -0
  146. package/dist/esm/operations/cap/pull.js +4 -1
  147. package/dist/esm/operations/cap/pull.js.map +1 -1
  148. package/dist/esm/operations/code/constants.d.ts +17 -0
  149. package/dist/esm/operations/code/constants.js +23 -0
  150. package/dist/esm/operations/code/constants.js.map +1 -0
  151. package/dist/esm/operations/code/deploy.js +31 -2
  152. package/dist/esm/operations/code/deploy.js.map +1 -1
  153. package/dist/esm/operations/code/download.js +1 -2
  154. package/dist/esm/operations/code/download.js.map +1 -1
  155. package/dist/esm/operations/debug/dap-adapter.d.ts +9 -0
  156. package/dist/esm/operations/debug/dap-adapter.js +17 -0
  157. package/dist/esm/operations/debug/dap-adapter.js.map +1 -1
  158. package/dist/esm/operations/debug/debug-session.d.ts +8 -0
  159. package/dist/esm/operations/debug/debug-session.js +18 -0
  160. package/dist/esm/operations/debug/debug-session.js.map +1 -1
  161. package/dist/esm/operations/debug/sdapi-client.d.ts +30 -0
  162. package/dist/esm/operations/debug/sdapi-client.js +80 -6
  163. package/dist/esm/operations/debug/sdapi-client.js.map +1 -1
  164. package/dist/esm/skills/github.js +77 -24
  165. package/dist/esm/skills/github.js.map +1 -1
  166. package/dist/esm/slas/token.js +9 -1
  167. package/dist/esm/slas/token.js.map +1 -1
  168. package/package.json +4 -2
@@ -0,0 +1,495 @@
1
+ <!-- prettier-ignore-start -->
2
+ # Class TaxHooks
3
+
4
+ - [TopLevel.Object](TopLevel.Object.md)
5
+ - [dw.order.hooks.TaxHooks](dw.order.hooks.TaxHooks.md)
6
+
7
+ This interface represents tax extension points for Commerce App tax providers.
8
+
9
+
10
+ These hooks provide integration points for external tax calculation services installed via the Commerce App
11
+ framework. They are distinct from the legacy `dw.order.calculateTax` extension point.
12
+
13
+
14
+ **IMPORTANT:** These hooks should **only** be implemented and registered by Commerce Apps
15
+ (applications installed via the Commerce App framework with a CAP file). They are not intended for custom merchant
16
+ cartridges or storefront implementations. Merchants who want custom tax calculation logic should use the legacy
17
+ `dw.order.calculateTax` extension point instead.
18
+
19
+
20
+ Hook Registration A function must be defined inside a JavaScript source and must be exported. The script
21
+ with the exported hook function must be located inside a site cartridge. Inside the site cartridge a
22
+ `package.json` file with a 'hooks' entry must exist:
23
+
24
+
25
+ ```
26
+ "hooks": "./hooks.json"
27
+ ```
28
+
29
+
30
+
31
+ The hooks entry links to a JSON file, relative to the `package.json` file. This file lists all registered
32
+ hooks inside the hooks property:
33
+
34
+
35
+
36
+
37
+ ```
38
+ "hooks": [
39
+ {"name": "sfcc.app.tax.calculate", "script": "./calculate.js"},
40
+ {"name": "sfcc.app.tax.commit", "script": "./commit.js"},
41
+ {"name": "sfcc.app.tax.cancel", "script": "./cancel.js"}
42
+ ]
43
+ ```
44
+
45
+
46
+
47
+ A hook entry has a `name` and a `script` property:
48
+
49
+
50
+
51
+ - The `name`contains the extension point name (the hook name).
52
+ - The `script`contains the script path relative to the hooks file, with the exported hook function.
53
+
54
+
55
+
56
+ **Function Naming Convention:** The exported JavaScript function name must match the last segment of the
57
+ extension point name, for example, `calculate`, `commit`, `cancel`..
58
+
59
+
60
+ Order Lifecycle Context Each hook fires at a specific point in the order lifecycle:
61
+
62
+ - **calculate:**Fires during basket calculation on every basket operation (e.g., adding items, changing quantities, updating shipping). Calculates tax amounts for the basket line items.
63
+ - **commit:**Fires immediately after successful order creation (order status `CREATED`). Notifies the tax provider that the order has been created and tax amounts should be committed.
64
+ - **cancel:**Fires on order cancellation or failure. Notifies the tax provider to void or cancel previously committed tax amounts.
65
+
66
+ Hook Precedence
67
+
68
+ - When `sfcc.app.tax.calculate`is registered, it takes precedence over the legacy `dw.order.calculateTax`hook.
69
+ - If the Commerce App hook is not registered, the platform falls back to `dw.order.calculateTax`(if registered).
70
+ - If neither hook is available, the platform uses default platform tax calculation.
71
+
72
+
73
+
74
+ **Important:** If you override the `dw.order.calculate` hook (the parent basket calculation
75
+ hook), the platform's tax hook selection logic is bypassed entirely. In this case, if you want to use Commerce App
76
+ tax providers, you must manually invoke the `sfcc.app.tax.calculate` hook from within your custom
77
+ `dw.order.calculate` implementation.
78
+
79
+
80
+ SCAPI Behavior
81
+
82
+
83
+ SCAPI requests with `ScapiHookExecutionEnabled` disabled bypass all hooks (both Commerce App tax hooks and
84
+ the legacy `dw.order.calculateTax` hook) and go straight to the default platform tax calculation.
85
+
86
+
87
+ Hook Arguments and Return Types
88
+
89
+ - **calculate:**Receives a `dw.order.LineItemCtnr`(typically a `dw.order.Basket`) as the first argument. Must return a `dw.system.Status`object (or `null`for success).
90
+ - **commit:**Receives a `dw.order.Order`object as the first argument. Must return a `dw.system.Status`object (or `null`for success).
91
+ - **cancel:**Receives a `dw.order.Order`object as the first argument. Must return a `dw.system.Status`object (or `null`for success).
92
+
93
+ Error Handling
94
+ For calculate hook:
95
+
96
+ - **Always blocks on error:**Both returning a `Status.ERROR`and throwing an exception prevent the basket calculation from completing successfully. The platform logs the error and halts the current basket operation. Since order creation requires a successful basket calculation, this also prevents orders from being created with incorrect tax amounts.
97
+
98
+ For commit hook:
99
+
100
+
101
+ The Commerce App developer chooses whether errors should block order creation by how they handle errors in their hook
102
+ implementation:
103
+
104
+
105
+
106
+ - **Non-blocking error:**Catch exceptions and return a `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order should still be created.
107
+ ```
108
+ return new Status(Status.ERROR, 'TAX_COMMIT_FAILED', 'Details about the failure');
109
+ ```
110
+
111
+ - **Blocking error:**Let exceptions propagate (don't catch them). The platform logs the error and rolls back the order lifecycle operation, preventing the order from being created.
112
+ ```
113
+ throw new Error('Tax provider unavailable');
114
+ ```
115
+
116
+
117
+ For cancel hook:
118
+
119
+
120
+ The Commerce App developer chooses whether errors should block order cancellation by how they handle errors in their
121
+ hook implementation:
122
+
123
+
124
+
125
+ - **Non-blocking error:**Catch exceptions and return a `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order cancellation should still proceed.
126
+ ```
127
+ return new Status(Status.ERROR, 'TAX_CANCEL_FAILED', 'Details about the failure');
128
+ ```
129
+
130
+ - **Blocking error:**Let exceptions propagate (don't catch them). The platform logs the error and rolls back the order cancellation operation.
131
+ ```
132
+ throw new Error('Tax provider unavailable');
133
+ ```
134
+
135
+
136
+
137
+ ## Constant Summary
138
+
139
+ | Constant | Description |
140
+ | --- | --- |
141
+ | [extensionPointAppCalculateTax](#extensionpointappcalculatetax): [String](TopLevel.String.md) = "sfcc.app.tax.calculate" | The extension point name sfcc.app.tax.calculate. |
142
+ | [extensionPointAppCancelTax](#extensionpointappcanceltax): [String](TopLevel.String.md) = "sfcc.app.tax.cancel" | The extension point name sfcc.app.tax.cancel. |
143
+ | [extensionPointAppCommitTax](#extensionpointappcommittax): [String](TopLevel.String.md) = "sfcc.app.tax.commit" | The extension point name sfcc.app.tax.commit. |
144
+
145
+ ## Constructor Summary
146
+
147
+ This class does not have a constructor, so you cannot create it directly.
148
+ ## Method Summary
149
+
150
+ | Method | Description |
151
+ | --- | --- |
152
+ | [calculate](dw.order.hooks.TaxHooks.md#calculatelineitemctnr)([LineItemCtnr](dw.order.LineItemCtnr.md)) | The function is called by extension point [extensionPointAppCalculateTax](dw.order.hooks.TaxHooks.md#extensionpointappcalculatetax). |
153
+ | [cancel](dw.order.hooks.TaxHooks.md#cancelorder)([Order](dw.order.Order.md)) | The function is called by extension point [extensionPointAppCancelTax](dw.order.hooks.TaxHooks.md#extensionpointappcanceltax) during OrderMgr.failOrder() or OrderMgr.cancelOrder(). |
154
+ | [commit](dw.order.hooks.TaxHooks.md#commitorder)([Order](dw.order.Order.md)) | The function is called by extension point [extensionPointAppCommitTax](dw.order.hooks.TaxHooks.md#extensionpointappcommittax) during order creation in the order creation transaction. |
155
+
156
+ ### Methods inherited from class Object
157
+
158
+ [assign](TopLevel.Object.md#assignobject-object), [create](TopLevel.Object.md#createobject), [create](TopLevel.Object.md#createobject-object), [defineProperties](TopLevel.Object.md#definepropertiesobject-object), [defineProperty](TopLevel.Object.md#definepropertyobject-object-object), [entries](TopLevel.Object.md#entriesobject), [freeze](TopLevel.Object.md#freezeobject), [fromEntries](TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](TopLevel.Object.md#hasownpropertystring), [is](TopLevel.Object.md#isobject-object), [isExtensible](TopLevel.Object.md#isextensibleobject), [isFrozen](TopLevel.Object.md#isfrozenobject), [isPrototypeOf](TopLevel.Object.md#isprototypeofobject), [isSealed](TopLevel.Object.md#issealedobject), [keys](TopLevel.Object.md#keysobject), [preventExtensions](TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](TopLevel.Object.md#propertyisenumerablestring), [seal](TopLevel.Object.md#sealobject), [setPrototypeOf](TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](TopLevel.Object.md#tolocalestring), [toString](TopLevel.Object.md#tostring), [valueOf](TopLevel.Object.md#valueof), [values](TopLevel.Object.md#valuesobject)
159
+ ## Constant Details
160
+
161
+ ### extensionPointAppCalculateTax
162
+
163
+ - extensionPointAppCalculateTax: [String](TopLevel.String.md) = "sfcc.app.tax.calculate"
164
+ - : The extension point name sfcc.app.tax.calculate.
165
+
166
+
167
+ ---
168
+
169
+ ### extensionPointAppCancelTax
170
+
171
+ - extensionPointAppCancelTax: [String](TopLevel.String.md) = "sfcc.app.tax.cancel"
172
+ - : The extension point name sfcc.app.tax.cancel.
173
+
174
+
175
+ ---
176
+
177
+ ### extensionPointAppCommitTax
178
+
179
+ - extensionPointAppCommitTax: [String](TopLevel.String.md) = "sfcc.app.tax.commit"
180
+ - : The extension point name sfcc.app.tax.commit.
181
+
182
+
183
+ ---
184
+
185
+ ## Method Details
186
+
187
+ ### calculate(LineItemCtnr)
188
+ - calculate(lineItemCtnr: [LineItemCtnr](dw.order.LineItemCtnr.md)): [Status](dw.system.Status.md)
189
+ - : The function is called by extension point [extensionPointAppCalculateTax](dw.order.hooks.TaxHooks.md#extensionpointappcalculatetax). It calculates tax amounts for
190
+ the basket line items during basket calculation. This hook fires on every basket operation (e.g., adding items,
191
+ changing quantities, updating shipping), not only before order creation.
192
+
193
+
194
+ **Note:** If the `dw.order.calculate` hook is overridden, the platform's automatic tax
195
+ hook selection is bypassed. You must manually invoke this hook from within your custom
196
+ `dw.order.calculate` implementation if you want to use Commerce App tax providers.
197
+
198
+
199
+
200
+
201
+ **Error Handling:** Both returning a `Status.ERROR` and throwing an exception will
202
+ prevent the basket calculation from completing successfully. The platform logs the error and halts the current
203
+ basket operation. Since order creation requires a successful basket calculation, this also prevents orders from
204
+ being created with incorrect tax amounts.
205
+
206
+
207
+
208
+
209
+ **SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
210
+ this hook and use default platform tax calculation.
211
+
212
+
213
+
214
+
215
+ **Sample Implementation:**
216
+
217
+
218
+
219
+
220
+ ```
221
+ function calculate(basket) {
222
+ var TaxMgr = require('dw/order/TaxMgr');
223
+ var Status = require('dw/system/Status');
224
+ var HTTPClient = require('dw/net/HTTPClient');
225
+
226
+ // 1. Extract shipping address and line items
227
+ var shipment = basket.getDefaultShipment();
228
+ var shippingAddress = shipment.getShippingAddress();
229
+
230
+ // 2. Build request for external tax provider
231
+ var taxRequest = {
232
+ addresses: {
233
+ shipTo: {
234
+ line1: shippingAddress.getAddress1(),
235
+ city: shippingAddress.getCity(),
236
+ region: shippingAddress.getStateCode(),
237
+ country: shippingAddress.getCountryCode().getValue(),
238
+ postalCode: shippingAddress.getPostalCode()
239
+ }
240
+ },
241
+ lines: []
242
+ };
243
+
244
+ // Add product line items
245
+ var pliIterator = basket.getProductLineItems().iterator();
246
+ while (pliIterator.hasNext()) {
247
+ var pli = pliIterator.next();
248
+ taxRequest.lines.push({
249
+ itemCode: pli.getProductID(),
250
+ quantity: pli.getQuantityValue(),
251
+ amount: pli.getAdjustedPrice().getValue(),
252
+ taxCode: pli.getTaxClassID() // Product tax category
253
+ });
254
+ }
255
+
256
+ // 3. Call external tax service
257
+ var httpClient = new HTTPClient();
258
+ httpClient.open('POST', 'https://api.taxprovider.com/calculate');
259
+ httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
260
+ httpClient.send(JSON.stringify(taxRequest));
261
+
262
+ if (httpClient.statusCode !== 200) {
263
+ return new Status(Status.ERROR, 'TAX_CALC_FAILED', 'Tax calculation failed: ' + httpClient.errorText);
264
+ }
265
+
266
+ var taxResponse = JSON.parse(httpClient.text);
267
+
268
+ // 4. Apply tax amounts to basket line items using TaxMgr
269
+ taxResponse.lines.forEach(function(line, index) {
270
+ var pli = basket.getProductLineItems()[index];
271
+ TaxMgr.setProductLineTax(pli, line.tax);
272
+ });
273
+
274
+ // Set shipping tax if applicable
275
+ if (taxResponse.shippingTax) {
276
+ TaxMgr.setShippingTax(shipment, taxResponse.shippingTax);
277
+ }
278
+
279
+ return new Status(Status.OK);
280
+ }
281
+
282
+ exports.calculate = calculate;
283
+ ```
284
+
285
+
286
+
287
+ **Common APIs used:** `dw.order.TaxMgr` (setProductLineTax, setShippingTax),
288
+ dw.net.HTTPClient, `dw.order.LineItemCtnr` (getProductLineItems, getShipments),
289
+ `dw.order.ProductLineItem` (getProductID, getTaxClassID), `dw.order.OrderAddress`
290
+ (getAddress1, getCity, getStateCode).
291
+
292
+
293
+ **Parameters:**
294
+ - lineItemCtnr - the line item container (basket) for which tax should be calculated.
295
+
296
+ **Returns:**
297
+ - `Status.OK` or `null` for success; `Status.ERROR` to block the basket
298
+ calculation with details about the failure. Throwing an exception will also block the basket calculation.
299
+
300
+
301
+
302
+ ---
303
+
304
+ ### cancel(Order)
305
+ - cancel(order: [Order](dw.order.Order.md)): [Status](dw.system.Status.md)
306
+ - : The function is called by extension point [extensionPointAppCancelTax](dw.order.hooks.TaxHooks.md#extensionpointappcanceltax) during OrderMgr.failOrder() or
307
+ OrderMgr.cancelOrder(). It notifies the Commerce App tax provider that the order has been cancelled or has
308
+ failed, and that previously committed tax amounts should be voided or cancelled in the tax provider.
309
+
310
+
311
+ **Error Handling:**
312
+
313
+
314
+
315
+ - **Non-blocking error:**Return `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order cancellation should still proceed.
316
+ - **Blocking error:**Throw an exception. The platform logs the error and rolls back the order lifecycle operation.
317
+
318
+
319
+
320
+ **SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
321
+ this hook.
322
+
323
+
324
+
325
+
326
+ **Sample Implementation:**
327
+
328
+
329
+
330
+
331
+ ```
332
+ function cancel(order) {
333
+ var Status = require('dw/system/Status');
334
+ var HTTPClient = require('dw/net/HTTPClient');
335
+
336
+ // 1. Retrieve the external transaction ID stored during commit
337
+ var taxProviderTransactionId = order.custom.taxProviderTransactionId;
338
+
339
+ if (!taxProviderTransactionId) {
340
+ // No transaction to cancel - tax was never committed
341
+ return new Status(Status.OK);
342
+ }
343
+
344
+ // 2. Build void/cancel request for external tax provider
345
+ var cancelRequest = {
346
+ code: order.getOrderNo(),
347
+ type: 'SalesInvoice'
348
+ };
349
+
350
+ // 3. Call external tax service to void/cancel the transaction
351
+ var httpClient = new HTTPClient();
352
+ httpClient.open('POST', 'https://api.taxprovider.com/transactions/' + taxProviderTransactionId + '/void');
353
+ httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
354
+ httpClient.send(JSON.stringify(cancelRequest));
355
+
356
+ if (httpClient.statusCode !== 200 && httpClient.statusCode !== 204) {
357
+ // Non-blocking error: log warning but allow order cancellation to proceed
358
+ return new Status(Status.ERROR, 'TAX_CANCEL_FAILED',
359
+ 'Failed to void tax transaction in provider, order cancellation will proceed. Error: ' + httpClient.errorText);
360
+ }
361
+
362
+ return new Status(Status.OK);
363
+ }
364
+
365
+ exports.cancel = cancel;
366
+ ```
367
+
368
+
369
+
370
+ **Common APIs used:** dw.net.HTTPClient, `dw.order.Order` (getOrderNo, custom
371
+ attributes), dw.system.Status.
372
+
373
+
374
+ **Parameters:**
375
+ - order - the order that has been cancelled and for which tax should be voided.
376
+
377
+ **Returns:**
378
+ - `Status.OK` or `null` for success; `Status.ERROR` to log a warning
379
+ without blocking the order cancellation. Throwing an exception will roll back the order cancellation
380
+ operation.
381
+
382
+
383
+
384
+ ---
385
+
386
+ ### commit(Order)
387
+ - commit(order: [Order](dw.order.Order.md)): [Status](dw.system.Status.md)
388
+ - : The function is called by extension point [extensionPointAppCommitTax](dw.order.hooks.TaxHooks.md#extensionpointappcommittax) during order creation in the order
389
+ creation transaction. It notifies the Commerce App tax provider that the order has been successfully created and
390
+ that tax amounts should be committed to the tax provider. The order is in `CREATED` status at this
391
+ point (before being placed).
392
+
393
+
394
+ **Error Handling:**
395
+
396
+
397
+
398
+ - **Non-blocking error:**Return `Status.ERROR`. The platform logs the error as a warning and continues with the order lifecycle. Use this when the tax provider is temporarily unavailable but the order should still be created.
399
+ - **Blocking error:**Throw an exception. The platform logs the error and rolls back the order lifecycle operation, preventing the order from being created.
400
+
401
+
402
+
403
+ **SCAPI Behavior:** When `ScapiHookExecutionEnabled` is disabled, SCAPI requests bypass
404
+ this hook.
405
+
406
+
407
+
408
+
409
+ **Sample Implementation:**
410
+
411
+
412
+
413
+
414
+ ```
415
+ function commit(order) {
416
+ var Transaction = require('dw/system/Transaction');
417
+ var Status = require('dw/system/Status');
418
+ var HTTPClient = require('dw/net/HTTPClient');
419
+
420
+ // 1. Build commit request for external tax provider
421
+ var commitRequest = {
422
+ code: order.getOrderNo(), // Use order number as unique transaction ID
423
+ type: 'SalesInvoice',
424
+ companyCode: 'DEFAULT',
425
+ date: order.getCreationDate(),
426
+ customerCode: order.getCustomerNo(),
427
+ addresses: {
428
+ shipTo: {
429
+ line1: order.getDefaultShipment().getShippingAddress().getAddress1(),
430
+ city: order.getDefaultShipment().getShippingAddress().getCity(),
431
+ region: order.getDefaultShipment().getShippingAddress().getStateCode(),
432
+ country: order.getDefaultShipment().getShippingAddress().getCountryCode().getValue(),
433
+ postalCode: order.getDefaultShipment().getShippingAddress().getPostalCode()
434
+ }
435
+ },
436
+ lines: [],
437
+ commit: true // Tell provider to commit the transaction
438
+ };
439
+
440
+ // Add order line items
441
+ var pliIterator = order.getProductLineItems().iterator();
442
+ while (pliIterator.hasNext()) {
443
+ var pli = pliIterator.next();
444
+ commitRequest.lines.push({
445
+ itemCode: pli.getProductID(),
446
+ quantity: pli.getQuantityValue(),
447
+ amount: pli.getAdjustedPrice().getValue(),
448
+ tax: pli.getAdjustedTax().getValue()
449
+ });
450
+ }
451
+
452
+ // 2. Call external tax service to commit transaction
453
+ var httpClient = new HTTPClient();
454
+ httpClient.open('POST', 'https://api.taxprovider.com/transactions');
455
+ httpClient.setRequestHeader('Authorization', 'Bearer ' + apiKey);
456
+ httpClient.send(JSON.stringify(commitRequest));
457
+
458
+ if (httpClient.statusCode !== 200 && httpClient.statusCode !== 201) {
459
+ // Non-blocking error: log warning but allow order to proceed
460
+ return new Status(Status.ERROR, 'TAX_COMMIT_FAILED',
461
+ 'Failed to commit tax to provider, order will proceed. Error: ' + httpClient.errorText);
462
+ }
463
+
464
+ var commitResponse = JSON.parse(httpClient.text);
465
+
466
+ // 3. Store external transaction ID in order custom attribute for later reference (cancel/refund)
467
+ Transaction.wrap(function() {
468
+ order.custom.taxProviderTransactionId = commitResponse.id;
469
+ });
470
+
471
+ return new Status(Status.OK);
472
+ }
473
+
474
+ exports.commit = commit;
475
+ ```
476
+
477
+
478
+
479
+ **Common APIs used:** dw.system.Transaction, dw.net.HTTPClient, `dw.order.Order`
480
+ (getOrderNo, getProductLineItems, getDefaultShipment, custom attributes), `dw.order.ProductLineItem`
481
+ (getAdjustedTax).
482
+
483
+
484
+ **Parameters:**
485
+ - order - the order that has been created and for which tax should be committed.
486
+
487
+ **Returns:**
488
+ - `Status.OK` or `null` for success; `Status.ERROR` to log a warning
489
+ without blocking the order. Throwing an exception will roll back the order creation.
490
+
491
+
492
+
493
+ ---
494
+
495
+ <!-- prettier-ignore-end -->
@@ -10,3 +10,4 @@
10
10
  | [PaymentHooks](dw.order.hooks.PaymentHooks.md) | This interface represents all script hooks that can be registered to customize the order center payment functionality. |
11
11
  | [ReturnHooks](dw.order.hooks.ReturnHooks.md) | This interface represents all script hooks that can be registered to customizing the order center return resource. |
12
12
  | [ShippingOrderHooks](dw.order.hooks.ShippingOrderHooks.md) | This interface represents all script hooks that can be registered around shipping order lifecycle. |
13
+ | [TaxHooks](dw.order.hooks.TaxHooks.md) | This interface represents tax extension points for Commerce App tax providers. |
@@ -24,6 +24,7 @@
24
24
  | [InvoiceItem](dw.order.InvoiceItem.md) | Represents a specific item in an [Invoice](dw.order.Invoice.md). |
25
25
  | [LineItem](dw.order.LineItem.md) | Common line item base class. |
26
26
  | [LineItemCtnr](dw.order.LineItemCtnr.md) | A container for line items, such as ProductLineItems, CouponLineItems, GiftCertificateLineItems. |
27
+ | [LineItemTax](dw.order.LineItemTax.md) | A tax on a line item: tax identifier, rate, and optional amount. |
27
28
  | [Order](dw.order.Order.md) | The Order class represents an order. |
28
29
  | [OrderAddress](dw.order.OrderAddress.md) | The Address class represents a customer's address. |
29
30
  | [OrderItem](dw.order.OrderItem.md) | Defines _extensions_ to [ProductLineItem](dw.order.ProductLineItem.md)s and [ShippingLineItem](dw.order.ShippingLineItem.md)s belonging to an [order](dw.order.Order.md). |
@@ -129,7 +129,7 @@ This class does not have a constructor, so you cannot create it directly.
129
129
 
130
130
 
131
131
  **Returns:**
132
- - `true` if the {@code SitemapFile} is valid, `false` otherwise.
132
+ - `true` if the `SitemapFile` is valid, `false` otherwise.
133
133
 
134
134
 
135
135
  ---
@@ -42,6 +42,7 @@ This class does not have a constructor, so you cannot create it directly.
42
42
  | static [deleteCustomSitemapFiles](dw.sitemap.SitemapMgr.md#deletecustomsitemapfiles)() | Deletes all custom sitemap files for all hostnames from the appservers shared file system. |
43
43
  | static [deleteCustomSitemapFiles](dw.sitemap.SitemapMgr.md#deletecustomsitemapfilesstring)([String](TopLevel.String.md)) | Deletes all custom sitemap files for the given hostname from the appservers shared file system. |
44
44
  | static [getCustomSitemapFiles](dw.sitemap.SitemapMgr.md#getcustomsitemapfiles)() | Reads all existing custom sitemap files from files system of the appservers custom sitemap directory into memory and returns them in a Map containing mappings like <ul> <li>Hostname 1 => \[SitemapFile hostname1\_sitemapfile1, SitemapFile hostname1\_sitemapfile2\]</li> <li>Hostname 2 => \[SitemapFile hostname2\_sitemapfile1\]</li> </ul> |
45
+ | static [getSitemap](dw.sitemap.SitemapMgr.md#getsitemapstring)([String](TopLevel.String.md)) | Reads the content of the specified sitemap file and returns it as a String. |
45
46
 
46
47
  ### Methods inherited from class Object
47
48
 
@@ -137,6 +138,28 @@ This class does not have a constructor, so you cannot create it directly.
137
138
  - The created map containing the list of SitemapFiles.
138
139
 
139
140
 
141
+ ---
142
+
143
+ ### getSitemap(String)
144
+ - static getSitemap(fileName: [String](TopLevel.String.md)): [String](TopLevel.String.md)
145
+ - : Reads the content of the specified sitemap file and returns it as a String.
146
+
147
+
148
+ The file is looked up in the shared sitemap directory for the current site,
149
+ using the hostname from the current storefront request. If the file is not found
150
+ in the new framework location ({@code .../sitemaps/<hostname>/}), the old
151
+ location ({@code .../sitemaps/}) is used as a fallback.
152
+
153
+
154
+ **Parameters:**
155
+ - fileName - The name of the sitemap file to read (e.g. "sitemap\_index.xml"). Must not be {@code null}, empty, or contain path traversal sequences.
156
+
157
+ **Returns:**
158
+ - The sitemap file content as a String, or {@code null} if the fileName is
159
+ invalid, the file does not exist, or the request context is unavailable.
160
+
161
+
162
+
140
163
  ---
141
164
 
142
165
  <!-- prettier-ignore-end -->
@@ -394,7 +394,6 @@ Use [Response.addHttpCookie(Cookie)](dw.system.Response.md#addhttpcookiecookie)
394
394
  :::
395
395
  **API Version:**
396
396
  :::note
397
- No longer available as of version 99.2.
398
397
  This method is deprecated and will be removed in the next API version.
399
398
  :::
400
399
 
@@ -16,6 +16,8 @@ This class does not have a constructor, so you cannot create it directly.
16
16
  | --- | --- |
17
17
  | static [areEqual](dw.util.Assert.md#areequalobject-object)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md)) | Propagates an assertion if the specified objects are not equal. |
18
18
  | static [areEqual](dw.util.Assert.md#areequalobject-object-string)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md), [String](TopLevel.String.md)) | Propagates an assertion using the specified message if the specified objects are not equal. |
19
+ | static [areNotEqual](dw.util.Assert.md#arenotequalobject-object)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md)) | Propagates an assertion if the specified objects are equal. |
20
+ | static [areNotEqual](dw.util.Assert.md#arenotequalobject-object-string)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md), [String](TopLevel.String.md)) | Propagates an assertion using the specified message if the specified objects are equal. |
19
21
  | static [areSame](dw.util.Assert.md#aresameobject-object)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md)) | Propagates an assertion if the specified objects are not the same. |
20
22
  | static [areSame](dw.util.Assert.md#aresameobject-object-string)([Object](TopLevel.Object.md), [Object](TopLevel.Object.md), [String](TopLevel.String.md)) | Propagates an assertion using the specified message if the specified objects are not the same. |
21
23
  | static [fail](dw.util.Assert.md#fail)() | Propagates a failure assertion. |
@@ -65,6 +67,33 @@ This class does not have a constructor, so you cannot create it directly.
65
67
  - msg - the assertion message.
66
68
 
67
69
 
70
+ ---
71
+
72
+ ### areNotEqual(Object, Object)
73
+ - static areNotEqual(arg1: [Object](TopLevel.Object.md), arg2: [Object](TopLevel.Object.md)): void
74
+ - : Propagates an assertion
75
+ if the specified objects are equal.
76
+
77
+
78
+ **Parameters:**
79
+ - arg1 - the first object to check.
80
+ - arg2 - the second object to check.
81
+
82
+
83
+ ---
84
+
85
+ ### areNotEqual(Object, Object, String)
86
+ - static areNotEqual(arg1: [Object](TopLevel.Object.md), arg2: [Object](TopLevel.Object.md), msg: [String](TopLevel.String.md)): void
87
+ - : Propagates an assertion using the specified message
88
+ if the specified objects are equal.
89
+
90
+
91
+ **Parameters:**
92
+ - arg1 - the first object to check.
93
+ - arg2 - the second object to check.
94
+ - msg - the assertion message.
95
+
96
+
68
97
  ---
69
98
 
70
99
  ### areSame(Object, Object)
@@ -35,7 +35,7 @@ This class does not have a constructor, so you cannot create it directly.
35
35
  | [getISO3Country](dw.util.Locale.md#getiso3country)() | Returns the uppercase ISO 3166 3-letter country/region code for this Locale. |
36
36
  | [getISO3Language](dw.util.Locale.md#getiso3language)() | Returns the 3-letter ISO 639 language code for this Locale. |
37
37
  | [getLanguage](dw.util.Locale.md#getlanguage)() | Returns the lowercase ISO 639 language code for this Locale. |
38
- | static [getLocale](dw.util.Locale.md#getlocalestring)([String](TopLevel.String.md)) | Returns a Locale instance for the given localeId, or `null` if no such Locale could be found. |
38
+ | static [getLocale](dw.util.Locale.md#getlocalestring---variant-1)([String](TopLevel.String.md)) | Returns a Locale instance for the given localeId, or `null` if no such Locale could be found. |
39
39
  | [toString](dw.util.Locale.md#tostring)() | Returns the String representation of the localeID. |
40
40
 
41
41
  ### Methods inherited from class Object
@@ -239,7 +239,7 @@ This class does not have a constructor, so you cannot create it directly.
239
239
 
240
240
  ---
241
241
 
242
- ### getLocale(String)
242
+ ### getLocale(String) - Variant 1
243
243
  - static getLocale(localeId: [String](TopLevel.String.md)): [Locale](dw.util.Locale.md)
244
244
  - : Returns a Locale instance for the given localeId, or
245
245
  `null` if no such Locale could be found.
@@ -253,6 +253,9 @@ This class does not have a constructor, so you cannot create it directly.
253
253
  `null` if no such Locale could be found.
254
254
 
255
255
 
256
+ **API Version:**
257
+ :::note
258
+ :::
256
259
 
257
260
  ---
258
261