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.
- otrs_somconnexio/client.py +110 -42
- otrs_somconnexio/exceptions.py +44 -11
- otrs_somconnexio/otrs_models/abstract_article.py +3 -0
- otrs_somconnexio/otrs_models/adsl_data.py +7 -37
- otrs_somconnexio/otrs_models/adsl_dynamic_fields.py +5 -4
- otrs_somconnexio/otrs_models/adsl_ticket.py +9 -5
- otrs_somconnexio/otrs_models/configurations/changes/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/changes/add_data.py +13 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_email.py +16 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_iban.py +8 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_owner.py +19 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_pack.py +6 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_shared_bond.py +7 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff.py +29 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff_adsl.py +20 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff_fiber.py +11 -0
- otrs_somconnexio/otrs_models/configurations/provision/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/{adsl_ticket.py → provision/adsl_ticket.py} +2 -2
- otrs_somconnexio/otrs_models/configurations/{fiber_ticket.py → provision/fiber_ticket.py} +6 -3
- otrs_somconnexio/otrs_models/configurations/provision/mobile_ticket.py +44 -0
- otrs_somconnexio/otrs_models/configurations/provision/router_4G_ticket.py +8 -0
- otrs_somconnexio/otrs_models/configurations/provision/switchboard_ticket.py +10 -0
- otrs_somconnexio/otrs_models/configurations/querys/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/querys/check_coverage.py +16 -0
- otrs_somconnexio/otrs_models/configurations/querys/we_call_you.py +26 -0
- otrs_somconnexio/otrs_models/coverage/adsl.py +1 -1
- otrs_somconnexio/otrs_models/coverage/asociatel_fiber.py +6 -0
- otrs_somconnexio/otrs_models/coverage/mm_fiber.py +7 -0
- otrs_somconnexio/otrs_models/coverage/orange_fiber.py +5 -0
- otrs_somconnexio/otrs_models/coverage/vdf_fiber.py +8 -0
- otrs_somconnexio/otrs_models/coverage_article.py +20 -4
- otrs_somconnexio/otrs_models/coverage_ticket.py +1 -0
- otrs_somconnexio/otrs_models/customer_data.py +15 -3
- otrs_somconnexio/otrs_models/customer_user.py +3 -9
- otrs_somconnexio/otrs_models/fiber_data.py +17 -33
- otrs_somconnexio/otrs_models/fiber_dynamic_fields.py +58 -4
- otrs_somconnexio/otrs_models/fiber_ticket.py +9 -5
- otrs_somconnexio/otrs_models/internet_data.py +79 -0
- otrs_somconnexio/otrs_models/internet_dynamic_fields.py +65 -26
- otrs_somconnexio/otrs_models/mobile_data.py +49 -5
- otrs_somconnexio/otrs_models/mobile_dynamic_fields.py +50 -8
- otrs_somconnexio/otrs_models/mobile_ticket.py +20 -4
- otrs_somconnexio/otrs_models/process_ticket/internet.py +40 -97
- otrs_somconnexio/otrs_models/process_ticket/mobile.py +63 -43
- otrs_somconnexio/otrs_models/process_ticket/process_ticket.py +74 -0
- otrs_somconnexio/otrs_models/providers.py +4 -3
- otrs_somconnexio/otrs_models/provision_article.py +7 -5
- otrs_somconnexio/otrs_models/provision_dynamic_fields.py +76 -11
- otrs_somconnexio/otrs_models/provision_ticket.py +52 -28
- otrs_somconnexio/otrs_models/responsible_data.py +6 -0
- otrs_somconnexio/otrs_models/router_4G_data.py +8 -0
- otrs_somconnexio/otrs_models/router_4G_dynamic_fields.py +9 -0
- otrs_somconnexio/otrs_models/router_4G_ticket.py +26 -0
- otrs_somconnexio/otrs_models/service.py +41 -12
- otrs_somconnexio/otrs_models/switchboard_data.py +58 -0
- otrs_somconnexio/otrs_models/switchboard_dynamic_fields.py +94 -0
- otrs_somconnexio/otrs_models/switchboard_header_data.py +18 -0
- otrs_somconnexio/otrs_models/switchboard_header_dynamic_fields.py +80 -0
- otrs_somconnexio/otrs_models/switchboard_header_ticket.py +30 -0
- otrs_somconnexio/otrs_models/switchboard_ticket.py +35 -0
- otrs_somconnexio/otrs_models/telecom_company.py +69 -69
- otrs_somconnexio/otrs_models/ticket_factory.py +34 -11
- otrs_somconnexio/otrs_models/ticket_types/__init__.py +0 -0
- otrs_somconnexio/otrs_models/ticket_types/add_data_ticket.py +36 -0
- otrs_somconnexio/otrs_models/ticket_types/base_change_tariff_ba_ticket.py +23 -0
- otrs_somconnexio/otrs_models/ticket_types/base_change_ticket.py +33 -0
- otrs_somconnexio/otrs_models/ticket_types/base_customer_ticket.py +24 -0
- otrs_somconnexio/otrs_models/ticket_types/base_ticket.py +147 -0
- otrs_somconnexio/otrs_models/ticket_types/change_email_ticket.py +40 -0
- otrs_somconnexio/otrs_models/ticket_types/change_iban_ticket.py +39 -0
- otrs_somconnexio/otrs_models/ticket_types/change_owner_ticket.py +132 -0
- otrs_somconnexio/otrs_models/ticket_types/change_pack_not_shared_data.py +36 -0
- otrs_somconnexio/otrs_models/ticket_types/change_personal_email_ticket.py +31 -0
- otrs_somconnexio/otrs_models/ticket_types/change_shared_bond_ticket.py +35 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_landline_ticket.py +30 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_out_landline_ticket.py +30 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_ticket.py +42 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_fiber_ticket.py +43 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket.py +87 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_mobile_pack.py +51 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_shared_bonds.py +22 -0
- otrs_somconnexio/otrs_models/ticket_types/check_coverage_ticket.py +52 -0
- otrs_somconnexio/otrs_models/ticket_types/we_call_you_ticket.py +53 -0
- otrs_somconnexio/otrs_models/vf_provisioning_article.py +4 -2
- otrs_somconnexio/responses/ticket_creation.py +5 -4
- otrs_somconnexio/services/activate_change_tarriff_mobile_tickets.py +13 -0
- otrs_somconnexio/services/base_get_ticket_by_number.py +22 -0
- otrs_somconnexio/services/change_to_confirm_ticket.py +45 -0
- otrs_somconnexio/services/get_mobile_related_tickets.py +11 -0
- otrs_somconnexio/services/get_sharing_data_mobile_tickets.py +65 -0
- otrs_somconnexio/services/get_ticket_title.py +26 -0
- otrs_somconnexio/services/mapping_mobile_minutes.py +5 -5
- otrs_somconnexio/services/mapping_services.py +8 -6
- otrs_somconnexio/services/move_sharing_data_mobile_tickets.py +13 -0
- otrs_somconnexio/services/search_tickets_mobile_change_tariff.py +25 -0
- otrs_somconnexio/services/search_tickets_service.py +57 -0
- otrs_somconnexio/services/set_SIM_recieved_mobile_ticket.py +107 -0
- otrs_somconnexio/services/set_SIM_returned_mobile_ticket.py +37 -0
- otrs_somconnexio/services/set_fiber_contract_code_mobile_ticket.py +21 -0
- otrs_somconnexio/services/unblock_mobile_pack_ticket.py +48 -0
- otrs_somconnexio/services/update_process_ticket_with_coverage_tickets_info_service.py +10 -10
- otrs_somconnexio/services/update_ticket_DF.py +18 -0
- otrs_somconnexio/services/update_ticket_with_provider_info.py +2 -3
- otrs_somconnexio/user_management_client/client.py +15 -27
- otrs_somconnexio/user_management_client/user_management_response.py +2 -3
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/METADATA +19 -4
- otrs_somconnexio-0.7.3.dist-info/RECORD +202 -0
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/WHEEL +1 -1
- tests/data/otrs_raw_responses.py +12 -6
- tests/integration/test_change_customer_language.py +14 -19
- tests/integration/test_ticket_factory.py +383 -106
- tests/integration/test_update_ticket_with_coverage_data.py +53 -27
- tests/otrs_models/common_helper.py +9 -0
- tests/otrs_models/configuration/changes/__init__.py +0 -0
- tests/otrs_models/configuration/changes/test_change_tariff_ticket.py +91 -0
- tests/otrs_models/configuration/provision/__init__.py +0 -0
- tests/otrs_models/configuration/provision/test_adsl_ticket.py +30 -0
- tests/otrs_models/configuration/provision/test_fiber_ticket.py +32 -0
- tests/otrs_models/configuration/provision/test_mobile_ticket.py +62 -0
- tests/otrs_models/process_ticket/test_internet_process_ticket.py +54 -60
- tests/otrs_models/process_ticket/test_mobile_process_ticket.py +56 -33
- tests/otrs_models/test_abstract_article.py +3 -2
- tests/otrs_models/test_adsl_data.py +11 -4
- tests/otrs_models/test_adsl_dynamic_fields.py +217 -100
- tests/otrs_models/test_adsl_ticket.py +78 -83
- tests/otrs_models/test_coverage_article.py +9 -7
- tests/otrs_models/test_coverage_ticket.py +4 -2
- tests/otrs_models/test_customer_user.py +23 -20
- tests/otrs_models/test_fiber_data.py +20 -4
- tests/otrs_models/test_fiber_dynamic_fields.py +458 -134
- tests/otrs_models/test_fiber_ticket.py +113 -79
- tests/otrs_models/test_mobile_data.py +14 -3
- tests/otrs_models/test_mobile_dynamic_fields.py +335 -74
- tests/otrs_models/test_mobile_paused_ticket.py +35 -0
- tests/otrs_models/test_mobile_ticket.py +82 -96
- tests/otrs_models/test_provision_article.py +49 -0
- tests/otrs_models/test_router_4G_data.py +43 -0
- tests/otrs_models/test_router_4G_dynamic_fields.py +619 -0
- tests/otrs_models/test_router_4G_ticket.py +135 -0
- tests/otrs_models/test_service.py +58 -14
- tests/otrs_models/test_switchboard_data.py +37 -0
- tests/otrs_models/test_switchboard_dynamic_fields.py +197 -0
- tests/otrs_models/test_switchboard_header_data.py +18 -0
- tests/otrs_models/test_switchboard_header_dynamic_fields.py +119 -0
- tests/otrs_models/test_switchboard_header_ticket.py +127 -0
- tests/otrs_models/test_switchboard_ticket.py +147 -0
- tests/otrs_models/test_telecom_company.py +16 -16
- tests/otrs_models/test_ticket_factory.py +73 -16
- tests/otrs_models/test_vf_provisioning_article.py +6 -5
- tests/otrs_models/ticket_types/__init__.py +0 -0
- tests/otrs_models/ticket_types/test_add_data.py +79 -0
- tests/otrs_models/ticket_types/test_change_email.py +163 -0
- tests/otrs_models/ticket_types/test_change_iban.py +82 -0
- tests/otrs_models/ticket_types/test_change_owner.py +277 -0
- tests/otrs_models/ticket_types/test_change_pack_not_shared_data.py +77 -0
- tests/otrs_models/ticket_types/test_change_personal_email.py +81 -0
- tests/otrs_models/ticket_types/test_change_tariff.py +435 -0
- tests/otrs_models/ticket_types/test_change_tariff_adsl_landline.py +115 -0
- tests/otrs_models/ticket_types/test_change_tariff_adsl_out_landline.py +115 -0
- tests/otrs_models/ticket_types/test_change_tariff_fiber.py +175 -0
- tests/otrs_models/ticket_types/test_change_tariff_mobile_pack.py +151 -0
- tests/otrs_models/ticket_types/test_change_tariff_shared_bonds.py +65 -0
- tests/otrs_models/ticket_types/test_check_coverage.py +106 -0
- tests/otrs_models/ticket_types/test_shared_bond.py +80 -0
- tests/otrs_models/ticket_types/test_we_call_you.py +108 -0
- tests/responses/test_ticket_creation.py +4 -4
- tests/services/test_activate_change_tariff_mobile_tickets.py +45 -0
- tests/services/test_change_to_confirm_ticket.py +80 -0
- tests/services/test_get_mobile_related_tickets.py +39 -0
- tests/services/test_get_sharing_data_mobile_tickets.py +127 -0
- tests/services/test_mapping_mobile_minutes.py +8 -8
- tests/services/{test_mappint_services.py → test_mapping_services.py} +9 -9
- tests/services/test_move_sharing_data_mobile_tickets.py +43 -0
- tests/services/test_search_tickets_mobile_change_tariff.py +84 -0
- tests/services/test_search_tickets_service.py +166 -0
- tests/services/test_set_SIM_recieved_mobile_ticket_service.py +211 -0
- tests/services/test_set_SIM_returned_mobile_ticket_service.py +59 -0
- tests/services/test_set_fiber_contract_code_mobile_ticket_service.py +47 -0
- tests/services/test_unblock_mobile_pack_ticket.py +224 -0
- tests/services/test_update_process_ticket_with_VF_provisioning.py +15 -14
- tests/services/test_update_process_ticket_with_coverage_tickets_info_service.py +22 -10
- tests/services/test_update_ticket_with_provider_info.py +16 -15
- tests/user_management_client/test_client.py +41 -58
- tests/user_management_client/test_user_management_response.py +13 -26
- otrs_somconnexio/otrs_models/configurations/mobile_ticket.py +0 -17
- otrs_somconnexio/otrs_models/coverage/mm_fibre.py +0 -7
- otrs_somconnexio/otrs_models/coverage/vdf_fibre.py +0 -8
- otrs_somconnexio-0.4.4.dist-info/RECORD +0 -95
- tests/otrs_models/configuration/test_adsl_ticket.py +0 -45
- tests/otrs_models/configuration/test_fiber_ticket.py +0 -45
- tests/otrs_models/configuration/test_mobile_ticket.py +0 -45
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class OTRSCreationTicketResponse
|
|
1
|
+
class OTRSCreationTicketResponse:
|
|
2
2
|
"""
|
|
3
3
|
This class is to map in object interface the response of Ticket creation call to the OTRS web
|
|
4
4
|
service using the library PyOTRS.
|
|
@@ -6,18 +6,19 @@ class OTRSCreationTicketResponse():
|
|
|
6
6
|
Dict returned:
|
|
7
7
|
{'TicketNumber': '2018121900000025', 'TicketID': '1135', 'ArticleID': '3200'}
|
|
8
8
|
"""
|
|
9
|
+
|
|
9
10
|
def __init__(self, otrs_response):
|
|
10
11
|
self.response = otrs_response
|
|
11
12
|
|
|
12
13
|
@property
|
|
13
14
|
def id(self):
|
|
14
|
-
return self.response.get(
|
|
15
|
+
return self.response.get("TicketID")
|
|
15
16
|
|
|
16
17
|
@property
|
|
17
18
|
def number(self):
|
|
18
|
-
return self.response.get(
|
|
19
|
+
return self.response.get("TicketNumber")
|
|
19
20
|
|
|
20
21
|
# Unused property.
|
|
21
22
|
@property
|
|
22
23
|
def article_id(self):
|
|
23
|
-
return self.response.get(
|
|
24
|
+
return self.response.get("ArticleID")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from .update_ticket_DF import UpdateTicketDF
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ActivateChangeTariffMobileTickets(UpdateTicketDF):
|
|
8
|
+
"""
|
|
9
|
+
Set DF enviaraMM to OTRS mobile tickets.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def _prepare_dynamic_fields(self):
|
|
13
|
+
return [DynamicField(name="enviatMMOV", value=1)]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from otrs_somconnexio.client import OTRSClient
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class BaseGetTicketByNumber:
|
|
6
|
+
""" """
|
|
7
|
+
|
|
8
|
+
def __init__(self, ticket_number):
|
|
9
|
+
self.ticket_number = ticket_number
|
|
10
|
+
self.ticket = None
|
|
11
|
+
self.otrs_client = None
|
|
12
|
+
|
|
13
|
+
def _get_ticket(self):
|
|
14
|
+
if not self.otrs_client:
|
|
15
|
+
self.otrs_client = OTRSClient()
|
|
16
|
+
if not self.ticket:
|
|
17
|
+
self.ticket = self.otrs_client.get_ticket_by_number(
|
|
18
|
+
self.ticket_number, dynamic_fields=True
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def run(self):
|
|
22
|
+
self._get_ticket()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from otrs_somconnexio.otrs_models.ticket_types.base_change_ticket import (
|
|
2
|
+
BaseChangeTicket,
|
|
3
|
+
)
|
|
4
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_email import (
|
|
5
|
+
ChangeEmailContractsConfiguration,
|
|
6
|
+
ChangeEmailPersonalConfiguration,
|
|
7
|
+
)
|
|
8
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_iban import (
|
|
9
|
+
ChangeIbanTicketConfiguration,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ChangeToConfirmTicket(BaseChangeTicket):
|
|
14
|
+
"""
|
|
15
|
+
Set DF enviatOdooOV to True to OTRS change email/iban tickets.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
QUEUES_IDS_TO_APPLIE_CHANGE = [
|
|
19
|
+
ChangeIbanTicketConfiguration.queue_id,
|
|
20
|
+
ChangeEmailContractsConfiguration.queue_id,
|
|
21
|
+
ChangeEmailPersonalConfiguration.queue_id,
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
def __init__(self):
|
|
25
|
+
super(ChangeToConfirmTicket, self).__init__(
|
|
26
|
+
username=None, customer_code=None, fields_dict=None
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def confirm(self, token):
|
|
30
|
+
ticket = self.get_by_IDOV(token)
|
|
31
|
+
if ticket.field_get("QueueID") in self.QUEUES_IDS_TO_APPLIE_CHANGE:
|
|
32
|
+
self.update(
|
|
33
|
+
ticket.field_get("TicketID"),
|
|
34
|
+
)
|
|
35
|
+
else:
|
|
36
|
+
raise Exception(
|
|
37
|
+
"""
|
|
38
|
+
Change confirmed for ticket in unexpected queue.
|
|
39
|
+
- Ticket ID: {ticket_id}
|
|
40
|
+
- QueueID: {queue_id}
|
|
41
|
+
""".format(
|
|
42
|
+
ticket_id=ticket.field_get("TicketID"),
|
|
43
|
+
queue_id=ticket.field_get("QueueID"),
|
|
44
|
+
)
|
|
45
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from otrs_somconnexio.services.base_get_ticket_by_number import BaseGetTicketByNumber
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class GetMobileRelatedTickets(BaseGetTicketByNumber):
|
|
5
|
+
def __init__(self, ticket_number, link_type="Normal"):
|
|
6
|
+
super().__init__(ticket_number)
|
|
7
|
+
self.link_type = link_type
|
|
8
|
+
|
|
9
|
+
def run(self):
|
|
10
|
+
super().run()
|
|
11
|
+
return self.otrs_client.get_linked_tickets(self.ticket.tid, self.link_type)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from ..otrs_models.configurations.provision.mobile_ticket import (
|
|
2
|
+
MobileTicketPlatformIntroducedConfiguration as PIConf,
|
|
3
|
+
MobileTicketActivationScheduledConfiguration as ASConf,
|
|
4
|
+
)
|
|
5
|
+
from ..client import OTRSClient
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GetSharingDataMobileTickets:
|
|
9
|
+
def __init__(self, ticket_id):
|
|
10
|
+
self.ticket_id = ticket_id
|
|
11
|
+
self.otrs_client = OTRSClient()
|
|
12
|
+
|
|
13
|
+
def run(self):
|
|
14
|
+
linked_tickets = [
|
|
15
|
+
t
|
|
16
|
+
for t in self.otrs_client.get_linked_tickets(self.ticket_id, "Normal")
|
|
17
|
+
if t.state in ["new", "open"]
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
if not linked_tickets:
|
|
21
|
+
return {}
|
|
22
|
+
|
|
23
|
+
ticket_dict = {"provisioned": [], "ready": [], "unready": []}
|
|
24
|
+
|
|
25
|
+
for t in linked_tickets:
|
|
26
|
+
if t.queue_id == PIConf.queue_id:
|
|
27
|
+
ticket_dict["provisioned"].append(t)
|
|
28
|
+
elif t.queue_id == ASConf.queue_id:
|
|
29
|
+
ticket_dict["ready"].append(t)
|
|
30
|
+
else:
|
|
31
|
+
ticket_dict["unready"].append(t)
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
"shared_bond_id": self._get_shared_bond_id(ticket_dict["provisioned"]),
|
|
35
|
+
"ready_mobile_tickets": [
|
|
36
|
+
self._extract_ticket_data(ticket) for ticket in ticket_dict["ready"]
|
|
37
|
+
],
|
|
38
|
+
"unready_mobile_tickets": [
|
|
39
|
+
self._extract_ticket_data(ticket) for ticket in ticket_dict["unready"]
|
|
40
|
+
],
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def _get_shared_bond_id(self, provisioned_tickets):
|
|
44
|
+
shared_bond_ids = set(
|
|
45
|
+
t.shared_bond_id for t in provisioned_tickets if t.shared_bond_id
|
|
46
|
+
)
|
|
47
|
+
return list(shared_bond_ids)
|
|
48
|
+
|
|
49
|
+
def _extract_ticket_data(self, ticket):
|
|
50
|
+
return {
|
|
51
|
+
"ticket_id": ticket.id,
|
|
52
|
+
"ticket_number": ticket.number,
|
|
53
|
+
"mobile_service_type": ticket.service_type,
|
|
54
|
+
"phone_number": ticket.msisdn,
|
|
55
|
+
"product_code": ticket.product_code,
|
|
56
|
+
"international_minutes": ticket.international_minutes,
|
|
57
|
+
"fiber_contract_code": ticket.fiber_contract_code,
|
|
58
|
+
"ICC_SC": ticket.icc,
|
|
59
|
+
"donor_ICC": ticket.donor_icc,
|
|
60
|
+
"donor_operator": ticket.previous_provider,
|
|
61
|
+
"docid": ticket.previous_owner_docid,
|
|
62
|
+
"name": ticket.previous_owner_name,
|
|
63
|
+
"surname": ticket.previous_owner_surname,
|
|
64
|
+
"activation_date": ticket.activation_date,
|
|
65
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class GetTicketTitle:
|
|
2
|
+
service_type_trans_dict = {
|
|
3
|
+
"fiber": "fibra",
|
|
4
|
+
"mobile": "mòbil",
|
|
5
|
+
"adsl": "ADSL",
|
|
6
|
+
"4G": "4G",
|
|
7
|
+
"switchboard": "Centraleta Virtual",
|
|
8
|
+
"switchboard_header": "Centraleta Virtual Capçalera",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
def __init__(self, technology, order_id, service_type):
|
|
12
|
+
self.technology = technology
|
|
13
|
+
self.order_id = order_id
|
|
14
|
+
self.service_type = service_type
|
|
15
|
+
|
|
16
|
+
def build(self):
|
|
17
|
+
if self.technology != "Mixta":
|
|
18
|
+
title = "Ticket#{} - Només {}".format(
|
|
19
|
+
self.order_id, self.service_type_trans_dict[self.service_type]
|
|
20
|
+
)
|
|
21
|
+
else:
|
|
22
|
+
title = "Ticket#{} - {} mixta".format(
|
|
23
|
+
self.order_id,
|
|
24
|
+
self.service_type_trans_dict[self.service_type].capitalize(),
|
|
25
|
+
)
|
|
26
|
+
return title
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class ServiceMappingMobileMinutes
|
|
1
|
+
class ServiceMappingMobileMinutes:
|
|
2
2
|
SERVICES = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"0min": "0",
|
|
4
|
+
"100min": "100",
|
|
5
|
+
"200min": "200",
|
|
6
|
+
"unlim": "unlimited",
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@classmethod
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
class ServiceMappingServices
|
|
1
|
+
class ServiceMappingServices:
|
|
2
2
|
SERVICES = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
"Mobil": "mobile",
|
|
4
|
+
"Fibra": "fiber",
|
|
5
|
+
"ADSL": "adsl",
|
|
6
|
+
"ADSL+100min": "adsl100",
|
|
7
|
+
"ADSL+1000min": "adsl1000",
|
|
8
|
+
"4G": "4g",
|
|
9
|
+
"Mixta": "mixta",
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
@classmethod
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from .update_ticket_DF import UpdateTicketDF
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MoveSharingDataMobileTickets(UpdateTicketDF):
|
|
8
|
+
"""
|
|
9
|
+
Set DF compartidesEnProvisio to OTRS mobile tickets.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def _prepare_dynamic_fields(self):
|
|
13
|
+
return [DynamicField(name="compartidesEnProvisio", value=1)]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_tariff import (
|
|
2
|
+
ChangeTariffSharedBondTicketConfiguration,
|
|
3
|
+
ChangeTariffTicketConfiguration,
|
|
4
|
+
)
|
|
5
|
+
from otrs_somconnexio.services.search_tickets_service import SearchTicketsService
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SearchMobileChangeTariff:
|
|
9
|
+
def __init__(self, customer_code):
|
|
10
|
+
self.search_types = [
|
|
11
|
+
ChangeTariffTicketConfiguration,
|
|
12
|
+
ChangeTariffSharedBondTicketConfiguration,
|
|
13
|
+
]
|
|
14
|
+
self.search_states = [
|
|
15
|
+
ChangeTariffTicketConfiguration.state,
|
|
16
|
+
ChangeTariffSharedBondTicketConfiguration.state,
|
|
17
|
+
]
|
|
18
|
+
self.customer_code = customer_code
|
|
19
|
+
|
|
20
|
+
def search(self, df_dct, extra_states=[]):
|
|
21
|
+
states = sorted(list(set(self.search_states + extra_states)))
|
|
22
|
+
tickets_found = SearchTicketsService(self.search_types).search(
|
|
23
|
+
self.customer_code, states, df_dct
|
|
24
|
+
)
|
|
25
|
+
return tickets_found
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from otrs_somconnexio.client import OTRSClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SearchTicketsService:
|
|
8
|
+
"""
|
|
9
|
+
Search by queueId, partner, states and DF OTRS tickets.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, configuration_class):
|
|
13
|
+
"""
|
|
14
|
+
configuration_class: Any ticket configuration class from 'otrs-models/configurations'
|
|
15
|
+
folder in this package
|
|
16
|
+
"""
|
|
17
|
+
self.configurations = configuration_class
|
|
18
|
+
|
|
19
|
+
if not isinstance(configuration_class, list):
|
|
20
|
+
self.configurations = [configuration_class]
|
|
21
|
+
else:
|
|
22
|
+
self.configurations = configuration_class
|
|
23
|
+
|
|
24
|
+
def search(self, customer_code=None, state_list=["new"], df_dct={}):
|
|
25
|
+
"""
|
|
26
|
+
customer_code (str): filter tickets by their customer
|
|
27
|
+
df_dct (dict): key, value as list of DF with which we must search
|
|
28
|
+
If value is a list of values, the method will return any match
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
state_list = [state for state in state_list]
|
|
32
|
+
|
|
33
|
+
otrs_client = OTRSClient()
|
|
34
|
+
|
|
35
|
+
process_id_df = DynamicField(
|
|
36
|
+
"ProcessManagementProcessID",
|
|
37
|
+
search_patterns=list(map(lambda c: c.process_id, self.configurations)),
|
|
38
|
+
)
|
|
39
|
+
activity_id_df = DynamicField(
|
|
40
|
+
"ProcessManagementActivityID",
|
|
41
|
+
search_patterns=list(map(lambda c: c.activity_id, self.configurations)),
|
|
42
|
+
)
|
|
43
|
+
df_list = [process_id_df, activity_id_df]
|
|
44
|
+
|
|
45
|
+
for key, value in df_dct.items():
|
|
46
|
+
df_list.append(DynamicField(key, search_patterns=list(value)))
|
|
47
|
+
|
|
48
|
+
search_args = {
|
|
49
|
+
"dynamic_fields": df_list,
|
|
50
|
+
"QueueIDs": list(map(lambda c: c.queue_id, self.configurations)),
|
|
51
|
+
"States": state_list,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if customer_code:
|
|
55
|
+
search_args["CustomerID"] = customer_code
|
|
56
|
+
|
|
57
|
+
return otrs_client.search_tickets(**search_args)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from datetime import date, timedelta
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
from pyotrs.lib import DynamicField
|
|
6
|
+
|
|
7
|
+
from otrs_somconnexio.exceptions import TicketNotReadyToBeUpdatedWithSIMReceivedData
|
|
8
|
+
from otrs_somconnexio.otrs_models.process_ticket.mobile import MobileProcessTicket
|
|
9
|
+
from otrs_somconnexio.services.update_ticket_DF import UpdateTicketDF
|
|
10
|
+
from otrs_somconnexio.otrs_models.configurations.provision.mobile_ticket import (
|
|
11
|
+
MobileTicketConfiguration,
|
|
12
|
+
MobileTicketPausedConfiguration,
|
|
13
|
+
MobileTicketCompletedConfiguration,
|
|
14
|
+
MobileTicketRequestedConfiguration
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class GetSIM(Enum):
|
|
19
|
+
SIM_RECEIVED = 1
|
|
20
|
+
SIM_RECEIVED_AND_DADES = 2
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SetSIMRecievedMobileTicket(UpdateTicketDF):
|
|
24
|
+
"""
|
|
25
|
+
Set DF SIMRebuda to True to OTRS mobile tickets.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
READY_QUEUES_IDS = (
|
|
29
|
+
MobileTicketCompletedConfiguration.queue_id,
|
|
30
|
+
MobileTicketConfiguration.queue_id,
|
|
31
|
+
MobileTicketPausedConfiguration.queue_id,
|
|
32
|
+
MobileTicketRequestedConfiguration.queue_id,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def __init__(
|
|
36
|
+
self,
|
|
37
|
+
ticket_number,
|
|
38
|
+
activation_date,
|
|
39
|
+
intro_date,
|
|
40
|
+
):
|
|
41
|
+
self.scheduled_activation = False
|
|
42
|
+
self.activation_date = activation_date
|
|
43
|
+
self.intro_date = intro_date
|
|
44
|
+
super().__init__(ticket_number)
|
|
45
|
+
self._get_ticket()
|
|
46
|
+
self.mobile_process_ticket = MobileProcessTicket(self.ticket)
|
|
47
|
+
self.associated = self._has_associated_fibers()
|
|
48
|
+
self.portability = self._is_portability()
|
|
49
|
+
self.only_mobile = self._only_mobile()
|
|
50
|
+
|
|
51
|
+
def _only_mobile(self):
|
|
52
|
+
return self.mobile_process_ticket.service_technology != "mixta"
|
|
53
|
+
|
|
54
|
+
def _has_associated_fibers(self):
|
|
55
|
+
return bool(self.mobile_process_ticket.fiber_contract_code)
|
|
56
|
+
|
|
57
|
+
def _is_portability(self):
|
|
58
|
+
return self.mobile_process_ticket.mobile_service_type == "portabilitat"
|
|
59
|
+
|
|
60
|
+
def _is_ready(self):
|
|
61
|
+
# Si esta en las colas indicadas hacer las comprobaciones,
|
|
62
|
+
# en caso contrario no hacer nada y que el cron vuelva a pasar
|
|
63
|
+
if self.mobile_process_ticket.queue_id in self.READY_QUEUES_IDS:
|
|
64
|
+
return True
|
|
65
|
+
return False
|
|
66
|
+
|
|
67
|
+
def _get_response(self):
|
|
68
|
+
return self.scheduled_activation
|
|
69
|
+
|
|
70
|
+
def _check_doc(self):
|
|
71
|
+
return self.mobile_process_ticket.confirmed_documentation == "si"
|
|
72
|
+
|
|
73
|
+
def _prepare_dynamic_fields(self):
|
|
74
|
+
if not self._is_ready():
|
|
75
|
+
raise TicketNotReadyToBeUpdatedWithSIMReceivedData(self.ticket_number)
|
|
76
|
+
|
|
77
|
+
# Si tiene asociada y es alta nueva: Enviar SIM + Datas
|
|
78
|
+
# Si tiene asociada y es portability: Enviar SIM + Datas
|
|
79
|
+
# Si no tiene asociada y documentacion es true: Enviar SIM + Datas
|
|
80
|
+
# Si no tiene asociada y documentacion es false: Enviar SIM
|
|
81
|
+
if self.only_mobile:
|
|
82
|
+
if self.associated:
|
|
83
|
+
mode = GetSIM.SIM_RECEIVED_AND_DADES
|
|
84
|
+
else:
|
|
85
|
+
if self._check_doc():
|
|
86
|
+
mode = GetSIM.SIM_RECEIVED_AND_DADES
|
|
87
|
+
else:
|
|
88
|
+
mode = GetSIM.SIM_RECEIVED
|
|
89
|
+
else:
|
|
90
|
+
if not self.associated and self._check_doc() and not self.portability:
|
|
91
|
+
mode = GetSIM.SIM_RECEIVED_AND_DADES
|
|
92
|
+
else:
|
|
93
|
+
mode = GetSIM.SIM_RECEIVED
|
|
94
|
+
|
|
95
|
+
if mode == GetSIM.SIM_RECEIVED_AND_DADES:
|
|
96
|
+
self.scheduled_activation = date.today() + timedelta(days=7)
|
|
97
|
+
return [
|
|
98
|
+
DynamicField(name="SIMrebuda", value=1),
|
|
99
|
+
DynamicField(name="permetActivacio", value="si"),
|
|
100
|
+
DynamicField(
|
|
101
|
+
name="dataActivacioLiniaMobil",
|
|
102
|
+
value=str(self.activation_date),
|
|
103
|
+
),
|
|
104
|
+
DynamicField(name="dataIntroPlataforma", value=str(self.intro_date)),
|
|
105
|
+
]
|
|
106
|
+
elif mode == GetSIM.SIM_RECEIVED:
|
|
107
|
+
return [DynamicField(name="SIMrebuda", value=1)]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from otrs_somconnexio.otrs_models.abstract_article import AbstractArticle
|
|
5
|
+
from otrs_somconnexio.services.update_ticket_DF import UpdateTicketDF
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SIMReturnedArticle(AbstractArticle):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self.subject = "PROCÉS DE DEVOLUCIÓ DE LA SIM"
|
|
11
|
+
self.body = "PROCÉS DE DEVOLUCIÓ DE LA SIM"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SetSIMReturnedMobileTicket(UpdateTicketDF):
|
|
15
|
+
"""
|
|
16
|
+
Empty referenciaCorreus DF to OTRS mobile tickets.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
ticket_number,
|
|
22
|
+
):
|
|
23
|
+
super().__init__(ticket_number)
|
|
24
|
+
self._get_ticket()
|
|
25
|
+
|
|
26
|
+
def _prepare_dynamic_fields(self):
|
|
27
|
+
return [
|
|
28
|
+
DynamicField(name="referenciaCorreus", value=""),
|
|
29
|
+
DynamicField(name="SIMrebuda", value=0),
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
def run(self):
|
|
33
|
+
super(SetSIMReturnedMobileTicket, self).run()
|
|
34
|
+
self.otrs_client.update_ticket(
|
|
35
|
+
self.ticket.tid,
|
|
36
|
+
article=SIMReturnedArticle().call(),
|
|
37
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from .update_ticket_DF import UpdateTicketDF
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SetFiberContractCodeMobileTicket(UpdateTicketDF):
|
|
8
|
+
"""
|
|
9
|
+
Set DF OdooContractRefRelacionat to OTRS mobile tickets.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, ticket_number, fiber_contract_code):
|
|
13
|
+
self.fiber_contract_code = fiber_contract_code
|
|
14
|
+
super().__init__(ticket_number)
|
|
15
|
+
|
|
16
|
+
def _prepare_dynamic_fields(self):
|
|
17
|
+
return [
|
|
18
|
+
DynamicField(
|
|
19
|
+
name="OdooContractRefRelacionat", value=self.fiber_contract_code
|
|
20
|
+
)
|
|
21
|
+
]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from pyotrs.lib import DynamicField
|
|
3
|
+
|
|
4
|
+
from otrs_somconnexio.services.update_ticket_DF import UpdateTicketDF
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class UnblockMobilePackTicket(UpdateTicketDF):
|
|
8
|
+
"""
|
|
9
|
+
Unblock the mobile pack tickets.
|
|
10
|
+
|
|
11
|
+
Once the fiber provisioning is closed, we can start with the mobile provisioning to complete
|
|
12
|
+
the pack products.
|
|
13
|
+
Unblock is to change the DynamicField_recuperarProvisio to 1
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, ticket_number, activation_date, introduced_date):
|
|
17
|
+
self.activation_date = activation_date
|
|
18
|
+
self.introduced_date = introduced_date
|
|
19
|
+
super().__init__(ticket_number)
|
|
20
|
+
|
|
21
|
+
def _prepare_dynamic_fields(self):
|
|
22
|
+
dynamic_fields = [
|
|
23
|
+
DynamicField(name="recuperarProvisio", value=1),
|
|
24
|
+
DynamicField(name="enviarNotificacio", value=0),
|
|
25
|
+
]
|
|
26
|
+
if bool(self.ticket.dynamic_field_get("SIMrebuda").value):
|
|
27
|
+
dynamic_fields.append(
|
|
28
|
+
DynamicField(
|
|
29
|
+
name="dataActivacioLiniaMobil", value=self.activation_date
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
dynamic_fields.append(
|
|
33
|
+
DynamicField(name="dataIntroPlataforma", value=self.introduced_date),
|
|
34
|
+
)
|
|
35
|
+
return dynamic_fields
|
|
36
|
+
|
|
37
|
+
def run(self):
|
|
38
|
+
self._get_ticket()
|
|
39
|
+
if (
|
|
40
|
+
self.ticket.dynamic_field_get("dataIntroPlataforma").value
|
|
41
|
+
and self.ticket.dynamic_field_get("dataActivacioLiniaMobil").value
|
|
42
|
+
):
|
|
43
|
+
return
|
|
44
|
+
self.otrs_client.update_ticket(
|
|
45
|
+
self.ticket.tid,
|
|
46
|
+
article=None,
|
|
47
|
+
dynamic_fields=self._prepare_dynamic_fields(),
|
|
48
|
+
)
|
|
@@ -7,17 +7,17 @@ class UpdateProcessTicketWithCoverageTicketsInfoService:
|
|
|
7
7
|
"""
|
|
8
8
|
Update the process ticket adding articles with the coverage data.
|
|
9
9
|
|
|
10
|
-
Receives a TicketID (provisioning process ticket) and
|
|
11
|
-
|
|
12
|
-
update the provisioning process ticket.
|
|
10
|
+
Receives a TicketID (provisioning process ticket) and an email.
|
|
11
|
+
Finds coverage tickets by email and creates articles with the information
|
|
12
|
+
required to update the provisioning process ticket.
|
|
13
13
|
"""
|
|
14
|
-
def __init__(self, ticket_id, coverage_tickets):
|
|
15
|
-
self.coverage_tickets = coverage_tickets
|
|
16
|
-
self.ticket_id = ticket_id
|
|
17
14
|
|
|
18
|
-
def
|
|
19
|
-
|
|
15
|
+
def __init__(self, ticket_id):
|
|
16
|
+
self.ticket_id = ticket_id
|
|
17
|
+
self.otrs_client = OTRSClient()
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
def run(self, email):
|
|
20
|
+
coverage_tickets = self.otrs_client.search_coverage_tickets_by_email(email)
|
|
21
|
+
for ticket in coverage_tickets:
|
|
22
22
|
article = CoverageArticle(ticket).call()
|
|
23
|
-
otrs_client.update_ticket(self.ticket_id, article)
|
|
23
|
+
self.otrs_client.update_ticket(self.ticket_id, article)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
from otrs_somconnexio.services.base_get_ticket_by_number import BaseGetTicketByNumber
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class UpdateTicketDF(BaseGetTicketByNumber):
|
|
6
|
+
"""
|
|
7
|
+
Abstract service class to update a given OTRS ticket DF's.
|
|
8
|
+
|
|
9
|
+
Class method '_prepare_dynamic_fields' needs to be implemented in child classes
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def run(self):
|
|
13
|
+
super().run()
|
|
14
|
+
self.otrs_client.update_ticket(
|
|
15
|
+
self.ticket.tid,
|
|
16
|
+
article=None,
|
|
17
|
+
dynamic_fields=self._prepare_dynamic_fields(),
|
|
18
|
+
)
|
|
@@ -19,9 +19,8 @@ class UpdateTicketWithProviderInfo:
|
|
|
19
19
|
pyOTRS_article = self.article.call()
|
|
20
20
|
|
|
21
21
|
otrs_client.update_ticket(
|
|
22
|
-
self.ticket_id,
|
|
23
|
-
|
|
24
|
-
dynamic_fields=dynamic_fields)
|
|
22
|
+
self.ticket_id, pyOTRS_article, dynamic_fields=dynamic_fields
|
|
23
|
+
)
|
|
25
24
|
|
|
26
25
|
def _df_list_from_dct(self, df_dct):
|
|
27
26
|
|