@salesforce/lds-adapters-commerce-store-pricing 0.1.0-dev1

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 (21) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/commerce-store-pricing.js +382 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getProductPrice.d.ts +29 -0
  5. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
  7. package/dist/es/es2018/types/src/generated/resources/getCommerceWebstoresPricingProductsByProductIdAndWebstoreId.d.ts +19 -0
  8. package/dist/es/es2018/types/src/generated/types/PriceAdjustmentScheduleRepresentation.d.ts +32 -0
  9. package/dist/es/es2018/types/src/generated/types/PriceAdjustmentTierRepresentation.d.ts +43 -0
  10. package/dist/es/es2018/types/src/generated/types/PricingInputRepresentation.d.ts +28 -0
  11. package/dist/es/es2018/types/src/generated/types/PricingLineItemInputRepresentation.d.ts +28 -0
  12. package/dist/es/es2018/types/src/generated/types/PricingLineItemInputRepresentationList.d.ts +28 -0
  13. package/dist/es/es2018/types/src/generated/types/PricingResultLineItemRepresentation.d.ts +40 -0
  14. package/dist/es/es2018/types/src/generated/types/PricingResultRepresentation.d.ts +35 -0
  15. package/dist/es/es2018/types/src/generated/types/ProductPriceRepresentation.d.ts +41 -0
  16. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  17. package/package.json +60 -0
  18. package/sfdc/index.d.ts +1 -0
  19. package/sfdc/index.js +413 -0
  20. package/src/raml/api.raml +197 -0
  21. package/src/raml/luvio.raml +16 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,413 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'Commerce';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ const { stringify: JSONStringify } = JSON;
