Skip to content

Instantly share code, notes, and snippets.

View hnestmann's full-sized avatar

Holger Nestmann hnestmann

  • Salesforce
  • Jena
View GitHub Profile
{
"basePath": "/",
"consumes": [
"application/json",
"text/xml",
"application/xml"
],
"definitions": {
"image": {
"properties": {
This file has been truncated, but you can view the full file.
{
"basePath": "/s/-/dw/shop/v22_4",
"consumes": [
"application/json",
"text/xml",
"application/xml"
],
"definitions": {
"approaching_discount": {
const shortCode = 'abcdefgh';
const tenant = 'zzzz_001';
const clientId = '1234567-890a-bcde-f123-4567890abcd';
const clientSecret = 'secret';
const base = `https://${shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/${tenant}/oauth2/passwordless`;
/** Start Page with a little form, where you can enter your username **/
function start() {
@hnestmann
hnestmann / priceChange.js
Created December 9, 2022 07:39
Job that randomizes prices to simultate operational price changes
'use strict';
/**
* Job Step Type that calculates random price changes
*
* - Covers ~25% of all products (search hits) per job run
* - Throws the dice to generate +/- 5-30% price changes
*/
'use strict';
exports.setApplicablePriceBooks = function () {
var CacheMgr = require('dw/system/CacheMgr');
var Site = require('dw/system/Site');
var cache = CacheMgr.getCache('customer-groups-with-pricebooks');
var cacheKey = Site.getCurrent().ID + '-customer-groups-with-pricebooks';
var customerGroupsWithPricebooks = cache.get(cacheKey, function () {
@hnestmann
hnestmann / requestbody.json
Created September 19, 2023 09:47
Salesforcce Order Management Sample Request
{
"allOrNone": true,
"compositeRequest": [
{
"method": "POST",
"url": "/services/data/v58.0/sobjects/Order",
"referenceId": "refOrder",
"body": {
"Pricebook2Id": "01sHn000001aU8VIAU",
"Name": "Derek Emmett Brown",