Fix PUTGenerator

This commit is contained in:
Max Martens 2025-05-07 11:31:04 +02:00
parent 8e5dcacff5
commit 9fd0a14e91

View File

@ -100,8 +100,8 @@ public class ABTProductsPUTGenerator {
((ObjectNode)newJsonNode).putRawValue("customerSegmentIds", null);
}
case "allowedGboAgeProfiles" -> {
LOGGER.info("Rewriting null allowedGboAgeProfiles to allowedGboAgeProfilesIds...");
((ObjectNode)newJsonNode).putRawValue("allowedGboAgeProfilesIds", null);
LOGGER.info("Rewriting null allowedGboAgeProfiles to allowedGboAgeProfileIds...");
((ObjectNode)newJsonNode).putRawValue("allowedGboAgeProfileIds", null);
}
case "mandatoryCustomerDataItems" -> {
LOGGER.info("Rewriting null mandatoryCustomerDataItems to mandatoryCustomerDataItemIds...");
@ -283,7 +283,8 @@ public class ABTProductsPUTGenerator {
((ObjectNode)sellingPeriod).putRawValue("forbiddenPaymentMethodIds", null);
}
}
if (sellingPeriod.get("sellingPrices") != null) {
if (!sellingPeriod.get("sellingPrices").isNull()) {
LOGGER.info("Deep-copying sellingPrices...");
ArrayNode sellingPrices = ((ArrayNode)sellingPeriod.get("sellingPrices")).deepCopy();
((ObjectNode)sellingPeriod).remove("sellingPrices");
if (!sellingPrices.isEmpty()) {
@ -299,8 +300,8 @@ public class ABTProductsPUTGenerator {
}
}
case "purchasePrices" -> {
LOGGER.info("Rewriting taxMetadata in purchasePrices to taxMetadataId...");
if (jsonField.getValue() != null) {
LOGGER.info("Deep-copying purchasePrices...");
if (!jsonField.getValue().isNull()) {
ArrayNode purchasePrices = ((ArrayNode)jsonField.getValue()).deepCopy();
((ObjectNode)newJsonNode).putArray("purchasePrices").addAll(purchasePrices);
} else {