From 9fd0a14e91a34e023425af82a01d654b8e0b6aea Mon Sep 17 00:00:00 2001 From: Max Martens Date: Wed, 7 May 2025 11:31:04 +0200 Subject: [PATCH] Fix PUTGenerator --- .../nl/htm/ovpay/abt/ABTProductsPUTGenerator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/java/ABTProductsPUTGenerator/src/main/java/nl/htm/ovpay/abt/ABTProductsPUTGenerator.java b/src/java/ABTProductsPUTGenerator/src/main/java/nl/htm/ovpay/abt/ABTProductsPUTGenerator.java index 3246d16..69426ac 100644 --- a/src/java/ABTProductsPUTGenerator/src/main/java/nl/htm/ovpay/abt/ABTProductsPUTGenerator.java +++ b/src/java/ABTProductsPUTGenerator/src/main/java/nl/htm/ovpay/abt/ABTProductsPUTGenerator.java @@ -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 {