diff --git a/RFXtoRP_HsrCarrierApt.ftl b/RFXtoRP_HsrCarrierApt.ftl index 562f5f3..8116107 100644 --- a/RFXtoRP_HsrCarrierApt.ftl +++ b/RFXtoRP_HsrCarrierApt.ftl @@ -49,7 +49,8 @@ "datas" : <#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl"> }, - <#if carrier_apt.status?? && carrier_apt.status.status_code=="999"> + <#include "RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl"> + <#if carrier_apt.status?? && (carrier_apt.status.status_code=="999" || carrier_apt.status.status_code=="040" || carrier_apt.status.status_code=="030")> [ { <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteCancelAppointment> diff --git a/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl b/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl new file mode 100644 index 0000000..81fefce --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl @@ -0,0 +1,38 @@ +<#-- + [ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "RefID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + } + "Payload": { + "ActorID": "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#--To configure--> +<#-- "MetaData": [ + { + "Key": "string", + "Value": { + "Bool": "true / false", + "Float": 3.1415, + "Int": 42, + "String": "Hello World !", + "Timestamp": { + "AuthorTimeZone": "Europe/Paris", + "DateTime": "2023-01-01T00:00:00Z" + } + } + ] + } +} +] +--> \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdatedToConfigure.ftl b/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdatedToConfigure.ftl new file mode 100644 index 0000000..df69038 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdatedToConfigure.ftl @@ -0,0 +1,36 @@ +<#-- + [ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "RefID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + } + "Payload": { + "ActorID": "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + "MetaData": [ + { + "Key": "string", + "Value": { + "Bool": "true / false", + "Float": 3.1415, + "Int": 42, + "String": "Hello World !", + "Timestamp": { + "AuthorTimeZone": "Europe/Paris", + "DateTime": "2023-01-01T00:00:00Z" + } + } + ] + } +} +] \ No newline at end of file diff --git a/RPtoRFX_CarrierAppointmentDefaultData.ftl b/RPtoRFX_CarrierAppointmentDefaultData.ftl index b773333..93b4aa7 100644 --- a/RPtoRFX_CarrierAppointmentDefaultData.ftl +++ b/RPtoRFX_CarrierAppointmentDefaultData.ftl @@ -2,8 +2,15 @@ <#-- Note : you can use Order Line Segmentation keys, using the define map : SegmentationKeys_Map --> <#-- How to use MD or SK map - Example : - <#assign owner_code = SegmentationKeys_Map["Owner"].String!""/> + <#if appointment.CarrierInformation??> + <#assign CarrierInformation_Map = JsonUtil.sequenceToMap(appointment.CarrierInformation, "Key", "Value") /> + <#if CarrierInformation_Map["Immatriculation"]??> + <#assign registration_number1 = CarrierInformation_Map["Immatriculation"].String!""/> + "registration_number":"${registration_number1}", + <#else> + "registration_number":"no plate number", + + If your SK is : Boolean : .Bool diff --git a/ReflexUtils.ftl b/ReflexUtils.ftl index afa299e..a22ce70 100644 --- a/ReflexUtils.ftl +++ b/ReflexUtils.ftl @@ -9,6 +9,23 @@ <#return dateutc?datetime.iso?iso_nz(locale)> +<#-- -------------------------------------------------------------------------------------------- --> +<#-- Add second to dateTime ex: AddSecondsToDatetime("2025-11-17T09:15:00Z"?datetime.iso, 61) --> +<#-- -------------------------------------------------------------------------------------------- --> +<#function AddSecondsToDatetime date seconds> + <#assign timeInMilliseconds = (1000 * seconds) > + <#assign aDate = date?long + timeInMilliseconds> + <#return aDate?number_to_datetime> + + +<#-- -------------------------------------------------------------------------------------------- --> +<#-- Duration between two datetimes in second --> +<#-- -------------------------------------------------------------------------------------------- --> +<#function DurationBetweenTwoDatetimeInSeconds startDate endDate> + <#return (endDate?long - startDate?long) / 1000 > + + + <#-- --------------------------------------------------------------------------------------- --> <#-- Split email reflex into json array string --> <#-- Example : splitemail "john.doe@hardis-group.com,; name@hardis-group.com" -->