Created on 09-24-2024 12:50 PM - edited 09-24-2024 12:51 PM
Hi,
I am trying to group webCategoryId and item with yes/no flag with some conditions inside array.
1 - if webCategoryId variable is present and not empty value then only use webCategoryId, ignore item value if present inside array.
2 - if webCategoryId variable is not present or present with empty value then use item if item value is present inside array.
Could you please advice.
Input
{
"correlationId": "3242a7b4-7929-43b3-9fb6-0d7e173373af",
"sourceSystemId": "PCS",
"messageTimestamp": "2024-05-03T00:00:00",
"id": 1234,
"promotionId": 2303,
"offerId": 2303,
"description": "Members Get Tees $15",
"customerDescription": "Members Get Tees $15",
"levelCode": 0,
"typeCode": 3,
"templateId": 4,
"couponCode": null,
"isCouponCodeRequired": 0,
"startDatetime": "2024-06-20T00:00:00",
"endDatetime": "2024-06-24T23:59:00",
"cancelationDatetime": null,
"comments": null,
"distributionRuleCode": null,
"exclusiveDiscountInd": 0,
"tiers": [
{
"conditions": [
{
"conditionId": 1134,
"buySpendType": 0,
"buySpendValue": 1,
"buyUom": "EA",
"conditionsMerch": [
{
"conditionMerchId": 85339,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"item": "613631673",
"diffId": "012",
"excludeInd": 0,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
},
{
"conditionMerchId": 85339,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"item": "613631674",
"webCategoryId": "",
"diffId": "012",
"excludeInd": 0,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
},
{
"conditionMerchId": 85340,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"webCategoryId": "613631673",
"diffId": "023",
"excludeInd": 1,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
},
{
"conditionMerchId": 85341,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"item": "12334",
"webCategoryId": "613631673",
"diffId": "013",
"excludeInd": 0,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
}
]
}
],
"rewards": [
{
"rewardId": 8127,
"changeType": 2,
"changeAmount": 15,
"changePercent": null,
"quantityToDiscount": null,
"applyInd": 2,
"rewardsMerch": []
}
],
"priceRuleAttributes": [
{
"type": "CFA",
"id": "PR_PATH_NAME",
"values": [
"MEMBERS"
]
},
{
"type": "CFA",
"id": "PR_PRICE_RULE_PROMO",
"valueBoolean": true
},
{
"type": "CFA",
"id": "PR_TARGET_SEGMENT",
"values": [
"PAS_LOGGEDIN",
"LOGGEDIN",
"PAS_NOT_LOGGEDIN"
]
},
{
"type": "CFA",
"id": "PR_CURR_CONDITION",
"values": [
"USD"
]
}
]
},
{
"conditions": [
{
"conditionId": 1135,
"buySpendType": 0,
"buySpendValue": 1,
"buyUom": "EA",
"conditionsMerch": [
{
"conditionMerchId": 85342,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"item": "",
"categoryId": "613631673",
"diffId": "012",
"excludeInd": 0,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
},
{
"conditionMerchId": 85343,
"merchandiseLevel": 5,
"deptClass": 0,
"uniqueClass": 0,
"subClass": 0,
"uniqueSubClass": 0,
"item": "",
"categoryId": "613631674",
"diffId": "023",
"excludeInd": 1,
"cancelDatetime": null,
"supplierSite": null,
"brandName": null,
"class": 0
}
]
}
],
"rewards": [
{
"rewardId": 8128,
"changeType": 2,
"changeAmount": 18,
"changePercent": null,
"quantityToDiscount": null,
"applyInd": 2,
"rewardsMerch": []
}
],
"priceRuleAttributes": [
{
"type": "CFA",
"id": "PR_PATH_NAME",
"values": [
"NON MEMBERS"
]
},
{
"type": "CFA",
"id": "PR_EMPTY_PATH_NAME",
"values": [
"NON"
]
},
{
"type": "CFA",
"id": "PR_PRICE_RULE_PROMO",
"valueBoolean": true
}
]
}
],
"locations": [
{
"location": 10051,
"cancelDateTime": null,
"action": "INSERT",
"locationType": "S"
}
],
"attributes": {
"webCategoryInd": false,
"currencyCode": "USD",
"priceType": "PROMOTION",
"createTimestamp": "2024-05-03T00:00:00",
"createUserId": "BRANDIE_YAWS@ANFCORP.COM",
"approvalId": "BRANDIE_YAWS@ANFCORP.COM",
"lastUpdateProgramId": "PCS",
"lastUpdateTimestamp": "2024-05-03T00:00:00",
"lastUpdateUserId": "BRANDIE_YAWS@ANFCORP.COM",
"emergencyInd": false,
"promoTypeCode": "TP"
},
"customAttributes": [
{
"type": "CFA",
"id": "PR_PRICE_RULE_PROMO",
"valueBoolean": true
}
]
}
Spec
[
{
"operation": "shift",
"spec": {
"description": "priceRuleName",
"startDateTime": "startDate",
"endDateTime": "enddate",
"locations": {
"0": {
"location": "storeLocation"
}
},
"customAttributes": {
"*": {
"id": {
"PR_PRICE_RULE_PROMO": {
"@(2,valueBoolean)": "priceRulePromo"
}
}
}
},
"tiers": {
"*": {
"priceRuleAttributes": {
"*": {
"id": {
"PR_EMPTY_PATH_NAME": {
"@(2,values[0])": "emptyPathName"
},
"PR_PATH_NAME": {
"@(2,values[0])": "pricePaths.paths.[&5].pathName"
},
"PR_TARGET_SEGMENT": {
"@(2,values)": "pricePaths.paths.[&5].customerCondition[#2].targetSegments"
},
"PR_CURR_CD": {
"@(2,values[0])": "pricePaths.paths.[&5].currencyCondition[#2].currency"
}
}
}
},
"conditions": {
"*": {
"conditionsMerch": {
"*": {
"item": {
"": {
"@(2,excludeInd)": {
"0": {
"@(4,webCategoryId)": "pricePaths.paths[&9].catalogCondition.category.yes.categoryList[]"
},
"1": {
"@(4,webCategoryId)": "pricePaths.paths[&9].catalogCondition.category.no.categoryList[]"
}
}
},
"*": {
"@(2,excludeInd)": {
"0": {
"@(4,item)": "pricePaths.paths[&9].catalogCondition.products.yes.productList[]"
},
"1": {
"@(4,item)": "pricePaths.paths[&9].catalogCondition.products.no.productList[]"
}
}
}
}
}
}
}
},
"rewards": {
"*": {
"changeType": "pricePaths.paths.[&3].calculatePrice[&1].calculationType",
"changeAmount": "pricePaths.paths.[&3].calculatePrice[&1].amount",
"changePercent": "pricePaths.paths.[&3].calculatePrice[&1].percentage",
"@(4,promotionId)": "pricePaths.paths.[&3].calculatePrice[&1].RPMPromoId",
"@(4,offerId)": "pricePaths.paths.[&3].calculatePrice[&1].RPMCompId",
"@(2,priceRuleAttributes)": {
"*": {
"id": {
"PR_CURR_CD": {
"@(2,values[0])": "pricePaths.paths.[&7].calculatePrice[&4].currency"
}
}
}
}
}
}
}
}
}
}
,
{
"operation": "shift",
"spec": {
"*": "&",
"pricePaths": {
"paths": {
"*": {
"*": "&3.&2[&1].&",
"catalogCondition": {
"*": {
"*": {
"*": "&6.&5[&4].&3.&2[#2].&",
"$": "&6.&5[&4].&3.&2[#2].include"
}
}
}
}
}
}
}
}
]
Created 09-26-2024 08:31 AM
@SAMSAL did you get a chance to look into it ?