// if we have set a custom setgroup scope, then the group id
// is used as suffix in the scopeKey...
if ($discount->
isScopeSetGroup()) { $payload['groupId'
] =
$discount->
getSetGroupId();
$payload['discountScope'
] = PromotionDiscountEntity::SCOPE_SETGROUP;
} // add all our set groups to our configuration
// if existing. always make sure to have at least a node
$payload['setGroups'
] =
[];
if ($promotion->
getSetgroups() !== null
) { foreach ($promotion->
getSetgroups() as $group) { $payload['setGroups'
][] =
[ 'groupId' =>
$group->
getId(),
'packagerKey' =>
$group->
getPackagerKey(),
'value' =>
$group->
getValue(),
'sorterKey' =>
$group->
getSorterKey(),
'rules' =>
$group->
getSetGroupRules(),
];
} }