From da8939ec74ec3099fe86b50df35d0de2ddcc927f Mon Sep 17 00:00:00 2001 From: Laurie Montant Date: Thu, 29 Feb 2024 11:57:41 +0100 Subject: [PATCH] modifs --- RFXtoRP_HsrReceiptList.ftl | 97 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl index 4932a33..5dc1631 100644 --- a/RFXtoRP_HsrReceiptList.ftl +++ b/RFXtoRP_HsrReceiptList.ftl @@ -3,7 +3,7 @@ <#-- project : projectId in ReflexPlatform --> <#-- organisation : organisationtId in ReflexPlatform --> -<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> <#assign organisationRP = organisation> @@ -12,82 +12,83 @@ <#switch cloudEventMsg.action> <#case "C"> <#-- *********************************************** Action = CREATE ******************** --> - - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign receipt = JsonUtil.jsonToMap(dataRfx)> - <#if receipt.receipt_type = "030"> - <#stop "ignored message because receipt type = transfert"> - <#else> - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> - - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> - - } - ] - + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + <#if receipt.receipt_reference ?? && receipt.receipt_reference!=""> + <#if receipt.receipt_type = "030"> + <#stop "ignored message because receipt type = transfert"> + <#else> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> + + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> + + } + ] + + <#break> <#case "U"> <#-- *********************************************** Action = UPDATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign receipt = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + [ <#if receipt.receipt_confirmed == "true" > { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ReceiptCompleted> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ReceiptCompleted> "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ReceiptCompleted.ftl"> - } + "datas" : + <#include "RFXtoRP_HsrReceiptList_ReceiptCompleted.ftl"> + } <#else> <#if receipt.receipt_type = "030"> <#stop "ignored message because receipt type = transfert"> <#else> { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> }, { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowReceiptExpected> "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> - + "datas" : + <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> + } - ] + ] <#break> - + <#case "D"> <#-- *********************************************** Action = DELETE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign receipt = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + [ { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrReceiptList_ExecutionflowCancelled.ftl"> - + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowCancelled.ftl"> + } - ] + ] <#break> - - + + <#default> <#stop "event not supported">