Metadata-Version: 2.4
Name: notify-vtex-client
Version: 0.4.0
Summary: Cliente HTTP para a API de Checkout da VTEX com suporte a pagamento PIX
Author: Jefferson
License-Expression: MIT
Project-URL: Homepage, https://github.com/jefersondossa/notify-vtex-client
Project-URL: Repository, https://github.com/jefersondossa/notify-vtex-client
Keywords: vtex,checkout,pix,ecommerce,payment
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dataclasses-json>=0.6.0
Requires-Dist: typing_extensions>=4.0.0
Requires-Dist: notify-tls-client>=0.1.4
Dynamic: license-file

# notify-vtex-client

Cliente HTTP para a API de Checkout da VTEX com suporte a pagamento PIX.

## Instalacao

```bash
pip install notify-vtex-client
```

## Uso

```python
from notify_tls_client import NotifyTLSClient
from notify_vtex_client.client.notifyvtexclient import NotifyVtexClient
from notify_vtex_client.client.structures.item import Item
from notify_vtex_client.payloads.additemspayload import AddItemsPayload
from notify_vtex_client.payloads.attachclientprofilepayload import AttachClientProfilePayload
from notify_vtex_client.payloads.attachshippingdatapayload import AttachShippingDataPayload
from notify_vtex_client.payloads.attachpaymentdatapayloads.attachpixpaymentdatapayload import AttachPixPaymentDataPayload

# Inicializar cliente
tls = NotifyTLSClient()
client = NotifyVtexClient(tls=tls, base_url="https://www.loja.com.br")

# Iniciar sessao
session = client.start_session()

# Adicionar item ao carrinho
item = Item(id="123", quantity=1, seller="1")
response = client.add_item_to_cart(item=item, sc=1)

# Anexar dados do cliente
profile = AttachClientProfilePayload(email="cliente@email.com")
client.attach_client_profile_data(payload=profile)

# Anexar endereco
shipping = AttachShippingDataPayload(
    postal_code="01001000",
    street="Praca da Se",
    number="1",
    city="Sao Paulo",
    state="SP",
    neighborhood="Se",
    receiver_name="Nome do Cliente"
)
client.attach_client_shipping_data(payload=shipping)

# Pagamento PIX
payment = AttachPixPaymentDataPayload(reference_value=9990)
client.attach_payment_data(payload=payment)

# Criar e processar transacao
transaction = client.create_transaction(value=9990)

# Obter QR code PIX
callback = client.process_callback_url(order_id="order-id")
print(callback.pix_code)
```

## Fluxo de Checkout

1. `start_session()` - Inicia sessao e obtem order_form_id
2. `check_email()` / `attach_client_profile_data()` - Perfil do cliente
3. `get_postal_code_info()` - Valida CEP
4. `attach_client_shipping_data()` - Dados de envio
5. `add_item_to_cart()` - Adiciona produto
6. `attach_payment_data()` - Dados de pagamento PIX
7. `create_transaction()` - Cria transacao no gateway
8. `process_transaction()` - Processa pagamento
9. `process_callback_url()` - Obtem QR code PIX

## Licenca

MIT
