This commit is contained in:
Laurie MONTANT 2024-03-05 17:03:32 +01:00
parent 97b3eb3d97
commit 3ef86f9e5c
3 changed files with 93 additions and 48 deletions

View File

@ -2,9 +2,9 @@
[ [
<#assign UUID = UUID.randomUUID()> <#assign UUID = UUID.randomUUID()>
<#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)> <#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)>
{ {
"Header": { "Header": {
"ProjectID": "${projectRP}" "ProjectID": "${projectRP}"
}, },
"ID": { "ID": {
"RefID": "${UUID}", "RefID": "${UUID}",
@ -12,7 +12,7 @@
"DateTime": "${aDateTime?iso_utc}", "DateTime": "${aDateTime?iso_utc}",
"AuthorTimeZone": "${time_zone_rfx}" "AuthorTimeZone": "${time_zone_rfx}"
} }
}, },
"Payload": { "Payload": {
<#assign severity = SeverityLevel.ERROR> <#assign severity = SeverityLevel.ERROR>
"Severity": "${severity}", "Severity": "${severity}",
@ -35,7 +35,7 @@
"ContextPayload": "rfxresponse", "ContextPayload": "rfxresponse",
"Type": "RP_EXECUTIONFLOW_EVENT", "Type": "RP_EXECUTIONFLOW_EVENT",
"Task": "${id.apiRestReflexID}", "Task": "${id.apiRestReflexID}",
"OriginalID": "${id.refid}", "OriginalID": "${id.refid?trim?json_string}",
"StackTrace": "" "StackTrace": ""
} }
} }

View File

@ -3,8 +3,8 @@
<#-- project : projectId in ReflexPlatform --> <#-- project : projectId in ReflexPlatform -->
<#-- organisation : organisationtId in ReflexPlatform --> <#-- organisation : organisationtId in ReflexPlatform -->
<#assign restResponsetMsg = JsonUtil.jsonToMap(input)> <#assign restResponsetMsg = JsonUtil.jsonToMap(input)>
<#assign id = JsonUtil.jsonToMap(restResponsetMsg.id)> <#assign id = JsonUtil.jsonToMap(restResponsetMsg.id)>
<#assign projectRP = project> <#assign projectRP = project>
<#assign organisationRP = organisation> <#assign organisationRP = organisation>
@ -18,91 +18,115 @@
<#case 201> <#case 201>
<#-- *********************************************** ApiRestID = preparation_orders_post ******************** --> <#-- *********************************************** ApiRestID = preparation_orders_post ******************** -->
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)>
<#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" > <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" >
[ [
{ {
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl"> <#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl">
} }
] ]
<#else> <#else>
[ [
{ {
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl"> <#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
} }
] ]
</#if> </#if>
<#break> <#break>
<#default> <#default>
[ [
{ {
<#if restResponsetMsg.body?? > <#if restResponsetMsg.body?? >
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#else> <#else>
<#assign restResponseBody = "{}" /> <#assign restResponseBody = "{}" />
</#if> </#if>
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl"> <#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
} }
] ]
</#switch> </#switch>
<#break> <#break>
<#case "receipts_post"> <#case "receipts_post">
<#switch restResponsetMsg.status> <#switch restResponsetMsg.status>
<#case 200> <#case 200>
<#case 201> <#case 201>
<#-- *********************************************** ApiRestID = receipts_post ******************** --> <#-- *********************************************** ApiRestID = receipts_post ******************** -->
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)>
<#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" > <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" >
[ [
{ {
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipToAcked> <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipToAcked>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_Receipt_ShipToAcked.ftl"> <#include "RFXtoRP_Receipt_ShipToAcked.ftl">
} }
] ]
<#else> <#else>
[ [
{ {
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl"> <#include "RFXtoRP_PlatformLogCreate.ftl">
} },
] {
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
}
]
</#if> </#if>
<#break> <#break>
<#default> <#default>
[ [
{ {
<#if restResponsetMsg.body?? > <#if restResponsetMsg.body?? >
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#else> <#else>
<#assign restResponseBody = "{}" /> <#assign restResponseBody = "{}" />
</#if> </#if>
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}", "apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" : "datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl"> <#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
} }
] ]
</#switch> </#switch>
<#break> <#break>
<#default> <#default>
<#stop> <#stop>
</#switch> </#switch>

View File

@ -0,0 +1,21 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#assign receipt_status_datetime = RfxDateTimetoUTC(receipt.creation_datetime,time_zone_offset_rfx) />
[
{
"Header": {
"ProjectID": "${projectRP}"
},
"ID": {
"RefID": "${id.refid?trim?json_string}",
"RefDate": {
"DateTime": "${aDateTime?iso_utc}",
"AuthorTimeZone": "${time_zone_rfx}"
}
},
"Payload": {}
}
]