From da3692787489e536e5c7ab14118c41b955e9ddb5 Mon Sep 17 00:00:00 2001 From: Laure Pascal Date: Wed, 13 Sep 2023 12:06:06 +0200 Subject: [PATCH] structured adress on actors --- RFXtoRP_HsaCarrier_ActorCreated.ftl | 33 ++++++++++++++++-------- RFXtoRP_HsaCons_ActorCreated.ftl | 31 +++++++++++++++++------ RFXtoRP_HsaSup_ActorCreated.ftl | 28 +++++++++++++++------ RFXtoRP_HsrDepot_ActorCreated.ftl | 39 ++++++++++++++++++----------- 4 files changed, 91 insertions(+), 40 deletions(-) diff --git a/RFXtoRP_HsaCarrier_ActorCreated.ftl b/RFXtoRP_HsaCarrier_ActorCreated.ftl index 77d450d..3ec3bc5 100644 --- a/RFXtoRP_HsaCarrier_ActorCreated.ftl +++ b/RFXtoRP_HsaCarrier_ActorCreated.ftl @@ -17,19 +17,32 @@ <#-- <#include "RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl">, --> - + + "Address": { - "Name": "${carrier.carrier_structured_address.name_or_company}", - "StreetAddressOne" : "${carrier.carrier_structured_address.street_and_PO}", - "StreetAddressTwo" : "${carrier.carrier_structured_address.additionnal_data}", - "PostalCode" : "${carrier.carrier_structured_address.postal_code}", - "City" : "${carrier.carrier_structured_address.post_code_area_name}", - "CountryCode" : "${carrier.carrier_structured_address.country_code}", - "ProvinceCode": "${carrier.carrier_structured_address.territorial_div_code}", - "State": "${carrier.carrier_structured_address.country_designation}" + <#-- if Reflex WMS address is structured --> + <#if carrier.carrier_structured_address?? > + + "Name": "${carrier.carrier_structured_address.name_or_company}", + "StreetAddressOne" : "${carrier.carrier_structured_address.street_and_PO}", + "StreetAddressTwo" : "${carrier.carrier_structured_address.additionnal_data}", + "PostalCode" : "${carrier.carrier_structured_address.postal_code}", + "City" : "${carrier.carrier_structured_address.post_code_area_name}", + "CountryCode" : "${carrier.carrier_structured_address.country_code}", + "ProvinceCode": "${carrier.carrier_structured_address.territorial_div_code}", + "State": "${carrier.carrier_structured_address.country_designation}" + + <#-- if Reflex WMS address is not structured --> + <#else> + "Name": "${carrier.address.company_name}", + "StreetAddressOne" : "${carrier.address.address_1}", + "StreetAddressTwo" : "${carrier.address.address_2}", + "StreetAddressThree" : "${carrier.address.address_3}" + }, - "Phones": ["${carrier.address.telephone}", + + "Phones": ["${carrier.address.telephone}", "${carrier.address.other_number}" ], "Typology": "TYPOLOGY_CARRIER" diff --git a/RFXtoRP_HsaCons_ActorCreated.ftl b/RFXtoRP_HsaCons_ActorCreated.ftl index 7acf9f1..6186125 100644 --- a/RFXtoRP_HsaCons_ActorCreated.ftl +++ b/RFXtoRP_HsaCons_ActorCreated.ftl @@ -17,9 +17,13 @@ <#-- <#include "RFXtoRP_HsaCons_ActorCreated_Metadata.ftl">, --> + + "Address": + { + + <#-- if Reflex WMS is structured --> + <#if actor.consignee_structured_address??> - "Address": - { "Name": "${actor.consignee_structured_address.name_or_company}", "StreetAddressOne" : "${actor.consignee_structured_address.street_and_PO}", "StreetAddressTwo" : "${actor.consignee_structured_address.additionnal_data}", @@ -27,12 +31,23 @@ "City" : "${actor.consignee_structured_address.post_code_area_name}", "CountryCode" : "${actor.consignee_structured_address.country_code}", "ProvinceCode": "${actor.consignee_structured_address.territorial_div_code}", - "State": "${actor.consignee_structured_address.country_designation}" - }, - "Phones": ["${actor.address.telephone}", - "${actor.address.other_number}" - ], - "Typology": "TYPOLOGY_UNKNOWN" + "State": "${actor.consignee_structured_address.country_designation}" + + <#-- if Reflex WMS is not structured --> + <#else> + + "Name": "${actor.address.company_name}", + "StreetAddressOne" : "${actor.address.address_1}", + "StreetAddressTwo" : "${actor.address.address_2}", + "StreetAddressThree" : "${actor.address.address_3}", + + + }, + + "Phones": ["${actor.address.telephone}", + "${actor.address.other_number}" + ], + "Typology": "TYPOLOGY_UNKNOWN" } } ] diff --git a/RFXtoRP_HsaSup_ActorCreated.ftl b/RFXtoRP_HsaSup_ActorCreated.ftl index 2b5e4d3..65a8315 100644 --- a/RFXtoRP_HsaSup_ActorCreated.ftl +++ b/RFXtoRP_HsaSup_ActorCreated.ftl @@ -20,14 +20,26 @@ "Address": { - "Name": "${actor.supplier_structured_address.name_or_company}", - "StreetAddressOne" : "${actor.supplier_structured_address.street_and_PO}", - "StreetAddressTwo" : "${actor.supplier_structured_address.additionnal_data}", - "PostalCode" : "${actor.supplier_structured_address.postal_code}", - "City" : "${actor.supplier_structured_address.post_code_area_name}", - "CountryCode" : "${actor.supplier_structured_address.country_code}", - "ProvinceCode": "${actor.supplier_structured_address.territorial_div_code}", - "State": "${actor.supplier_structured_address.country_designation}" + <#-- if Reflex WMS address is structured --> + <#if actor.supplier_structured_address?? > + + "Name": "${actor.supplier_structured_address.name_or_company}", + "StreetAddressOne" : "${actor.supplier_structured_address.street_and_PO}", + "StreetAddressTwo" : "${actor.supplier_structured_address.additionnal_data}", + "PostalCode" : "${actor.supplier_structured_address.postal_code}", + "City" : "${actor.supplier_structured_address.post_code_area_name}", + "CountryCode" : "${actor.supplier_structured_address.country_code}", + "ProvinceCode": "${actor.supplier_structured_address.territorial_div_code}", + "State": "${actor.supplier_structured_address.country_designation}" + + <#-- if Reflex WMS address is not structured --> + <#else> + "Name": "${actor.optional_attributes.company_name}", + "StreetAddressOne" : "${actor.optional_attributes.address_1}", + "StreetAddressTwo" : "${actor.optional_attributes.address_2}", + "StreetAddressThree" : "${actor.optional_attributes.address_3}" + + }, "Phones": ["${actor.optional_attributes.telephone}", "${actor.optional_attributes.other_number}" diff --git a/RFXtoRP_HsrDepot_ActorCreated.ftl b/RFXtoRP_HsrDepot_ActorCreated.ftl index 9421a12..ca4bd63 100644 --- a/RFXtoRP_HsrDepot_ActorCreated.ftl +++ b/RFXtoRP_HsrDepot_ActorCreated.ftl @@ -18,22 +18,33 @@ <#include "RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl">, --> - "Address": + "Address": { - "StreetAddressOne" : "${depot.physical_depot_address.address_1}", - "StreetAddressTwo" : "${depot.physical_depot_address.address_2}", + <#-- if Reflex WMS address is structured --> + <#if depot.physical_depot_structured_address?? > - <#if depot.physical_depot_address.address_3?length < 10> - "PostalCode" : "${depot.physical_depot_address.address_3?trim}", - <#else> - "PostalCode" : "${depot.physical_depot_address.address_3?substring(0,9)?trim}", - - <#if depot.physical_depot_address.address_4?length < 14> - "CountryCode" : "" - <#else> - "CountryCode" : "${depot.physical_depot_address.address_4?substring(10,13)?trim}" - - } + "Name": "${depot.physical_depot_structured_address.name_or_company}", + "StreetAddressOne" : "${depot.physical_depot_structured_address.street_and_PO}", + "StreetAddressTwo" : "${depot.physical_depot_structured_address.additionnal_data}", + "PostalCode" : "${depot.physical_depot_structured_address.postal_code}", + "City" : "${depot.physical_depot_structured_address.post_code_area_name}", + "CountryCode" : "${depot.physical_depot_structured_address.country_code}", + "ProvinceCode": "${depot.physical_depot_structured_address.territorial_div_code}", + "State": "${depot.physical_depot_structured_address.country_designation}" + + <#-- if Reflex WMS address is not structured --> + <#else> + "Name": "${depot.physical-depot_address.company_name}", + "StreetAddressOne" : "${depot.physical-depot_address.address_1}", + "StreetAddressTwo" : "${depot.physical-depot_address.address_2}", + "StreetAddressThree" : "${depot.physical-depot_address.address_3}" + + + }, + "Phones": ["${depot.physical-depot_address.telephone}", + "${depot.physical-depot_address.other_number}" + ], + "Typology": "TYPOLOGY_UNKNOWN" } } ]