otrs-somconnexio 0.4.4__py2.py3-none-any.whl → 0.7.3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. otrs_somconnexio/client.py +110 -42
  2. otrs_somconnexio/exceptions.py +44 -11
  3. otrs_somconnexio/otrs_models/abstract_article.py +3 -0
  4. otrs_somconnexio/otrs_models/adsl_data.py +7 -37
  5. otrs_somconnexio/otrs_models/adsl_dynamic_fields.py +5 -4
  6. otrs_somconnexio/otrs_models/adsl_ticket.py +9 -5
  7. otrs_somconnexio/otrs_models/configurations/changes/__init__.py +0 -0
  8. otrs_somconnexio/otrs_models/configurations/changes/add_data.py +13 -0
  9. otrs_somconnexio/otrs_models/configurations/changes/change_email.py +16 -0
  10. otrs_somconnexio/otrs_models/configurations/changes/change_iban.py +8 -0
  11. otrs_somconnexio/otrs_models/configurations/changes/change_owner.py +19 -0
  12. otrs_somconnexio/otrs_models/configurations/changes/change_pack.py +6 -0
  13. otrs_somconnexio/otrs_models/configurations/changes/change_shared_bond.py +7 -0
  14. otrs_somconnexio/otrs_models/configurations/changes/change_tariff.py +29 -0
  15. otrs_somconnexio/otrs_models/configurations/changes/change_tariff_adsl.py +20 -0
  16. otrs_somconnexio/otrs_models/configurations/changes/change_tariff_fiber.py +11 -0
  17. otrs_somconnexio/otrs_models/configurations/provision/__init__.py +0 -0
  18. otrs_somconnexio/otrs_models/configurations/{adsl_ticket.py → provision/adsl_ticket.py} +2 -2
  19. otrs_somconnexio/otrs_models/configurations/{fiber_ticket.py → provision/fiber_ticket.py} +6 -3
  20. otrs_somconnexio/otrs_models/configurations/provision/mobile_ticket.py +44 -0
  21. otrs_somconnexio/otrs_models/configurations/provision/router_4G_ticket.py +8 -0
  22. otrs_somconnexio/otrs_models/configurations/provision/switchboard_ticket.py +10 -0
  23. otrs_somconnexio/otrs_models/configurations/querys/__init__.py +0 -0
  24. otrs_somconnexio/otrs_models/configurations/querys/check_coverage.py +16 -0
  25. otrs_somconnexio/otrs_models/configurations/querys/we_call_you.py +26 -0
  26. otrs_somconnexio/otrs_models/coverage/adsl.py +1 -1
  27. otrs_somconnexio/otrs_models/coverage/asociatel_fiber.py +6 -0
  28. otrs_somconnexio/otrs_models/coverage/mm_fiber.py +7 -0
  29. otrs_somconnexio/otrs_models/coverage/orange_fiber.py +5 -0
  30. otrs_somconnexio/otrs_models/coverage/vdf_fiber.py +8 -0
  31. otrs_somconnexio/otrs_models/coverage_article.py +20 -4
  32. otrs_somconnexio/otrs_models/coverage_ticket.py +1 -0
  33. otrs_somconnexio/otrs_models/customer_data.py +15 -3
  34. otrs_somconnexio/otrs_models/customer_user.py +3 -9
  35. otrs_somconnexio/otrs_models/fiber_data.py +17 -33
  36. otrs_somconnexio/otrs_models/fiber_dynamic_fields.py +58 -4
  37. otrs_somconnexio/otrs_models/fiber_ticket.py +9 -5
  38. otrs_somconnexio/otrs_models/internet_data.py +79 -0
  39. otrs_somconnexio/otrs_models/internet_dynamic_fields.py +65 -26
  40. otrs_somconnexio/otrs_models/mobile_data.py +49 -5
  41. otrs_somconnexio/otrs_models/mobile_dynamic_fields.py +50 -8
  42. otrs_somconnexio/otrs_models/mobile_ticket.py +20 -4
  43. otrs_somconnexio/otrs_models/process_ticket/internet.py +40 -97
  44. otrs_somconnexio/otrs_models/process_ticket/mobile.py +63 -43
  45. otrs_somconnexio/otrs_models/process_ticket/process_ticket.py +74 -0
  46. otrs_somconnexio/otrs_models/providers.py +4 -3
  47. otrs_somconnexio/otrs_models/provision_article.py +7 -5
  48. otrs_somconnexio/otrs_models/provision_dynamic_fields.py +76 -11
  49. otrs_somconnexio/otrs_models/provision_ticket.py +52 -28
  50. otrs_somconnexio/otrs_models/responsible_data.py +6 -0
  51. otrs_somconnexio/otrs_models/router_4G_data.py +8 -0
  52. otrs_somconnexio/otrs_models/router_4G_dynamic_fields.py +9 -0
  53. otrs_somconnexio/otrs_models/router_4G_ticket.py +26 -0
  54. otrs_somconnexio/otrs_models/service.py +41 -12
  55. otrs_somconnexio/otrs_models/switchboard_data.py +58 -0
  56. otrs_somconnexio/otrs_models/switchboard_dynamic_fields.py +94 -0
  57. otrs_somconnexio/otrs_models/switchboard_header_data.py +18 -0
  58. otrs_somconnexio/otrs_models/switchboard_header_dynamic_fields.py +80 -0
  59. otrs_somconnexio/otrs_models/switchboard_header_ticket.py +30 -0
  60. otrs_somconnexio/otrs_models/switchboard_ticket.py +35 -0
  61. otrs_somconnexio/otrs_models/telecom_company.py +69 -69
  62. otrs_somconnexio/otrs_models/ticket_factory.py +34 -11
  63. otrs_somconnexio/otrs_models/ticket_types/__init__.py +0 -0
  64. otrs_somconnexio/otrs_models/ticket_types/add_data_ticket.py +36 -0
  65. otrs_somconnexio/otrs_models/ticket_types/base_change_tariff_ba_ticket.py +23 -0
  66. otrs_somconnexio/otrs_models/ticket_types/base_change_ticket.py +33 -0
  67. otrs_somconnexio/otrs_models/ticket_types/base_customer_ticket.py +24 -0
  68. otrs_somconnexio/otrs_models/ticket_types/base_ticket.py +147 -0
  69. otrs_somconnexio/otrs_models/ticket_types/change_email_ticket.py +40 -0
  70. otrs_somconnexio/otrs_models/ticket_types/change_iban_ticket.py +39 -0
  71. otrs_somconnexio/otrs_models/ticket_types/change_owner_ticket.py +132 -0
  72. otrs_somconnexio/otrs_models/ticket_types/change_pack_not_shared_data.py +36 -0
  73. otrs_somconnexio/otrs_models/ticket_types/change_personal_email_ticket.py +31 -0
  74. otrs_somconnexio/otrs_models/ticket_types/change_shared_bond_ticket.py +35 -0
  75. otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_landline_ticket.py +30 -0
  76. otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_out_landline_ticket.py +30 -0
  77. otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_ticket.py +42 -0
  78. otrs_somconnexio/otrs_models/ticket_types/change_tariff_fiber_ticket.py +43 -0
  79. otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket.py +87 -0
  80. otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_mobile_pack.py +51 -0
  81. otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_shared_bonds.py +22 -0
  82. otrs_somconnexio/otrs_models/ticket_types/check_coverage_ticket.py +52 -0
  83. otrs_somconnexio/otrs_models/ticket_types/we_call_you_ticket.py +53 -0
  84. otrs_somconnexio/otrs_models/vf_provisioning_article.py +4 -2
  85. otrs_somconnexio/responses/ticket_creation.py +5 -4
  86. otrs_somconnexio/services/activate_change_tarriff_mobile_tickets.py +13 -0
  87. otrs_somconnexio/services/base_get_ticket_by_number.py +22 -0
  88. otrs_somconnexio/services/change_to_confirm_ticket.py +45 -0
  89. otrs_somconnexio/services/get_mobile_related_tickets.py +11 -0
  90. otrs_somconnexio/services/get_sharing_data_mobile_tickets.py +65 -0
  91. otrs_somconnexio/services/get_ticket_title.py +26 -0
  92. otrs_somconnexio/services/mapping_mobile_minutes.py +5 -5
  93. otrs_somconnexio/services/mapping_services.py +8 -6
  94. otrs_somconnexio/services/move_sharing_data_mobile_tickets.py +13 -0
  95. otrs_somconnexio/services/search_tickets_mobile_change_tariff.py +25 -0
  96. otrs_somconnexio/services/search_tickets_service.py +57 -0
  97. otrs_somconnexio/services/set_SIM_recieved_mobile_ticket.py +107 -0
  98. otrs_somconnexio/services/set_SIM_returned_mobile_ticket.py +37 -0
  99. otrs_somconnexio/services/set_fiber_contract_code_mobile_ticket.py +21 -0
  100. otrs_somconnexio/services/unblock_mobile_pack_ticket.py +48 -0
  101. otrs_somconnexio/services/update_process_ticket_with_coverage_tickets_info_service.py +10 -10
  102. otrs_somconnexio/services/update_ticket_DF.py +18 -0
  103. otrs_somconnexio/services/update_ticket_with_provider_info.py +2 -3
  104. otrs_somconnexio/user_management_client/client.py +15 -27
  105. otrs_somconnexio/user_management_client/user_management_response.py +2 -3
  106. {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/METADATA +19 -4
  107. otrs_somconnexio-0.7.3.dist-info/RECORD +202 -0
  108. {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/WHEEL +1 -1
  109. tests/data/otrs_raw_responses.py +12 -6
  110. tests/integration/test_change_customer_language.py +14 -19
  111. tests/integration/test_ticket_factory.py +383 -106
  112. tests/integration/test_update_ticket_with_coverage_data.py +53 -27
  113. tests/otrs_models/common_helper.py +9 -0
  114. tests/otrs_models/configuration/changes/__init__.py +0 -0
  115. tests/otrs_models/configuration/changes/test_change_tariff_ticket.py +91 -0
  116. tests/otrs_models/configuration/provision/__init__.py +0 -0
  117. tests/otrs_models/configuration/provision/test_adsl_ticket.py +30 -0
  118. tests/otrs_models/configuration/provision/test_fiber_ticket.py +32 -0
  119. tests/otrs_models/configuration/provision/test_mobile_ticket.py +62 -0
  120. tests/otrs_models/process_ticket/test_internet_process_ticket.py +54 -60
  121. tests/otrs_models/process_ticket/test_mobile_process_ticket.py +56 -33
  122. tests/otrs_models/test_abstract_article.py +3 -2
  123. tests/otrs_models/test_adsl_data.py +11 -4
  124. tests/otrs_models/test_adsl_dynamic_fields.py +217 -100
  125. tests/otrs_models/test_adsl_ticket.py +78 -83
  126. tests/otrs_models/test_coverage_article.py +9 -7
  127. tests/otrs_models/test_coverage_ticket.py +4 -2
  128. tests/otrs_models/test_customer_user.py +23 -20
  129. tests/otrs_models/test_fiber_data.py +20 -4
  130. tests/otrs_models/test_fiber_dynamic_fields.py +458 -134
  131. tests/otrs_models/test_fiber_ticket.py +113 -79
  132. tests/otrs_models/test_mobile_data.py +14 -3
  133. tests/otrs_models/test_mobile_dynamic_fields.py +335 -74
  134. tests/otrs_models/test_mobile_paused_ticket.py +35 -0
  135. tests/otrs_models/test_mobile_ticket.py +82 -96
  136. tests/otrs_models/test_provision_article.py +49 -0
  137. tests/otrs_models/test_router_4G_data.py +43 -0
  138. tests/otrs_models/test_router_4G_dynamic_fields.py +619 -0
  139. tests/otrs_models/test_router_4G_ticket.py +135 -0
  140. tests/otrs_models/test_service.py +58 -14
  141. tests/otrs_models/test_switchboard_data.py +37 -0
  142. tests/otrs_models/test_switchboard_dynamic_fields.py +197 -0
  143. tests/otrs_models/test_switchboard_header_data.py +18 -0
  144. tests/otrs_models/test_switchboard_header_dynamic_fields.py +119 -0
  145. tests/otrs_models/test_switchboard_header_ticket.py +127 -0
  146. tests/otrs_models/test_switchboard_ticket.py +147 -0
  147. tests/otrs_models/test_telecom_company.py +16 -16
  148. tests/otrs_models/test_ticket_factory.py +73 -16
  149. tests/otrs_models/test_vf_provisioning_article.py +6 -5
  150. tests/otrs_models/ticket_types/__init__.py +0 -0
  151. tests/otrs_models/ticket_types/test_add_data.py +79 -0
  152. tests/otrs_models/ticket_types/test_change_email.py +163 -0
  153. tests/otrs_models/ticket_types/test_change_iban.py +82 -0
  154. tests/otrs_models/ticket_types/test_change_owner.py +277 -0
  155. tests/otrs_models/ticket_types/test_change_pack_not_shared_data.py +77 -0
  156. tests/otrs_models/ticket_types/test_change_personal_email.py +81 -0
  157. tests/otrs_models/ticket_types/test_change_tariff.py +435 -0
  158. tests/otrs_models/ticket_types/test_change_tariff_adsl_landline.py +115 -0
  159. tests/otrs_models/ticket_types/test_change_tariff_adsl_out_landline.py +115 -0
  160. tests/otrs_models/ticket_types/test_change_tariff_fiber.py +175 -0
  161. tests/otrs_models/ticket_types/test_change_tariff_mobile_pack.py +151 -0
  162. tests/otrs_models/ticket_types/test_change_tariff_shared_bonds.py +65 -0
  163. tests/otrs_models/ticket_types/test_check_coverage.py +106 -0
  164. tests/otrs_models/ticket_types/test_shared_bond.py +80 -0
  165. tests/otrs_models/ticket_types/test_we_call_you.py +108 -0
  166. tests/responses/test_ticket_creation.py +4 -4
  167. tests/services/test_activate_change_tariff_mobile_tickets.py +45 -0
  168. tests/services/test_change_to_confirm_ticket.py +80 -0
  169. tests/services/test_get_mobile_related_tickets.py +39 -0
  170. tests/services/test_get_sharing_data_mobile_tickets.py +127 -0
  171. tests/services/test_mapping_mobile_minutes.py +8 -8
  172. tests/services/{test_mappint_services.py → test_mapping_services.py} +9 -9
  173. tests/services/test_move_sharing_data_mobile_tickets.py +43 -0
  174. tests/services/test_search_tickets_mobile_change_tariff.py +84 -0
  175. tests/services/test_search_tickets_service.py +166 -0
  176. tests/services/test_set_SIM_recieved_mobile_ticket_service.py +211 -0
  177. tests/services/test_set_SIM_returned_mobile_ticket_service.py +59 -0
  178. tests/services/test_set_fiber_contract_code_mobile_ticket_service.py +47 -0
  179. tests/services/test_unblock_mobile_pack_ticket.py +224 -0
  180. tests/services/test_update_process_ticket_with_VF_provisioning.py +15 -14
  181. tests/services/test_update_process_ticket_with_coverage_tickets_info_service.py +22 -10
  182. tests/services/test_update_ticket_with_provider_info.py +16 -15
  183. tests/user_management_client/test_client.py +41 -58
  184. tests/user_management_client/test_user_management_response.py +13 -26
  185. otrs_somconnexio/otrs_models/configurations/mobile_ticket.py +0 -17
  186. otrs_somconnexio/otrs_models/coverage/mm_fibre.py +0 -7
  187. otrs_somconnexio/otrs_models/coverage/vdf_fibre.py +0 -8
  188. otrs_somconnexio-0.4.4.dist-info/RECORD +0 -95
  189. tests/otrs_models/configuration/test_adsl_ticket.py +0 -45
  190. tests/otrs_models/configuration/test_fiber_ticket.py +0 -45
  191. tests/otrs_models/configuration/test_mobile_ticket.py +0 -45
  192. {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/top_level.txt +0 -0
@@ -2,39 +2,66 @@ import os
2
2
 
3
3
  from pyotrs import Client
4
4
  from pyotrs.lib import DynamicField
5
- from pyotrs.lib import APIError, HTTPError, ResponseParseError, SessionNotCreated, ArgumentMissingError
5
+ from pyotrs.lib import (
6
+ APIError,
7
+ HTTPError,
8
+ ResponseParseError,
9
+ SessionNotCreated,
10
+ ArgumentMissingError,
11
+ )
6
12
 
7
13
  from otrs_somconnexio.responses.ticket_creation import OTRSCreationTicketResponse
8
14
  from otrs_somconnexio.otrs_models.process_ticket.internet import InternetProcessTicket
9
15
  from otrs_somconnexio.otrs_models.process_ticket.mobile import MobileProcessTicket
10
16
  from otrs_somconnexio.otrs_models.coverage_ticket import CoverageTicket
11
17
  from otrs_somconnexio.otrs_models.service import Service
12
- from otrs_somconnexio.exceptions import TicketNotCreated, ErrorCreatingSession, TicketNotFoundError
18
+ from otrs_somconnexio.exceptions import (
19
+ TicketNotCreated,
20
+ ErrorCreatingSession,
21
+ TicketNotFoundError,
22
+ )
13
23
 
14
24
 
15
- class OTRSClient():
25
+ class OTRSClient:
16
26
  TICKET_CONNECTOR_CONFIG = {
17
- 'Name': 'GenericTicketConnectorREST',
18
- 'Config': {
19
- 'SessionCreate': {'RequestMethod': 'POST',
20
- 'Route': '/Session',
21
- 'Result': 'SessionID'},
22
- 'TicketCreate': {'RequestMethod': 'POST',
23
- 'Route': '/Ticket',
24
- 'Result': 'TicketID'},
25
- 'TicketGet': {'RequestMethod': 'GET',
26
- 'Route': '/Ticket/:TicketID',
27
- 'Result': 'Ticket'},
28
- 'TicketGetList': {'RequestMethod': 'GET',
29
- 'Route': '/TicketList',
30
- 'Result': 'Ticket'},
31
- 'TicketSearch': {'RequestMethod': 'POST',
32
- 'Route': '/TicketSearch',
33
- 'Result': 'TicketID'},
34
- 'TicketUpdate': {'RequestMethod': 'PATCH',
35
- 'Route': '/Ticket/:TicketID',
36
- 'Result': 'TicketID'},
37
- }
27
+ "Name": "GenericTicketConnectorREST",
28
+ "Config": {
29
+ "AccessTokenCreate": {
30
+ "RequestMethod": "POST",
31
+ "Route": "/Session",
32
+ "Result": "AccessToken",
33
+ },
34
+ "AccesTokenGet": {
35
+ "RequestMethod": "GET",
36
+ "Route": "/Session/:Token",
37
+ "Result": "AccessToken",
38
+ },
39
+ "TicketCreate": {
40
+ "RequestMethod": "POST",
41
+ "Route": "/Ticket",
42
+ "Result": "TicketID",
43
+ },
44
+ "TicketGet": {
45
+ "RequestMethod": "GET",
46
+ "Route": "/Ticket/:TicketID",
47
+ "Result": "Ticket",
48
+ },
49
+ "TicketGetList": {
50
+ "RequestMethod": "GET",
51
+ "Route": "/TicketList",
52
+ "Result": "Ticket",
53
+ },
54
+ "TicketSearch": {
55
+ "RequestMethod": "POST",
56
+ "Route": "/TicketSearch",
57
+ "Result": "TicketID",
58
+ },
59
+ "TicketUpdate": {
60
+ "RequestMethod": "PATCH",
61
+ "Route": "/Ticket/:TicketID",
62
+ "Result": "TicketID",
63
+ },
64
+ },
38
65
  }
39
66
 
40
67
  def __init__(self):
@@ -42,18 +69,18 @@ class OTRSClient():
42
69
 
43
70
  @staticmethod
44
71
  def _password():
45
- return os.environ['OTRS_PASSW']
72
+ return os.environ["OTRS_PASSW"]
46
73
 
47
74
  @staticmethod
48
75
  def _user():
49
- return os.environ['OTRS_USER']
76
+ return os.environ["OTRS_USER"]
50
77
 
51
78
  @staticmethod
52
79
  def _url():
53
- return os.environ['OTRS_URL']
80
+ return os.environ["OTRS_URL"]
54
81
 
55
82
  def _create_client_with_session(self):
56
- """ Create a OTRS Client with session open to play calls.
83
+ """Create a OTRS Client with session open to play calls.
57
84
 
58
85
  This method call to the OTRS API to create a session to play another requests with authentication done.
59
86
  Raise User errors to show the problem with the request if it is fault.
@@ -65,15 +92,17 @@ class OTRSClient():
65
92
  baseurl=self._url(),
66
93
  username=self._user(),
67
94
  password=self._password(),
68
- webservice_config_ticket=self.TICKET_CONNECTOR_CONFIG
95
+ webservice_config_ticket=self.TICKET_CONNECTOR_CONFIG,
69
96
  )
70
97
  client.session_create()
71
98
  except (HTTPError, APIError, ResponseParseError) as error:
72
99
  raise ErrorCreatingSession(error.message)
73
100
  return client
74
101
 
75
- def create_otrs_process_ticket(self, ticket, article, dynamic_fields):
76
- """ Create a OTRS Process Ticket to manage the provisioning.
102
+ def create_otrs_process_ticket(
103
+ self, ticket, article, dynamic_fields, attachments=None
104
+ ):
105
+ """Create a OTRS Process Ticket to manage the provisioning.
77
106
 
78
107
  This method call to the OTRS API to create a ticket with all the information of the econtract.
79
108
  If the Ticket is created, return the response to save the ID and the number in the EticomContract
@@ -86,13 +115,21 @@ class OTRSClient():
86
115
  client_response = self.client.ticket_create(
87
116
  ticket=ticket,
88
117
  article=article,
89
- dynamic_fields=dynamic_fields)
90
- except (HTTPError, APIError, ResponseParseError, SessionNotCreated, ArgumentMissingError) as error:
91
- raise TicketNotCreated(error.message)
118
+ dynamic_fields=dynamic_fields,
119
+ attachments=attachments,
120
+ )
121
+ except (
122
+ HTTPError,
123
+ APIError,
124
+ ResponseParseError,
125
+ SessionNotCreated,
126
+ ArgumentMissingError,
127
+ ) as error:
128
+ raise TicketNotCreated(error.message, ticket, dynamic_fields)
92
129
  return OTRSCreationTicketResponse(client_response)
93
130
 
94
131
  def get_otrs_process_ticket(self, ticket_id):
95
- """ Search a OTRS Process Ticket by ID.
132
+ """Search a OTRS Process Ticket by ID.
96
133
 
97
134
  This method call to the OTRS API to search a ticket with all the information of the provisioning process.
98
135
  If the Ticket is founded, return the Ticket object.
@@ -119,23 +156,54 @@ class OTRSClient():
119
156
  def search_coverage_tickets_by_email(self, email):
120
157
  df_process_id = {
121
158
  "name": "ProcessManagementProcessID",
122
- "value": "Process-be8cf222949132c9fae1bb74615a5ae4"
159
+ "value": "Process-be8cf222949132c9fae1bb74615a5ae4",
123
160
  }
124
161
 
125
162
  tickets = self.search_tickets(
126
163
  dynamic_fields=[
127
- DynamicField(df_process_id["name"], search_patterns=[df_process_id["value"]]),
128
- DynamicField("correuElectronic", search_patterns=[email])
164
+ DynamicField(
165
+ df_process_id["name"], search_patterns=[df_process_id["value"]]
166
+ ),
167
+ DynamicField("correuElectronic", search_patterns=[email]),
129
168
  ]
130
169
  )
131
170
  return [CoverageTicket(t) for t in tickets]
132
171
 
172
+ def get_ticket_by_number(self, ticket_number, dynamic_fields=False):
173
+ """
174
+ Search a OTRS Process Ticket by its number.
175
+ Returns a PyOTRS Ticket object if found.
176
+ """
177
+ ticket = self.client.ticket_get_by_number(
178
+ ticket_number, dynamic_fields=dynamic_fields
179
+ )
180
+ return ticket
181
+
133
182
  def update_ticket(self, ticket_id, article, dynamic_fields=[]):
134
- self.client.ticket_update(
135
- ticket_id,
136
- article,
137
- dynamic_fields=dynamic_fields
183
+ self.client.ticket_update(ticket_id, article, dynamic_fields=dynamic_fields)
184
+
185
+ def link_tickets(self, src_ticket_id, dst_ticket_id, link_type="Normal"):
186
+ """
187
+ Sets a LINK between to OTRS tickets to interconnect them.
188
+ """
189
+ self.client.link_add(src_ticket_id, dst_ticket_id, link_type=link_type)
190
+
191
+ def get_linked_tickets(self, src_ticket_id, link_type="Normal"):
192
+ """
193
+ Gets tickets linked with the one which ID is passed as parameter (src_ticket_id).
194
+ """
195
+ linked_tickets_response = self.client.link_list(
196
+ src_object_id=src_ticket_id, link_type=link_type
138
197
  )
198
+ if not linked_tickets_response:
199
+ return []
200
+
201
+ if isinstance(linked_tickets_response, list):
202
+ ticket_ids = [ticket["Key"] for ticket in linked_tickets_response]
203
+ else:
204
+ ticket_ids = [linked_tickets_response["Key"]]
205
+
206
+ return [self.get_otrs_process_ticket(ticket_id) for ticket_id in ticket_ids]
139
207
 
140
208
  def _process_ticket_response(self, ticket):
141
209
  service = Service(ticket)
@@ -6,19 +6,48 @@ class OTRSClientException(Exception):
6
6
 
7
7
  class ErrorCreatingSession(OTRSClientException):
8
8
  def __init__(self, error_msg):
9
- message = "Error creating the session with the next error message: {}".format(error_msg)
9
+ message = "Error creating the session with the next error message: {}".format(
10
+ error_msg
11
+ )
10
12
  super(OTRSClientException, self).__init__(message)
11
13
 
12
14
 
13
15
  class TicketNotCreated(OTRSClientException):
14
- def __init__(self, error_msg):
15
- message = "Error creating the ticket with the next error message: {}".format(error_msg)
16
+ def _DF_to_string(self, df_list):
17
+ if not df_list or len(df_list) == 0:
18
+ return ""
19
+ df_msg = ""
20
+ for df in df_list:
21
+ df_msg = df_msg + "{}: {}\n".format(df.name, df.value)
22
+ return df_msg
23
+
24
+ def _ticket_to_string(self, ticket):
25
+ if not ticket:
26
+ return ""
27
+ ticket_msg = ""
28
+ for field_key in ticket.fields.keys():
29
+ ticket_msg = ticket_msg + "{}: {}\n".format(
30
+ field_key, ticket.fields[field_key]
31
+ )
32
+ return ticket_msg
33
+
34
+ def __init__(self, error_msg, ticket=None, dynamic_fields=None):
35
+ title_message = "Error creating the ticket with the next error message:"
36
+ df_message = self._DF_to_string(dynamic_fields)
37
+ ticket_message = self._ticket_to_string(ticket)
38
+
39
+ message = "{}\n\t{}\n{}{}".format(
40
+ title_message, error_msg, ticket_message, df_message
41
+ )
42
+
16
43
  super(OTRSClientException, self).__init__(message)
17
44
 
18
45
 
19
46
  class TicketNotFoundError(OTRSClientException):
20
- def __init__(self, ticket_id, error_msg=''):
21
- message = "Error searching the ticket with ID {} with the next error message: {}".format(ticket_id, error_msg)
47
+ def __init__(self, ticket_id, error_msg=""):
48
+ message = "Error searching the ticket with ID {} with the next error message: {}".format(
49
+ ticket_id, error_msg
50
+ )
22
51
  super(OTRSClientException, self).__init__(message)
23
52
 
24
53
 
@@ -28,13 +57,17 @@ class UserManagementResponseEmpty(OTRSClientException):
28
57
  super(OTRSClientException, self).__init__(message)
29
58
 
30
59
 
31
- class CustomerMailMissing(OTRSClientException):
32
- def __init__(self, order_id):
33
- message = "Customer without mail in order ID {}".format(order_id)
60
+ class ServiceTypeNotAllowedError(OTRSClientException):
61
+ def __init__(self, id, service_type):
62
+ message = "Contract {} with service type not allowed: {}".format(
63
+ id, service_type
64
+ )
34
65
  super(OTRSClientException, self).__init__(message)
35
66
 
36
67
 
37
- class ServiceTypeNotAllowedError(OTRSClientException):
38
- def __init__(self, id, service_type):
39
- message = "Contract {} with service type not allowed: {}".format(id, service_type)
68
+ class TicketNotReadyToBeUpdatedWithSIMReceivedData(OTRSClientException):
69
+ def __init__(self, ticket_number):
70
+ message = "Ticket {} not ready to be updated with SIM received data".format(
71
+ ticket_number
72
+ )
40
73
  super(OTRSClientException, self).__init__(message)
@@ -6,12 +6,15 @@ class AbstractArticle:
6
6
 
7
7
  subject = ""
8
8
  body = ""
9
+ # Parameter to mark notes field red and available only for personnel
10
+ isVisibleForCustomer = "1"
9
11
 
10
12
  def call(self):
11
13
  article_params = {
12
14
  "Subject": self.subject,
13
15
  "Body": self.body,
14
16
  "ContentType": "text/plain; charset=utf8",
17
+ "IsVisibleForCustomer": self.isVisibleForCustomer,
15
18
  }
16
19
 
17
20
  return Article(article_params)
@@ -1,40 +1,10 @@
1
- class ADSLData:
2
- type = 'adsl'
1
+ from otrs_somconnexio.otrs_models.internet_data import InternetData
3
2
 
4
- def __init__(
5
- self, order_id, phone_number, iban,
6
- landline_phone_number, service_address, service_city, service_zip,
7
- service_subdivision, shipment_address, shipment_city, shipment_zip,
8
- shipment_subdivision, previous_service, previous_provider, previous_internal_provider,
9
- previous_owner_vat, previous_owner_name, previous_owner_surname, notes,
10
- adsl_coverage, mm_fiber_coverage, vdf_fiber_coverage, change_address, product):
11
- # Common all the Tickets
12
- self.order_id = order_id
13
- self.phone_number = phone_number
14
- self.iban = iban
15
- self.previous_provider = previous_provider
16
- self.previous_internal_provider = previous_internal_provider
17
- self.previous_owner_vat = previous_owner_vat
18
- self.previous_owner_name = previous_owner_name
19
- self.previous_owner_surname = previous_owner_surname
20
3
 
21
- # Common Internet the Tickets
22
- self.service_address = service_address
23
- self.service_city = service_city
24
- self.service_zip = service_zip
25
- self.service_subdivision = service_subdivision
26
- self.shipment_address = shipment_address
27
- self.shipment_city = shipment_city
28
- self.shipment_zip = shipment_zip
29
- self.shipment_subdivision = shipment_subdivision
30
- self.previous_service = previous_service
31
- self.notes = notes
32
- self.adsl_coverage = adsl_coverage
33
- self.mm_fiber_coverage = mm_fiber_coverage
34
- self.vdf_fiber_coverage = vdf_fiber_coverage
35
- self.change_address = change_address
4
+ class ADSLData(InternetData):
5
+ service_type = "adsl"
36
6
 
37
- # ADSL the Tickets
38
- self.landline_phone_number = landline_phone_number
39
-
40
- self.product = product
7
+ def __init__(self, **args):
8
+ self.landline_phone_number = args.get("landline_phone_number", "")
9
+ args.pop("landline_phone_number", None)
10
+ super().__init__(**args)
@@ -5,13 +5,14 @@ from otrs_somconnexio.otrs_models.internet_dynamic_fields import InternetDynamic
5
5
 
6
6
 
7
7
  class ADSLDynamicFields(InternetDynamicFields):
8
-
9
8
  def _build_specific_broadband_service_dynamic_fields(self):
10
- """ Return list of OTRS DynamicFields to create a OTRS Process Ticket from Eticom Contract.
11
- Return only the specifics fields of ADSL Ticket. """
9
+ """Return list of OTRS DynamicFields to create a OTRS Process Ticket from Eticom Contract.
10
+ Return only the specifics fields of ADSL Ticket."""
12
11
  return [
13
12
  self._df_landline_number(),
14
13
  ]
15
14
 
16
15
  def _df_landline_number(self):
17
- return DynamicField(name="mantenirFix", value=self.service_data.landline_phone_number)
16
+ return DynamicField(
17
+ name="mantenirFix", value=self.service_data.landline_phone_number
18
+ )
@@ -1,23 +1,27 @@
1
1
  # coding: utf-8
2
2
  from otrs_somconnexio.otrs_models.provision_ticket import ProvisionTicket
3
3
  from otrs_somconnexio.otrs_models.adsl_dynamic_fields import ADSLDynamicFields
4
- from otrs_somconnexio.otrs_models.configurations.adsl_ticket import ADSLTicketConfiguration
4
+ from otrs_somconnexio.otrs_models.configurations.provision.adsl_ticket import (
5
+ ADSLTicketConfiguration,
6
+ )
5
7
 
6
8
 
7
9
  class ADSLTicket(ProvisionTicket):
8
-
9
- def __init__(self, service_data, customer_data, otrs_configuration=None):
10
+ def __init__(
11
+ self, service_data, customer_data, responsible_data, otrs_configuration=None
12
+ ):
13
+ super(ADSLTicket, self).__init__(responsible_data)
10
14
  self.service_data = service_data
11
15
  self.customer_data = customer_data
12
16
  self.otrs_configuration = ADSLTicketConfiguration(otrs_configuration)
13
17
 
14
18
  def service_type(self):
15
- return 'adsl'
19
+ return "adsl"
16
20
 
17
21
  def _build_dynamic_fields(self):
18
22
  return ADSLDynamicFields(
19
23
  self.service_data,
20
24
  self.customer_data,
21
25
  self._ticket_process_id(),
22
- self._ticket_activity_id()
26
+ self._ticket_activity_id(),
23
27
  ).all()
@@ -0,0 +1,13 @@
1
+ class AddDataTicketConfiguration:
2
+ process_id = "Process-7f03577ba04a39dbc9e0fe0d2c6144df"
3
+ activity_id = "Activity-d621f2e21d7583c0dffc7569cd3c9f59"
4
+ queue_id = 105
5
+ subject = "Sol·licitud abonament addicional oficina virtual"
6
+ type = "Petición"
7
+ state = "new"
8
+ priority = "3 normal"
9
+
10
+
11
+ class AddDataTicketRequestedConfiguration(AddDataTicketConfiguration):
12
+ queue_id = 104
13
+ state = "open"
@@ -0,0 +1,16 @@
1
+ class ChangeEmailTicketConfiguration:
2
+ process_id = "Process-b4243866849bc5c0c292f18100fad9d3"
3
+ activity_id = "Activity-8cc76400ded45e7b408f6d3e0267a2c6"
4
+ type = "Petición"
5
+ state = "new"
6
+ priority = "3 normal"
7
+
8
+
9
+ class ChangeEmailContractsConfiguration(ChangeEmailTicketConfiguration):
10
+ queue_id = 174
11
+ subject = "Sol·licitud canvi de email oficina virtual"
12
+
13
+
14
+ class ChangeEmailPersonalConfiguration(ChangeEmailTicketConfiguration):
15
+ queue_id = 178
16
+ subject = "Canvi d'email dades personals OV"
@@ -0,0 +1,8 @@
1
+ class ChangeIbanTicketConfiguration:
2
+ process_id = "Process-76f712cb8936190743ace3a886b3d167"
3
+ activity_id = "Activity-621e28c842e6556964d4a6ce04286235"
4
+ queue_id = 170
5
+ subject = "Sol·licitud canvi de IBAN oficina virtual"
6
+ type = "Petición"
7
+ state = "new"
8
+ priority = "3 normal"
@@ -0,0 +1,19 @@
1
+ class ChangeOwnerConfiguration:
2
+ process_id = "Process-975190079a628ddf1eb4f0188dce2e4a"
3
+ type = "Petición"
4
+ state = "new"
5
+ priority = "3 normal"
6
+ subject = "Sol·licitud canvi de titular oficina virtual"
7
+ body = "Adjunta documentació titular actual"
8
+ update_subject = "Resposta sol·licitud de canvi de titular oficina virtual"
9
+ update_body = "Adjunta documentació nou titular"
10
+
11
+
12
+ class ChangeOwnerTicketConfiguration(ChangeOwnerConfiguration):
13
+ queue_id = 236
14
+ activity_id = "Activity-12c832820da79b425874b2bdf05fa512"
15
+
16
+
17
+ class ChangeOwnerPackTicketConfiguration(ChangeOwnerConfiguration):
18
+ queue_id = 237
19
+ activity_id = "Activity-0dc37160064a0aeccae2a0393cda1189"
@@ -0,0 +1,6 @@
1
+ class ChangePackNotSharedDataTicketConfiguration:
2
+ process_id = "Process-4112fd4fbd7f4f384947621ae36ae74f"
3
+ activity_id = "Activity-1a175e9802e4ec5784aa6948c3fd4080"
4
+ queue_id = 249
5
+ subject = "Canvi paquet F600 a F300"
6
+ service = "Oficina Virtual"
@@ -0,0 +1,7 @@
1
+ class ChangeSharedBondTicketConfiguration:
2
+ process_id = "Process-304d80eb0f377a484aae9ef23c6c5b74"
3
+ activity_id = "Activity-2a3858fe1d17a3777858ed273eb549f0"
4
+ type = "Petición"
5
+ queue_id = 225
6
+ state = "new"
7
+ priority = "3 normal"
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ class ChangeTariffTicketConfiguration:
3
+ process_id = "Process-f91240baa6e0146aecc70a9c97d6f84f"
4
+ activity_id = "Activity-7117b19116339f88dc43767cd477f2be"
5
+ type = "Petición"
6
+ queue_id = 97
7
+ state = "new"
8
+ priority = "3 normal"
9
+
10
+ def __init__(self, otrs_configuration=None):
11
+ if otrs_configuration:
12
+ self.process_id = otrs_configuration.mobile_process_id
13
+ self.activity_id = otrs_configuration.mobile_activity_id
14
+ self.type = otrs_configuration.mobile_ticket_type
15
+ self.queue_id = otrs_configuration.mobile_ticket_queue_id
16
+ self.state = otrs_configuration.mobile_ticket_state
17
+ # We need to mantain this typo because is in a Tryton model field.
18
+ self.priority = otrs_configuration.mobile_ticket_priority
19
+
20
+
21
+ class ChangeTariffExceptionalTicketConfiguration(ChangeTariffTicketConfiguration):
22
+ process_id = "Process-68cb2bbbfeaf511c76285ff1ee35166b"
23
+ activity_id = "Activity-24e02ae12857239254b4c1d1e76acbba"
24
+ queue_id = 187
25
+
26
+
27
+ class ChangeTariffSharedBondTicketConfiguration(ChangeTariffTicketConfiguration):
28
+ queue_id = 201
29
+ activity_id = "Activity-0fa4168fb49ea8be15e7270d6ba2d1c3"
@@ -0,0 +1,20 @@
1
+ class ChangeTariffAdslConfiguration:
2
+ type = "Petición"
3
+ state = "new"
4
+ priority = "3 normal"
5
+
6
+
7
+ class ChangeTariffTicketAdslOutLandlineConfig(ChangeTariffAdslConfiguration):
8
+ process_id = "Process-75757fe8d1526118bf0a723fde97b217"
9
+ activity_id = "Activity-4c41ac0caaa3601dff977822b7b83299"
10
+ queue_id = 165
11
+ subject = "OV Sol·licitud CT A SF/F SF"
12
+ code_fiber = "SE_SC_REC_BA_F_300_SF"
13
+
14
+
15
+ class ChangeTariffTicketAdslLandlineConfig(ChangeTariffAdslConfiguration):
16
+ process_id = "Process-5684ebe48aa930b2890e3ae0febc483d"
17
+ activity_id = "Activity-6d1a466b85f7278eda75c4fec4e6ecfe"
18
+ queue_id = 192
19
+ subject = "OV Sol·licitud CT A F/F F"
20
+ code_fiber = "SE_SC_REC_BA_F_300"
@@ -0,0 +1,11 @@
1
+ class ChangeTariffTicketFiberConfiguration:
2
+ process_id = "Process-a7b08ec0f281167899a5b72c8bd0899d"
3
+ activity_id = "Activity-ea6172a702d09d7cbe8c2b44de9a9853"
4
+ queue_id = 157
5
+ type = "Petición"
6
+ state = "new"
7
+ priority = "3 normal"
8
+ subject = "Sol·licitud Canvi de tarifa sense fix oficina virtual"
9
+ code_fiber_100_landline = "SE_SC_REC_BA_F_100"
10
+ code_fiber_100 = "SE_SC_REC_BA_F_100_SF"
11
+ code_fiber_300 = "SE_SC_REC_BA_F_300_SF"
@@ -3,7 +3,7 @@ class ADSLTicketConfiguration:
3
3
  process_id = "Process-441820b536cb5b9899d12f729e6f5e97"
4
4
  activity_id = "Activity-6036295f5d5035663dd7817ab69fdedd"
5
5
  type = "Sin Clasificar"
6
- queue = "Serveis de banda ampla::Provisió ADSL"
6
+ queue_id = 17
7
7
  state = "new"
8
8
  priority = "3 normal"
9
9
 
@@ -12,7 +12,7 @@ class ADSLTicketConfiguration:
12
12
  self.process_id = otrs_configuration.adsl_process_id
13
13
  self.activity_id = otrs_configuration.adsl_activity_id
14
14
  self.type = otrs_configuration.adsl_ticket_type
15
- self.queue = otrs_configuration.adsl_ticket_queue
15
+ self.queue_id = otrs_configuration.adsl_ticket_queue_id
16
16
  self.state = otrs_configuration.adsl_ticket_state
17
17
  # We need to mantain this typo because is in a Tryton model field.
18
18
  self.priority = otrs_configuration.adsl_ticket_proprity
@@ -2,17 +2,20 @@
2
2
  class FiberTicketConfiguration:
3
3
  process_id = "Process-2a8a97fe837ce3c1906f524decb6fa6d"
4
4
  activity_id = "Activity-862a6517cdbf72be58b0b1b3a9e42f98"
5
- type = "Sin Clasificar"
6
- queue = "Serveis de banda ampla::Provisió Fibra"
5
+ type = "Petición"
6
+ SLA = "No pendent resposta"
7
+ service = "Banda Ancha::Fibra::Provisió Fibra"
8
+ queue_id = 31
7
9
  state = "new"
8
10
  priority = "3 normal"
9
11
 
10
12
  def __init__(self, otrs_configuration=None):
13
+ # Deprecated - Only used with Tryton
11
14
  if otrs_configuration:
12
15
  self.process_id = otrs_configuration.fiber_process_id
13
16
  self.activity_id = otrs_configuration.fiber_activity_id
14
17
  self.type = otrs_configuration.fiber_ticket_type
15
- self.queue = otrs_configuration.fiber_ticket_queue
18
+ self.queue_id = otrs_configuration.fiber_ticket_queue_id
16
19
  self.state = otrs_configuration.fiber_ticket_state
17
20
  # We need to mantain this typo because is in a Tryton model field.
18
21
  self.priority = otrs_configuration.fiber_ticket_proprity
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+ class MobileTicketConfiguration:
3
+ process_id = "Process-325351399237c1e69144b17e471b1b51"
4
+ activity_id = "Activity-90f09a366cd9426695ef0e21faeb4ed2"
5
+ type = "Petición"
6
+ queue_id = 71
7
+ state = "new"
8
+ SLA = "No pendent resposta"
9
+ service = "Mòbil"
10
+ priority = "3 normal"
11
+
12
+ def __init__(self, otrs_configuration=None):
13
+ if otrs_configuration:
14
+ self.process_id = otrs_configuration.mobile_process_id
15
+ self.activity_id = otrs_configuration.mobile_activity_id
16
+ self.type = otrs_configuration.mobile_ticket_type
17
+ self.queue_id = otrs_configuration.mobile_ticket_queue_id
18
+ self.state = otrs_configuration.mobile_ticket_state
19
+ self.priority = otrs_configuration.mobile_ticket_priority
20
+
21
+
22
+ class MobileTicketPausedConfiguration(MobileTicketConfiguration):
23
+ activity_id = "Activity-ad31188b18cac0d1af222360fce65757"
24
+ queue_id = 197
25
+
26
+
27
+ class MobileTicketCompletedConfiguration(MobileTicketConfiguration):
28
+ activity_id = "Activity-32e86e86b387b7311a6258b783f16a29"
29
+ queue_id = 198
30
+
31
+
32
+ class MobileTicketRequestedConfiguration(MobileTicketConfiguration):
33
+ activity_id = "Activity-19187651eb9900b7c239d6b168c0b6f3"
34
+ queue_id = 72
35
+
36
+
37
+ class MobileTicketPlatformIntroducedConfiguration(MobileTicketConfiguration):
38
+ activity_id = "Activity-87200fa0f40f91ebd8a36ad2d1ed45c2"
39
+ queue_id = 75
40
+
41
+
42
+ class MobileTicketActivationScheduledConfiguration(MobileTicketConfiguration):
43
+ activity_id = "Activity-31525744004897d761133c9bee9ef6d9"
44
+ queue_id = 73