Commit fb0b3ffe authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_dqe: Implement 'ESTOCADE' call to DQE

parent 02197068
...@@ -123,3 +123,33 @@ class DQEDataValidatorClientConnector(XMLObject): ...@@ -123,3 +123,33 @@ class DQEDataValidatorClientConnector(XMLObject):
archive_kw=archive_kw, archive_kw=archive_kw,
) )
return response return response
def checkRelocation(
self,
first_name,
last_name,
address,
zip_code,
city,
service,
social_title='',
complement='',
lieu_dit='',
archive_kw=None,
):
response = self.call(
'ESTOCADE',
service,
params={
'Nom': last_name,
'Prenom': first_name,
'Adresse': address,
'CodePostal': zip_code,
'Ville': city,
'Civilite': social_title,
'Complement': complement,
'LieuDit': lieu_dit,
},
archive_kw=archive_kw,
)
return response
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>ESTOCADE</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>RelocationData</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Relocation Data</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -10,4 +10,5 @@ return { ...@@ -10,4 +10,5 @@ return {
dqe_resource_category.DefaultAddress: 'DQECodeDetail', dqe_resource_category.DefaultAddress: 'DQECodeDetail',
dqe_resource_category.DeliveryAddress: 'DQECodeDetail', dqe_resource_category.DeliveryAddress: 'DQECodeDetail',
dqe_resource_category.OrganisationData: 'DQE_status', dqe_resource_category.OrganisationData: 'DQE_status',
dqe_resource_category.RelocationData: 'RESULT',
} }
...@@ -7,4 +7,5 @@ return { ...@@ -7,4 +7,5 @@ return {
dqe_resource_category.DefaultAddress: "Adresse facturation", dqe_resource_category.DefaultAddress: "Adresse facturation",
dqe_resource_category.DeliveryAddress: "Adresse livraison", dqe_resource_category.DeliveryAddress: "Adresse livraison",
dqe_resource_category.OrganisationData: "Organisation", dqe_resource_category.OrganisationData: "Organisation",
dqe_resource_category.RelocationData: "Déménagement",
}.get(context.getResourceValue(), '') }.get(context.getResourceValue(), '')
...@@ -9,7 +9,13 @@ try: ...@@ -9,7 +9,13 @@ try:
except ValueError: except ValueError:
return {} return {}
# In all cases, the actual response is an inner dict that has key '1', # In all cases, the actual response is an inner dict that has key '1',
# apart from 'SIRETINFO' ('OrganisationData' resource for us) that it is just the dict # apart from 'SIRETINFO' ('OrganisationData' resource for us)
if resource_value == context.getPortalObject().portal_categories.http_exchange_resource.dqe.OrganisationData: # and 'ESTOCADE' ('RelocationData' resource for us)
# that it is just the dict
http_exchange_resource = context.getPortalObject().portal_categories.http_exchange_resource
if resource_value in (
http_exchange_resource.dqe.OrganisationData,
http_exchange_resource.dqe.RelocationData,
):
return response_dict return response_dict
return response_dict.get('1', {}) return response_dict.get('1', {})
resource_value = context.getResourceValue() resource_value = context.getResourceValue()
if not resource_value.isMemberOf('http_exchange_resource/dqe'): if not resource_value.isMemberOf('http_exchange_resource/dqe'):
return '' return {}
response = context.getResponse()
if response == 'TIMEOUT':
return 'Timeout'
elif response == 'FAILURE':
return context.Base_translateString('Failure')
response_dict = context.HTTPExchange_getDQEResponseDict() response_dict = context.HTTPExchange_getDQEResponseDict()
dqe_resource_category = context.getPortalObject().portal_categories.http_exchange_resource.dqe dqe_resource_category = context.getPortalObject().portal_categories.http_exchange_resource.dqe
...@@ -18,8 +12,7 @@ if resource_value in ( ...@@ -18,8 +12,7 @@ if resource_value in (
dqe_resource_category.DefaultAddress, dqe_resource_category.DeliveryAddress dqe_resource_category.DefaultAddress, dqe_resource_category.DeliveryAddress
): ):
return response_dict.get('DQELibErreur', 'Inconnue').encode('utf-8') return response_dict.get('DQELibErreur', 'Inconnue').encode('utf-8')
elif resource_value == dqe_resource_category.DefaultEmail:
if resource_value == dqe_resource_category.DefaultEmail:
return { return {
'00': 'E-mail valide', '00': 'E-mail valide',
'01': 'E-mail correct, mais le nom n’a pas pu être contrôlé', '01': 'E-mail correct, mais le nom n’a pas pu être contrôlé',
...@@ -35,7 +28,7 @@ if resource_value == dqe_resource_category.DefaultEmail: ...@@ -35,7 +28,7 @@ if resource_value == dqe_resource_category.DefaultEmail:
}.get( }.get(
response_dict.get('IdError'), 'Inconnue' response_dict.get('IdError'), 'Inconnue'
) )
if resource_value in ( elif resource_value in (
dqe_resource_category.DefaultTelephone, dqe_resource_category.MobileTelephone, dqe_resource_category.DefaultTelephone, dqe_resource_category.MobileTelephone,
): ):
return { return {
...@@ -45,11 +38,15 @@ if resource_value in ( ...@@ -45,11 +38,15 @@ if resource_value in (
}.get( }.get(
response_dict.get('IdError'), 'Inconnue' response_dict.get('IdError'), 'Inconnue'
) )
if resource_value == dqe_resource_category.OrganisationData: elif resource_value == dqe_resource_category.OrganisationData:
return { return {
'FOUND': 'Organisation trouvée ', 'FOUND': 'Organisation trouvée ',
'NOT FOUND': 'Organisation introuvable', 'NOT FOUND': 'Organisation introuvable',
}.get( }.get(
response_dict.get('DQE_status', 'NOT FOUND'), 'Inconnue' response_dict.get('DQE_status', 'NOT FOUND'), 'Inconnue'
) )
elif resource_value == dqe_resource_category.RelocationData:
if response_dict.get('RESULT', 'FALSE') == 'TRUE':
return 'Déménagée'
return 'Non déménagée'
return '' return ''
...@@ -16,6 +16,7 @@ service_value_to_key_list_dict = { ...@@ -16,6 +16,7 @@ service_value_to_key_list_dict = {
dqe_resource_category.DefaultAddress: ('Adresse', 'Pays'), dqe_resource_category.DefaultAddress: ('Adresse', 'Pays'),
dqe_resource_category.DeliveryAddress: ('Adresse', 'Pays'), dqe_resource_category.DeliveryAddress: ('Adresse', 'Pays'),
dqe_resource_category.OrganisationData: ('Siret', ), dqe_resource_category.OrganisationData: ('Siret', ),
dqe_resource_category.RelocationData: ('Adresse', 'CodePostal', 'Ville', 'Complement', 'LieuDit'),
} }
sent_value_list = [] sent_value_list = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment