develop #38
@ -67,7 +67,9 @@ public class ABTProductsPUTGenerator {
|
|||||||
|
|
||||||
jsonNode.fields().forEachRemaining(jsonField -> {
|
jsonNode.fields().forEachRemaining(jsonField -> {
|
||||||
if (!List.of(JsonNodeType.ARRAY, JsonNodeType.OBJECT).contains(jsonField.getValue().getNodeType())) {
|
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());
|
LOGGER.info("Keeping {} as-is...", jsonField.getKey());
|
||||||
newJsonNode.put(jsonField.getKey(), jsonField.getValue());
|
newJsonNode.put(jsonField.getKey(), jsonField.getValue());
|
||||||
}
|
}
|
||||||
@ -87,6 +89,43 @@ public class ABTProductsPUTGenerator {
|
|||||||
return newJsonNode;
|
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) {
|
private static void rewriteObjectFields(Map.Entry<String, JsonNode> jsonField, JsonNode newJsonNode) {
|
||||||
switch (jsonField.getKey()) {
|
switch (jsonField.getKey()) {
|
||||||
case "productOwner" -> {
|
case "productOwner" -> {
|
||||||
@ -138,6 +177,18 @@ public class ABTProductsPUTGenerator {
|
|||||||
((ObjectNode)newJsonNode).putRawValue("customerSegmentIds", null);
|
((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" -> {
|
case "tokenTypes" -> {
|
||||||
LOGGER.info("Rewriting tokenTypes to tokenTypeIds...");
|
LOGGER.info("Rewriting tokenTypes to tokenTypeIds...");
|
||||||
if (jsonField.getValue() != null) {
|
if (jsonField.getValue() != null) {
|
||||||
@ -233,13 +284,7 @@ public class ABTProductsPUTGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sellingPeriod.get("sellingPrices") != null) {
|
if (sellingPeriod.get("sellingPrices") != null) {
|
||||||
LOGGER.info("Rewriting taxMetadata in sellingPrices to taxMetadataId...");
|
|
||||||
ArrayNode sellingPrices = ((ArrayNode)sellingPeriod.get("sellingPrices")).deepCopy();
|
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");
|
((ObjectNode)sellingPeriod).remove("sellingPrices");
|
||||||
if (!sellingPrices.isEmpty()) {
|
if (!sellingPrices.isEmpty()) {
|
||||||
((ObjectNode)sellingPeriod).putArray("sellingPrices").addAll(sellingPrices);
|
((ObjectNode)sellingPeriod).putArray("sellingPrices").addAll(sellingPrices);
|
||||||
@ -257,11 +302,6 @@ public class ABTProductsPUTGenerator {
|
|||||||
LOGGER.info("Rewriting taxMetadata in purchasePrices to taxMetadataId...");
|
LOGGER.info("Rewriting taxMetadata in purchasePrices to taxMetadataId...");
|
||||||
if (jsonField.getValue() != null) {
|
if (jsonField.getValue() != null) {
|
||||||
ArrayNode purchasePrices = ((ArrayNode)jsonField.getValue()).deepCopy();
|
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);
|
((ObjectNode)newJsonNode).putArray("purchasePrices").addAll(purchasePrices);
|
||||||
} else {
|
} else {
|
||||||
((ObjectNode)newJsonNode).putRawValue("purchasePrices", null);
|
((ObjectNode)newJsonNode).putRawValue("purchasePrices", null);
|
||||||
|
|||||||
@ -1,73 +1,33 @@
|
|||||||
{
|
{
|
||||||
"productId": 38,
|
"productId": 251,
|
||||||
|
"fikoArticleNumber": null,
|
||||||
"parentProductId": null,
|
"parentProductId": null,
|
||||||
"productCode": "30901-WA",
|
|
||||||
"gboPackageTemplateId": "30901",
|
"gboPackageTemplateId": "30901",
|
||||||
"tapConnectProductCode": null,
|
"tapConnectProductCode": null,
|
||||||
"productGroupMetadata": null,
|
"productName": "MaxTestPOST-21-okt-test-1 edited PUT",
|
||||||
"productName": "HTM P1W Prolongatie-Test 90% Korting",
|
"productDescription": "21-okt-test-1 edited PUT - reis met 90% korting gedurende de eerste F&F pilot!",
|
||||||
"productDescription": "Reis je regelmatig met HTM? Activeer dan HTM 90% Korting op je betaalpas of credit card en reis met korting!",
|
"validityPeriod": null,
|
||||||
"validityPeriod": {
|
"productTranslations": null,
|
||||||
"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!"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"productOwner": {
|
"productOwner": {
|
||||||
"productOwnerId": 17,
|
"productOwnerId": 1,
|
||||||
"name": "Corneel Verstoep",
|
"name": "Corneel Verstoep",
|
||||||
"organization": "HTM"
|
"organization": "HTM"
|
||||||
},
|
},
|
||||||
"marketSegments": [
|
"marketSegments": null,
|
||||||
{
|
"customerSegments": null,
|
||||||
"marketSegmentId": 1,
|
"allowedGboAgeProfiles": null,
|
||||||
"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+)"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"productCategory": {
|
"productCategory": {
|
||||||
"productCategoryId": 1,
|
"productCategoryId": 9,
|
||||||
"isTravelProduct": true,
|
"isTravelProduct": true,
|
||||||
"name": "Kortingsabonnement"
|
"name": "Kortingsabonnement"
|
||||||
},
|
},
|
||||||
"requiredCustomerLevel": {
|
"requiredCustomerLevel": {
|
||||||
"requiredCustomerLevelId": 3,
|
"requiredCustomerLevelId": 1,
|
||||||
"name": "profile"
|
"name": "guest"
|
||||||
},
|
},
|
||||||
"requiredProducts": null,
|
"requiredProducts": null,
|
||||||
"incompatibleProducts": null,
|
"incompatibleProducts": null,
|
||||||
"mandatoryCustomerDataItems": [
|
"mandatoryCustomerDataItems": [
|
||||||
{
|
|
||||||
"mandatoryCustomerDataItemId": 1,
|
|
||||||
"customerDataItem": "birthname"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mandatoryCustomerDataItemId": 2,
|
|
||||||
"customerDataItem": "surname"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"mandatoryCustomerDataItemId": 4,
|
"mandatoryCustomerDataItemId": 4,
|
||||||
"customerDataItem": "emailAddress"
|
"customerDataItem": "emailAddress"
|
||||||
@ -77,7 +37,20 @@
|
|||||||
"customerDataItem": "address"
|
"customerDataItem": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requiredGboPersonalAttributes": null,
|
"requiredGboPersonalAttributes": [
|
||||||
|
{
|
||||||
|
"requiredGboPersonalAttributeId": 1,
|
||||||
|
"name": "NAME"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"requiredGboPersonalAttributeId": 2,
|
||||||
|
"name": "BIRTHDATE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"requiredGboPersonalAttributeId": 3,
|
||||||
|
"name": "PHOTO"
|
||||||
|
}
|
||||||
|
],
|
||||||
"tokenTypes": [
|
"tokenTypes": [
|
||||||
{
|
{
|
||||||
"tokenTypeId": 1,
|
"tokenTypeId": 1,
|
||||||
@ -89,24 +62,71 @@
|
|||||||
"name": "prepaid"
|
"name": "prepaid"
|
||||||
},
|
},
|
||||||
"serviceOptions": null,
|
"serviceOptions": null,
|
||||||
"validityDuration": "P1W",
|
"validityDuration": "P7D",
|
||||||
"maxStartInFutureDuration": "P6W",
|
"maxStartInFutureDuration": "P6W",
|
||||||
"isRenewable": true,
|
"isRenewable": false,
|
||||||
"sendInvoice": true,
|
"sendInvoice": false,
|
||||||
"imageReference": "https://web.acc.cloud.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||||
"productPageUrl": "https://web.acc.cloud.htm.nl/webshop/htm-90-korting/",
|
"productPageUrl": "https://www.htm.nl/nog-onbekende-product-pagina",
|
||||||
"termsUrl": "https://web.acc.cloud.htm.nl/reisproducten/productvoorwaarden/htm-90-korting/",
|
"termsUrl": "https://www.htm.nl/nog-onbekende-productvoorwaarden-pagina",
|
||||||
"isSellableAtHtm": true,
|
"isSellableAtHtm": true,
|
||||||
"needsSolvencyCheckConsumer": false,
|
"needsSolvencyCheckConsumer": false,
|
||||||
"needsSolvencyCheckBusiness": false,
|
"needsSolvencyCheckBusiness": false,
|
||||||
"sellingPeriods": [
|
"sellingPeriods": [
|
||||||
{
|
{
|
||||||
"sellingPeriodId": 89,
|
"sellingPeriodId": 240,
|
||||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||||
"toInclusive": "2029-12-01T23:00:00.000+00:00",
|
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||||
"salesTouchpoint": {
|
"salesTouchpoint": {
|
||||||
"salesTouchpointId": 3,
|
"salesTouchpointId": 6,
|
||||||
"name": "Website (Perplex)",
|
"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,
|
"isActive": true,
|
||||||
"retailer": {
|
"retailer": {
|
||||||
"retailerId": 1001,
|
"retailerId": 1001,
|
||||||
@ -119,36 +139,64 @@
|
|||||||
"country": "Nederland",
|
"country": "Nederland",
|
||||||
"emailAddress": "info@htm.nl",
|
"emailAddress": "info@htm.nl",
|
||||||
"phoneNumber": "070 374 9002",
|
"phoneNumber": "070 374 9002",
|
||||||
"taxId": 572309345923,
|
"taxId": null,
|
||||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg"
|
"imageReference": "https://www.htm.nl/typo3conf/ext/htm_template/Resources/Public/img/logo.svg"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"forbiddenPaymentMethods": null,
|
"forbiddenPaymentMethods": [
|
||||||
|
{
|
||||||
|
"forbiddenPaymentMethodId": 2,
|
||||||
|
"name": "creditcard",
|
||||||
|
"issuer": "Visa"
|
||||||
|
}
|
||||||
|
],
|
||||||
"sellingPrices": [
|
"sellingPrices": [
|
||||||
{
|
{
|
||||||
"sellingPriceId": 82,
|
"sellingPriceId": 320,
|
||||||
"amountExclTax": 92,
|
"taxCode": "V21",
|
||||||
|
"taxPercentage": 21.0000,
|
||||||
|
"amountExclTax": 94,
|
||||||
"amountInclTax": 100,
|
"amountInclTax": 100,
|
||||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||||
"toInclusive": "2029-12-01T23:00:00.000+00:00",
|
"toInclusive": "2024-12-18T23:59:59.000+00:00",
|
||||||
"internalPrice": 0.0000,
|
"internalPrice": 92.0000
|
||||||
"taxMetadata": {
|
},
|
||||||
"taxMetadataId": "47C8972E-A730-4032-9BDA-AF0A5BCB2C85",
|
{
|
||||||
"taxCode": "V09",
|
"sellingPriceId": 321,
|
||||||
"taxPercentageAmount": 9,
|
"taxCode": "V21",
|
||||||
"description": "BTW VERKOOP LAAG 9%"
|
"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": [
|
"auditTrail": [
|
||||||
{
|
{
|
||||||
"auditTrailId": 162,
|
"auditTrailId": 228,
|
||||||
|
"action": "update",
|
||||||
|
"user": "api",
|
||||||
|
"timestamp": "2024-10-21T09:00:30.410+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auditTrailId": 227,
|
||||||
"action": "insert",
|
"action": "insert",
|
||||||
"user": "api",
|
"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