86
+ function createLink(ref) {
87
+ return {
88
+ __ref: serializeStructuredKey(ref),
89
+ };
90
+ }
91
+
92
+ function validate$2(obj, path = 'PriceAdjustmentTierRepresentation') {
93
+ const v_error = (() => {
94
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
95
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
96
+ }
97
+ const obj_adjustmentType = obj.adjustmentType;
98
+ const path_adjustmentType = path + '.adjustmentType';
99
+ if (typeof obj_adjustmentType !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_adjustmentType + '" (at "' + path_adjustmentType + '")');
101
+ }
102
+ const obj_adjustmentValue = obj.adjustmentValue;
103
+ const path_adjustmentValue = path + '.adjustmentValue';
104
+ if (typeof obj_adjustmentValue !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_adjustmentValue + '" (at "' + path_adjustmentValue + '")');
106
+ }
107
+ const obj_id = obj.id;
108
+ const path_id = path + '.id';
109
+ if (typeof obj_id !== 'string') {
110
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
111
+ }
112
+ const obj_lowerBound = obj.lowerBound;
113
+ const path_lowerBound = path + '.lowerBound';
114
+ if (typeof obj_lowerBound !== 'string') {
115
+ return new TypeError('Expected "string" but received "' + typeof obj_lowerBound + '" (at "' + path_lowerBound + '")');
116
+ }
117
+ const obj_tierUnitPrice = obj.tierUnitPrice;
118
+ const path_tierUnitPrice = path + '.tierUnitPrice';
119
+ if (typeof obj_tierUnitPrice !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_tierUnitPrice + '" (at "' + path_tierUnitPrice + '")');
121
+ }
122
+ const obj_upperBound = obj.upperBound;
123
+ const path_upperBound = path + '.upperBound';
124
+ if (typeof obj_upperBound !== 'string') {
125
+ return new TypeError('Expected "string" but received "' + typeof obj_upperBound + '" (at "' + path_upperBound + '")');
126
+ }
127
+ })();
128
+ return v_error === undefined ? null : v_error;
129
+ }
130
+
131
+ function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
132
+ const v_error = (() => {
133
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
134
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
135
+ }
136
+ const obj_id = obj.id;
137
+ const path_id = path + '.id';
138
+ if (typeof obj_id !== 'string') {
139
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
140
+ }
141
+ const obj_priceAdjustmentTiers = obj.priceAdjustmentTiers;
142
+ const path_priceAdjustmentTiers = path + '.priceAdjustmentTiers';
143
+ if (!ArrayIsArray(obj_priceAdjustmentTiers)) {
144
+ return new TypeError('Expected "array" but received "' + typeof obj_priceAdjustmentTiers + '" (at "' + path_priceAdjustmentTiers + '")');
145
+ }
146
+ for (let i = 0; i < obj_priceAdjustmentTiers.length; i++) {
147
+ const obj_priceAdjustmentTiers_item = obj_priceAdjustmentTiers[i];
148
+ const path_priceAdjustmentTiers_item = path_priceAdjustmentTiers + '[' + i + ']';
149
+ const referencepath_priceAdjustmentTiers_itemValidationError = validate$2(obj_priceAdjustmentTiers_item, path_priceAdjustmentTiers_item);
150
+ if (referencepath_priceAdjustmentTiers_itemValidationError !== null) {
151
+ let message = 'Object doesn\'t match PriceAdjustmentTierRepresentation (at "' + path_priceAdjustmentTiers_item + '")\n';
152
+ message += referencepath_priceAdjustmentTiers_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
153
+ return new TypeError(message);
154
+ }
155
+ }
156
+ })();
157
+ return v_error === undefined ? null : v_error;
158
+ }
159
+
160
+ const VERSION = "3e2882f4e8e38efd02e1a14114269e4c";
161
+ function validate(obj, path = 'ProductPriceRepresentation') {
162
+ const v_error = (() => {
163
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
164
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
165
+ }
166
+ const obj_currencyIsoCode = obj.currencyIsoCode;
167
+ const path_currencyIsoCode = path + '.currencyIsoCode';
168
+ if (typeof obj_currencyIsoCode !== 'string') {
169
+ return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
170
+ }
171
+ const obj_listPrice = obj.listPrice;
172
+ const path_listPrice = path + '.listPrice';
173
+ if (typeof obj_listPrice !== 'string') {
174
+ return new TypeError('Expected "string" but received "' + typeof obj_listPrice + '" (at "' + path_listPrice + '")');
175
+ }
176
+ const obj_priceAdjustment = obj.priceAdjustment;
177
+ const path_priceAdjustment = path + '.priceAdjustment';
178
+ let obj_priceAdjustment_union0 = null;
179
+ const obj_priceAdjustment_union0_error = (() => {
180
+ const referencepath_priceAdjustmentValidationError = validate$1(obj_priceAdjustment, path_priceAdjustment);
181
+ if (referencepath_priceAdjustmentValidationError !== null) {
182
+ let message = 'Object doesn\'t match PriceAdjustmentScheduleRepresentation (at "' + path_priceAdjustment + '")\n';
183
+ message += referencepath_priceAdjustmentValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
184
+ return new TypeError(message);
185
+ }
186
+ })();
187
+ if (obj_priceAdjustment_union0_error != null) {
188
+ obj_priceAdjustment_union0 = obj_priceAdjustment_union0_error.message;
189
+ }
190
+ let obj_priceAdjustment_union1 = null;
191
+ const obj_priceAdjustment_union1_error = (() => {
192
+ if (obj_priceAdjustment !== null) {
193
+ return new TypeError('Expected "null" but received "' + typeof obj_priceAdjustment + '" (at "' + path_priceAdjustment + '")');
194
+ }
195
+ })();
196
+ if (obj_priceAdjustment_union1_error != null) {
197
+ obj_priceAdjustment_union1 = obj_priceAdjustment_union1_error.message;
198
+ }
199
+ if (obj_priceAdjustment_union0 && obj_priceAdjustment_union1) {
200
+ let message = 'Object doesn\'t match union (at "' + path_priceAdjustment + '")';
201
+ message += '\n' + obj_priceAdjustment_union0.split('\n').map((line) => '\t' + line).join('\n');
202
+ message += '\n' + obj_priceAdjustment_union1.split('\n').map((line) => '\t' + line).join('\n');
203
+ return new TypeError(message);
204
+ }
205
+ const obj_pricebookEntryId = obj.pricebookEntryId;
206
+ const path_pricebookEntryId = path + '.pricebookEntryId';
207
+ if (typeof obj_pricebookEntryId !== 'string') {
208
+ return new TypeError('Expected "string" but received "' + typeof obj_pricebookEntryId + '" (at "' + path_pricebookEntryId + '")');
209
+ }
210
+ const obj_unitPrice = obj.unitPrice;
211
+ const path_unitPrice = path + '.unitPrice';
212
+ if (typeof obj_unitPrice !== 'string') {
213
+ return new TypeError('Expected "string" but received "' + typeof obj_unitPrice + '" (at "' + path_unitPrice + '")');
214
+ }
215
+ })();
216
+ return v_error === undefined ? null : v_error;
217
+ }
218
+ const RepresentationType = 'ProductPriceRepresentation';
219
+ function normalize(input, existing, path, luvio, store, timestamp) {
220
+ return input;
221
+ }
222
+ const select$1 = function ProductPriceRepresentationSelect() {
223
+ return {
224
+ kind: 'Fragment',
225
+ version: VERSION,
226
+ private: [],
227
+ opaque: true
228
+ };
229
+ };
230
+ function equals(existing, incoming) {
231
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
232
+ return false;
233
+ }
234
+ return true;
235
+ }
236
+ const ingest = function ProductPriceRepresentationIngest(input, path, luvio, store, timestamp) {
237
+ if (process.env.NODE_ENV !== 'production') {
238
+ const validateError = validate(input);
239
+ if (validateError !== null) {
240
+ throw validateError;
241
+ }
242
+ }
243
+ const key = path.fullPath;
244
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
245
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Commerce", VERSION, RepresentationType, equals);
246
+ return createLink(key);
247
+ };
248
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
249
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
250
+ const rootKey = fullPathFactory();
251
+ rootKeySet.set(rootKey, {
252
+ namespace: keyPrefix,
253
+ representationName: RepresentationType,
254
+ mergeable: false
255
+ });
256
+ }
257
+
258
+ function select(luvio, params) {
259
+ return select$1();
260
+ }
261
+ function keyBuilder$1(luvio, params) {
262
+ return keyPrefix + '::ProductPriceRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'productId:' + params.urlParams.productId + ',' + 'webstoreId:' + params.urlParams.webstoreId + ')';
263
+ }
264
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
265
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
266
+ }
267
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
268
+ const { body } = response;
269
+ const key = keyBuilder$1(luvio, resourceParams);
270
+ luvio.storeIngest(key, ingest, body);
271
+ const snapshot = luvio.storeLookup({
272
+ recordId: key,
273
+ node: select(),
274
+ variables: {},
275
+ }, snapshotRefresh);
276
+ if (process.env.NODE_ENV !== 'production') {
277
+ if (snapshot.state !== 'Fulfilled') {
278
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
279
+ }
280
+ }
281
+ deepFreeze(snapshot.data);
282
+ return snapshot;
283
+ }
284
+ function ingestError(luvio, params, error, snapshotRefresh) {
285
+ const key = keyBuilder$1(luvio, params);
286
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
287
+ luvio.storeIngestError(key, errorSnapshot);
288
+ return errorSnapshot;
289
+ }
290
+ function createResourceRequest(config) {
291
+ const headers = {};
292
+ return {
293
+ baseUri: '/services/data/v66.0',
294
+ basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/pricing/products/' + config.urlParams.productId + '',
295
+ method: 'get',
296
+ body: null,
297
+ urlParams: config.urlParams,
298
+ queryParams: config.queryParams,
299
+ headers,
300
+ priority: 'normal',
301
+ };
302
+ }
303
+
304
+ const adapterName = 'getProductPrice';
305
+ const getProductPrice_ConfigPropertyMetadata = [
306
+ generateParamConfigMetadata('productId', true, 0 /* UrlParameter */, 0 /* String */),
307
+ generateParamConfigMetadata('webstoreId', true, 0 /* UrlParameter */, 0 /* String */),
308
+ generateParamConfigMetadata('effectiveAccountId', false, 1 /* QueryParameter */, 0 /* String */),
309
+ ];
310
+ const getProductPrice_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getProductPrice_ConfigPropertyMetadata);
311
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(getProductPrice_ConfigPropertyMetadata);
312
+ function keyBuilder(luvio, config) {
313
+ const resourceParams = createResourceParams(config);
314
+ return keyBuilder$1(luvio, resourceParams);
315
+ }
316
+ function typeCheckConfig(untrustedConfig) {
317
+ const config = {};
318
+ typeCheckConfig$1(untrustedConfig, config, getProductPrice_ConfigPropertyMetadata);
319
+ return config;
320
+ }
321
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
322
+ if (!untrustedIsObject(untrustedConfig)) {
323
+ return null;
324
+ }
325
+ if (process.env.NODE_ENV !== 'production') {
326
+ validateConfig(untrustedConfig, configPropertyNames);
327
+ }
328
+ const config = typeCheckConfig(untrustedConfig);
329
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
330
+ return null;
331
+ }
332
+ return config;
333
+ }
334
+ function adapterFragment(luvio, config) {
335
+ createResourceParams(config);
336
+ return select();
337
+ }
338
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
339
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
340
+ config,
341
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
342
+ });
343
+ return luvio.storeBroadcast().then(() => snapshot);
344
+ }
345
+ function onFetchResponseError(luvio, config, resourceParams, response) {
346
+ const snapshot = ingestError(luvio, resourceParams, response, {
347
+ config,
348
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
349
+ });
350
+ return luvio.storeBroadcast().then(() => snapshot);
351
+ }
352
+ function buildNetworkSnapshot(luvio, config, options) {
353
+ const resourceParams = createResourceParams(config);
354
+ const request = createResourceRequest(resourceParams);
355
+ return luvio.dispatchResourceRequest(request, options)
356
+ .then((response) => {
357
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
358
+ const cache = new StoreKeyMap();
359
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
360
+ return cache;
361
+ });
362
+ }, (response) => {
363
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
364
+ });
365
+ }
366
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
367
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
368
+ }
369
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
370
+ const { luvio, config } = context;
371
+ const selector = {
372
+ recordId: keyBuilder(luvio, config),
373
+ node: adapterFragment(luvio, config),
374
+ variables: {},
375
+ };
376
+ const cacheSnapshot = storeLookup(selector, {
377
+ config,
378
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
379
+ });
380
+ return cacheSnapshot;
381
+ }
382
+ const getProductPriceAdapterFactory = (luvio) => function Commerce__getProductPrice(untrustedConfig, requestContext) {
383
+ const config = validateAdapterConfig(untrustedConfig, getProductPrice_ConfigPropertyNames);
384
+ // Invalid or incomplete config
385
+ if (config === null) {
386
+ return null;
387
+ }
388
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
389
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
390
+ };
391
+
392
+ let getProductPrice;
393
+ // Imperative GET Adapters
394
+ let getProductPrice_imperative;
395
+ // Adapter Metadata
396
+ const getProductPriceMetadata = { apiFamily: 'Commerce', name: 'getProductPrice' };
397
+ // Notify Update Available
398
+ function bindExportsTo(luvio) {
399
+ // LDS Adapters
400
+ const getProductPrice_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getProductPrice', getProductPriceAdapterFactory), getProductPriceMetadata);
401
+ return {
402
+ getProductPrice: createWireAdapterConstructor(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata),
403
+ // Imperative GET Adapters
404
+ getProductPrice_imperative: createImperativeAdapter(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata),
405
+ // Notify Update Availables
406
+ };
407
+ }
408
+ withDefaultLuvio((luvio) => {
409
+ ({ getProductPrice, getProductPrice_imperative } = bindExportsTo(luvio));
410
+ });
411
+
412
+ export { getProductPrice, getProductPrice_imperative };
413
+ // version: 0.1.0-dev1-c978a7b010
@@ -0,0 +1,197 @@
1
+ #%RAML 1.0
2
+ securedBy:
3
+ - OAuth2
4
+ title: Salesforce Connect API
5
+ version: '52.0'
6
+ mediaType: application/json
7
+ protocols:
8
+ - https
9
+ baseUri: /services/data/v66.0
10
+ securitySchemes:
11
+ OAuth2:
12
+ type: OAuth 2.0
13
+ settings:
14
+ authorizationUri: https://example.com/oauth/authorize
15
+ accessTokenUri: ''
16
+ authorizationGrants:
17
+ - implicit
18
+ annotationTypes:
19
+ oas-readOnly:
20
+ type: boolean
21
+ allowedTargets: TypeDeclaration
22
+ oas-collectionFormat:
23
+ type: string
24
+ oas-body-name:
25
+ type: string
26
+ allowedTargets: TypeDeclaration
27
+ types:
28
+ PriceAdjustmentScheduleRepresentation:
29
+ description: Representation for the details of a single price adjustment schedule
30
+ type: object
31
+ properties:
32
+ id:
33
+ description: Represents the ID of the price adjustment schedule
34
+ type: string
35
+ priceAdjustmentTiers:
36
+ description: Represents the list of price adjustment tiers
37
+ type: array
38
+ items:
39
+ type: PriceAdjustmentTierRepresentation
40
+ PriceAdjustmentTierRepresentation:
41
+ description: Representation for the details of a single price adjustment tier
42
+ type: object
43
+ properties:
44
+ adjustmentType:
45
+ description: Represents the price adjustment type
46
+ type: string
47
+ enum:
48
+ - AmountBasedAdjustment
49
+ - PercentageBasedAdjustment
50
+ adjustmentValue:
51
+ description: Represents the adjustment value
52
+ type: string
53
+ id:
54
+ description: Represents the ID of the price adjustment tier
55
+ type: string
56
+ lowerBound:
57
+ description: Represents the lower bound of the tier
58
+ type: string
59
+ tierUnitPrice:
60
+ description: Represents the unit price of the tier
61
+ type: string
62
+ upperBound:
63
+ description: Represents the upper bound of the tier
64
+ type: string
65
+ PricingInputRepresentation:
66
+ description: Representation of the request for multiple products pricing
67
+ type: object
68
+ properties:
69
+ pricingLineItems:
70
+ description: The Line Items the pricing request is for
71
+ type: array
72
+ items:
73
+ type: object
74
+ PricingLineItemInputRepresentation:
75
+ description: Representation of the Line Item portion the request for multiple
76
+ products pricing
77
+ type: object
78
+ properties:
79
+ productId:
80
+ description: The product ID to be priced in the request
81
+ type: string
82
+ PricingLineItemInputRepresentationList:
83
+ description: Wraps a list of Pricing Line Items for Apex
84
+ type: object
85
+ properties:
86
+ pricingLineItemInputList:
87
+ description: Pricing line Items
88
+ type: array
89
+ items:
90
+ type: object
91
+ PricingResultLineItemRepresentation:
92
+ description: Representation of the Line Item portion of the response for multiple
93
+ products pricing
94
+ type: object
95
+ properties:
96
+ # Error Response representation did not get created
97
+ # error:
98
+ # description: Error code and error message
99
+ # type: ErrorResponseRepresentation
100
+ listPrice:
101
+ description: Represents the list price for the product
102
+ type: string
103
+ pricebookEntryId:
104
+ description: Represents the ID of the pricebook entry
105
+ type: string
106
+ productId:
107
+ description: Represents the product ID to be priced in the response
108
+ type: string
109
+ success:
110
+ description: Represents whether execution was successful
111
+ type: boolean
112
+ unitPrice:
113
+ description: Represents the unit price for the product
114
+ type: string
115
+ PricingResultRepresentation:
116
+ description: Representation for the response for multiple products pricing
117
+ type: object
118
+ properties:
119
+ currencyIsoCode:
120
+ description: Represents the currency used in the Multi Products Pricing API
121
+ type: string
122
+ # Error response representation did not get created
123
+ # error:
124
+ # description: Error code and error message
125
+ # type: ErrorResponseRepresentation
126
+ pricingLineItemResults:
127
+ description: Represents the Line Items of the response
128
+ type: array
129
+ items:
130
+ type: PricingResultLineItemRepresentation
131
+ success:
132
+ description: Represents whether execution was successful
133
+ type: boolean
134
+ ProductPriceRepresentation:
135
+ description: Representation for the details of a single product price
136
+ type: object
137
+ properties:
138
+ currencyIsoCode:
139
+ description: Represents the currency used in this price calculations
140
+ type: string
141
+ listPrice:
142
+ description: Represents the list price for the product
143
+ type: string
144
+ priceAdjustment:
145
+ description: Represents the price adjustment schedule
146
+ type: PriceAdjustmentScheduleRepresentation | nil # TODO "nil" union type hand rolled
147
+ pricebookEntryId:
148
+ description: Represents the ID of the pricebook entry
149
+ type: string
150
+ unitPrice:
151
+ description: Represents the unit price for the product
152
+ type: string
153
+ /commerce/webstores/{webstoreId}/pricing/products:
154
+ # TODO: Hand rolled
155
+ # post:
156
+ # description: Resource to calculate the price
157
+ # responses:
158
+ # '200':
159
+ # description: Success
160
+ # body:
161
+ # application/json:
162
+ # type: PricingResultRepresentation
163
+ # queryParameters:
164
+ # effectiveAccountId:
165
+ # type: string
166
+ # required: false
167
+ # body:
168
+ # application/json:
169
+ # type: PricingInputRepresentation
170
+ # # TODO : HAND ROLLED, required not supported
171
+ # # required: false
172
+ # (oas-body-name): pricingInput
173
+ uriParameters:
174
+ webstoreId:
175
+ type: string
176
+ required: true
177
+ /commerce/webstores/{webstoreId}/pricing/products/{productId}:
178
+ get:
179
+ description: Get the list price and buyer price for a product in the context of
180
+ a Web Store for the given account and currency
181
+ responses:
182
+ '200':
183
+ description: Success
184
+ body:
185
+ application/json:
186
+ type: ProductPriceRepresentation
187
+ queryParameters:
188
+ effectiveAccountId:
189
+ type: string
190
+ required: false
191
+ uriParameters:
192
+ productId:
193
+ type: string
194
+ required: true
195
+ webstoreId:
196
+ type: string
197
+ required: true
@@ -0,0 +1,16 @@
1
+ #%RAML 1.0 Overlay
2
+ extends: ./api.raml
3
+ uses:
4
+ luvio: luvio://annotations.raml
5
+
6
+ (luvio.keyPrefix): 'Commerce'
7
+ (luvio.ttl): 2592000000
8
+
9
+ types:
10
+ ProductPriceRepresentation:
11
+ (luvio.opaque): true
12
+
13
+ /commerce/webstores/{webstoreId}/pricing/products/{productId}:
14
+ get:
15
+ (luvio.adapter):
16
+ name: getProductPrice