develop #38
@ -67,7 +67,9 @@ public class ABTProductsPUTGenerator {
|
||||
|
||||
jsonNode.fields().forEachRemaining(jsonField -> {
|
||||
if (!List.of(JsonNodeType.ARRAY, JsonNodeType.OBJECT).contains(jsonField.getValue().getNodeType())) {
|
||||
if (!jsonField.getKey().equals("productId") && !jsonField.getKey().equals("auditTrail")) {
|
||||
if (jsonField.getValue().isNull()) {
|
||||
checkRewriteNullFields(jsonField, newJsonNode);
|
||||
} else if (!jsonField.getKey().equals("productId") && !jsonField.getKey().equals("auditTrail")) {
|
||||
LOGGER.info("Keeping {} as-is...", jsonField.getKey());
|
||||
newJsonNode.put(jsonField.getKey(), jsonField.getValue());
|
||||
}
|
||||
@ -87,6 +89,43 @@ public class ABTProductsPUTGenerator {
|
||||
return newJsonNode;
|
||||
}
|
||||
|
||||
private static void checkRewriteNullFields(Map.Entry<String, JsonNode> jsonField, JsonNode newJsonNode) {
|
||||
switch (jsonField.getKey()) {
|
||||
case "marketSegments" -> {
|
||||
LOGGER.info("Rewriting null marketSegments to marketSegmentIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("marketSegmentIds", null);
|
||||
}
|
||||
case "customerSegments" -> {
|
||||
LOGGER.info("Rewriting null customerSegments to customerSegmentIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("customerSegmentIds", null);
|
||||
}
|
||||
case "allowedGboAgeProfiles" -> {
|
||||
LOGGER.info("Rewriting null allowedGboAgeProfiles to allowedGboAgeProfilesIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("allowedGboAgeProfilesIds", null);
|
||||
}
|
||||
case "mandatoryCustomerDataItems" -> {
|
||||
LOGGER.info("Rewriting null mandatoryCustomerDataItems to mandatoryCustomerDataItemIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("mandatoryCustomerDataItemIds", null);
|
||||
}
|
||||
case "requiredGboPersonalAttributes" -> {
|
||||
LOGGER.info("Rewriting null requiredGboPersonalAttributes to requiredGboPersonalAttributeIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("requiredGboPersonalAttributeIds", null);
|
||||
}
|
||||
case "tokenTypes" -> {
|
||||
LOGGER.info("Rewriting null tokenTypes to tokenTypeIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("tokenTypeIds", null);
|
||||
}
|
||||
case "serviceOptions" -> {
|
||||
LOGGER.info("Rewriting null serviceOptions to serviceOptionIds...");
|
||||
((ObjectNode)newJsonNode).putRawValue("serviceOptionIds", null);
|
||||
}
|
||||
default -> {
|
||||
LOGGER.info("Keeping {} as-is...", jsonField.getKey());
|
||||
((ObjectNode)newJsonNode).put(jsonField.getKey(), jsonField.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void rewriteObjectFields(Map.Entry<String, JsonNode> jsonField, JsonNode newJsonNode) {
|
||||
switch (jsonField.getKey()) {
|
||||
case "productOwner" -> {
|
||||
@ -138,6 +177,18 @@ public class ABTProductsPUTGenerator {
|
||||
((ObjectNode)newJsonNode).putRawValue("customerSegmentIds", null);
|
||||
}
|
||||
}
|
||||
case "allowedGboAgeProfiles" -> {
|
||||
LOGGER.info("Rewriting allowedGboAgeProfiles to allowedGboAgeProfileIds...");
|
||||
if (jsonField.getValue() != null) {
|
||||
ArrayNode allowedGboAgeProfileIds = new ArrayNode(new JsonNodeFactory(true));
|
||||
((ArrayNode)jsonField.getValue()).elements().forEachRemaining(allowedGboAgeProfile -> {
|
||||
allowedGboAgeProfileIds.add(allowedGboAgeProfile.get("gboAgeProfileId").asLong());
|
||||
});
|
||||
((ObjectNode)newJsonNode).putArray("allowedGboAgeProfileIds").addAll(allowedGboAgeProfileIds);
|
||||
} else {
|
||||
((ObjectNode)newJsonNode).putRawValue("allowedGboAgeProfileIds", null);
|
||||
}
|
||||
}
|
||||
case "tokenTypes" -> {
|
||||
LOGGER.info("Rewriting tokenTypes to tokenTypeIds...");
|
||||
if (jsonField.getValue() != null) {
|
||||
@ -233,13 +284,7 @@ public class ABTProductsPUTGenerator {
|
||||
}
|
||||
}
|
||||
if (sellingPeriod.get("sellingPrices") != null) {
|
||||
LOGGER.info("Rewriting taxMetadata in sellingPrices to taxMetadataId...");
|
||||
ArrayNode sellingPrices = ((ArrayNode)sellingPeriod.get("sellingPrices")).deepCopy();
|
||||
sellingPrices.elements().forEachRemaining(sellingPrice -> {
|
||||
String taxMetadataId = sellingPrice.get("taxMetadata").get("taxMetadataId").asText();
|
||||
((ObjectNode)sellingPrice).put("taxMetadataId", taxMetadataId);
|
||||
((ObjectNode)sellingPrice).remove("taxMetadata");
|
||||
});
|
||||
((ObjectNode)sellingPeriod).remove("sellingPrices");
|
||||
if (!sellingPrices.isEmpty()) {
|
||||
((ObjectNode)sellingPeriod).putArray("sellingPrices").addAll(sellingPrices);
|
||||
@ -257,11 +302,6 @@ public class ABTProductsPUTGenerator {
|
||||
LOGGER.info("Rewriting taxMetadata in purchasePrices to taxMetadataId...");
|
||||
if (jsonField.getValue() != null) {
|
||||
ArrayNode purchasePrices = ((ArrayNode)jsonField.getValue()).deepCopy();
|
||||
purchasePrices.elements().forEachRemaining(purchasePrice -> {
|
||||
String taxMetadataId = purchasePrice.get("taxMetadata").get("taxMetadataId").asText();
|
||||
((ObjectNode)purchasePrice).put("taxMetadataId", taxMetadataId);
|
||||
((ObjectNode)purchasePrice).remove("taxMetadata");
|
||||
});
|
||||
((ObjectNode)newJsonNode).putArray("purchasePrices").addAll(purchasePrices);
|
||||
} else {
|
||||
((ObjectNode)newJsonNode).putRawValue("purchasePrices", null);
|
||||
|
||||
@ -1,73 +1,33 @@
|
||||
{
|
||||
"productId": 38,
|
||||
"productId": 251,
|
||||
"fikoArticleNumber": null,
|
||||
"parentProductId": null,
|
||||
"productCode": "30901-WA",
|
||||
"gboPackageTemplateId": "30901",
|
||||
"tapConnectProductCode": null,
|
||||
"productGroupMetadata": null,
|
||||
"productName": "HTM P1W Prolongatie-Test 90% Korting",
|
||||
"productDescription": "Reis je regelmatig met HTM? Activeer dan HTM 90% Korting op je betaalpas of credit card en reis met korting!",
|
||||
"validityPeriod": {
|
||||
"validityPeriodId": 148,
|
||||
"fromInclusive": "2023-12-31T23:00:00.000+00:00",
|
||||
"toInclusive": "2029-12-08T04:00:00.000+00:00"
|
||||
},
|
||||
"productTranslations": [
|
||||
{
|
||||
"language": "en",
|
||||
"name": "HTM Prolongation-Test 90% Discount",
|
||||
"description": "Are you a regular traveler? Activate HTM 90% discount on your EMV card!"
|
||||
}
|
||||
],
|
||||
"productName": "MaxTestPOST-21-okt-test-1 edited PUT",
|
||||
"productDescription": "21-okt-test-1 edited PUT - reis met 90% korting gedurende de eerste F&F pilot!",
|
||||
"validityPeriod": null,
|
||||
"productTranslations": null,
|
||||
"productOwner": {
|
||||
"productOwnerId": 17,
|
||||
"productOwnerId": 1,
|
||||
"name": "Corneel Verstoep",
|
||||
"organization": "HTM"
|
||||
},
|
||||
"marketSegments": [
|
||||
{
|
||||
"marketSegmentId": 1,
|
||||
"name": "B2C"
|
||||
}
|
||||
],
|
||||
"customerSegments": [
|
||||
{
|
||||
"customerSegmentId": 2,
|
||||
"name": "Kind (4-11)"
|
||||
},
|
||||
{
|
||||
"customerSegmentId": 3,
|
||||
"name": "Jongere (12-18)"
|
||||
},
|
||||
{
|
||||
"customerSegmentId": 4,
|
||||
"name": "Volwassene (19-64)"
|
||||
},
|
||||
{
|
||||
"customerSegmentId": 5,
|
||||
"name": "Oudere (65+)"
|
||||
}
|
||||
],
|
||||
"marketSegments": null,
|
||||
"customerSegments": null,
|
||||
"allowedGboAgeProfiles": null,
|
||||
"productCategory": {
|
||||
"productCategoryId": 1,
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": true,
|
||||
"name": "Kortingsabonnement"
|
||||
},
|
||||
"requiredCustomerLevel": {
|
||||
"requiredCustomerLevelId": 3,
|
||||
"name": "profile"
|
||||
"requiredCustomerLevelId": 1,
|
||||
"name": "guest"
|
||||
},
|
||||
"requiredProducts": null,
|
||||
"incompatibleProducts": null,
|
||||
"mandatoryCustomerDataItems": [
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 1,
|
||||
"customerDataItem": "birthname"
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 2,
|
||||
"customerDataItem": "surname"
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"customerDataItem": "emailAddress"
|
||||
@ -77,7 +37,20 @@
|
||||
"customerDataItem": "address"
|
||||
}
|
||||
],
|
||||
"requiredGboPersonalAttributes": null,
|
||||
"requiredGboPersonalAttributes": [
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 1,
|
||||
"name": "NAME"
|
||||
},
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 2,
|
||||
"name": "BIRTHDATE"
|
||||
},
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 3,
|
||||
"name": "PHOTO"
|
||||
}
|
||||
],
|
||||
"tokenTypes": [
|
||||
{
|
||||
"tokenTypeId": 1,
|
||||
@ -89,24 +62,71 @@
|
||||
"name": "prepaid"
|
||||
},
|
||||
"serviceOptions": null,
|
||||
"validityDuration": "P1W",
|
||||
"validityDuration": "P7D",
|
||||
"maxStartInFutureDuration": "P6W",
|
||||
"isRenewable": true,
|
||||
"sendInvoice": true,
|
||||
"imageReference": "https://web.acc.cloud.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||
"productPageUrl": "https://web.acc.cloud.htm.nl/webshop/htm-90-korting/",
|
||||
"termsUrl": "https://web.acc.cloud.htm.nl/reisproducten/productvoorwaarden/htm-90-korting/",
|
||||
"isRenewable": false,
|
||||
"sendInvoice": false,
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||
"productPageUrl": "https://www.htm.nl/nog-onbekende-product-pagina",
|
||||
"termsUrl": "https://www.htm.nl/nog-onbekende-productvoorwaarden-pagina",
|
||||
"isSellableAtHtm": true,
|
||||
"needsSolvencyCheckConsumer": false,
|
||||
"needsSolvencyCheckBusiness": false,
|
||||
"sellingPeriods": [
|
||||
{
|
||||
"sellingPeriodId": 89,
|
||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
||||
"toInclusive": "2029-12-01T23:00:00.000+00:00",
|
||||
"sellingPeriodId": 240,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"salesTouchpoint": {
|
||||
"salesTouchpointId": 3,
|
||||
"name": "Website (Perplex)",
|
||||
"salesTouchpointId": 6,
|
||||
"name": "Service-engine",
|
||||
"isActive": true,
|
||||
"retailer": {
|
||||
"retailerId": 1000,
|
||||
"name": "HTM intern beheer",
|
||||
"street": "Koningin Julianaplein",
|
||||
"number": 10,
|
||||
"numberAddition": null,
|
||||
"postalCode": "2595 AA",
|
||||
"city": "Den Haag",
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@htm.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": null,
|
||||
"imageReference": "https://www.htm.nl/typo3conf/ext/htm_template/Resources/Public/img/logo.svg"
|
||||
}
|
||||
},
|
||||
"forbiddenPaymentMethods": null,
|
||||
"sellingPrices": [
|
||||
{
|
||||
"sellingPriceId": 318,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 94,
|
||||
"amountInclTax": 100,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-18T23:59:59.000+00:00",
|
||||
"internalPrice": 92.0000
|
||||
},
|
||||
{
|
||||
"sellingPriceId": 319,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 98,
|
||||
"amountInclTax": 102,
|
||||
"fromInclusive": "2024-12-19T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"internalPrice": 0.0000
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"sellingPeriodId": 241,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"salesTouchpoint": {
|
||||
"salesTouchpointId": 5,
|
||||
"name": "Servicewinkel (Team Incident Masters)",
|
||||
"isActive": true,
|
||||
"retailer": {
|
||||
"retailerId": 1001,
|
||||
@ -119,36 +139,64 @@
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@htm.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": 572309345923,
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg"
|
||||
"taxId": null,
|
||||
"imageReference": "https://www.htm.nl/typo3conf/ext/htm_template/Resources/Public/img/logo.svg"
|
||||
}
|
||||
},
|
||||
"forbiddenPaymentMethods": null,
|
||||
"forbiddenPaymentMethods": [
|
||||
{
|
||||
"forbiddenPaymentMethodId": 2,
|
||||
"name": "creditcard",
|
||||
"issuer": "Visa"
|
||||
}
|
||||
],
|
||||
"sellingPrices": [
|
||||
{
|
||||
"sellingPriceId": 82,
|
||||
"amountExclTax": 92,
|
||||
"sellingPriceId": 320,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 94,
|
||||
"amountInclTax": 100,
|
||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
||||
"toInclusive": "2029-12-01T23:00:00.000+00:00",
|
||||
"internalPrice": 0.0000,
|
||||
"taxMetadata": {
|
||||
"taxMetadataId": "47C8972E-A730-4032-9BDA-AF0A5BCB2C85",
|
||||
"taxCode": "V09",
|
||||
"taxPercentageAmount": 9,
|
||||
"description": "BTW VERKOOP LAAG 9%"
|
||||
}
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-18T23:59:59.000+00:00",
|
||||
"internalPrice": 92.0000
|
||||
},
|
||||
{
|
||||
"sellingPriceId": 321,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 98,
|
||||
"amountInclTax": 102,
|
||||
"fromInclusive": "2024-12-19T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"internalPrice": 0.0000
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"purchasePrices": null,
|
||||
"purchasePrices": [
|
||||
{
|
||||
"purchasePriceId": 184,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 0,
|
||||
"amountInclTax": 0,
|
||||
"fromInclusive": "2024-09-01T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-31T23:59:59.000+00:00"
|
||||
}
|
||||
],
|
||||
"auditTrail": [
|
||||
{
|
||||
"auditTrailId": 162,
|
||||
"auditTrailId": 228,
|
||||
"action": "update",
|
||||
"user": "api",
|
||||
"timestamp": "2024-10-21T09:00:30.410+00:00"
|
||||
},
|
||||
{
|
||||
"auditTrailId": 227,
|
||||
"action": "insert",
|
||||
"user": "api",
|
||||
"timestamp": "2024-11-25T08:39:36.793+00:00"
|
||||
"timestamp": "2024-10-21T08:58:39.237+00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user