diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl index edeec2c..1f985f7 100644 --- a/RFXtoRP_HsrReceiptList.ftl +++ b/RFXtoRP_HsrReceiptList.ftl @@ -102,18 +102,22 @@ <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowReceiptCompleted.ftl"> } <#else> - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl"> - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowReceiptCompleted.ftl"> - } + <#if receipt.line_list ?? && receipt.line_list[0]??> + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowReceiptCompleted.ftl"> + } + <#else> + <#stop> <#-- No line --> + <#else> <#if receipt.receipt_confirmed?? && receipt.receipt_confirmed == "true" && receipt.confirmation_total_level_1==0 && receipt.confirmation_total_level_2==0 && receipt.confirmation_total_level_3==0> @@ -138,6 +142,7 @@ <#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl"> } <#else> + <#if receipt.line_list ?? && receipt.line_list[0]??> { <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> "apiReflexPlatformID" : "${apiReflexPlatformID}", @@ -150,10 +155,14 @@ "datas" : <#include "RFXtoRP_HsrReceiptList_ExecutionflowReceiptCompleted.ftl"> } + <#else> + <#stop> <#-- No line --> + <#else> <#if receipt.receipt_type?? && receipt.receipt_type == "030" && receipt.receipt_confirmed == "false" && receipt.line_list?? && receipt.line_list[0]??> <#if receipt.receipt_reference?? && receipt.receipt_reference!=""> + <#if receipt.line_list ?? && receipt.line_list[0]??> [ { <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> @@ -168,6 +177,9 @@ <#include "RFXtoRP_HsrReceiptList_TransfertReceiptExpected.ftl"> } ] + <#else> + <#stop> <#-- No line --> + <#else> <#stop> <#-- Receipt reference for transfer is empty--> @@ -186,7 +198,7 @@ <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> } <#else> - <#stop> + <#stop> <#-- No line --> diff --git a/RFXtoRP_PlatformLogCreate.ftl b/RFXtoRP_PlatformLogCreate.ftl index d1ade42..6b214f4 100644 --- a/RFXtoRP_PlatformLogCreate.ftl +++ b/RFXtoRP_PlatformLogCreate.ftl @@ -1,43 +1,51 @@ -<#include "HfRpConfig.ftl"> -[ - <#assign UUID = UUID.randomUUID()> - <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)> - { - "Header": { - "ProjectID": "${projectRP}" - }, - "ID": { - "RefID": "${UUID}", - "RefDate": { - "DateTime": "${aDateTime?iso_utc}", - "AuthorTimeZone": "${time_zone_rfx}" - } - }, - "Payload": { - <#assign severity = SeverityLevel.ERROR> - "Severity": "${severity}", - "Namespace": "ReflexIntegration", - "DateTime": { - "DateTime": "${aDateTime?iso_utc}", - "AuthorTimeZone": "${time_zone_rfx}" - }, - "TechMessage": { - "Code": "${restResponsetMsg.status!"no Code"}", - "Label": ${strJsonBody?truncate(32000,'...')} - }, - "UserMessage": { - "Code": "${restResponsetMsg.status!"no Code"}", - "Label": ${strJsonBody?truncate(32000,'...')}, - "Params": [] - }, - "DetailElements": [], - "CorrelationID": "${id.correlationid!"no Correlationid"}", - "ContextPayload": ${strJsonBody?truncate(32000,'...')}, - "Type": "${event}", - "Task": "${id.apiRestReflexID!"no Task"}", - "OriginalID": "${id.refid!"no OriginalID"?trim?json_string}", - "StackTrace": "" - } - } - +<#include "HfRpConfig.ftl"> +[ + <#assign UUID = UUID.randomUUID()> + <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")> + <#assign maxLen = 32000> + <#if strJsonBody?length gt maxLen> + <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)?replace("\n", "")?replace("\r", "")?replace('"logical_key_list"\\s*:\\s*\\[[^\\]]*\\]', '"logical_key_list": []', 'r')> + + <#if strJsonBody?length gt maxLen> + <#assign safeJsonBody = "{\"truncated\": true, \"original_size\": " + strJsonBody?length + "}"> + <#else> + <#assign safeJsonBody = strJsonBody> + + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${UUID}", + "RefDate": { + "DateTime": "${aDateTime?iso_utc}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload": { + <#assign severity = SeverityLevel.ERROR> + "Severity": "${severity}", + "Namespace": "ReflexIntegration", + "DateTime": { + "DateTime": "${aDateTime?iso_utc}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "TechMessage": { + "Code": "${restResponsetMsg.status!"no Code"}", + "Label": "${safeJsonBody?json_string}" + }, + "UserMessage": { + "Code": "${restResponsetMsg.status!"no Code"}", + "Label": "${safeJsonBody?json_string}", + "Params": [] + }, + "DetailElements": [], + "CorrelationID": "${id.correlationid!"no Correlationid"}", + "ContextPayload": "${safeJsonBody?json_string}", + "Type": "${event}", + "Task": "${id.apiRestReflexID!"no Task"}", + "OriginalID": "${id.refid!"no OriginalID"?trim?json_string}", + "StackTrace": "" + } + } ] \ No newline at end of file diff --git a/VERSION b/VERSION index c2ba032..4ad9f06 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.25+2 +2.0.25+3