Django Vtex Integration
Project description
django-vtex
Starting
These instructions will allow you to install the library in your python project.
Current features
- Get tracking info.
Pre-requisitos
- Python >= 3.7
- Django >= 3
- requests >= 2
Installation
- To get the latest stable release from PyPi:
pip install django-vtex
or
- From a build
git clone https://gitlab.com/linets/ecommerce/oms/integrations/django-vtex
cd {{project}}
python setup.py sdist
and, install in your project django
pip install {{path}}/django-vtex/dist/{{tar.gz file}}
- Settings in django project
DJANGO_VTEX = {
'VTEX': {
'BASE_URL': '<VTEX_BASE_URL>',
'APP_KEY': '<VTEX_APP_KEY>',
'APP_TOKEN': '<VTEX_APP_TOKEN>',
}
}
Usage
- Get orders:
from vtex.handler import VtexHandler
handler = VtexHandler()
response = handler.get_orders(<offset>)
- Get order detail:
from vtex.handler import VtexHandler
handler = VtexHandler()
response = handler.get_order_detail(<identifier>)
-
Create instance to be sent in create_invoice
import json from collections import namedtuple dict_ = { 'type': 'Output', 'invoiceNumber': 'NFe-00001', 'courier': '', 'trackingNumber': '', 'trackingUrl': '', 'items': [ { 'id': '345117', 'quantity': 1, 'price': 9003 } ], 'issuanceDate': '2013-11-21T00:00:00', 'invoiceValue': 9508 } instance = namedtuple('VtexInstance', dict_.keys())(*dict_.values())
-
Create invoice:
from vtex.handler import VtexHandler
handler = VtexHandler()
response = handler.create_invoice(<identifier>, <instance>)
- Update order status:
from vtex.handler import VtexHandler
handler = VtexHandler()
response = handler.update_order_status(<identifier>, <status>)
- Update tracking status:
from vtex.handler import VtexHandler
handler = VtexHandler()
# events = [] default
# is_delivered = False default
response = handler.update_tracking_status(
<identifier>, <wms_reference>, <events>, <is_delivered>)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-vtex-1.0.2.tar.gz
(5.3 kB
view hashes)