# Path: roulier/codec.py
# class Encoder(ABC):
#     def __init__(self, config_object):
#         self.config = config_object
# 
#     def _extra_input_data_processing(self, input_payload, data):
#         return data
# 
#     @abstractmethod
#     def transform_input_to_carrier_webservice(self, data):
#         pass
# 
#     def encode(self, input_payload):
#         """Transform input from external app to compatible input for carrier webservice."""
#         validator = self.config.api(self.config)
#         if not validator.validate(input_payload):
#             _logger.warning("Laposte api call exception:")
#             raise InvalidApiInput(
#                 {"api_call_exception": validator.errors(input_payload)}
#             )
#         # Set isTest in config if it is the case so the system choose the test url
#         # if any
#         if input_payload.get("auth", {}).get("isTest"):
#             self.config.is_test = True
#         data = validator.normalize(input_payload)
#         data = self._extra_input_data_processing(input_payload, data)
#         return self.transform_input_to_carrier_webservice(data)
# 
# Path: roulier/exception.py
# class InvalidApiInput(Exception):
#     """Bad input.
# 
#     Use this class in your application to manage
#     exception with api call
#     """


from datetime import date
from roulier.codec import Encoder
from roulier.exception import InvalidApiInput
    "T821": "country",
}
ADDRESS_MAPPING = {
    "T860": "company",
    "T8906": "name",
    "T863": "street1",
    "T861": "street2",
    "T862": "street3",
    "T330": "zip",
    "T864": "city",
    "T100": "country",
    "T871": "phone",
    "T1230": "mobile",
    "T1229": "email",
}

PARCEL_MAPPING = {
    "T530": "weight",
    "T8973": "parcel_number_barcode",
    "T8904": "parcel_number_label",
}


def merge_dict(mydict):
    mydict.update(AUTH_MAPPING)
    mydict.update(ACCOUNT_MAPPING)
    mydict.update(DELIVERY_MAPPING)
    mydict.update(PARCEL_MAPPING)



# Path: roulier/codec.py
# class Encoder(ABC):
#     def __init__(self, config_object):
#         self.config = config_object
# 
#     def _extra_input_data_processing(self, input_payload, data):
#         return data
# 
#     @abstractmethod
#     def transform_input_to_carrier_webservice(self, data):
#         pass
# 
#     def encode(self, input_payload):
#         """Transform input from external app to compatible input for carrier webservice."""
#         validator = self.config.api(self.config)
#         if not validator.validate(input_payload):
#             _logger.warning("Laposte api call exception:")
#             raise InvalidApiInput(
#                 {"api_call_exception": validator.errors(input_payload)}
#             )
#         # Set isTest in config if it is the case so the system choose the test url
#         # if any
#         if input_payload.get("auth", {}).get("isTest"):
#             self.config.is_test = True
#         data = validator.normalize(input_payload)
#         data = self._extra_input_data_processing(input_payload, data)
#         return self.transform_input_to_carrier_webservice(data)
# 
# Path: roulier/exception.py
# class InvalidApiInput(Exception):
#     """Bad input.
# 
#     Use this class in your application to manage
#     exception with api call
#     """


# Path: roulier/carriers/gls_fr/glsbox/encoder.py
from datetime import date
from roulier.codec import Encoder
from roulier.exception import InvalidApiInput

    "T821": "country",
}
ADDRESS_MAPPING = {
    "T860": "company",
    "T8906": "name",
    "T863": "street1",
    "T861": "street2",
    "T862": "street3",
    "T330": "zip",
    "T864": "city",
    "T100": "country",
    "T871": "phone",
    "T1230": "mobile",
    "T1229": "email",
}

PARCEL_MAPPING = {
    "T530": "weight",
    "T8973": "parcel_number_barcode",
    "T8904": "parcel_number_label",
}


def merge_dict(mydict):
    mydict.update(AUTH_MAPPING)
    mydict.update(ACCOUNT_MAPPING)
    mydict.update(DELIVERY_MAPPING)
    mydict.update(PARCEL_MAPPING)



class GlsEncoder(Encoder):