Skip to main content

Linets Correos Chile

Starting 🚀

These instructions will allow you to install the library in your django project.

Current features 📋

  • Generate order in Correos Chile.
  • Generate default data for create order in Correos Chile.

Pre-requisitos 📋

  • Python >= 3.7

Installation 🔧

  1. To get the latest stable release from PyPi:
pip install django-correos-chile-rest

or

  1. From a build
git clone https://gitlab.com/linets/ecommerce/oms/integrations/django-correos
cd {{project}} && git checkout develop
python setup.py sdist

and, install in your project django

pip install {{path}}/django-correos/dist/{{tar.gz file}}
  1. Settings in django project
DJANGO_CORREOS_CHILE = {
    'CORREOS_CHILE': {
        'BASE_URL': '<CORREOS_CHILE_BASE_URL>',
        'USER': '<CORREOS_CHILE_USER>',
        'PASSWORD': '<CORREOS_CHILE_PASSWORD>',
        'TOKEN': '<CORREOS_CHILE_TOKEN>',
        'COD_SERVICIO': '<CORREOS_CHILE_COD_SERVICIO>',
        'COD_REF': '<CORREOS_CHILE_COD_REF>',
        'TYPE_POR': '<CORREOS_CHILE_TYPE_POR>',
        'DEV_CON': '<CORREOS_CHILE_DEV_CON>',
    },
    'SENDER': {
        'ADMISSION': '<CORREOS_CHILE_ADMISSION>',
        'CLIENT': '<CORREOS_CHILE_CLIENT>',
        'CENTRO': '<CORREOS_CHILE_CENTRO>',
        'NAME': '<CORREOS_CHILE_NAME>',
        'ADDRESS': '<CORREOS_CHILE_ADDRESS>',
        'COUNTRY': '<CORREOS_CHILE_COUNTRY>',
        'POSTALCODE': '<CORREOS_CHILE_POSTALCODE>',
        'CITY': '<CORREOS_CHILE_CITY>',
        'RUT': '<CORREOS_CHILE_RUT>',
        'CONTACT_NAME': '<CORREOS_CHILE_CONTACT_NAME>',
        'CONTACT_PHONE': '<CORREOS_CHILE_CONTACT_PHONE>',
    }
}

Usage 🔧

  1. Create instance to be sent

    import json
    from types import SimpleNamespace
    
    dict_ = {
        'reference': '99999',
        'created_at': '12/12/21',
        'shipping_date': '12/12/21',
        'expiration_date': '26/12/21'
        'tracking_code': '6075620-1',
        'transport_guide_number': '1121632479536-01-1',
        'purchase_number': 'CLV0048146676851-1',
        'customer': {
            'first_name': 'Marcos',
            'last_name': 'Sac',
            'full_name': 'Marcos Sac',
            'phone': '932932932',
            'email': 'test@gmail.com',
            'rut': '16936195-9'
        },
        'address': {
            'street': 'ALEJANDRO VENEGAS CADIZ',
            'number': '513',
            'unit': 'DEPTO 6A',
            'full_address': 'ALEJANDRO VENEGAS CADIZ 513 DEPTO 6A'
        },
        'commune': {
            'name': 'Aisen',
            'code': '',
            'zone_code': '11201',
            'zone_post': 'WPA',
        },
        'location': {
            'code': 'MONTANDON',
            'name': 'MNN',
        },
        'region': {
            'name': 'Aysén del General Carlos Ibáñez del Campo',
            'code': '11',
            'iso_code': 'CL-XI',
        }
    }
    
    instance = json.loads(json.dumps(dict_), object_hook=lambda attr: SimpleNamespace(**attr))
    
  2. Generate default data for create a order in Correos Chile:

from correos_chile.handler import CorreosHandler

handler = CorreosHandler()
default_data = handler.get_default_payload(instance)

Output:
{
    "nroDTE": 0,
    "codCliente": "888888",
    "posicionInicial": 0,
    "formatoEtiqueta": "PDF",
    "modo": "json",
    "data": [
        {
            "codAdmision": "PRUEBA01",
            "codCentro": "",
            "codServicio": "24",
            "remitente": {
                "nombre": "PRUEBA CORREOSCHILE",
                "codPais": "056",
                "comuna": "ESTACION CENTRAL",
                "direccion": "EXPOSICION 221. Sexto 6",
                "codPostal": "9160002",
                "rut": "55.555.555-5",
                "contacto": "Soporte ecommerce",
                "telefono": "6009502020",
                "email": "soporte.ecommerce@correos.cl"
            },
            "destinatario": {
                "nombre": "CLIENTE DE PRUEBA",
                "codPais": "056",
                "comuna": "ESTACION CENTRAL",
                "direccion": "EXPOSICION 221. Sexto 6",
                "codPostal": "",
                "rut": "55.555.555-5",
                "contacto": "cliente de prueba",
                "telefono": "555555555",
                "email": "cliente@deprueba.cl"
            },
            "pagoSeguro": 0,
            "bultos": 1,
            "kilos": 1,
            "volumen": 0.001,
            "codReferencia": "prbcch0001",
            "observaciones": "Observaciones",
            "observacionesInternas": "Observaciones de uso interno",
            "tipoMercancia": "",
            "tipoPortes": "P",
            "valorDeclarado": 10000,
            "devolucionConforme": 0,
            "importeReembolso": 0,
            "numDocumentos": 0
        }
    ]
}
  1. Create a order in Correos Chile:
from correos_chile.handler import CorreosHandler

handler = CorreosHandler()
response = handler.create_shipping(default_data)

Output:
{
    "info": [
        {
            "estado": "WARNING",
            "mensaje_1": "El parámetro rut de remitente se ajustó como 55555555-5",
            "mensaje_2": "El parámetro rut de destinatario se ajustó como 55555555-5",
            "admision": {
                "codAdmision": "PRUEBA01",
                "abreviaturaCentro": "888888",
                "codSucursal": "",
                "nombreSucursal": "",
                "codDelegacionDestino": "864",
                "nombreDelegacionDestino": "PLANTA CEP RM",
                "direccionDestino": "EXPOSICION 221  SEXTO 6",
                "cuartel": "4",
                "codEncaminamiento": "12491600027",
                "sector": "2",
                "numeroEnvio": "880000001459",
                "comunaDestino": "ESTACION CENTRAL",
                "abreviaturaServicio": "PED",
                "SDP": "1",
                "codigoBarras": [
                    "12491600027880000001459001"
                ]
            }
        }
    ],
    "errores": [],
    "archivos": [
        {
            "nombre": "etiquetas_20211229_174300",
            "extension": "pdf",
            "str64Data": ""
        }
    ]
}

Metadata

Release files for django-correos-chile-rest 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-correos-chile-rest 1.1.4
File Size Uploaded Provenance Actions
django-correos-chile-rest-1.1.4.tar.gz 8.0 kB Without provenance Details for django-correos-chile-rest-1.1.4.tar.gz

Release files / django-correos-chile-rest-1.1.4.tar.gz

Download URL django-correos-chile-rest-1.1.4.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
60386eec53f972342d72afd9bf9f99cb6262645dc5ddc4083a9662c4e3031794
BLAKE2b-256 checksum
How to use checksums
1a5c4a2c589ddb3e78fc9423c007085674baf4de2cf3c1fc3cff1c1ffd9bf336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.10.0 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

Security for django-correos-chile-rest 1.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page